function valid_required(field)
{
         if(field=="")          {
         return false;
         }
    return true;
}

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 valForm()
{

}
	
function valForm_old()
{
        if(!valid_required(document.mycontactform.fname.value) || document.mycontactform.fname.value=="*Frist Name")
        {
			alert("Please enter First name.")
			document.mycontactform.fname.focus();
			return false;
        }
		 if(!valid_required(document.mycontactform.lname.value) || document.mycontactform.lname.value=="*Last Name")
        {
			alert("Please enter Last Name.")
			document.mycontactform.lname.focus();
			return false;
		 }
		if(!echeck(document.mycontactform.email.value)){
			document.mycontactform.email.focus();
			return false;
			
		}
		if(!valid_required(document.mycontactform.phone2.value) || document.mycontactform.phone2.value=="*Daytime Phone")
        {
			alert("Please enter Daytime Phone.")
			document.mycontactform.phone2.focus();
			return false;
        }
		if(!valid_required(document.mycontactform.phone1.value) || document.mycontactform.phone1.value=="*Evening Phone")
        {
			alert("Please enter Evening Phone.")
			document.mycontactform.phone1.focus();
			return false;
        }
		 if(!valid_required(document.mycontactform.address1.value) || document.mycontactform.address1.value=="*Address Street 1")
        {
			alert("Please enter Address Street 1.")
			document.mycontactform.address1.focus();
			return false;
        }
		if(!valid_required(document.mycontactform.address2.value) || document.mycontactform.address2.value=="*Address Street 2")
        {
			alert("Please enter Address Street 2")
			document.mycontactform.address2.focus();
			return false;
        }
		if(!valid_required(document.mycontactform.city.value) || document.mycontactform.city.value=="*City")
        {
			alert("Please enter City.")
			document.mycontactform.city.focus();
			return false;
        }
		if(!valid_required(document.mycontactform.zip.value) || document.mycontactform.zip.value=="*Zip Code")
        {
			alert("Please enter Zip Code.")
			document.mycontactform.zip.focus();
			return false;
        }
		if(!valid_required(document.mycontactform.state.value) || document.mycontactform.state.value=="*State")
        {
			alert("Please enter State.")
			document.mycontactform.state.focus();
			return false;
        }
    return true;
}
