// JavaScript Document
function ValidateEmail(str)
{
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if (str.indexOf(at)==-1){
	   alert("Invalid E-mail ID");
	   return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail ID");
	   return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert("Invalid E-mail ID");
	    return false;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    alert("Invalid E-mail ID");
	    return false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert("Invalid E-mail ID");
	    return false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    alert("Invalid E-mail ID");
	    return false;
	 }

	 if (str.indexOf(" ")!=-1){
	    alert("Invalid E-mail ID");
	    return false;
	 }

	 return true;
}
function trimSpace(x)
{
	var emptySpace = / /g;
	var trimAfter = x.replace(emptySpace,"");
	return(trimAfter);
}


function validquote()
{
	
 if(document.frmquote.name.value=="")	
 {
	 alert("Please enter name.");
	 document.frmquote.name.focus();
	 return false;
 }
 if(document.frmquote.email.value=="")	
 {
	 alert("Please enter email.");
	 document.frmquote.email.focus();
	 return false;
 }
 
 if(ValidateEmail(document.frmquote.email.value)==false)
 {
   document.frmquote.email.value="";
   document.frmquote.email.focus();
   return false;
 }
 
 if(document.frmquote.Address.value=="")	
 {
	 alert("Please enter address.");
	 document.frmquote.Address.focus();
	 return false;
 }
 if(document.frmquote.City.value=="")	
 {
	 alert("Please enter city.");
	 document.frmquote.City.focus();
	 return false;
 }
 if(document.frmquote.State.value=="")	
 {
	 alert("Please enter state.");
	 document.frmquote.State.focus();
	 return false;
 }
 if(document.frmquote.Zip.value=="")	
 {
	 alert("Please enter zip.");
	 document.frmquote.Zip.focus();
	 return false;
 }
  if(document.frmquote.Phone.value=="")	
 {
	 alert("Please enter business phone.");
	 document.frmquote.Phone.focus();
	 return false;
 }
   if(document.frmquote.equipment.value=="")	
 {
	 alert("Please mention equipments needed.");
	 document.frmquote.equipment.focus();
	 return false;
 }
 
 return true;
}

