function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function validate() {
	if((document.search.City.value == 'AllCity') && (document.search.Metro.value == 'AllMetro') && (document.search.State.value == 'AllStates') && (document.search.Providence.value == '') && (document.search.Zip.value == '') && (document.search.Country.value == 'AllCountry')) {
		alert('Please enter/select atleast one value.');
		return false;
	}	
	if(document.search.CompanyName.value != '')  {
		if((document.search.City.value == 'AllCity') && (document.search.Metro.value == 'AllMetro') && (document.search.State.value == 'AllStates') && (document.search.Providence.value == '') && (document.search.Zip.value == '') && (document.search.Country.value == 'AllCountry')) {
			alert('Please select/enter a city/metro/state/province/zip.');			
			return false;
		}
	}
	if((document.search.Country.value != 'AllCountry') && (document.search.CompanyName.value == ''))  {
		if((document.search.City.value == 'AllCity') && (document.search.Metro.value == 'AllMetro') && ((document.search.CompanyName.value != ''))) {
			alert('Please select a city/metro.');			
			return false;
		}
	}
	return true;
}
function setindex() {
	Current = 0;
	document.search.City.selectedIndex = Current;
}
function setindex1() {
	Current = 0;
	document.search.Metro.selectedIndex = Current;
}
function show_map(a) {
	var t_link = '/zip_maps/maps.cfm?fn='+a;
	map = window.open(t_link,"","HEIGHT=600,WIDTH=700,titlebar=0,MENUBAR=0,status=0,menubar=0,toolbar=0,location=0,RESIZABLE=1,SCROLLBARS=1")
}
function login_validate() {
	var obj = document.login;
	if(obj.login_name.value == '') {
		alert('Please enter your login name.');
		obj.login_name.focus();
		return false;
	}
	if(obj.password.value == '') {
		alert('Please enter your pasword.');
		obj.password.focus();
		return false;
	}
	return true;
}
function validate_chgpass() {
	var obj = document.chgpass;
	if(obj.OldPass.value == '') {
		alert('Please enter old password.');
		obj.OldPass.focus();
		return false;
	}
	if(obj.NewPass.value == '') {
		alert('Please enter new password.');
		obj.NewPass.focus();
		return false;
	}
	if(obj.NewPass1.value == '') {
		alert('Please enter new password again.');
		obj.NewPass1.focus();
		return false;
	}
	if(obj.NewPass.value != obj.NewPass1.value) {
		alert('Passwords wont match. Please enter again.');
		obj.NewPass.value = '';
		obj.NewPass1.value = '';
		obj.NewPass.focus();
		return false;
	}
	return true;
}

function validate_basic() {
	var obj = document.basic_listing;
	//alert(obj.basic_listing_type[1].checked);
	len = obj.basic_listing_type.length;

	for(i=0;i<len;i++) {
		//alert(i);
		if(obj.basic_listing_type[i].checked) {
			checked =1;
			break;
		}
	}

	if(checked != 1) {
		alert('Please select listing type');
		return false;
	}

	if(obj.basic_listing_type[1].checked) {
		if(obj.basic_listing_number.value == '') {
			alert('Please enter number of listings.');
			obj.basic_listing_number.focus();
			return false;
		}
	}	
	
	if(obj.center_name.value == '') {
		alert('Please enter center name.');
		obj.center_name.focus();
		return false;
	}
	if(obj.contact_person.value == '') {
		alert('Please enter contact person.');
		obj.contact_person.focus();
		return false;
	}
	if(obj.email.value == '') {
		alert('Please enter email.');
		obj.email.focus();
		return false;
	} else {
		if (obj.email.value.indexOf("@") == -1 || obj.email.value.indexOf(".") == -1 || obj.email.value.indexOf(" ") != -1)
		  {
			 alert("Sorry, \""+obj.email.value+"\" is an invalid e-mail address.");
			 obj.email.focus();
			 return false;
		  }
	}
	if(obj.address1.value == '') {
		alert('Please enter address .');
		obj.address1.focus();
		return false;
	}
	if(obj.city.value == '') {
		alert('Please enter city.');
		obj.city.focus();
		return false;
	}
	if(obj.province.value == '') {
		if(obj.state.value == '') {
			alert('Please enter state.');
			obj.state.focus();
			return false;
		}
	}
	if(obj.zip.value == '') {
		alert('Please enter zip code.');
		obj.zip.focus();
		return false;
	}
	if(obj.country.value == '') {
		alert('Please enter country.');
		obj.country.focus();
		return false;
	}
	if(obj.main_phone.value == '') {
		alert('Please enter phone number.');
		obj.main_phone.focus();
		return false;
	}
	if(obj.fax_phone.value == '') {
		alert('Please enter fax number.');
		obj.fax_phone.focus();
		return false;
	}
	return true;
}
function validate_basic1() {
	var obj = document.basic_login;
	if(obj.username.value == '') {
		alert('Please enter username.');
		obj.username.focus();
		return false;
	}
	if(obj.password.value == '') {
		alert('Please enter password.');
		obj.password.focus();
		return false;
	}
	return true;
}
function virtual_basic1() {
	var obj = document.virtual_login;
	if(obj.username.value == '') {
		alert('Please enter username.');
		obj.username.focus();
		return false;
	}
	if(obj.password.value == '') {
		alert('Please enter password.');
		obj.password.focus();
		return false;
	}
	return true;
}
function validate_basic1_1() {
	var obj = document.basic_login1;
	if(obj.username.value == '') {
		alert('Please enter username.');
		obj.username.focus();
		return false;
	}
	if(obj.password.value == '') {
		alert('Please enter password.');
		obj.password.focus();
		return false;
	}
	return true;
}
function virtual_basic1_1() {
	var obj = document.virtual_login1;
	if(obj.username.value == '') {
		alert('Please enter username.');
		obj.username.focus();
		return false;
	}
	if(obj.password.value == '') {
		alert('Please enter password.');
		obj.password.focus();
		return false;
	}
	return true;
}
function validate_basic4() {
	var obj = document.basic_listing;

	if(obj.center_name.value == '') {
		alert('Please enter center name.');
		obj.center_name.focus();
		return false;
	}
	if(obj.contact_person.value == '') {
		alert('Please enter contact person.');
		obj.contact_person.focus();
		return false;
	}
	if(obj.email.value == '') {
		alert('Please enter email.');
		obj.email.focus();
		return false;
	} else {
		if (obj.email.value.indexOf("@") == -1 || obj.email.value.indexOf(".") == -1 || obj.email.value.indexOf(" ") != -1)
		  {
			 alert("Sorry, \""+obj.email.value+"\" is an invalid e-mail address.");
			 obj.email.focus();
			 return false;
		  }
	}
	if(obj.address1.value == '') {
		alert('Please enter address .');
		obj.address1.focus();
		return false;
	}
	if(obj.city.value == '') {
		alert('Please enter city.');
		obj.city.focus();
		return false;
	}
	if(obj.zip.value == '') {
		alert('Please enter zip code.');
		obj.zip.focus();
		return false;
	}
	if(obj.main_phone.value == '') {
		alert('Please enter phone number.');
		obj.main_phone.focus();
		return false;
	}
	if(obj.fax_phone.value == '') {
		alert('Please enter fax number.');
		obj.fax_phone.focus();
		return false;
	}
	if(obj.member_of[2].checked) {
		if(obj.other_member_of.value == '') {
			alert('Please enter your other industry network you are member of.');
			obj.other_member_of.focus();
			return false;
		}
	}
	if(obj.express_submit[0].checked) {
		if(obj.express_email.value == '') {
			alert('Please enter express email.');
			obj.express_email.focus();
			return false;
		}
	}
	return true;
}
function validate_basic5() {
	var obj = document.basic_listing;

	if(obj.center_name.value == '') {
		alert('Please enter center name.');
		obj.center_name.focus();
		return false;
	}
	if(obj.contact_person.value == '') {
		alert('Please enter contact person.');
		obj.contact_person.focus();
		return false;
	}
	if(obj.email.value == '') {
		alert('Please enter email.');
		obj.email.focus();
		return false;
	} else {
		if (obj.email.value.indexOf("@") == -1 || obj.email.value.indexOf(".") == -1 || obj.email.value.indexOf(" ") != -1)
		  {
			 alert("Sorry, \""+obj.email.value+"\" is an invalid e-mail address.");
			 obj.email.focus();
			 return false;
		  }
	}
	if(obj.address1.value == '') {
		alert('Please enter address .');
		obj.address1.focus();
		return false;
	}
	if(obj.city.value == '') {
		alert('Please enter city.');
		obj.city.focus();
		return false;
	}
	if(obj.zip.value == '') {
		alert('Please enter zip code.');
		obj.zip.focus();
		return false;
	}
	if(obj.main_phone.value == '') {
		alert('Please enter phone number.');
		obj.main_phone.focus();
		return false;
	}
	if(obj.fax_phone.value == '') {
		alert('Please enter fax number.');
		obj.fax_phone.focus();
		return false;
	}
	if(obj.member_of[2].checked) {
		if(obj.other_member_of.value == '') {
			alert('Please enter your other industry network you are member of.');
			obj.other_member_of.focus();
			return false;
		}
	}
	return true;
}
function validate_basic_payment() {
	var obj = document.payment;

	var flag1 = 0;
	var flag2 = 0;

	if(obj.basic_payment_annual.checked) {		
		flag1 = 1;
	}
	if(obj.basic_payment_monthly.checked) {
		flag2 = 1;
	}

	if((flag1 == 0) && (flag2==0)) {
	//if(!(obj.basic_payment_annual.checked) || !(obj.basic_payment_monthly.checked)) {
		alert('Please select payment type.');
		obj.basic_payment_annual.focus();
		return false;
	}
	if(obj.basic_card_holder_name.value == '') {
		alert('Please enter billing card holder name.');
		obj.basic_card_holder_name.focus();
		return false;
	}
	if(obj.basic_card_number.value == '') {
		alert('Please enter billing card number.');
		obj.basic_card_number.focus();
		return false;
	}
	if(obj.basic_card_expiry.value == '') {
		alert('Please enter billing card expiry.');
		obj.basic_card_expiry.focus();
		return false;
	}
	if(obj.basic_card_csv.value == '') {
		alert('Please enter billing card csv.');
		obj.basic_card_csv.focus();
		return false;
	}
	return true;
}
function virtual_basic_payment() {
	var obj = document.virtual_basic;

	var flag1 = 0;
	var flag2 = 0;

	if(obj.basic_payment_annual.checked) {		
		flag1 = 1;
	}
	/*if(obj.basic_payment_monthly.checked) {
		flag2 = 1;
	}*/

	if((flag1 == 0) && (flag2==0)) {
	//if(!(obj.basic_payment_annual.checked) || !(obj.basic_payment_monthly.checked)) {
		alert('Please select payment type.');
		obj.basic_payment_annual.focus();
		return false;
	}
	if(obj.basic_card_holder_name.value == '') {
		alert('Please enter billing card holder name.');
		obj.basic_card_holder_name.focus();
		return false;
	}
	if(obj.basic_card_number.value == '') {
		alert('Please enter billing card number.');
		obj.basic_card_number.focus();
		return false;
	}
	if(obj.basic_card_expiry.value == '') {
		alert('Please enter billing card expiry.');
		obj.basic_card_expiry.focus();
		return false;
	}
	if(obj.basic_card_csv.value == '') {
		alert('Please enter billing card csv.');
		obj.basic_card_csv.focus();
		return false;
	}
	return true;
}
function validate_virtual() {
	var obj = document.virtual_listing;
	//alert(obj.basic_listing_type[1].checked);
	//len = obj.basic_listing_type.length;

	//for(i=0;i<len;i++) {
		//alert(i);
	/*	if(obj.basic_listing_type[i].checked) {
			checked =1;
			break;
		}
	}

	if(checked != 1) {
		alert('Please select listing type');
		return false;
	}

	if(obj.basic_listing_type[1].checked) {
		if(obj.basic_listing_number.value == '') {
			alert('Please enter number of listings.');
			obj.basic_listing_number.focus();
			return false;
		}
	}*/	
	
	if(obj.center_name.value == '') {
		alert('Please enter center name.');
		obj.center_name.focus();
		return false;
	}
	if(obj.contact_person.value == '') {
		alert('Please enter contact person.');
		obj.contact_person.focus();
		return false;
	}
	if(obj.email.value == '') {
		alert('Please enter email.');
		obj.email.focus();
		return false;
	} else {
		if (obj.email.value.indexOf("@") == -1 || obj.email.value.indexOf(".") == -1 || obj.email.value.indexOf(" ") != -1)
		  {
			 alert("Sorry, \""+obj.email.value+"\" is an invalid e-mail address.");
			 obj.email.focus();
			 return false;
		  }
	}
	if(obj.virtual_office.value == '') {
		alert('Please enter virtual office link.');
		obj.virtual_office.focus();
		return false;
	}
	if(obj.address1.value == '') {
		alert('Please enter address .');
		obj.address1.focus();
		return false;
	}
	if(obj.city.value == '') {
		alert('Please enter city.');
		obj.city.focus();
		return false;
	}
	if(obj.province.value == '') {
		if(obj.state.value == '') {
			alert('Please enter state.');
			obj.state.focus();
			return false;
		}
	}
	if(obj.zip.value == '') {
		alert('Please enter zip code.');
		obj.zip.focus();
		return false;
	}
	if(obj.country.value == '') {
		alert('Please enter country.');
		obj.country.focus();
		return false;
	}
	if(obj.main_phone.value == '') {
		alert('Please enter phone number.');
		obj.main_phone.focus();
		return false;
	}
	if(obj.fax_phone.value == '') {
		alert('Please enter fax number.');
		obj.fax_phone.focus();
		return false;
	}
	return true;
}

function amount_update(obj,type) {
	var obj = document.payment;	
	//alert(type);
	if(type == 'annual') {
		amt = 89 + 25;
		obj.total_fee.value = amt;
		obj.basic_total_amount.value = amt;
		obj.basic_payment_monthly.checked = false;
	} else if(type == 'monthly') {
		amt = 9 + 25;
		obj.total_fee.value = amt;
		obj.basic_total_amount.value = amt;
		obj.basic_payment_annual.checked = false;
	}
	//alert(obj.total_fee.value);
}
function validate_forgot() {
	var obj = document.forgot;
	if(obj.username.value == '') {
		alert('Please enter your username.');
		obj.username.focus();
		return false;
	}
	return true;
}
function validate_enhanced() {
	var obj = document.enhanced_listing;
	len = obj.enhanced_listing_type.length;

	for(i=0;i<len;i++) {
		//alert(i);
		if(obj.enhanced_listing_type[i].checked) {
			checked =1;
			break;
		}
	}

	if(checked != 1) {
		alert('Please select listing type');
		return false;
	}

	if(obj.enhanced_listing_type[1].checked) {
		if(obj.enhanced_listing_number.value == '') {
			alert('Please enter number of listings.');
			obj.enhanced_listing_number.focus();
			return false;
		}
	}
	if(obj.center_name.value == '') {
		alert('Please enter center name.');
		obj.center_name.focus();
		return false;
	}
	if(obj.contact_person.value == '') {
		alert('Please enter contact person.');
		obj.contact_person.focus();
		return false;
	}
	if(obj.address1.value == '') {
		alert('Please enter address.');
		obj.address1.focus();
		return false;
	}
	if(obj.city.value == '') {
		alert('Please enter city.');
		obj.city.focus();
		return false;
	}
	if(obj.location.value == '') {
		alert('Please enter location.');
		obj.location.focus();
		return false;
	}
	if(obj.metro.value == 'Other') {
		if(obj.metroother.value == '') {
			alert('Please enter other metro.');
			obj.metroother.focus();
			return false;
		}
	}
	if(obj.province.value == '') {
		if(obj.state.value == '') {
			alert('Please select state.');
			obj.state.focus();
			return false;
		}
	}
	if(obj.zip.value == '') {
		alert('Please enter zip.');
		obj.zip.focus();
		return false;
	}
	if(obj.country.value == '') {
		alert('Please enter country.');
		obj.country.focus();
		return false;
	}
	if(obj.main_phone.value == '') {
		alert('Please enter main phone.');
		obj.main_phone.focus();
		return false;
	}
	if(obj.email.value == '') {
		alert('Please enter email.');
		obj.email.focus();
		return false;
	} else {
		if (obj.email.value.indexOf("@") == -1 || obj.email.value.indexOf(".") == -1 || obj.email.value.indexOf(" ") != -1)
		  {
			 alert("Sorry, \""+obj.email.value+"\" is an invalid e-mail address.");
			 obj.email.focus();
			 return false;
		  }
	}
	if(obj.range_price_min.value != '') {
		if(isNaN(obj.range_price_min.value)) {
			alert('Please enter price range min only in numbers. Dont include($) symbol.');
			obj.range_price_min.focus();
			return false;
		}
	}
	if(obj.range_price_max.value != '') {
		if(isNaN(obj.range_price_max.value)) {
			alert('Please enter price range max only in numbers. Dont include($) symbol.');
			obj.range_price_max.focus();
			return false;
		}
	}
	if(obj.ci[0].checked) {
		if(obj.ci_upload.value == '') {
			alert('Please select an image to upload.');
			obj.ci_upload.focus();
			return false;
		}
	}
	if(obj.ml[0].checked) {
		if(obj.map_upload.value == '') {
			alert('Please select map to upload.');
			obj.map_upload.focus();
			return false;
		}
	}
	if(obj.fp[0].checked) {
		if(obj.fp_upload.value == '') {
			alert('Please select floor plan to upload.');
			obj.fp_upload.focus();
			return false;
		}
	}
	if(obj.vt[0].checked) {
		if(obj.vt_upload.value == '') {
			alert('Please select virtual tour to upload.');
			obj.vt_upload.focus();
			return false;
		}
	}
	if(obj.member_of[2].checked) {
		if(obj.other_member_of.value == '') {
			alert('Please enter your other industry network you are member of.');
			obj.other_member_of.focus();
			return false;
		}
	}
	return true;
}
function validate_enhanced1() {
	var obj = document.enhanced_listing1;
	
	if(obj.center_name.value == '') {
		alert('Please enter center name.');
		obj.center_name.focus();
		return false;
	}
	if(obj.contact_person.value == '') {
		alert('Please enter contact person.');
		obj.contact_person.focus();
		return false;
	}
	if(obj.address1.value == '') {
		alert('Please enter address.');
		obj.address1.focus();
		return false;
	}
	if(obj.city.value == '') {
		alert('Please enter city.');
		obj.city.focus();
		return false;
	}
	if(obj.location.value == '') {
		alert('Please enter location.');
		obj.location.focus();
		return false;
	}
	if(obj.metro.value == 'Other') {
		if(obj.metroother.value == '') {
			alert('Please enter other metro.');
			obj.metroother.focus();
			return false;
		}
	}
	/*if(obj.province.value == '') {
		if(obj.state.value == '') {
			alert('Please select state.');
			obj.state.focus();
			return false;
		}
	}*/
	if(obj.zip.value == '') {
		alert('Please enter zip.');
		obj.zip.focus();
		return false;
	}
	
	if(obj.main_phone.value == '') {
		alert('Please enter main phone.');
		obj.main_phone.focus();
		return false;
	}
	if(obj.email.value == '') {
		alert('Please enter email.');
		obj.email.focus();
		return false;
	} else {
		if (obj.email.value.indexOf("@") == -1 || obj.email.value.indexOf(".") == -1 || obj.email.value.indexOf(" ") != -1)
		  {
			 alert("Sorry, \""+obj.email.value+"\" is an invalid e-mail address.");
			 obj.email.focus();
			 return false;
		  }
	}
	
	if(obj.member_of[2].checked) {
		if(obj.other_member_of.value == '') {
			alert('Please enter your other industry network you are member of.');
			obj.other_member_of.focus();
			return false;
		}
	}
	if(obj.express_submit[0].checked) {
		if(obj.express_email.value == '') {
			alert('Please enter express email.');
			obj.express_email.focus();
			return false;
		}
	}
	return true;
}
function validate_enhanced2() {
	var obj = document.enhanced_listing1;
	
	if(obj.center_name.value == '') {
		alert('Please enter center name.');
		obj.center_name.focus();
		return false;
	}
	if(obj.contact_person.value == '') {
		alert('Please enter contact person.');
		obj.contact_person.focus();
		return false;
	}
	if(obj.address1.value == '') {
		alert('Please enter address.');
		obj.address1.focus();
		return false;
	}
	if(obj.city.value == '') {
		alert('Please enter city.');
		obj.city.focus();
		return false;
	}
	if(obj.location.value == '') {
		alert('Please enter location.');
		obj.location.focus();
		return false;
	}
	if(obj.metro.value == 'Other') {
		if(obj.metroother.value == '') {
			alert('Please enter other metro.');
			obj.metroother.focus();
			return false;
		}
	}
	/*if(obj.province.value == '') {
		if(obj.state.value == '') {
			alert('Please select state.');
			obj.state.focus();
			return false;
		}
	}*/
	if(obj.zip.value == '') {
		alert('Please enter zip.');
		obj.zip.focus();
		return false;
	}
	
	if(obj.main_phone.value == '') {
		alert('Please enter main phone.');
		obj.main_phone.focus();
		return false;
	}
	if(obj.email.value == '') {
		alert('Please enter email.');
		obj.email.focus();
		return false;
	} else {
		if (obj.email.value.indexOf("@") == -1 || obj.email.value.indexOf(".") == -1 || obj.email.value.indexOf(" ") != -1)
		  {
			 alert("Sorry, \""+obj.email.value+"\" is an invalid e-mail address.");
			 obj.email.focus();
			 return false;
		  }
	}
	
	if(obj.member_of[2].checked) {
		if(obj.other_member_of.value == '') {
			alert('Please enter your other industry network you are member of.');
			obj.other_member_of.focus();
			return false;
		}
	}
	return true;
}
function enhanced_cpl() {
	var obj = document.payment;
	/*alert(eval(obj.total_cost1.value));
	alert(eval(obj.total_cost2.value));
	alert(eval(obj.total_cost3.value));*/
	//alert(obj.link_include.checked);
	if(obj.link_include.checked) {
		obj.total_cost2.value = 49;
		
		var tot = eval(obj.total_cost1.value) + eval(obj.total_cost2.value) +  eval(obj.total_cost3.value)+(25);
		//alert(eval(tot));
		obj.total_fee.value = eval(tot);
		obj.total_fee1.value = eval(obj.total_fee1.value)+49;
		obj.basic_total_amount.value = eval(obj.basic_total_amount.value)+49;
		
	} else {
		obj.total_cost2.value = 0;
		obj.total_fee.value = eval(obj.total_cost1.value) + eval(obj.total_cost2.value) +  eval(obj.total_cost3.value)+(25);
		obj.total_fee1.value = eval(obj.total_fee1.value)-(49);
		obj.basic_total_amount.value = eval(obj.basic_total_amount.value)-(49);
	}
}

function enhanced_not() {
	var obj = document.payment;
	obj.total_cost2.value = obj.no_of_tours.value * 25;
	obj.total_fee.value = eval(obj.total_cost.value) + eval(obj.total_cost1.value) +  eval(obj.total_cost2.value);
}

function validate_enhanced_payment() {
	var obj = document.payment;

	var flag1 = 0;
	var flag2 = 0;

	if(obj.enhanced_payment_annual.checked) {		
		flag1 = 1;
	}
	if(obj.enhanced_payment_monthly.checked) {
		flag2 = 1;
	}

	if((flag1 == 0) && (flag2==0)) {
		alert('Please select payment type.');
		obj.enhanced_payment_annual.focus();
		return false;
	}
	if(obj.basic_card_holder_name.value == '') {
		alert('Please enter billing card holder name.');
		obj.basic_card_holder_name.focus();
		return false;
	}
	if(obj.basic_card_number.value == '') {
		alert('Please enter billing card number.');
		obj.basic_card_number.focus();
		return false;
	}
	if(obj.basic_card_expiry.value == '') {
		alert('Please enter billing card expiry.');
		obj.basic_card_expiry.focus();
		return false;
	}
	if(obj.basic_card_csv.value == '') {
		alert('Please enter billing card csv.');
		obj.basic_card_csv.focus();
		return false;
	}
	return true;
}
function enhanced_amount_update(obj,type) {
	var obj = document.payment;	
	//alert(type);
	if(type == 'annual') {
		amt = 199 + 25;
		if(obj.enhanced_payment_tours.checked) {
			amt = amt + (obj.no_of_tours.value*25);
		}
		if(obj.enhanced_payment_link.checked) {
			amt = amt + 49;
		}

		if(obj.virtual_office_link.checked) {
			amt = amt + 65;
		}

		if(obj.enhanced_assisted_setup_fee.checked) {
			amt = amt + (obj.no_of_tours.value*20);
		}

		obj.total_fee.value = amt;
		obj.basic_total_amount.value = amt;
		obj.enhanced_payment_monthly.checked = false;
	} else if(type == 'monthly') {
		amt = 20 + 25;
		if(obj.enhanced_payment_tours.checked) {
			amt = amt + (obj.no_of_tours.value*25);
		}
		if(obj.enhanced_payment_link.checked) {
			amt = amt + 49;
		}

		if(obj.virtual_office_link.checked) {
			amt = amt + 65;
		}

		if(obj.enhanced_assisted_setup_fee.checked) {
			amt = amt + (obj.no_of_tours.value*20);
		}

		obj.total_fee.value = amt;
		obj.basic_total_amount.value = amt;
		obj.enhanced_payment_annual.checked = false;
	} else if(type == 'tour') {
		amt = 0;
		if(obj.enhanced_payment_annual.checked) {
			amt = 199 + 25;
			obj.enhanced_payment_monthly.checked = false;
		}
		if(obj.enhanced_payment_monthly.checked) {
			amt = amt + 20 + 25;
			obj.enhanced_payment_annual.checked = false;
		}
		if(obj.enhanced_payment_tours.checked) {
			amt = amt + (obj.no_of_tours.value*25);
		}
		if(obj.enhanced_payment_link.checked) {
			amt = amt + 49;
		}

		if(obj.virtual_office_link.checked) {
			amt = amt + 65;
		}

		if(obj.enhanced_assisted_setup_fee.checked) {
			amt = amt + (obj.no_of_tours.value*20);
		}

		obj.total_fee.value = amt;
		obj.basic_total_amount.value = amt;
	} else if(type == 'link') {
		amt = 0;
		if(obj.enhanced_payment_annual.checked) {
			amt = 199 + 25;
			obj.enhanced_payment_monthly.checked = false;
		}
		if(obj.enhanced_payment_monthly.checked) {
			amt = amt + 20 + 25;
			obj.enhanced_payment_annual.checked = false;
		}
		if(obj.enhanced_payment_tours.checked) {
			amt = amt + (obj.no_of_tours.value*25);
		}
		if(obj.enhanced_payment_link.checked) {
			amt = amt + 49;
		}

		if(obj.virtual_office_link.checked) {
			amt = amt + 65;
		}

		if(obj.enhanced_assisted_setup_fee.checked) {
			amt = amt + (obj.no_of_tours.value*20);
		}

		obj.total_fee.value = amt;
		obj.basic_total_amount.value = amt;
	} else if(type == 'vo_link') {
		amt = 0;
		if(obj.enhanced_payment_annual.checked) {
			amt = 199 + 25;
			obj.enhanced_payment_monthly.checked = false;
		}
		if(obj.enhanced_payment_monthly.checked) {
			amt = amt + 20 + 25;
			obj.enhanced_payment_annual.checked = false;
		}
		if(obj.enhanced_payment_tours.checked) {
			amt = amt + (obj.no_of_tours.value*25);
		}
		if(obj.enhanced_payment_link.checked) {
			amt = amt + 49;
		}

		if(obj.virtual_office_link.checked) {
			amt = amt + 65;
		}		

		if(obj.enhanced_assisted_setup_fee.checked) {
			amt = amt + (obj.no_of_tours.value*20);
		}

		obj.total_fee.value = amt;
		obj.basic_total_amount.value = amt;
	} else if(type == 'assist') {
		amt = 0;
		if(obj.enhanced_payment_annual.checked) {
			amt = 199 + 25;
			obj.enhanced_payment_monthly.checked = false;
		}
		if(obj.enhanced_payment_monthly.checked) {
			amt = amt + 20 + 25;
			obj.enhanced_payment_annual.checked = false;
		}
		if(obj.enhanced_payment_tours.checked) {
			amt = amt + (obj.no_of_tours.value*25);
		}
		if(obj.enhanced_payment_link.checked) {
			amt = amt + 49;
		}

		if(obj.virtual_office_link.checked) {
			amt = amt + 65;
		}

		if(obj.enhanced_assisted_setup_fee.checked) {
			amt = amt + (obj.no_of_tours.value*20);
		}
		obj.total_fee.value = amt;
		obj.basic_total_amount.value = amt;	
	}
	//alert(obj.total_fee.value);
}

function show_image(ControlID,Type) {
	if(Type == 0) {
		//center image
		window.open("view.cfm?ControlID="+ControlID+"&type=ci","popup","scrollbars=1,height=300,width=500,resizable=1");
	} else if(Type == 1) {
		//maps
		window.open("view.cfm?ControlID="+ControlID+"&type=maps","popup","scrollbars=1,height=300,width=500,resizable=1");
	} else if(Type == 2) {
		//floor plan
		window.open("view.cfm?ControlID="+ControlID+"&type=floor","popup","scrollbars=1,height=300,width=500,resizable=1");
	} else if(Type == 3) {
		//tours
		window.open("view.cfm?ControlID="+ControlID+"&type=tour","popup","scrollbars=1,height=300,width=500,resizable=1");

	}	
}
function show_image1(img,Type,center_name,location) {
	//alert('a');
	if(Type == 1) {
		//maps
		window.open("view1.cfm?img="+img+"&type=maps&cn="+center_name+"&loc="+location,"popup342","scrollbars=1,height=300,width=500,resizable=1");
	} else if(Type == 3) {
		//floor plan
		window.open("view1.cfm?img="+img+"&type=floor&cn="+center_name+"&loc="+location,"popup324","scrollbars=1,height=300,width=500,resizable=1");
	} else if(Type == 2) {
		//tours
		window.open("view1.cfm?img="+img+"&type=tour&cn="+center_name+"&loc="+location,"popup522","scrollbars=1,height=300,width=500,resizable=1");

	}	
}
function preview() {
	window.open("enhanced_preview.cfm","popup","scrollbars=1,height=600,width=800,resizable=1");
}

function enhanced_instructions() {
	window.open("enhanced_instructions.cfm","popup","scrollbars=1,height=600,width=800,resizable=1");
}
function add_text(span_name,span_text)
{
//document.getElementById(span_name).innerHTML = span_text;
	var obj = window.opener.document.basic_login;
	var preview_content = '<table width="640"><tr><td align="left"><div align="left">';
	preview_content = '<table>';
	preview_content += '<tr>';
	if(obj.ci_upload.value != '') {
		preview_content += '<td align="left"><b class="body">[<A HREF="SearchMain.cfm">NEW SEARCH</a>]</b><BR><img src="uploads/'+obj.ci_upload.value+'" border="2"></td>';
	}
	preview_content += '<td align="left">';
	if(obj.vc.value == 'Yes') {
		preview_content += '<div align="center"><IMG SRC="images/videoicon3.gif" WIDTH=37 HEIGHT=40 ALT="" BORDER="0"></div>';
	}
	if(obj.ia.value == 'Yes') {
		preview_content += '<div align="center"><IMG SRC="images/earth_animated.gif" WIDTH=32 HEIGHT=32 ALT="" BORDER="0"></div>';
	}
	if(obj.t1.value == 'Yes') {
		preview_content += '<div align="center"><IMG SRC="images/Lighting.gif" WIDTH=42 HEIGHT=40 ALT="" BORDER="0"></div>';
	}
	if(obj.training.value == 'Yes') {
		preview_content += '<div align="center"><IMG SRC="images/Training.gif" WIDTH=36 HEIGHT=35 ALT="" BORDER="0"></div>';
	}
		preview_content += '</td>';
		preview_content += '</tr>';

	if(obj.map_upload.value != '' || obj.fp_upload.value != '' || obj.vt_upload.value != '') {
		preview_content += '<tr><td colspan="2">';
		if(obj.map_upload.value != '') {			
			preview_content += '<input type="button" value="Map!" onClick="show_image1(\''+obj.map_upload.value+'\',1,\''+obj.center_name.value+'\',\''+obj.location.value+'\');">';
		}
		if(obj.fp_upload.value != '') {
			preview_content += '<input type="button" value="Virtual Tour!" onclick="show_image1(\''+obj.vt_upload.value+'\',2,\''+obj.center_name.value+'\',\''+obj.location.value+'\');">';
		}
		
		if(obj.vt_upload.value != '') {
			preview_content += '<input type="button" value="Floor Plan!" onclick="show_image1(\''+obj.fp_upload.value+'\',3,\''+obj.center_name.value+'\',\''+obj.location.value+'\');">';
		}
		preview_content += '</td></tr>';
	}
	preview_content += '</table></div>';
	preview_content += '<TABLE WIDTH="640" CELLPADDING="3"><TR><TD><FONT SIZE="5"><span class="body"><b><font size="3" color="#0000FF">'+obj.center_name.value+'</font></b></span></FONT><span class="body"><BR>';
	if(obj.location.value != '') {
		preview_content += '<B>'+obj.location.value+'</B><BR>';
	}
	if(obj.metroother.value == '') {
		preview_content += '<B>Metro Area: '+obj.metro.value+'</B> ';
	} else {
		preview_content += '<B>Metro Area: '+obj.metroother.value+'</B> ';
	}
	preview_content += '</TD></TR></TABLE>';
	preview_content += '<TABLE WIDTH="640" CELLPADDING="3"><TR bgcolor="#336699"><TD COLSPAN="2"><font size="4" color="#FFFFFF">Contact Information</font></TD></TR><TR VALIGN="TOP"><TD class="body">'+obj.address1.value+'<BR>';

	if(obj.address2.value != '') {
		preview_content += obj.address2.value + '<BR>';
	}

	preview_content += obj.city.value + ',';
	if(obj.state.value != '') {
		preview_content += '&nbsp;'+obj.state.value;
	} else {
		preview_content += '&nbsp;'+obj.province.value;
	}

	preview_content += '&nbsp;'+obj.zip.value + '<BR>';
	preview_content += obj.country.value + '</td>';

	preview_content += '<TD><b><span class="body">Contact:</span></b> <span class="body">';
	preview_content += obj.contact_person.value + '<br>';

	if(obj.main_phone.value != '') {
		preview_content += '<B>Phone:</B>';

		if(obj.int_phone_code.value != '') {
			preview_content += '('+obj.int_phone_code.value+')';
		}
		preview_content += obj.main_phone.value + '<br>';
	}
	if(obj.fax_phone.value != '') {
		preview_content += '<B>Fax:</B>';
		if(obj.int_phone_code.value != '') {
			preview_content += '('+obj.int_phone_code.value+')';
		}
		preview_content += obj.fax_phone.value + '<br>';
	}

	if(obj.email.value != '') {
		preview_content += '<B>Email:</B> <A HREF="mailto:'+obj.email.value+'">'+obj.email.value+'</A>';
	}

	if(obj.webaddress.value != '') {
		preview_content += '<BR><B>Web Address:</B> <A HREF="'+obj.webaddress.value+'">'+obj.webaddress.value+'</A>';
	}

	preview_content += '</TD></TR></TABLE>';
	
	preview_content += '<TABLE WIDTH="640"  CELLPADDING="3"><TR><TD BGCOLOR="#336699"><font size="4" color="#FFFFFF">Location Notes</font></TD></TR><TR><TD class="body">'+obj.location_notes.value+'</TD></TR></TABLE><TABLE WIDTH="640" CELLPADDING="3"><TR bgcolor="#336699"><TD COLSPAN="2"><font size="4" color="#FFFFFF">Office Information</font></TD></TR><TR><TD COLSPAN="2"><BR></TD></TR><TR><TD COLSPAN="2"><FONT SIZE="4" class="body" >Total Number of Offices:</FONT><span class="body">'+obj.total_office_number.value+'</span></TD></TR><TR><TD><FONT SIZE="4"><B class="body">Range of Office Sizes</B></FONT></TD><TD><FONT SIZE="4"><B class="body">Price Range</B></FONT></TD></TR><TR><TD><B><span class="body">Minimum:</span></B><span class="body"><br>'+obj.office_range_size_min.value+' square feet</span></TD><TD><B><span class="body">Minimum:</span></B><span class="body"><BR>$'+obj.range_price_min.value+' per month</span></TD></TR><TR><TD><B><span class="body">Maximum:</span></B><span class="body"><br>'+obj.office_range_size_max.value+' square feet </span><P></TD><TD><B><span class="body">Maximum:</span></B><span class="body"><BR>$'+obj.range_price_max.value+' per month</span></TD></TR><TR><TD></TD><TD><B><span class="body">Currency Type:</span></B> <span class="body"> USD </span><BR></TD></TR></TABLE>';

	preview_content += '<TABLE WIDTH="640" CELLPADDING="3"><TR><TD WIDTH="50%" VALIGN="TOP" BGCOLOR="#336699" ><font size="4" color="#FFFFFF">Amenities</font></td><TD WIDTH="50%" VALIGN="TOP" BGCOLOR="#336699"><font size="4" color="#FFFFFF">Optional (Extra Charge) Services</font></TD></TR><TR><TD WIDTH="50%" VALIGN="TOP">';
	
	if(obj.tmp_list_ame.value != '') {
		var tmp_spl1 = obj.tmp_list_ame.value;
		var tmp_spl_list_ame = tmp_spl1.split("::");

		preview_content += '<UL>';
		for(i=0;i<tmp_spl_list_ame.length;i++) {
			preview_content += '<LI>'+tmp_spl_list_ame[i];
		}
	} else {
		preview_content += '<UL>'+obj.list_amenities.value;
	}
	
	preview_content += '</UL></TD><TD WIDTH="50%" VALIGN="TOP" >';
	
	if(obj.tmp_suite_options.value != '') {
		var tmp_spl2 = obj.tmp_suite_options.value;
		var tmp_spl_suite_options = tmp_spl2.split("::");

		preview_content += '<UL>';
		for(i=0;i<tmp_spl_suite_options.length;i++) {
			preview_content += '<LI>'+tmp_spl_suite_options[i];
		}		
	} else {
		preview_content += '<UL>'+obj.suite_options.value;
	}
	
	preview_content += '</UL></TD></TR></TABLE><TABLE WIDTH="640"><TR><TD BGCOLOR="#336699"><font size="4" color="#FFFFFF">Comments</font></TD></TR><TR><TD class="body">'+obj.comments.value+'</TD></TR></TABLE><P class="body">[<A HREF="http://www.esuite.com/templates/Directory/SearchMain.cfm"><b>NEW SEARCH</b></a>] <P></P></TD></TR></TABLE>';

	preview_content += '</td></tr></table>';
	document.getElementById("preview").innerHTML = preview_content;
}

function instructions1(type) {	
	if(type == 1) {
		window.open("center_instructions.cfm","popup","scrollbars=1,height=600,width=600,resizable=1");
	} else if(type == 2) {
		window.open("map_instructions.cfm","popup","scrollbars=1,height=600,width=600,resizable=1");
	} else if(type == 3) {
		window.open("floor_instructions.cfm","popup","scrollbars=1,height=600,width=600,resizable=1");
	} else if(type == 4) {
		window.open("tour_instructions.cfm","popup","scrollbars=1,height=600,width=600,resizable=1");
	}
}

function validate_metro() {
	var obj = document.metro;
	if(obj.metro.value == '') {
		alert('Please enter metro');
		obj.metro.focus();
		return false;
	}
	return true;
}
//(cnt_enh * (199-((199)*(discount/100))))
function renew_charges(form,tc,dis) {
	//alert(form.renewal_type.value);
	if(form.renewal_type.value == 'monthly') {
		total_charges1 = (form.cnt_bas.value * (9-((9)*(dis/100))));
		total_charges2 = (form.cnt_enh.value * (20-((20)*(dis/100))));
		if(form.link_include.checked) {
			total_charges3 = tc * 49;
		} else {
			total_charges3 = 0;
		}

		if(form.no_of_tours.value != '') {
			total_charges4 = form.no_of_tours.value * 25;
		} else {
			total_charges4 = 0;
		}
		total_charges = total_charges1+total_charges2+total_charges3+total_charges4;
		form.total_charges.value = total_charges;
	} 
	if(form.renewal_type.value == 'annual') {
		total_charges1 = (form.cnt_bas.value * (89-((89)*(dis/100))));
		total_charges2 = (form.cnt_enh.value * (199-((199)*(dis/100))));
		if(form.link_include.checked) {
			total_charges3 = tc * 49;
		} else {
			total_charges3 = 0;
		}
		if(form.no_of_tours.value != '') {
			total_charges4 = form.no_of_tours.value * 25;
		} else {
			total_charges4 = 0;
		}
		total_charges = total_charges1+total_charges2+total_charges3+total_charges4;
		form.total_charges.value = total_charges;
	} 
}

function renew_billing_validate() {
	var obj = document.renew_billing;

	if(obj.basic_card_type.value == '') {
		alert('Please select card type.');
		obj.basic_card_type.focus();
		return false;
	}

	if(obj.basic_card_holder_name.value == '') {
		alert('Please enter card holder name.');
		obj.basic_card_holder_name.focus();
		return false;
	}
	if(obj.basic_card_number.value == '') {
		alert('Please enter card number.');
		obj.basic_card_number.focus();
		return false;
	}
	if(obj.basic_card_expiry.value == '') {
		alert('Please select card expiry.');
		obj.basic_card_expiry.focus();
		return false;
	}
	if(obj.basic_card_csv.value == '') {
		alert('Please enter card csv.');
		obj.basic_card_csv.focus();
		return false;
	}
	if(obj.basic_billing_name_card.value == '') {
		alert('Please enter name on card.');
		obj.basic_billing_name_card.focus();
		return false;
	}
	if(obj.basic_billing_address.value == '') {
		alert('Please enter billing address.');
		obj.basic_billing_address.focus();
		return false;
	}
	if(obj.basic_billing_city.value == '') {
		alert('Please enter billing cty.');
		obj.basic_billing_city.focus();
		return false;
	}if(obj.basic_billing_state.value == '') {
		alert('Please enter state name.');
		obj.basic_billing_state.focus();
		return false;
	}
	if(obj.basic_billing_zip.value == '') {
		alert('Please enter billing zip.');
		obj.basic_billing_zip.focus();
		return false;
	}
	if(obj.basic_billing_country.value == '') {
		alert('Please enter billing country.');
		obj.basic_billing_country.focus();
		return false;
	}
	return true;
}
function sa_renew_billing_validate() {
	var obj = document.renew_billing;

	if(obj.payment_type.value == 'cc') {
		if(obj.basic_card_type.value == '') {
			alert('Please select card type.');
			obj.basic_card_type.focus();
			return false;
		}

		if(obj.basic_card_holder_name.value == '') {
			alert('Please enter card holder name.');
			obj.basic_card_holder_name.focus();
			return false;
		}
		if(obj.basic_card_number.value == '') {
			alert('Please enter card number.');
			obj.basic_card_number.focus();
			return false;
		}
		if(obj.basic_card_expiry.value == '') {
			alert('Please select card expiry.');
			obj.basic_card_expiry.focus();
			return false;
		}
		if(obj.basic_card_csv.value == '') {
			alert('Please enter card csv.');
			obj.basic_card_csv.focus();
			return false;
		}
		if(obj.basic_billing_name_card.value == '') {
			alert('Please enter name on card.');
			obj.basic_billing_name_card.focus();
			return false;
		}
		if(obj.basic_billing_address.value == '') {
			alert('Please enter billing address.');
			obj.basic_billing_address.focus();
			return false;
		}
		if(obj.basic_billing_city.value == '') {
			alert('Please enter billing cty.');
			obj.basic_billing_city.focus();
			return false;
		}if(obj.basic_billing_state.value == '') {
			alert('Please enter state name.');
			obj.basic_billing_state.focus();
			return false;
		}
		if(obj.basic_billing_zip.value == '') {
			alert('Please enter billing zip.');
			obj.basic_billing_zip.focus();
			return false;
		}
		if(obj.basic_billing_country.value == '') {
			alert('Please enter billing country.');
			obj.basic_billing_country.focus();
			return false;
		}
	}
	
	return true;
}
function billing_link(form,tc,dis) {
	if(form.link_include.checked) {
		if(form.renewal_type.value == 'monthly') {
			total_charges1 = (form.cnt_bas.value * (9-((9)*(dis/100))));
			total_charges2 = (form.cnt_enh.value * (20-((20)*(dis/100))));
		} 
		if(form.renewal_type.value == 'annual') {
			total_charges1 = (form.cnt_bas.value * (89-((89)*(dis/100))));
			total_charges2 = (form.cnt_enh.value * (199-((199)*(dis/100))));
		} 
		total_charges3 = tc * (49-(49*(dis/100)));
		if(form.no_of_tours.value != '') {
			total_charges4 = form.no_of_tours.value * 25;
		} else {
			total_charges4 = 0;
		}
		total_charges = total_charges1+total_charges2+total_charges3+total_charges4;		
		form.total_charges.value = total_charges;
	} else {
		if(form.renewal_type.value == 'monthly') {
			total_charges1 = (form.cnt_bas.value * (9-((9)*(dis/100))));
			total_charges2 = (form.cnt_enh.value * (20-((20)*(dis/100))));
		} 
		if(form.renewal_type.value == 'annual') {
			total_charges1 = (form.cnt_bas.value * (89-((89)*(dis/100))));
			total_charges2 = (form.cnt_enh.value * (199-((199)*(dis/100))));
		} 		

		if(form.no_of_tours.value != '') {
			total_charges4 = form.no_of_tours.value * 25;
		} else {
			total_charges4 = 0;
		}

		total_charges = (total_charges1+total_charges2+total_charges4);		
		form.total_charges.value = total_charges;
	}
}

function billing_tours(form,tc,dis) {
	if(form.link_include.checked) {
		if(form.renewal_type.value == 'monthly') {
			total_charges1 = (form.cnt_bas.value * (9-((9)*(dis/100))));
			total_charges2 = (form.cnt_enh.value * (20-((20)*(dis/100))));
		} 
		if(form.renewal_type.value == 'annual') {
			total_charges1 = (form.cnt_bas.value * (89-((89)*(dis/100))));
			total_charges2 = (form.cnt_enh.value * (199-((199)*(dis/100))));
		} 
		total_charges3 = tc * (49-(49*(dis/100)));
		if(form.no_of_tours.value != '') {
			total_charges4 = form.no_of_tours.value * 25;
		} else {
			total_charges4 = 0;
		}
		total_charges = total_charges1+total_charges2+total_charges3+total_charges4;		
		form.total_charges.value = total_charges;
	} else {
		if(form.renewal_type.value == 'monthly') {
			total_charges1 = (form.cnt_bas.value * (9-((9)*(dis/100))));
			total_charges2 = (form.cnt_enh.value * (20-((20)*(dis/100))));
		} 
		if(form.renewal_type.value == 'annual') {
			total_charges1 = (form.cnt_bas.value * (89-((89)*(dis/100))));
			total_charges2 = (form.cnt_enh.value * (199-((199)*(dis/100))));
		} 		

		if(form.no_of_tours.value != '') {
			total_charges4 = form.no_of_tours.value * 25;
		} else {
			total_charges4 = 0;
		}

		total_charges = (total_charges1+total_charges2+total_charges4);		
		form.total_charges.value = total_charges;
	}	
}
function IsNumOnly(param1)
{
	var str;
	str = param1;
    var str1;
    var str2;
    var fValid;
    
    fValid = true;    
    str1 = "0";
    str2 = "9";
    str3 = ".";
    //str5 = " ";
    
    str  = str.toUpperCase();
	nLen = str.length;
	
	for(i=0; i<nLen; ++i)
	{
		if((str.charCodeAt(i)< str1.charCodeAt(0)|| str.charCodeAt(i) > str2.charCodeAt(0))&& str.charCodeAt(i) != str3.charCodeAt(0))
	  	{
	  	  fValid = false;
	  	  break;
	  	}
	}
	return fValid;
}

function IsDate(param1) {
	var str;
	str = param1;

	a = param1.split("/");
	nLen = a.length; 
	if(nLen < 3 || nLen > 3) {
		return false;
	}
	return true;
}

function IsDate1(param1) {
	var str;
	str = param1;

	a = param1.split("/");

	nLen = a.length;
	if(nLen < 2 || nLen > 2) {
		return false;
	}
	return true;
}

function validate_billing_edit() {
	var obj = document.billing_edit;
	if(obj.amount.value == '') {
		alert('Amount field cannot be empty.');
		obj.amount.focus();
		return false;
	} else if(!IsNumOnly(obj.amount.value)) {
		alert('Amount can only be a number.');
		obj.amount.focus();
		return false;
	}
	if(obj.discount.value == '') {
		alert('Discount field cannot be empty.');
		obj.discount.focus();
		return false;
	} else if(!IsNumOnly(obj.discount.value)) {
		alert('Discount can only be a number.');
		obj.discount.focus();
		return false;
	}
	
	if(obj.period_from.value == '') {
		alert('Period From field cannot be empty.');
		obj.period_from.focus();
		return false;
	} else if(!IsDate(obj.period_from.value)) {
		alert('Period From is invalid date.');
		obj.period_from.focus();
		return false;
	}
	
	if(obj.period_to.value == '') {
		alert('Period To field cannot be empty.');
		obj.period_to.focus();
		return false;
	} else if(!IsDate(obj.period_to.value)) {
		alert('Period To is invalid date.');
		obj.period_to.focus();
		return false;
	}

	if(obj.new_amount.value != '') {
		if(obj.name_on_card.value == '') {
			alert('Please enter name on card.');
			obj.name_on_card.focus();
			return false;
		}
		if(obj.card_number.value == '') {
			alert('Please enter card number.');
			obj.card_number.focus();
			return false;
		} else if(obj.card_number.value.length < 14) {
			alert('Invalid card number.');
			obj.card_number.focus();
			return false;
		}
		if(obj.expiry_date.value == '') {
			alert('Please enter expiry_date.');
			obj.expiry_date.focus();
			return false;
		} else if(!IsDate1(obj.expiry_date.value)) {
			alert('Invalid expiry date.');
			obj.expiry_date.focus();
			return false;
		}
		if(obj.cvv.value == '') {
			alert('Please enter card cvv number.');
			obj.cvv.focus();
			return false;
		} else if(obj.cvv.value.length < 3) {
			alert('Invalid cvv number.');
			obj.cvv.focus();
			return false;
		}
		if(obj.zip.value == '') {
			alert('Please enter card zipcode.');
			obj.zip.focus();
			return false;
		} else if(obj.zip.value.length < 5) {
			alert('Invalid zip code.');
			obj.zip.focus();
			return false;
		}

		if(obj.address.value == '') {
			alert('Please enter address.');
			obj.address.focus();
			return false;
		} else if(obj.address.value.length < 10) {
			alert('Invalid address.');
			obj.address.focus();
			return false;
		}
	}
	//alert(obj.amount.value);
	return true;
}

function sa_validate_billing_edit() {
	var obj = document.billing_edit;
	if(obj.amount.value == '') {
		alert('Amount field cannot be empty.');
		obj.amount.focus();
		return false;
	} else if(!IsNumOnly(obj.amount.value)) {
		alert('Amount can only be a number.');
		obj.amount.focus();
		return false;
	}
	if(obj.discount.value == '') {
		alert('Discount field cannot be empty.');
		obj.discount.focus();
		return false;
	} else if(!IsNumOnly(obj.discount.value)) {
		alert('Discount can only be a number.');
		obj.discount.focus();
		return false;
	}
	
	if(obj.period_from.value == '') {
		alert('Period From field cannot be empty.');
		obj.period_from.focus();
		return false;
	} else if(!IsDate(obj.period_from.value)) {
		alert('Period From is invalid date.');
		obj.period_from.focus();
		return false;
	}
	
	if(obj.period_to.value == '') {
		alert('Period To field cannot be empty.');
		obj.period_to.focus();
		return false;
	} else if(!IsDate(obj.period_to.value)) {
		alert('Period To is invalid date.');
		obj.period_to.focus();
		return false;
	}

	if(obj.new_amount.value != '') {
		if(obj.payment_type.value == 'cc') {
			if(obj.name_on_card.value == '') {
				alert('Please enter name on card.');
				obj.name_on_card.focus();
				return false;
			}
			if(obj.card_number.value == '') {
				alert('Please enter card number.');
				obj.card_number.focus();
				return false;
			} else if(obj.card_number.value.length < 14) {
				alert('Invalid card number.');
				obj.card_number.focus();
				return false;
			}
			if(obj.expiry_date.value == '') {
				alert('Please enter expiry_date.');
				obj.expiry_date.focus();
				return false;
			} else if(!IsDate1(obj.expiry_date.value)) {
				alert('Invalid expiry date.');
				obj.expiry_date.focus();
				return false;
			}
			if(obj.cvv.value == '') {
				alert('Please enter card cvv number.');
				obj.cvv.focus();
				return false;
			} else if(obj.cvv.value.length < 3) {
				alert('Invalid cvv number.');
				obj.cvv.focus();
				return false;
			}
			if(obj.zip.value == '') {
				alert('Please enter card zipcode.');
				obj.zip.focus();
				return false;
			} else if(obj.zip.value.length < 5) {
				alert('Invalid zip code.');
				obj.zip.focus();
				return false;
			}

			if(obj.address.value == '') {
				alert('Please enter address.');
				obj.address.focus();
				return false;
			} else if(obj.address.value.length < 10) {
				alert('Invalid address.');
				obj.address.focus();
				return false;
			}
		}
	}
	//alert(obj.amount.value);
	return true;
}

function validate_free_listing() {
	var obj = document.free_listing;
	if (obj.listing.value == '') {
		alert('Please select a listing.');
		obj.listing.focus();
		return false;
	}
	return true;
}

function validate_broker_inquiry() {
	var obj = document.express;
	if(obj.ContactPhone.value == '') {
		alert('Please enter your Contact Phone.');
		obj.ContactPhone.focus();
		return false;
	}
	if(obj.Email_1.value == '') {
		alert('Please enter your email.');
		obj.Email_1.focus();
		return false;
	} else {
		if (obj.Email_1.value.indexOf("@") == -1 || obj.Email_1.value.indexOf(".") == -1 || obj.Email_1.value.indexOf(" ") != -1)
		 {
			alert("Sorry, \""+obj.Email_1.value+"\" is an invalid e-mail address.");
			obj.Email_1.focus();
			return false;
		 }
	}
	return true;
}

function validate_express_submit() {
	var obj = document.express;
	if(obj.ContactPhone.value == '') {
		alert('Please enter your Contact Phone.');
		obj.ContactPhone.focus();
		return false;
	}
	if(obj.Email_1.value == '') {
		alert('Please enter your email.');
		obj.Email_1.focus();
		return false;
	} else {
		if (obj.Email_1.value.indexOf("@") == -1 || obj.Email_1.value.indexOf(".") == -1 || obj.Email_1.value.indexOf(" ") != -1)
		 {
			alert("Sorry, \""+obj.Email_1.value+"\" is an invalid e-mail address.");
			obj.Email_1.focus();
			return false;
		 }
	}
	if(obj.location.value == '') {
		alert('Please enter area of the city you are looking for.');
		obj.location.focus();
		return false;
	}
	if(obj.schedule.value == '') {
		alert('Please enter when space is needed.');
		obj.schedule.focus();
		return false;
	}
	if(obj.TotalOfficeNumber.value == '') {
		alert('Please enter number of offices.');
		obj.TotalOfficeNumber.focus();
		return false;
	}
	if(obj.term.value == '') {
		alert('Please select length of term.');
		obj.term.focus();
		return false;
	}
	if(obj.preference.value == '') {
		alert('Please select preference of office.');
		obj.preference.focus();
		return false;
	}
	if(obj.furnished.value == '') {
		alert('Please select if office needs to be furnished.');
		obj.furnished.focus();
		return false;
	}
	if(obj.PriceMax.value == '') {
		alert('Please enter your maximum budget for space only');
		obj.PriceMax.focus();
		return false;
	}
	return true;
}

