/*################## Contact us page Form Validation Starts Here ##################*/
function validate_contactus(thisform)
{
	if(thisform.txtName.value == '')	
		{
			alert("Please enter your name!");
			thisform.txtName.focus();
			return false;
		}
	if(thisform.txtEmail.value == '')	
		{
			alert("Please enter your email address!");
			thisform.txtEmail.focus();
			return false;
		}
	if(validate_email(thisform.txtEmail,"Invalid email address! Please re-enter!")==false)
		{
			thisform.txtEmail.select();
			thisform.txtEmail.focus();
			return false;
		}
	if(thisform.txtPhone.value == '')	
		{
			alert("Please enter your phone!");
			thisform.txtPhone.focus();
			return false;
		}
	if(IsNumeric(thisform.txtPhone.value)==false)
		{
			alert("Invalid phone number! Please re-enter!");
			thisform.txtPhone.select();
			thisform.txtPhone.focus();
			return false;
		}

	if(thisform.txtComments.value == '')	
		{
			alert("Please enter your comments!");
			thisform.txtComments.focus();
			return false;
		}				
	thisform.submit();
	return true;
}
/*################## Contact us page Form Validation Ends Here ##################*/
/*################## Request a Quote Form Validation Starts Here ##################*/

function request_quote_validate(thisform)
{
	if(thisform.name.value == '')	
		{
			alert("Please enter your name!");
			thisform.name.focus();
			return false;
		}
	if(thisform.email.value == '')	
		{
			alert("Please enter your email address!");
			thisform.email.focus();
			return false;
		}
	if(validate_email(thisform.email,"Invalid email address! Please re-enter!")==false)
		{
			thisform.email.select();
			thisform.email.focus();
			return false;
		}
	if(thisform.phone.value == '')	
		{
			alert("Please enter your phone!");
			thisform.phone.focus();
			return false;
		}
	if(IsNumeric(thisform.phone.value)==false)
		{
			alert("Invalid phone number! Please re-enter!");
			thisform.phone.select();
			thisform.phone.focus();
			return false;
		}

	if(thisform.comments.value == '')	
		{
			alert("Please enter your comments!");
			thisform.comments.focus();
			return false;
		}				
	thisform.submit();
	return true;
}
/*################## Request a Quote Form Validation Ends Here ##################*/
/*################## Email Checking Functions Starts Here ##################*/
function validate_email(entered,alertbox) {

   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = entered.value;
   if(reg.test(address) == false) {
     if (alertbox!="") alert(alertbox,entered);
      return false;
   }
}
/*################## Email Checking Functions Ends Here ##################*/
/*################## Numeric Checking Functions Starts Here ##################*/
function IsNumeric(strString)
{
   var strValidChars = "0123456789-+(). ";
   var strChar;
   var blnResult = true;
   if (strString.length == 0) return false;

   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         	{
        	 blnResult = false;
         	}
      }
   return blnResult;
}
/*################## Numeric Checking Functions Ends Here ##################*/