﻿// JScript File

function MyValidate() 
{
    	
	//start Company information
	if(isEmpty(document.frmsignup.txt_cust_name.value) )   
		{
				alert("Please Enter Company Name.");
				document.frmsignup.txt_cust_name.focus();
				return false;			
		}
		

	if(document.frmsignup.txt_address1.value=="") 
	{
		alert("Please Enter Address1.");
		document.frmsignup.txt_address1.focus();
		return false;
	}

	var zip1 = document.frmsignup.txt_zip_code1.value + document.frmsignup.txt_zip_code2.value ;
	    if(isEmpty(zip1)==false)
		{
			if( !isZIPCode(zip1) )
			{
				alert("Invalid Zip Code.");
				document.frmsignup.txt_zip_code1.focus();
				return false;
			}
		}
		else
		{
		        alert("Please Enter Zip Code.");
				document.frmsignup.txt_zip_code1.focus();
				return false;
		}
	var phone1 = document.frmsignup.txt_cust_phone1.value + document.frmsignup.txt_cust_phone2.value + document.frmsignup.txt_cust_phone3.value;
		if( !isEmpty(phone1) )
		{
			if( !isUSPhoneNumber(phone1))
			{
				alert("Invalid Phone Number.");
				document.frmsignup.txt_cust_phone1.focus();
				return false;
			}
		}
		else
		{
		    alert("Please Enter Phone Number.");
			document.frmsignup.txt_cust_phone2.focus();
			return false;
		}
	
	
	 if( !isEmpty(document.frmsignup.txt_cust_email.value) )
		{
			if( !isEmail(document.frmsignup.txt_cust_email.value) )
			{
				alert("Invalid Email.");
				document.frmsignup.txt_cust_email.focus();
				return false;
			}
		}
		else
		{
		        alert("Please Enter Email.");
				document.frmsignup.txt_cust_email.focus();
				return false;
		}   
	//end Company information
	
	//start employee contact information
	if(isEmpty(document.frmsignup.txt_first_name.value) )   
		{
				alert("Please Enter First Name.");
				document.frmsignup.txt_first_name.focus();
				return false;			
		}
		
	/*if(!isEmpty(document.frmsignup.txt_first_name.value) )   
		{
	
	
	        var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,z=0,z1=0,z2=0,z3=0,z4=0,z5=0,z6=0,z7=0,z8=0;
			i=document.frmsignup.txt_first_name.value.indexOf('@',i);
			j=document.frmsignup.txt_first_name.value.indexOf('^',j);
			k=document.frmsignup.txt_first_name.value.indexOf('+',k);
			l=document.frmsignup.txt_first_name.value.indexOf('/',l);
			m=document.frmsignup.txt_first_name.value.indexOf('<',m);
			n=document.frmsignup.txt_first_name.value.indexOf('>',n);
			o=document.frmsignup.txt_first_name.value.indexOf('{',o);
			p=document.frmsignup.txt_first_name.value.indexOf('[',p);
			q=document.frmsignup.txt_first_name.value.indexOf('}',q);
			r=document.frmsignup.txt_first_name.value.indexOf(']',r);
			s=document.frmsignup.txt_first_name.value.indexOf('\\',s);
			t=document.frmsignup.txt_first_name.value.indexOf('~',t);
	        u=document.frmsignup.txt_first_name.value.indexOf('!',u);
	        v=document.frmsignup.txt_first_name.value.indexOf('#',v);
	        w=document.frmsignup.txt_first_name.value.indexOf('$',w);
	        x=document.frmsignup.txt_first_name.value.indexOf('%',x);
	    	z=document.frmsignup.txt_first_name.value.indexOf('&',z);
	    	z1=document.frmsignup.txt_first_name.value.indexOf('*',z1);
	    	z2=document.frmsignup.txt_first_name.value.indexOf('(',z2);
	    	z3=document.frmsignup.txt_first_name.value.indexOf(')',z3);
	    	z4=document.frmsignup.txt_first_name.value.indexOf('-',z4);
	    	z5=document.frmsignup.txt_first_name.value.indexOf('|',z5);
	    	z6=document.frmsignup.txt_first_name.value.indexOf('?',z6);
	    	
	    	z7=document.frmsignup.txt_first_name.value.indexOf('\'',z7);
	    	z8=document.frmsignup.txt_first_name.value.indexOf('"',z8);
	    	
			if( i >= 0 || j >= 0 || k >= 0 || l >= 0 || m >= 0 || n >= 0 || o >= 0 || p >= 0 || q >= 0 || r >= 0 || s >= 0 || t >= 0 || u >= 0 || v >= 0 || w >= 0 || x >= 0 || z >= 0 || z1 >= 0 || z2 >= 0 || z3 >= 0 || z4 >= 0 || z5 >= 0 || z6 >= 0 || z7 >= 0 || z8 >= 0)
			{
		
				
				alert("Invalid First Name.");
				document.frmsignup.txt_first_name.focus();
				return false;
			}
	        
			
			
		}
		
		
		if(!isEmpty(document.frmsignup.txt_mid_name.value) )   
		{
	
	
	        var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,z=0,z1=0,z2=0,z3=0,z4=0,z5=0,z6=0,z7=0,z8=0;
			i=document.frmsignup.txt_mid_name.value.indexOf('@',i);
			j=document.frmsignup.txt_mid_name.value.indexOf('^',j);
			k=document.frmsignup.txt_mid_name.value.indexOf('+',k);
			l=document.frmsignup.txt_mid_name.value.indexOf('/',l);
			m=document.frmsignup.txt_mid_name.value.indexOf('<',m);
			n=document.frmsignup.txt_mid_name.value.indexOf('>',n);
			o=document.frmsignup.txt_mid_name.value.indexOf('{',o);
			p=document.frmsignup.txt_mid_name.value.indexOf('[',p);
			q=document.frmsignup.txt_mid_name.value.indexOf('}',q);
			r=document.frmsignup.txt_mid_name.value.indexOf(']',r);
			s=document.frmsignup.txt_mid_name.value.indexOf('\\',s);
			t=document.frmsignup.txt_mid_name.value.indexOf('~',t);
	        u=document.frmsignup.txt_mid_name.value.indexOf('!',u);
	        v=document.frmsignup.txt_mid_name.value.indexOf('#',v);
	        w=document.frmsignup.txt_mid_name.value.indexOf('$',w);
	        x=document.frmsignup.txt_mid_name.value.indexOf('%',x);
	    	z=document.frmsignup.txt_mid_name.value.indexOf('&',z);
	    	z1=document.frmsignup.txt_mid_name.value.indexOf('*',z1);
	    	z2=document.frmsignup.txt_mid_name.value.indexOf('(',z2);
	    	z3=document.frmsignup.txt_mid_name.value.indexOf(')',z3);
	    	z4=document.frmsignup.txt_mid_name.value.indexOf('-',z4);
	    	z5=document.frmsignup.txt_mid_name.value.indexOf('|',z5);
	    	z6=document.frmsignup.txt_mid_name.value.indexOf('?',z6);
	    	
	    	z7=document.frmsignup.txt_mid_name.value.indexOf('\'',z7);
	    	z8=document.frmsignup.txt_mid_name.value.indexOf('"',z8);
	    	
			if( i >= 0 || j >= 0 || k >= 0 || l >= 0 || m >= 0 || n >= 0 || o >= 0 || p >= 0 || q >= 0 || r >= 0 || s >= 0 || t >= 0 || u >= 0 || v >= 0 || w >= 0 || x >= 0 || z >= 0 || z1 >= 0 || z2 >= 0 || z3 >= 0 || z4 >= 0 || z5 >= 0 || z6 >= 0 || z7 >= 0 || z8 >= 0)
			{
		
				
				alert("Invalid Middle Initial Name.");
				document.frmsignup.txt_mid_name.focus();
				return false;
			}
	        
			
			
		}*/
	
	if(isEmpty(document.frmsignup.txt_last_name.value) )   
		{
				alert("Please Enter Last Name.");
				document.frmsignup.txt_last_name.focus();
				return false;			
		}
		
	/*if(!isEmpty(document.frmsignup.txt_last_name.value) )   
		{
	        
	        var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,z=0,z1=0,z2=0,z3=0,z4=0,z5=0,z6=0,z7=0,z8=0;
			i=document.frmsignup.txt_last_name.value.indexOf('@',i);
			j=document.frmsignup.txt_last_name.value.indexOf('^',j);
			k=document.frmsignup.txt_last_name.value.indexOf('+',k);
			l=document.frmsignup.txt_last_name.value.indexOf('/',l);
			m=document.frmsignup.txt_last_name.value.indexOf('<',m);
			n=document.frmsignup.txt_last_name.value.indexOf('>',n);
			o=document.frmsignup.txt_last_name.value.indexOf('{',o);
			p=document.frmsignup.txt_last_name.value.indexOf('[',p);
			q=document.frmsignup.txt_last_name.value.indexOf('}',q);
			r=document.frmsignup.txt_last_name.value.indexOf(']',r);
			s=document.frmsignup.txt_last_name.value.indexOf('\\',s);
			t=document.frmsignup.txt_last_name.value.indexOf('~',t);
	        u=document.frmsignup.txt_last_name.value.indexOf('!',u);
	        v=document.frmsignup.txt_last_name.value.indexOf('#',v);
	        w=document.frmsignup.txt_last_name.value.indexOf('$',w);
	        x=document.frmsignup.txt_last_name.value.indexOf('%',x);
	    	z=document.frmsignup.txt_last_name.value.indexOf('&',z);
	    	z1=document.frmsignup.txt_last_name.value.indexOf('*',z1);
	    	z2=document.frmsignup.txt_last_name.value.indexOf('(',z2);
	    	z3=document.frmsignup.txt_last_name.value.indexOf(')',z3);
	    	z4=document.frmsignup.txt_last_name.value.indexOf('-',z4);
	    	z5=document.frmsignup.txt_last_name.value.indexOf('|',z5);
	    	z6=document.frmsignup.txt_last_name.value.indexOf('?',z6);
	    	
	    	z7=document.frmsignup.txt_last_name.value.indexOf('\'',z7);
	    	z8=document.frmsignup.txt_last_name.value.indexOf('"',z8);
	    	
			if( i >= 0 || j >= 0 || k >= 0 || l >= 0 || m >= 0 || n >= 0 || o >= 0 || p >= 0 || q >= 0 || r >= 0 || s >= 0 || t >= 0 || u >= 0 || v >= 0 || w >= 0 || x >= 0 || z >= 0 || z1 >= 0 || z2 >= 0 || z3 >= 0 || z4 >= 0 || z5 >= 0 || z6 >= 0 || z7 >= 0 || z8 >= 0)
			{
		
				alert("Invalid Last Name.");
				document.frmsignup.txt_last_name.focus();
				return false;
			}
	    
			
				
			
	}*/
	
	if(document.frmsignup.txt_position.value=="") 
	{
		alert("Please Enter Position.");
		document.frmsignup.txt_position.focus();
		return false;
	}
	
	/*if(!isEmpty(document.frmsignup.txt_position.value) )   
		{
	        
	        var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,z=0,z1=0,z2=0,z3=0,z4=0,z5=0,z6=0,z7=0,z8=0;
			i=document.frmsignup.txt_position.value.indexOf('@',i);
			j=document.frmsignup.txt_position.value.indexOf('^',j);
			k=document.frmsignup.txt_position.value.indexOf('+',k);
			l=document.frmsignup.txt_position.value.indexOf('/',l);
			m=document.frmsignup.txt_position.value.indexOf('<',m);
			n=document.frmsignup.txt_position.value.indexOf('>',n);
			o=document.frmsignup.txt_position.value.indexOf('{',o);
			p=document.frmsignup.txt_position.value.indexOf('[',p);
			q=document.frmsignup.txt_position.value.indexOf('}',q);
			r=document.frmsignup.txt_position.value.indexOf(']',r);
			s=document.frmsignup.txt_position.value.indexOf('\\',s);
			t=document.frmsignup.txt_position.value.indexOf('~',t);
	        u=document.frmsignup.txt_position.value.indexOf('!',u);
	        v=document.frmsignup.txt_position.value.indexOf('#',v);
	        w=document.frmsignup.txt_position.value.indexOf('$',w);
	        x=document.frmsignup.txt_position.value.indexOf('%',x);
	    	z=document.frmsignup.txt_position.value.indexOf('&',z);
	    	z1=document.frmsignup.txt_position.value.indexOf('*',z1);
	    	z2=document.frmsignup.txt_position.value.indexOf('(',z2);
	    	z3=document.frmsignup.txt_position.value.indexOf(')',z3);
	    	z4=document.frmsignup.txt_position.value.indexOf('-',z4);
	    	z5=document.frmsignup.txt_position.value.indexOf('|',z5);
	    	z6=document.frmsignup.txt_position.value.indexOf('?',z6);
	    	
	    	z7=document.frmsignup.txt_position.value.indexOf('\'',z7);
	    	z8=document.frmsignup.txt_position.value.indexOf('"',z8);
	    	
			if( i >= 0 || j >= 0 || k >= 0 || l >= 0 || m >= 0 || n >= 0 || o >= 0 || p >= 0 || q >= 0 || r >= 0 || s >= 0 || t >= 0 || u >= 0 || v >= 0 || w >= 0 || x >= 0 || z >= 0 || z1 >= 0 || z2 >= 0 || z3 >= 0 || z4 >= 0 || z5 >= 0 || z6 >= 0 || z7 >= 0 || z8 >= 0)
			{
		
				alert("Invalid Position.");
				document.frmsignup.txt_position.focus();
				return false;
			}
	    
			
				
			
		}*/
	
	var phone2 = document.frmsignup.txt_contact_phone1.value + document.frmsignup.txt_contact_phone2.value + document.frmsignup.txt_contact_phone3.value;
		if( !isEmpty(phone2) )
		{
			if( !isUSPhoneNumber(phone2))
			{
				alert("Invalid Phone Number.");
				document.frmsignup.txt_contact_phone1.focus();
				return false;
			}
		}
		else
		{
		    alert("Please Enter Phone Number.");
			document.frmsignup.txt_contact_phone1.focus();
			return false;
		}
	
	 if( !isEmpty(document.frmsignup.txt_contact_email.value) )
		{
		
			if( !isEmail(document.frmsignup.txt_contact_email.value) )
			{
				alert("Invalid Email.");
				document.frmsignup.txt_contact_email.focus();
				return false;
			}
		}
		else
		{
		
		        alert("Please Enter Email.");
				document.frmsignup.txt_contact_email.focus();
				return false;
		}   
	//end employee contact information
	
	  
	return true;
}
