
	whitespace = "\t \n\r";
	function isEmptyString(s)
   	{
   		var i;
  		if((s == null) || (s.length == 0)) return true;
  		for(i=0;i < s.length;i++)
  		{
  			var currchar = s.charAt(i);
  			if(whitespace.indexOf(currchar) == -1) return false;
  		}
      		return true;
   	}
	function validate()
	{
		var nullspace=0;
	   	var billEmailCount=1;
	    var n=document.form1.email.value;
	   var kCount=1;
               	var nLength=n.length;
		var txt=document.form1.yrs.value
		
if (isEmptyString(document.form1.name.value))
		{
			alert("Please enter your Name");
			document.form1.name.focus();
			return false;
		}
		if (isEmptyString(document.form1.company.value))
		{
			alert("Please enter your Company");
			document.form1.company.focus();
			return false;
		}
		if (isEmptyString(document.form1.yrs.value))
		{
			alert("Please enter your Years in business");
			document.form1.yrs.focus();
			return false;
		}	
		if(txt>=0 && txt <=9999)
		{          
			  }
        else
		{
			 alert("Enter only numeric value of years in business.")
           document.form1.yrs.focus();
        return false;
            }
		if (isEmptyString(document.form1.address.value))
		{
			alert("Please enter your Address");
			document.form1.address.focus();
			return false;
		}
		if (isEmptyString(document.form1.city.value))
		{
			alert("Please enter your city");
			document.form1.city.focus();
			return false;
		}
		if (isEmptyString(document.form1.state.value))
		{
			alert("Please enter your state");
			document.form1.state.focus();
			return false;
		}
		if (isEmptyString(document.form1.zipcode.value))
		{
			alert("Please enter your zipcode");
			document.form1.zipcode.focus();
			return false;
		}
		if (isEmptyString(document.form1.country.value))
		{
			alert("Please enter your country");
			document.form1.country.focus();
			return false;
		}

		if (isEmptyString(document.form1.phone.value))
		{
			alert("Please enter your Phone Number");
			document.form1.phone.focus();
			return false;
		}
		if (isEmptyString(document.form1.email.value))
		{
			alert("Please enter your E-mail ID");
			document.form1.email.focus();
			return false;
		}
		
        while((parseInt(billEmailCount) < parseInt(nLength)) && 
(n.charAt(parseInt(billEmailCount)) != '@'))
		{
			billEmailCount++;
		}
		if ((parseInt(billEmailCount) >= parseInt(nLength)) || 
(n.charAt(billEmailCount) != '@'))
		{
			alert("Please enter Email ID in proper format");
			document.form1.email.focus();
			return false;	
		}	
		else 
		{
			billEmailCount=billEmailCount+2;
		}
		while((billEmailCount<nLength) && (n.charAt(billEmailCount)!="."))
		{
			billEmailCount++;
		}
		if ((billEmailCount>=nLength-1) || (n.charAt(billEmailCount)!="."))
		{
			alert("Please enter Email ID in proper format");
			document.form1.email.focus();
			return false;	
		}	
		while((kCount<nLength))
		{
			if(n.charAt(kCount)==" ")
			{
				nullspace=1;
			}
			kCount++;
		}
		if(nullspace==1)
		{
			alert("Please enter Email ID in proper format");
			document.form1.email.focus();
			return false;
		}
return true;
}

