
function fnselect(obj) {
    if (obj == 'business') {
        document.getElementById('businessdiv').style.display = 'block';
        document.getElementById('propertydiv').style.display = 'none';
        document.getElementById('feedbackdiv').style.display = 'none';
    } else if (obj == 'property') {
        document.getElementById('businessdiv').style.display = 'none';
        document.getElementById('propertydiv').style.display = 'block';
        document.getElementById('feedbackdiv').style.display = 'none';
    } else if (obj == 'feedback') {
        document.getElementById('businessdiv').style.display = 'none';
        document.getElementById('propertydiv').style.display = 'none';
        document.getElementById('feedbackdiv').style.display = 'block';
    }
}
function chk_validation() {

    var objuname = document.getElementById("last_name");
    document.getElementById("uname_err").style.display = "none";
    document.getElementById("uname_err_num").style.display = "none";
    var objemailid = document.getElementById("email");
    document.getElementById("emailid_err").style.display = "none";
    var objemailid1 = document.getElementById("b_email");
    document.getElementById("emailid1_err").style.display = "none";
    var objmobile = document.getElementById("b_mobile");;
    var objmobilezero = objmobile.value;
    document.getElementById("mobile_err").style.display = "none";
    document.getElementById("mobile_err1").style.display = "none";
    document.getElementById("mobile_zero").style.display = "none";
	document.getElementById("mobile_max").style.display="none";
	document.getElementById("mobile_blankspaces").style.display="none";
    document.getElementById("mobile_alpha").style.display="none";
	
    var objpi = document.getElementById("b_project");
    document.getElementById("pi_err").style.display = "none";
    var objlandline = document.getElementById("b_landline");
	var objstdcode = document.getElementById("std_code");
    document.getElementById("landline_err").style.display = "none";
    document.getElementById("landline_err1").style.display = "none";
	document.getElementById("landline_blankspaces").style.display="none";
	document.getElementById("landline_alpha").style.display="none";
	document.getElementById("landline_stdblankspaces").style.display="none";
	document.getElementById("landline_stdalpha").style.display="none";
    var objcountry = document.getElementById("b_country");
    document.getElementById("country_err").style.display = "none";
    var objcity = document.getElementById("b_city");
    document.getElementById("city_err").style.display = "none";
    var objcitybox = document.getElementById("b_city1");
    document.getElementById("city_err1").style.display = "none";
    var objpublisher = document.getElementById("00N20000001l1Ix");
    if (document.getElementById("00N200000020mNQ")) {
        var objcampaign = document.getElementById("00N200000020mNQ");
        var objcampaignvalue = objcampaign.value;
    }
    else {
        objcampaignvalue = '';
    }
    if (Trim(objuname.value) == "") {
        document.getElementById("uname_err").style.display = "inline";
        objuname.focus();
        return false;
    }
	/*
    if (special_fun(objuname.value) == false) {
        document.getElementById("uname_err_num").style.display = "inline";
        objuname.focus();
        return false;
    }
	*/
    if (objemailid.value == "") {
        document.getElementById("emailid_err").style.display = "inline";
        objemailid.focus();
        return false;
    } else {
        var stremail = (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,5})+$/).test(objemailid.value);
        if (stremail == false) {
            document.getElementById("emailid1_err").style.display = "inline";
            objemailid.focus();
            return false;
        }
    }
    if (objcountry.value == "") {
        document.getElementById("country_err").style.display = "inline";
        objcountry.focus();
        return false;
    }
    if (objcity.value == "" && objcitybox.value == "") {
        document.getElementById("city_err").style.display = "inline";
        objcity.focus();
        return false;
    }
    //if(objmobile.value=="" && (objlandline.value =="Ph No" || objlandline.value =="")){
    if (objmobile.value == "" && objlandline.value == "") {
        document.getElementById("mobile_eg").style.display = "none"; //added on 15/01/2010
        document.getElementById("mobile_err").style.display = "inline";
        objmobile.focus();
        return false;
    }
    if (objmobilezero.substr(0, 1) == "0") {
        document.getElementById("mobile_eg").style.display = "none"; //added on 15/01/2010
        document.getElementById("mobile_zero").style.display = "inline";
        objmobile.focus();
        return false;
    }
	
	if (!isDigit(objmobile.value)) 
	{
		document.getElementById("mobile_eg").style.display="none";
		document.getElementById("mobile_alpha").style.display="inline";
		document.getElementById('00N20000001SJmb1').focus();
		return false;
	}
	var mobilemax =	objmobile.value.length
	if(objcountry.value=="India" && mobilemax < 10 )
	{
        
        document.getElementById("mobile_digit").style.display="inline";
		objmobile.focus();
		return false;
	  
	}
	if(objcountry.value=="India" && mobilemax > 10 )
	{
        
        document.getElementById("mobile_max").style.display="inline";
		objmobile.focus();
		return false;
	  
	}
    if (objmobile.value != "" && document.getElementById("mb_country_code").value == "") {
        document.getElementById("mobile_eg").style.display = "none"; //added on 15/01/2010
        document.getElementById("mobile_err1").style.display = "inline";
        document.getElementById("mb_country_code").focus();
        return false;
    }
   
    if ((objlandline.value != "") && (document.getElementById("std_code").value != "") && (document.getElementById("country_code").value != "")) {
        if ((document.getElementById("country_code").value == "") || (document.getElementById("std_code").value == "")) {
            document.getElementById("landline_eg").style.display = "none"; //added on 15/01/2010
            document.getElementById("landline_err1").style.display = "inline";
            document.getElementById("country_code").focus();
            return false;
        }
    }
	if (!isDigit(objstdcode.value)) 
	{
		document.getElementById("landline_eg").style.display="none";
		document.getElementById("landline_stdalpha").style.display="inline";
		document.getElementById('std_code').focus();
		return false;
	}
	/*
	if (isBlankSpaces(objlandline.value)) 
	{
		document.getElementById("landline_eg").style.display="none";
		document.getElementById("landline_blankspaces").style.display="inline";
		document.getElementById('b_landline').focus();
		return false;
	}
	*/
	if (!isDigit(objlandline.value)) 
	{
		document.getElementById("landline_eg").style.display="none";
		document.getElementById("landline_alpha").style.display="inline";
		document.getElementById('b_landline').focus();
		return false;
	}
	 if (objpi.value == "") {
        document.getElementById("pi_err").style.display = "inline";
        objpi.focus();
        return false;
    }
    document.getElementById("mobile_eg").style.display = "block"; //added on 15/01/2010
    document.getElementById("landline_eg").style.display = "block"; //added on 15/01/2010
    var mobile;
    var landnumber;
    var clientType = ""
    var city = "";
    var otherCity = "";
    var recordTypeval = "";
    if (objcountry.value == "India") {
        if (objcity.value == "Mumbai") {
            //clientType = "Mumbaiite";
            //city = objcity.value;
            clientType = "Mumbaiite"
            city = objcity.value;
            mobile = objmobile.value
        }
        else {
            if (objcity.value != "Pune" || objcity.value != "Hyderabad") {
                city = "Others"
                otherCity = objcity.value
            }
            else {
                city = objcity.value;
            }
            clientType = "Other Indian"
            mobile = objmobile.value
        }
    }
    else {
        clientType = "Foreigner"
        city = "Others"
        otherCity = objcitybox.value
        mobile = document.getElementById("mb_country_code").value + "" + objmobile.value
    }
    //Revist
    var revisit;
    var rdinterest, interested, comments;
    var datetime = "";
    var visitdate = "";
    
    interested = "Yes";
    //if(objlandline.value!="" && objlandline.value!="Ph No"  && document.getElementById("std_code").value!="STD")
    if (objlandline.value != "" && document.getElementById("std_code").value != "") landnumber = document.getElementById("country_code").value + "" + document.getElementById("std_code").value + "" + objlandline.value
    else landnumber = "";
	
   if (document.getElementById("b_project").value == "Lodha Excelus" || document.getElementById("b_project").value == "iTHINK - Kanjurmarg" || document.getElementById("b_project").value == "iTHINK  - Thane" || document.getElementById("b_project").value == "Lodha Supremus - Kanjurmarg" || document.getElementById("b_project").value == "Lodha Supremus - Thane" 
	|| document.getElementById("b_project").value == "Lodha Supremus - Upper Worli" 																																																																										   
	|| document.getElementById("b_project").value == "Lodha Supremus - Worli Naka" 	|| document.getElementById("b_project").value == "Lodha Supremus - Powai" 																																																																											        ) 
	{
        recordTypeval = "012200000009NDM" ;
	    document.getElementById('00N20000001SJm9').value = objcountry.value;
	    document.getElementById('00N20000001SJn3').value = otherCity;
	    document.getElementById('00N20000001SJm2').value = city;
		document.getElementById('00N20000001SJmg').value = landnumber;
    }
    else {
        recordTypeval = "0122000000098Zo";
		document.getElementById('00N20000001SJn4').value = otherCity;
        document.getElementById('00N20000001SJm3').value = city;
		document.getElementById('00N20000001SJmA').value = objcountry.value;
		document.getElementById('phone').value = landnumber;
    }
	
    document.getElementById('recordType').value = recordTypeval;
    document.getElementById('00N20000001SJmb').value = mobile;
    document.getElementById('00N20000001SJm4').value = clientType;
    document.getElementById('00N20000001SJmR').value = interested;
   
    document.getElementById('00N20000001SJmw').value = document.getElementById("b_project").value;

	var urldata = "name=" + objuname.value + "&email=" + objemailid.value + "&mobile=" + mobile + "&landline=" + landnumber + "&country=" + objcountry.value + "&city=" + objcity.value + "&othercity=" + objcitybox.value + "&apt=1&interest=" + rdinterest + "&revisit=" + revisit + "&datetime=" + datetime + "&site=" + document.getElementById("b_project").value + "&publisher=" + objpublisher.value + "&campaign=" + objcampaignvalue;
   req = createXMLHttpRequest();
	setobj = document.getElementById("businessdiv"); 
	sendRequest("send_enquiry.php?"+urldata);
	showdiv(document.getElementById("businessdiv"));

	document.businessfrm.action = "https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8";
	document.businessfrm.submit();

}





function CalcKeyCode(aChar) {
  var character = aChar.substring(0,1);
  var code = aChar.charCodeAt(0);
  return code;
}

function checkNumber(val) {
  var strPass = val.value;
  var strLength = strPass.length;
  var lchar = val.value.charAt((strLength) - 1);
  var cCode = CalcKeyCode(lchar);
  if (cCode < 48 || cCode > 57 ) {
    var myNumber = val.value.substring(0, (strLength) - 1);
    val.value = myNumber;
  }
  return false;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function getCountryValue()
{
	
	var countrycode = getCountryCode(document.getElementById("b_country").value)
	
	document.businessfrm.country_code.value = countrycode;
	document.businessfrm.mb_country_code.value = countrycode;



	if(document.businessfrm.b_country.value == "India")
	{
		document.getElementById("div_city_dropdown").style.display = "block";
		document.getElementById("div_city").style.display = "none";
	}
	else
	{
		document.getElementById("div_city_dropdown").style.display = "none";
		document.getElementById("div_city").style.display = "block";
	}

}


function getCountryCode(countryname)
{
	var countrycode="";

	if(countryname=="United States")countrycode = "001";
	if(countryname=="Albania")countrycode = "00355";
	if(countryname=="Algeria")countrycode = "00213";
	if(countryname=="Angola")countrycode = "00244";
	if(countryname=="Argentina")countrycode = "0054";
	if(countryname=="Armenia")countrycode = "00374";
	if(countryname=="Australia")countrycode = "0061";
	if(countryname=="Austria")countrycode = "0043";
	if(countryname=="Azerbaijan")countrycode = "00994";
	if(countryname=="Bahamas")countrycode = "001242";
	if(countryname=="Bahrain")countrycode = "001973";
	if(countryname=="Bangladesh")countrycode = "00880";
	if(countryname=="Belarus")countrycode = "00375";
	if(countryname=="Belgium")countrycode = "0032";
	if(countryname=="Benin")countrycode = "00229";
	if(countryname=="Bermuda")countrycode = "001441";
	if(countryname=="Bolivia")countrycode = "00591";
	if(countryname=="Bosnia and Herzegovina")countrycode = "00387";
	if(countryname=="Botswana")countrycode = "00267";
	if(countryname=="Brazil")countrycode = "0055";
	if(countryname=="Bulgaria")countrycode = "00359";
	if(countryname=="Canada")countrycode = "001";
	if(countryname=="Chile")countrycode = "0056";
	if(countryname=="China")countrycode = "0086";
	if(countryname=="Colombia")countrycode = "0057";
	if(countryname=="Cook Islands")countrycode = "00682";
	if(countryname=="Costa Rica")countrycode = "00506";
	if(countryname=="Croatia")countrycode = "00385";
	if(countryname=="Cyprus")countrycode = "00357";
	if(countryname=="Czech Republic")countrycode = "00420";
	if(countryname=="Denmark")countrycode = "0045";
	if(countryname=="Dominican Republic")countrycode = "001809";
	if(countryname=="Ecuador")countrycode = "00593";
	if(countryname=="Egypt")countrycode = "0020";
	if(countryname=="El Salvador")countrycode = "00503";
	if(countryname=="Equatorial Guinea")countrycode = "00240";
	if(countryname=="Estonia")countrycode = "00372";
	if(countryname=="Ethiopia")countrycode = "00251";
	if(countryname=="Faroe Islands")countrycode = "00298";
	if(countryname=="Finland")countrycode = "00358";
	if(countryname=="France")countrycode = "0033";
	if(countryname=="French Polynesia")countrycode = "00689";
	if(countryname=="Gabon")countrycode = "00241";
	if(countryname=="Gambia")countrycode = "00220";
	if(countryname=="Georgia")countrycode = "00995";
	if(countryname=="Germany")countrycode = "0049";
	if(countryname=="Ghana")countrycode = "00233";
	if(countryname=="Gibraltar")countrycode = "00350";
	if(countryname=="Greece")countrycode = "0030";
	if(countryname=="Greenland")countrycode = "00299";
	if(countryname=="Guatemala")countrycode = "00502";
	if(countryname=="Honduras")countrycode = "00504";
	if(countryname=="Hong Kong")countrycode = "00852";
	if(countryname=="Hungary")countrycode = "0036";
	if(countryname=="Iceland")countrycode = "00354";
	if(countryname=="India")countrycode = "0091";
	if(countryname=="Indonesia")countrycode = "0062";
	if(countryname=="Iran")countrycode = "0098";
	if(countryname=="Iraq")countrycode = "00964";
	if(countryname=="Ireland")countrycode = "00353";
	if(countryname=="Israel")countrycode = "00972";
	if(countryname=="Italy")countrycode = "0039";
	if(countryname=="Japan")countrycode = "0081";
	if(countryname=="Jordan")countrycode = "00962";
	if(countryname=="Kazakhstan")countrycode = "007";
	if(countryname=="Kenya")countrycode = "00254";
	if(countryname=="Korea")countrycode = "00850";
	if(countryname=="Kuwait")countrycode = "00965";
	if(countryname=="Kyrgyzstan")countrycode = "00965";
	if(countryname=="Latvia")countrycode = "00371";
	if(countryname=="Lebanon")countrycode = "00961";
	if(countryname=="Liechtenstein")countrycode = "00423";
	if(countryname=="Lithuania")countrycode = "00370";
	if(countryname=="Luxembourg")countrycode = "00352";
	if(countryname=="Macedonia")countrycode = "00389";
	if(countryname=="Madagascar")countrycode = "00261";
	if(countryname=="Malaysia")countrycode = "0060";
	if(countryname=="Malta")countrycode = "00353";
	if(countryname=="Mauritius")countrycode = "0020230";
	if(countryname=="Mexico")countrycode = "0052";
	if(countryname=="Moldova")countrycode = "00373";
	if(countryname=="Morocco")countrycode = "00212";
	if(countryname=="Namibia")countrycode = "00264";
	if(countryname=="Nepal")countrycode = "00977";
	if(countryname=="Netherlands")countrycode = "0031";
	if(countryname=="Netherlands Antilles")countrycode = "00599";
	if(countryname=="New Zealand")countrycode = "0064";
	if(countryname=="Nicaragua")countrycode = "00505";
	if(countryname=="Nigeria")countrycode = "00234";
	if(countryname=="Norway")countrycode = "0047";
	if(countryname=="Pakistan")countrycode = "0092";
	if(countryname=="Panama")countrycode = "00507";
	if(countryname=="Peru")countrycode = "0051";
	if(countryname=="Philippines")countrycode = "0063";
	if(countryname=="Poland")countrycode = "0048";
	if(countryname=="Portugal")countrycode = "00351";
	if(countryname=="Qatar")countrycode = "00974";
	if(countryname=="Romania")countrycode = "0040";
	if(countryname=="Russian Federation")countrycode = "007";
	if(countryname=="Saudi Arabia")countrycode = "00966";
	if(countryname=="Singapore")countrycode = "0065";
	if(countryname=="Slovak Republic")countrycode = "00421";
	if(countryname=="Slovenia")countrycode = "00386";
	if(countryname=="South Africa")countrycode = "0027";
	if(countryname=="Spain")countrycode = "0034";
	if(countryname=="Sri Lanka")countrycode = "0094";
	if(countryname=="Sultanate of Oman")countrycode = "00968";
	if(countryname=="Sweden")countrycode = "0046";
	if(countryname=="Switzerland")countrycode = "0041";
	if(countryname=="Syria")countrycode = "00963";
	if(countryname=="Taiwan")countrycode = "00886";
	if(countryname=="Tanzania")countrycode = "00256";
	if(countryname=="Thailand")countrycode = "0066";
	if(countryname=="Timor-Leste")countrycode = "00670";
	if(countryname=="Togo")countrycode = "00228";
	if(countryname=="Trinidad and Tobago")countrycode = "001868";
	if(countryname=="Tunisia")countrycode = "00216";
	if(countryname=="Turkey")countrycode = "0090";
	if(countryname=="Uganda")countrycode = "006254";
	if(countryname=="Ukraine")countrycode = "00380";
	if(countryname=="United Arab Emirates")countrycode = "00971";
	if(countryname=="United Kingdom")countrycode = "0044";
	if(countryname=="Uruguay")countrycode = "00598";
	if(countryname=="Uzbekistan")countrycode = "00998";
	if(countryname=="Venezuela")countrycode = "0058";
	if(countryname=="Viet Nam")countrycode = "0084";
	if(countryname=="Yemen")countrycode = "00967";
	if(countryname=="Yugoslavia")countrycode = "00967";
	if(countryname=="Zimbabwe")countrycode = "00263";
	if(countryname=="Other")countrycode = "00";
	if(countryname=="UAE")countrycode = "00971";
	if(countryname=="American Samoa")countrycode = "001684";
	if(countryname=="Andorra")countrycode = "00376";
	if(countryname=="Anguilla")countrycode = "001264";
	if(countryname=="Antarctica")countrycode = "00672";
	if(countryname=="Antigua and Barbuda")countrycode = "001268";
	if(countryname=="Aruba")countrycode = "00297";
	if(countryname=="Barbados")countrycode = "001246";
	if(countryname=="Belize")countrycode = "00501";
	if(countryname=="Bhutan")countrycode = "00975";
	if(countryname=="Bouvet Island")countrycode = "0047";
	if(countryname=="British Indian Ocean Territory")countrycode = "001284";
	if(countryname=="British Virgin Islands")countrycode = "001284";
	if(countryname=="Brunei")countrycode = "00673";
	if(countryname=="Burkina Faso")countrycode = "00226";
	if(countryname=="Burundi")countrycode = "00257";
	if(countryname=="Cambodia")countrycode = "00855";
	if(countryname=="Cameroon")countrycode = "00238";
	if(countryname=="Cape Verde")countrycode = "00238";
	if(countryname=="Cayman Islands")countrycode = "001";
	if(countryname=="Central African Republic")countrycode = "00236";
	if(countryname=="Chad")countrycode = "00235";
	if(countryname=="Christmas Island")countrycode = "006189";
	if(countryname=="Cocos Islands")countrycode = "001161";
	if(countryname=="Comoros")countrycode = "00269";
	if(countryname=="Congo")countrycode = "00242";
	if(countryname=="Cuba")countrycode = "0053";
	if(countryname=="Djibouti")countrycode = "00253";
	if(countryname=="Dominica")countrycode = "001767";
	if(countryname=="Eritrea")countrycode = "00291";
	if(countryname=="Falkland Islands")countrycode = "00500";
	if(countryname=="Fiji")countrycode = "00679";
	if(countryname=="French Guiana")countrycode = "00594";
	if(countryname=="French Southern Territories")countrycode = "00689";
	if(countryname=="Grenada")countrycode = "001473";
	if(countryname=="Guadeloupe")countrycode = "00590";
	if(countryname=="Guam")countrycode = "001671";
	if(countryname=="Guinea")countrycode = "00224";
	if(countryname=="Guinea-Bissau")countrycode = "00245";
	if(countryname=="Guyana")countrycode = "00592";
	if(countryname=="Haiti")countrycode = "00509";
	if(countryname=="Heard and McDonald Islands")countrycode = "00509";
	if(countryname=="Afghanistan")countrycode = "0093";
	if(countryname=="Ivory Coast")countrycode = "00225";
	if(countryname=="Jamaica")countrycode = "001876";
	if(countryname=="Kiribati")countrycode = "00686";
	if(countryname=="Laos")countrycode = "00856";
	if(countryname=="Lesotho")countrycode = "00266";
	if(countryname=="Liberia")countrycode = "00231";
	if(countryname=="Libya")countrycode = "00218";
	if(countryname=="Macau")countrycode = "00853";
	if(countryname=="Malawi")countrycode = "00265";
	if(countryname=="Maldives")countrycode = "00960";
	if(countryname=="Mali")countrycode = "00223";
	if(countryname=="Marshall Islands")countrycode = "00692";
	if(countryname=="Martinique")countrycode = "00596";
	if(countryname=="Mauritania")countrycode = "00222";
	if(countryname=="Mayotte")countrycode = "00269";
	if(countryname=="Micronesia")countrycode = "00691";
	if(countryname=="Monaco")countrycode = "00377";
	if(countryname=="Mongolia")countrycode = "00976";
	if(countryname=="Montserrat")countrycode = "001664";
	if(countryname=="Mozambique")countrycode = "00258";
	if(countryname=="Myanmar")countrycode = "0095";
	if(countryname=="Nauru")countrycode = "00674";
	if(countryname=="New Caledonia")countrycode = "00687";
	if(countryname=="Niger")countrycode = "00227";
	if(countryname=="Niue")countrycode = "00683";
	if(countryname=="Norfolk Island")countrycode = "006723";
	if(countryname=="Northern Mariana Islands")countrycode = "001";
	if(countryname=="Palau")countrycode = "00680";
	if(countryname=="Papua New Guinea")countrycode = "00675";
	if(countryname=="Paraguay")countrycode = "002595";
	if(countryname=="Pitcairn Island")countrycode = "0063";
	if(countryname=="Puerto Rico")countrycode = "001939";
	if(countryname=="Reunion")countrycode = "00262";
	if(countryname=="Rwanda")countrycode = "00250";
	if(countryname=="S. Georgia and S. Sandwich Isls.")countrycode = "007";
	if(countryname=="Saint Kitts and Nevis")countrycode = "001869";
	if(countryname=="Saint Lucia")countrycode = "001758";
	if(countryname=="Saint Vincent and The Grenadines")countrycode = "001";
	if(countryname=="Samoa")countrycode = "00685";
	if(countryname=="San Marino")countrycode = "00378";
	if(countryname=="Sao Tome and Principe")countrycode = "00378";
	if(countryname=="Senegal")countrycode = "00221";
	if(countryname=="Seychelles")countrycode = "00248";
	if(countryname=="Sierra Leone")countrycode = "00232";
	if(countryname=="Slovakia")countrycode = "00421";
	if(countryname=="Somalia")countrycode = "00252";
	if(countryname=="St. Helena")countrycode = "00290";
	if(countryname=="St. Pierre and Miquelon")countrycode = "00508";
	if(countryname=="Sudan")countrycode = "00249";
	if(countryname=="Suriname")countrycode = "00597";
	if(countryname=="Svalbard and Jan Mayen Islands")countrycode = "00597";
	if(countryname=="Swaziland")countrycode = "00268";
	if(countryname=="Tajikistan")countrycode = "00992";
	if(countryname=="Tokelau")countrycode = "00690";
	if(countryname=="Tonga")countrycode = "00676";
	if(countryname=="Turkmenistan")countrycode = "00993";
	if(countryname=="Turks and Caicos Islands")countrycode = "001649";
	if(countryname=="Tuvalu")countrycode = "00688";
	if(countryname=="Vanuatu")countrycode = "00678";
	if(countryname=="Vatican City")countrycode = "0039";
	if(countryname=="Virgin Islands")countrycode = "001";
	if(countryname=="Wallis and Futuna Islands")countrycode = "00681";
	if(countryname=="Western Sahara")countrycode = "00681";
	if(countryname=="Zaire")countrycode = "00243";
	if(countryname=="Zambia")countrycode = "00260";
		



	return countrycode;
}


function Trim(strText) 
{	
	// this will get rid of leading spaces 
	while (strText.substring(0,1) == ' ') 
		strText = strText.substring(1, strText.length);

	// this will get rid of trailing spaces 
	while (strText.substring(strText.length-1,strText.length) == ' ')
		strText = strText.substring(0, strText.length-1);

	return strText;
} 

function isDate(dateStr) {
	//dateStr should be in this format - dd/mm/yyyy or dd-mm-yyyy

	var arrMonth = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
	var matchArray = dateStr.match(datePat); // format 

	if (matchArray == null) {
	alert("Please select date for visiting.");
	return false;
	}

	month = matchArray[3]; 
	day = matchArray[1];
	year = matchArray[5];

	if (month < 1 || month > 12) { // check month range
	alert("Month must be between 1 and 12.");
	return false;
	}

	if (day < 1 || day > 31) {
	alert("Day must be between 1 and 31.");
	return false;
	}

	var intMonth = new Number(month)
	
	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
	alert("Month "+ arrMonth[(intMonth-1)] +" doesn`t have 31 days!")
	return false;
	}

	if (month == 2) { // check for february 29th
	var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
	if (day > 29 || (day==29 && !isleap)) {
	alert("February " + year + " doesn`t have " + day + " days!");
	return false;
	}
	}
	return true; // date is valid
}
function isBlankSpaces(s) 
{
	var i = 0;
	while (i < s.length) {
		if (s.charAt(i) == " ") {
			i = i + 1;
			continue;
		} else return false;
	}
	return true;
}
function isDigit(s) {
	var i = 0;
	while (i < s.length) {
		var c = s.charAt(i);
		if ((c >= "0") && (c <= "9")) {
			i++;
			continue;
		} else return false;
	}
	return true;
}
