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 valForm1()
{
        if(!valid_required(document.myform.first_name.value) || document.myform.last_name.value=="last_name")
        {
			alert("First Name is a required field!")
			document.myform.first_name.focus();
			return false;
        }

        if(!valid_required(document.myform.last_name.value) || document.myform.last_name.value=="last_name")
        {
			alert("Last Name is a required field!")
			document.myform.last_name.focus();
			return false;
        }
		
		if(!echeck(document.myform.email.value))
		{
			document.myform.email.focus();
			return false;
			
		}
		
		/* Validation for "Phone Number" field
		if(!valid_required(document.myform.Phone.value) || document.myform.Phone.value=="Phone")
        {
			alert("Phone is a required field!")
			document.myform.Phone.focus();
			return false;
        }
		*/
		
		/* validation for "Website" field
		 if(!valid_required(document.myform.website.value) || document.myform.name.value=="Website")
        {
			alert("Website is a required field!")
			document.myform.website.focus();
			return false;
        }
		*/

    return true;
}



/*
function valForm2()
{
        if(!valid_required(document.myform_contactus.name2.value) || document.myform_contactus.name2.value=="Name")
        {
			alert("Name is a required field!")
			document.myform_contactus.name2.focus();
			return false;
        }
		if(!echeck(document.myform_contactus.email2.value))
		{
			document.myform_contactus.email2.focus();
			return false;
			
		}
		
		 Validation for "Phone Number" field
		if(!valid_required(document.myform_contactus.Phone2.value) || document.myform_contactus.Phone2.value=="Phone")
        {
			alert("Phone is a required field!")
			document.myform_contactus.Phone2.focus();
			return false;
        }
		*/		
		
		/* validation for "Website" field
		 if(!valid_required(document.myform_contactus2.website2.value) || document.myform_contactus.website2.value=="Website")
        {
			alert("Website is a required field!")
			document.myform_contactus.website2.focus();
			return false;
        }
		

    return true;
}*/
