<!-- 
//Window Status;
window.defaultStatus = "FMW-Surveyors-Fairhall Moffatt \& Woodland Limited-Ontario Land Surveyors"

function validateBook(){
	if ((!document.book.Name.value) || (document.book.Name.value == "") || (document.book.Name.value == " ")) {	
		alert ("Could we please know your name?");
		document.book.Name.focus();
		return false;
	}
	if ((!document.book.Phone.value) && (!document.book.EMail.value) && (!document.book.Fax.value)) {	
		alert ("How should we contact you?");
		document.book.Phone.focus();
		return false;
	}	
	else {
		document.book.submit();
		return true;
	}
}


function validateCall(){
	if ((!document.Call.Name.value) || (document.Call.Name.value == "") || (document.Call.Name.value == " ")) {	
		alert ("Could we please know your name?");
		document.Call.Name.focus();
		return false;
	}
	if ((!document.Call.Phone.value) || (document.Call.Phone.value == "") || (document.Call.Phone.value == " ") || (document.Call.Phone.value == "  ")) {
		alert ("Please supply your phone number");
		document.Call.Phone.focus();
		return false;
	}	
	else {
		document.Call.submit();
		return true;
	}
}





function chkemail(em,emaddress)
{
// check email feild is properly formatted        
var address = emaddress
if ((address.indexOf('@', 0) <=0) || (address.indexOf('.', 0) <=2))	{
	if (confirm("If you wish to be contacted,\nplease enter a proper e-mail address.\n\nfor example\n myname@myprovider.ca")) {
		em.focus();
		em.value=""; 
		}
	else {
		em.focus();
		em.value=" ";
		em.focus();
		}
	}
}

//replace = sign with equal to avoid splitting while parsing
//and truncate textarea boxes at 1024 to avoid hackers who like to cut and paste
function shorteq(tf,tval) {
	tarray=tval.split("=");
	tstring=tarray.join(" equals ");
	if (tstring.length > 1024){
		tshort=tstring.substring(0,1024);
	}
	else {
		tshort=tstring;
	}
	tf.value=tshort;
}



//check ph# and fax number
function chkphone(tf,tph) {
//set base values
baseph="";
pherr="no";
//step thru each letter create base number
	for (i=0;i<tph.length;i++)	{
		var ch = tph.charAt(i);
		if (ch != ')' && ch != '(' && ch != '-'  && ch != ' ')	{
			if (isNaN(parseInt(ch))) {pherr="Yes";}
			else {baseph += ch;}
		}
	}	
//create a properly formatted phone number or fail
var phl =  (baseph.length);
if (phl==11){goodph=baseph.substring(0,1)+"-"+baseph.substring(1,4)+"-"+baseph.substring(4,7)+"-"+baseph.substring(7,11);}
else if (phl==10){goodph="1-"+baseph.substring(0,3)+"-"+baseph.substring(3,6)+"-"+baseph.substring(6,10);}
else if (phl==8){goodph=baseph.substring(0,1)+"-"+baseph.substring(1,4)+"-"+baseph.substring(4,8);}
else if (phl==7){goodph=baseph.substring(0,3)+"-"+baseph.substring(3,7);}
else pherr="Yes";
//display error message or enter proper phone number	
if (pherr=="Yes") {	
	alert(" Please enter a proper phone number \n (i.e. 123-4567 or 1-613-123-4567)");
	tf.value="";
	tf.focus();
	}
else {tf.value=goodph;}	
}
// end hiding -->