// JavaScript Documentfunction validate_contact()
 function validate()
 {
   var error = "";
   //file
   try
    {
        var myf=document.frmService.file1.value;
        if (myf=="")
        {
            error = "Select the file for uploading.\n";   
            document.frmService.file1.style.background='Yellow';   
        }
        else
            document.frmService.file1.style.background = 'White';
     }
    catch(e)
    {
        error = "Select the file for uploading.\n";
        document.frmService.file1.style.background='Yellow';   
    }
  
    //Company name
    var company=document.frmService.txtCompany.value;
    if (company== "") 
   {
        error+="You didn't enter a company name.\n'";
        document.frmService.txtCompany.style.background='Yellow';
    }
    else
        document.frmService.txtCompany.style.background = 'White';
        
    // Phone number
    
   var phone=document.frmService.txtPhone.value;
   var stripped = phone.replace(/[\(\)\.\-\ ]/g, '');    

   if (phone.length== 0) 
   {
        error+="You didn't enter a phone number.\n'";
        document.frmService.txtPhone.style.background='Yellow';
    } 
    else if (isNaN(parseInt(stripped))) 
    {
        error += "The phone number contains illegal characters.\n";
        document.frmService.txtPhone.style.background='Yellow';
    }
    else if (stripped.length <= 10 && stripped.length >6 ) 
    {
        error += "The phone number should contain minmum of seven and maximum of ten number.\n";
        document.frmService.txtPhone.style.background='Yellow';
    }
    else
        document.frmService.txtPhone.style.background = 'White';
   //Email        
   var emailRegxp = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/
   var address = document.frmService.textfield3.value;
   if(emailRegxp.test(address) == false) 
    {
      error+="Invalid Email Address.\n";
      document.frmService.textfield3.style.background='Yellow';
    }
    else
        document.frmService.textfield3.style.background = 'White';
        
    if (error != "") {
        alert("Some fields need correction:\n\n" + error);
        return false;
    }
    return true;
}





