function submitContactMenForm() {
	if(isWhitespace(document.mailform.fname.value))
	{
		alertMessage.show({msg:"Please Enter Your First Name."},document.mailform.fname);
		document.mailform.fname.focus();
		return false;
	}	
	else if(!isAlphabetic(document.mailform.fname.value))
	{
		alertMessage.show({msg:"Please Enter Your First Name using only English Letters."},document.mailform.fname);
		document.mailform.fname.focus();
		return false;
	}
	if(isWhitespace(document.mailform.lname.value))
	{
		alertMessage.show({msg:"Please Enter Your Last Name."},document.mailform.lname);
		document.mailform.lname.focus();
		return false;
	}
	else if(!isAlphabetic(document.mailform.lname.value))
	{
		alertMessage.show({msg:"Please Enter Your Last Name using only English Letters."},document.mailform.lname);
		document.mailform.lname.focus();
		return false;
	}
	if(isWhitespace(document.mailform.from.value))
	{
		alertMessage.show({msg:"Please Enter Your Email."},document.mailform.from);
		document.mailform.from.focus();
		return false;
	}	
	if(!isEmail(document.mailform.from.value))
	{
		alertMessage.show({msg:"Your Email is Not Correct (eg., \'Tom@Yahoo.com\')."},document.mailform.from);
		document.mailform.from.focus();
		return false;
	}
	if(isWhitespace(document.mailform.tel.value))
	{
		alertMessage.show({msg:"Please Enter Your Phone Number."},document.mailform.tel);
		document.mailform.tel.focus();
		return false;
	}	
	if(isWhitespace(document.mailform.subject.value))
	{
		alertMessage.show({msg:"Please Enter Your Subject."},document.mailform.subject);
		document.mailform.subject.focus();
		return false;
	}	
	if(isWhitespace(document.mailform.message.value))
	{
		alertMessage.show({msg:"Please Enter Your Comment."},document.mailform.message);
		document.mailform.message.focus();
		return false;
	}

	var pars = "mode=contactMe&userID="+document.mailform.userID.value+"&fname="+document.mailform.fname.value+"&lname="+document.mailform.lname.value+"&from="+document.mailform.from.value+"&tel="+document.mailform.tel.value+"&subject="+document.mailform.subject.value+"&message="+document.mailform.message.value;
	var url = '/php/controlpanel/mywebsites/submitform.ajax';
	
	var onComplete = function(originalRequest) {
		if(originalRequest=='0')
			$('msg').innerHTML = "Not send out, try again.";	
		else if(originalRequest=='1') {
			$('msg').innerHTML = "Your email has been sent."
			document.mailform.reset();
		}
	};
	MyAjax.post(url,pars, onComplete);
	setTimeout("hiddenMsg()",5000);
}

function submitHomeFinderForm() {
	if(isWhitespace(document.mailform.fname.value))
	{
		alertMessage.show({msg:"Please Enter Your First Name."},document.mailform.fname);
		document.mailform.fname.focus();
		return false;
	}	
	else if(!isAlphabetic(document.mailform.fname.value))
	{
		alertMessage.show({msg:"Please Enter Your First Name using only English Letters."},document.mailform.fname);
		document.mailform.fname.focus();
		return false;
	}
	if(isWhitespace(document.mailform.lname.value))
	{
		alertMessage.show({msg:"Please Enter Your Last Name."},document.mailform.lname);
		document.mailform.lname.focus();
		return false;
	}
	else if(!isAlphabetic(document.mailform.lname.value))
	{
		alertMessage.show({msg:"Please Enter Your Last Name using only English Letters."},document.mailform.lname);
		document.mailform.lname.focus();
		return false;
	}
	if(isWhitespace(document.mailform.from.value))
	{
		alertMessage.show({msg:"Please Enter Your Email."},document.mailform.from);
		document.mailform.from.focus();
		return false;
	}	
	if(!isEmail(document.mailform.from.value))
	{
		alertMessage.show({msg:"Your Email is Not Correct (eg., \'Tom@Yahoo.com\')"},document.mailform.from);
		document.mailform.from.focus();
		return false;
	}
	if(isWhitespace(document.mailform.tel.value))
	{
		alertMessage.show({msg:"Please Enter Your Phone Number."},document.mailform.tel);
		document.mailform.tel.focus();
		return false;
	}	

	var pars = "mode=homeFinder&userID="+document.mailform.userID.value+"&fname="+document.mailform.fname.value+"&lname="+document.mailform.lname.value+"&from="+document.mailform.from.value+"&tel="+document.mailform.tel.value+"&message="+document.mailform.message.value+"&homestyle="+document.mailform.homestyle1.value+"&communities="+document.mailform.communities.value+"&postalcode="+document.mailform.postalcode.value+"&pricefrom="+document.mailform.pricefrom1.value+"&priceto="+document.mailform.priceto1.value+"&bed="+document.mailform.bed.value+"&bath="+document.mailform.bath.value+"&size="+document.mailform.size.value+"&when="+document.mailform.when1.value;
	var url = '/php/controlpanel/mywebsites/submitform.ajax';
	
	var onComplete = function(originalRequest) {
		if(originalRequest=='0')
			$('msg').innerHTML = "Not send out, try again.";	
		else if(originalRequest=='1') {
			$('msg').innerHTML = "Your email has been sent."
			document.mailform.reset();
		}
	};
	MyAjax.post(url,pars, onComplete);
	setTimeout("hiddenMsg()",5000);
}

function checkHomeEvalForm() {
	if(isWhitespace(document.mailform.fname.value))
	{
		alertMessage.show({msg:"Please Enter Your First Name."},document.mailform.fname);
		document.mailform.fname.focus();
		return false;
	}	
	else if(!isAlphabetic(document.mailform.fname.value))
	{
		alertMessage.show({msg:"Please Enter Your First Name using only English Letters."},document.mailform.fname);
		document.mailform.fname.focus();
		return false;
	}
	if(isWhitespace(document.mailform.lname.value))
	{
		alertMessage.show({msg:"Please Enter Your Last Name."},document.mailform.lname);
		document.mailform.lname.focus();
		return false;
	}
	else if(!isAlphabetic(document.mailform.lname.value))
	{
		alertMessage.show({msg:"Please Enter Your Last Name using only English Letters."},document.mailform.lname);
		document.mailform.lname.focus();
		return false;
	}
	if(isWhitespace(document.mailform.from.value))
	{
		alertMessage.show({msg:"Please Enter Your Email."},document.mailform.from);
		document.mailform.from.focus();
		return false;
	}	
	if(!isEmail(document.mailform.from.value))
	{
		alertMessage.show({msg:"Your Email is Not Correct (eg., \'Tom@Yahoo.com\')."},document.mailform.from);
		document.mailform.from.focus();
		return false;
	}
	if(isWhitespace(document.mailform.tel.value))
	{
		alertMessage.show({msg:"Please Enter Your Phone Number."},document.mailform.tel);
		document.mailform.tel.focus();
		return false;
	}	
	if(isWhitespace(document.mailform.message.value))
	{
		alertMessage.show({msg:"Please Enter Your Comment."},document.mailform.message);
		document.mailform.message.focus();
		return false;
	}

	if(isWhitespace(document.mailform.address.value))
	{
		alertMessage.show({msg:"Please Enter Your Address."},document.mailform.address);
		document.mailform.address.focus();
		return false;
	}
	else
	{
		// Check # in Address box
		s = new String(document.mailform.address.value);
		re = /#/gi;
		str = s.replace(re,'No.');

		document.mailform.address.value = str;
	}

	if(isWhitespace(document.mailform.city.value))
	{
		alertMessage.show({msg:"Please Enter Your City."},document.mailform.city);
		document.mailform.city.focus();
		return false;
	}
//	else if(!isAlphabetic(document.mailform.city.value))
//	{
//		alertMessage.show({msg:"Please Enter Your City using only English Letters."},document.mailform.city);
//		document.mailform.city.focus();
//		return false;
//	}        

	if(isWhitespace(document.mailform.province.value))
	{
		alertMessage.show({msg:"Please Enter Your State/Province."},document.mailform.province);
		document.mailform.province.focus();
		return false;
	}
//	else if(!isAlphabetic(document.mailform.province.value))
//	{
//		alertMessage.show({msg:"Please Enter Your State/Province using only English Letters."},document.mailform.province);
//		document.mailform.province.focus();
//		return false;
//	}  
	
	var pars = "mode=homeEval&userID="+document.mailform.userID.value+"&fname="+document.mailform.fname.value+"&lname="+document.mailform.lname.value+"&from="+document.mailform.from.value+"&tel="+document.mailform.tel.value+"&message="+document.mailform.message.value+"&address="+document.mailform.address.value+"&city="+document.mailform.city.value+"&province="+document.mailform.province.value+"&postalcode="+document.mailform.postalcode.value+"&bed="+document.mailform.bed.value+"&bath="+document.mailform.bath.value+"&size="+document.mailform.size.value+"&features="+document.mailform.features.value;
	var url = '/php/controlpanel/mywebsites/submitform.ajax';
	var onComplete = function(originalRequest) {
		if(originalRequest=='0')
			$('msg').innerHTML = "Not send out, try again.";	
		else if(originalRequest=='1') {
			$('msg').innerHTML = "Your email has been sent."
			document.mailform.reset();
		}
	};
	MyAjax.post(url,pars, onComplete);
	setTimeout("hiddenMsg()",5000);
	
	
}

function checkform() {
	if(isWhitespace(document.mailform.mrg_amount.value))
	{
		alertMessage.show({msg:"Please Enter the Your Mortgage Amount."},document.mailform.mrg_amount);
		document.mailform.mrg_amount.focus();
		return false;
	}
	else if(!isFloat(document.mailform.mrg_amount.value))
	{
		alertMessage.show({msg:"Please Enter only Float Number for Your Mortgage Amount."},document.mailform.mrg_amount);
		document.mailform.mrg_amount.focus();
		return false;
	}

	if(isWhitespace(document.mailform.anu_interest_rate.value))
	{
		alertMessage.show({msg:"Please Enter the Your Annual Interest Rate."},document.mailform.anu_interest_rate);
		document.mailform.anu_interest_rate.focus();
		return false;
	}
	else if(!isFloat(document.mailform.anu_interest_rate.value))
	{
		alertMessage.show({msg:"Please Enter only Float Number for Your Annual Interest Rate."},document.mailform.anu_interest_rate);
		document.mailform.anu_interest_rate.focus();
		return false;
	}

	if(isWhitespace(document.mailform.term.value))
	{
		alertMessage.show({msg:"Please Enter the Your Mortgage Term."},document.mailform.term);
		document.mailform.term.focus();
		return false;
	}
	else if(!isFloat(document.mailform.term.value))
	{
		alertMessage.show({msg:"Please Enter only Float Number for Your Mortgage Term."},document.mailform.term);
		document.mailform.term.focus();
		return false;
	}

	getsetMrgResult(document.mailform.anu_interest_rate.value,document.mailform.mrg_amount.value,document.mailform.term.value);
}
					
					
function getsetMrgResult(i,p,n) {
	p = replaceAll(p, ",", "");
	pmtCA1 = monthlyPmtCA(i,p,n);
	totalcost1 = new String(pmtCA1 * 12 * n);
	totalinterest1 = new String(totalcost1 - p);

	pmtCA = formatNumber(pmtCA1,2);
	totalcost = formatNumber(totalcost1,3);
	totalinterest = formatNumber(totalinterest1,3);

	document.mailform.mon_payment.value = pmtCA;
	document.mailform.tot_cost.value = totalcost;	
	document.mailform.tot_interest.value = totalinterest;
}

function hiddenMsg() {
	$('msg').innerHTML = "";
}

