function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function echeck(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 ValidateEmailForm(){
	var emailID=document.form1.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

	
function Form_Validator(theForm)
	{

	if (theForm.firstName.value == "")
	  {
	    alert("Please enter a value for the \"First Name\" field.");
	    theForm.firstName.focus();
	    return (false);
	  }
	if (theForm.lastName.value == "")
	  {
	    alert("Please enter a value for the \"Last Name\" field.");
	    theForm.lastName.focus();
	    return (false);
	  }
	if (theForm.email.value == "")
	  {
	    alert("Please enter a value for the \"E-mail\" field.");
	    theForm.email.focus();
	    return (false);
	  }
	if (theForm.phone.value == "")
	  {
	    alert("Please enter a value for the \"Telephone\" field.");
	    theForm.phone.focus();
	    return (false);
	  }
	if (theForm.phone.value.length < 10)
	  {
	    alert("Please enter at least 10 characters in the \"Telephone\" field.");
	    theForm.phone.focus();
	    return (false);
	  }
	var checkOK = "0123456789-.,";
	  var checkStr = theForm.phone.value;
	  var allValid = true;
	  var validGroups = true;
	  var decPoints = 0;
	  var allNum = "";
	  for (i = 0;  i < checkStr.length;  i++)
	  {
	    ch = checkStr.charAt(i);
	    for (j = 0;  j < checkOK.length;  j++)
	      if (ch == checkOK.charAt(j))
	        break;
	    if (j == checkOK.length)
	    {
	      allValid = false;
	      break;
	    }
	    if (ch == ".")
	    {
	      allNum += ".";
	      decPoints++;
	    }
	    else if (ch == "," && decPoints != 0)
	    {
	      validGroups = false;
	      break;
	    }
	    else if (ch != ",")
	      allNum += ch;
	  }
	  if (!allValid)
	  {
	    alert("Please enter only digit characters in the \"Telephone\" field.");
	    theForm.phone.focus();
	    return (false);
	  }
	  if (decPoints > 1 || !validGroups)
	  {
	    alert("Please enter a valid number in the \"Telephone\" field.");
	    theForm.phone.focus();
	    return (false);
	  }
	if (theForm.address1.value == "")
	  {
	    alert("Please enter a value for the \"Address 1\" field.");
	    theForm.address1.focus();
	    return (false);
	  }
	if (theForm.city.value == "")
	  {
	    alert("Please enter a value for the \"City, State, Zip, Country\" field.");
	    theForm.city.focus();
	    return (false);
	  }

	var emailID=document.form2.email
	
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}



return (true);
}