﻿// Common Javascript functions 
/*
 Code Written By :  Jothish
 Date :  04/14/2008
 Copyright : Recellular Inc

*/
function ValidateForm()
{
	var frm=document.entryform;	
 
     if (frm.VendorID.value==0)
	        {		 
		        alert('Please Enter vendorID')
		        frm.VendorID.focus()
		        return false
	        }    
	        
	 
     if (frm.selsource.value==0)
	        {		 
		        alert('Please Select a source')
		        frm.selsource.focus()		       
		        return false
	        }
	      frm.hidsource.value=frm.selsource.value	 
     if ((frm.boxcount.value==null)||(trim(frm.boxcount.value)==""))
	      {
	        alert("Please Enter the number of labels needed")
		    frm.boxcount.focus()
		    return false    	  
	      } 
	   
	 if (echeck(frm.emailentry.value)==false)
	    {		 
		    frm.emailentry.focus()
		    return false
	    }
	 if ((frm.Firstnameentry.value==null)||(trim(frm.Firstnameentry.value)==""))
	    {
		    alert("Please Enter your Firstname")
		    frm.Firstnameentry.focus()
		    return false
	    }
	    if ((frm.Lastnameentry.value==null)||(trim(frm.Lastnameentry.value)==""))
	    {
		    alert("Please Enter your Lastname")
		    frm.Lastnameentry.focus()
		    return false
	    }
	
	 if ((frm.companyentry.value==null)||(trim(frm.companyentry.value)==""))
	    {
		    alert("Please Enter your Company Name")
		    frm.companyentry.focus()
		    return false
	    }	
	
	     frm.subject.value=frm.companyentry.value + " Mailing Label Request"
	 if ((frm.street1entry.value==null)||(trim(frm.street1entry.value)==""))
	    {
		    alert("Please Enter your Address")
		    frm.street1entry.focus()
		    return false
	    }
	
	 if ((frm.cityentry.value==null)||(trim(frm.cityentry.value)==""))
	    {
		    alert("Please Enter your City")
		    frm.cityentry.focus()
		    return false
	    }
	 if ((frm.zipentry.value==null)||(trim(frm.zipentry.value)==""))
	    {
		    alert("Please Enter your Zip code")
		    frm.zipentry.focus()
		    return false
	    }
	
	if (IsNumeric(frm.zipentry.value)==false)
	    {
		    alert('Invalid Zip code');
		    frm.zipentry.value=""
		    frm.zipentry.focus()
		    return false
	    }	 
	
	if (frm.stateentry.value==0)
	    {		 
		    alert('Please Select a state')
		    frm.stateentry.focus()
		    return false
    	}
  // if(trim(frm.phoneentry.value)!="") 
    // {
       if(frm.phoneentry.value.length <10)
        {
            alert('Phone number must be minimum 10 numbers')
            frm.phoneentry.focus()
            return false 
        }
     //}
   document.entryform.submit();  
   document.getElementById("impbtnsnd").src = "../common/images/Progressbar.gif"

 }
