﻿// JScript File

// Validate entires.


			
function CheckAll()
{
        var theform;
        var postback = true;
        		
        if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) 
	        theform = document.forms["aspnetForm"];
        else
	        theform = document.aspnetForm;
	
       if(alltrim(theform.ctl00_cphMainBody_txtFirstName.value)=="")
       {
        alert("Please Enter First Name");
        theform.ctl00_cphMainBody_txtFirstName.focus();
        postback=false
        return false;
       }	  
       
       if(alltrim(theform.ctl00_cphMainBody_txtLastName.value)=="")
       {
        alert("Please Enter Last Name");
        theform.ctl00_cphMainBody_txtLastName.focus();
        postback=false
        return false;
       }	  
       
       if(alltrim(theform.ctl00_cphMainBody_txtCompanyName.value)=="")
       {
        alert("Please Enter Company Name");
        theform.ctl00_cphMainBody_txtCompanyName.focus();
        postback=false
        return false;
       }
       
       if(alltrim(theform.ctl00_cphMainBody_txtPhoneExt.value)=="")
       {
        alert("Please Enter Phone Ext");
        theform.ctl00_cphMainBody_txtPhoneExt.focus();
        postback=false
        return false;
       }	
       
        if(alltrim(theform.ctl00_cphMainBody_txtPhone.value)=="")
       {
        alert("Please Enter Phone");
        theform.ctl00_cphMainBody_txtPhone.focus();
        postback=false
        return false;
       } 	  
       
         if(alltrim(theform.ctl00_cphMainBody_txtEmailAddress.value)=="")
       {
        alert("Please EMail.");
        theform.ctl00_cphMainBody_txtEmailAddress.focus();
        postback=false
        return false;
       } 	  
       
        if(checkEmail(theform.ctl00_cphMainBody_txtEmailAddress.value)=="")
       {
        alert("Please enter a valid EMail.");
        theform.ctl00_cphMainBody_txtEmailAddress.focus();
        postback=false
        return false;
       } 	  
}
	
//       if (theform.ctl00$cphMainBody$txtFirstName.value=="")
//       {
//         alert("Please Enter First Name");
//         theform.ctl00$cphMainBody$txtFirstName.focus();
//         return false;
//       }  
//       
//       
//     if (theform.ctl00_cphMainBody_txtLastName.value == "")
//    {
//        alert("Please Enter Last Name");
//        theform.ctl00_cphMainBody_txtLastName.focus();
//        return false;
//    }   
//    
//     if (theform.ctl00_cphMainBody_txtCompanyName.value == "")
//    {
//        alert("Please Enter Company Name");
//        theform.ctl00_cphMainBody_txtCompanyName.focus();
//        return false;
//    }
//    
//     if (theform.ctl00_cphMainBody_txtPhoneExt.value== "")
//    {
//        alert("Please Enter Phone Number");
//        theform.ctl00_cphMainBody_txtPhoneExt.focus();
//        return false;
//    }
//    
//      if (theform.ctl00_cphMainBody_txtPhone.value== "")
//    {
//        alert("Please Enter Phone Name");
//        theform.ctl00_cphMainBody_txtPhone.focus();
//        return false;
//    }
//    
//       if (theform.ctl00_cphMainBody_txtEmailAddress.value== "")
//    {
//        alert("Please Enter Email Address");
//        theform.ctl00_cphMainBody_txtEmailAddress.focus();
//        return false;
//    }
//    
//     if (checkEmail(theform.ctl00_cphMainBody_txtEmailAddress.value == false )
//    {
//        alert("Please enter a valid EMail.");
//        theform.ctl00_cphMainBody_txtEmailAddress.focus();
//        return false;
//    }     
 
   
 // This function checks for a valid email id.
function checkEmail(str)
{
    var filter=/^.+@.+\..{2,3}$/
    if (filter.test(str))
    {
        return true;
    }
    else
    {
        return false;
    }
}        


