// JavaScript Document
function checkform (tellform)
{    var why = "";
 //check required fields
 			why += checkrequired();
			why += checkcnumber(tellform.cnumber.value);
			why += checkbname(tellform.bname.value);
			why += checksaddress(tellform.saddress.value);
			why += checksphone(tellform.sphone.value);
			why += checknsuites(tellform.nsuites.value);
			why += checkdate(tellform.date.value);
			why += checkpmanager(tellform.pmanager.value);
			why += checkpcompany(tellform.pcompany.value);
			why += checkcphone(tellform.cphone.value);
	
    if (why != "") {
			 why = "Sorry. The following errors occured:\n\n" + why;
       alert(why);
       return false;
    }
return true;
}
	function checkrequired()
	{
		var error = "";
		  if ((!(tellform.required1.checked)) && (!(tellform.required2.checked))) {
			 error = "Please select what you are 'Required for'\n"
		  }
		return error;	  

	}

	function checkbname(strng)
	{
		var error = "";
		  if (strng.length == 0) {
			 error = "Please fill in your 'Building Name'\n"
		  }
		return error;	  

	}

	function checkcnumber(strng)
	{
		var error = "";
		  if (strng.length == 0) {
			 error = "Please fill in your 'Corporation Number'\n"
		  }
		return error;	  

	}

	function checksaddress(strng)
	{
		var error = "";
		  if (strng.length == 0) {
			 error = "Please fill in your 'Site Address'\n"
		  }
		return error;	  

	}

	function checksphone(strng)
	{
		var error = "";
		  if (strng.length == 0) {
			 error = "Please fill in your 'Site Phone'\n"
		  }
		return error;	  

	}

	function checkdate(strng)
	{
		var error = "";
		  if (strng.length == 0) {
			 error = "Please fill in your 'Date Quote Required By'\n"
		  }
		return error;	  

	}

	function checknsuites(strng)
	{
		var error = "";
		  if (strng.length == 0) {
			 error = "Please fill in your 'Number Suites'\n"
		  }
		return error;	  

	}

	function checkpmanager(strng)
	{
		var error = "";
		  if (strng.length == 0) {
			 error = "Please fill in your 'Property Manager'\n"
		  }
		return error;	  

	}

	function checkpcompany(strng)
	{
		var error = "";
		  if (strng.length == 0) {
			 error = "Please fill in your 'Property Management Company'\n"
		  }
		return error;	  

	}
	function checkcphone(strng)
	{
		var error = "";
		  if (strng.length == 0) {
			 error = "Please fill in your 'Contact Phone'\n"
		  }
		return error;	  

	}

    function checksemail(strng)
	{
	var error="";
		var emailFilter=/^.+@.+\..{2,3}$/;
		if (!(emailFilter.test(strng))) { 
		   error = "Please fill in a valid 'Site Email' address.\n";
		}
		else {
	//test email for illegal characters
		   var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) {
			  error = "There are illegal characters in you 'Site Email' address. Please check again.\n";
		   }
		}
	return error;    
	}
	
    function checkcemail(strng)
	{
	var error="";
		var emailFilter=/^.+@.+\..{2,3}$/;
		if (!(emailFilter.test(strng))) { 
		   error = "Please fill in a valid 'Site Email' address.\n";
		}
		else {
	//test email for illegal characters
		   var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) {
			  error = "There are illegal characters in you 'Site Email' address. Please check again.\n";
		   }
		}
	return error;    
	}
	

//-->

