function CheckSignupForm()
{
    var theForm = window.document.frm;
    var flag = true ;

    if(theForm.BusinessType[0].checked==false && theForm.BusinessType[1].checked==false) 
	{
        alert("Please select Business Type");     
		theForm.BusinessType[0].focus();   
        return false;
    }
    
    if(theForm.CompanyName.value=="") 
	{
        alert("Please enter Company Name");     
		theForm.CompanyName.focus();   
        return false;
    }
    
    if(theForm.FirstName.value=="") 
	{
        alert("Please enter First Name");     
		theForm.FirstName.focus();   
        return false;
    }
    
    if(theForm.LastName.value=="") 
	{
        alert("Please enter Last Name");     
		theForm.LastName.focus();   
        return false;
    }
    
    if(theForm.TelNumber.value=="") 
	{
        alert("Please enter Telephone Number");     
		theForm.TelNumber.focus();   
        return false;
    }

	if(!isValidEmail(theForm.EmailAddress.value)) 
	{
        alert("Please enter a valid email address");     
		theForm.EmailAddress.focus();   
        return false;
    }
    
    if(theForm.StreetAddress.value=="") 
	{
        alert("Please enter Street Address");     
		theForm.StreetAddress.focus();   
        return false;
    }
    
    if(theForm.City.value=="") 
	{
        alert("Please enter City");     
		theForm.City.focus();   
        return false;
    }
    
    if(theForm.State.value=="") 
	{
        alert("Please enter State/Province");     
		theForm.State.focus();   
        return false;
    }
    
    if(theForm.Zip.value=="") 
	{
        alert("Please enter Zip Code");     
		theForm.Zip.focus();   
        return false;
    }
    
    if(theForm.Country.value=="") 
	{
        alert("Please select Country");     
		theForm.Country.focus();   
        return false;
    }
    
    if(theForm.Buyer1.value=="") 
	{
        alert("Please enter Buyer #1");     
		theForm.Buyer1.focus();   
        return false;
    }
    
    if(theForm.BusinessHours.value=="") 
	{
        alert("Please enter Business Hours");     
		theForm.BusinessHours.focus();   
        return false;
    }
    
    if(theForm.OpenedDate.value=="") 
	{
        alert("Please enter Date Business First Opened");     
		theForm.OpenedDate.focus();   
        return false;
    }
    
    if(theForm.TaxIDNumber.value=="") 
	{
        alert("Please enter Federal Tax ID Number (TIN))");     
		theForm.TaxIDNumber.focus();   
        return false;
    }
    
    if(theForm.SellerPermit.value=="") 
	{
        alert("Please enter State/Local Seller Permit #");     
		theForm.SellerPermit.focus();   
        return false;
    }
    
    if(theForm.JurisdictionPermit.value=="") 
	{
        alert("Please enter Jurisdiction Issuing Permit");     
		theForm.JurisdictionPermit.focus();   
        return false;
    }
    
    if(theForm.BusinessForm[0].checked==false && theForm.BusinessForm[1].checked==false && theForm.BusinessForm[2].checked==false) 
	{
        alert("Please select Business Form");     
		theForm.BusinessForm[0].focus();   
        return false;
    }
    
    if(theForm.AnnualSales[0].checked==false && theForm.AnnualSales[1].checked==false && theForm.AnnualSales[2].checked==false && theForm.AnnualSales[3].checked==false && theForm.AnnualSales[4].checked==false) 
	{
        alert("Please select Annual Sales");     
		theForm.AnnualSales[0].focus();   
        return false;
    }
    
    if(theForm.Location[0].checked==false && theForm.Location[1].checked==false && theForm.Location[2].checked==false && theForm.Location[3].checked==false) 
	{
        alert("Please select Location");     
		theForm.Location[0].focus();   
        return false;
    }
    
    if (theForm.Location[3].checked==true && theForm.LocationOther.value=="")
    {
    	alert("Please enter Other Location");     
		theForm.LocationOther.focus();   
        return false;	
    }
    
    if(theForm.StoreSize[0].checked==false && theForm.StoreSize[1].checked==false && theForm.StoreSize[2].checked==false && theForm.StoreSize[3].checked==false && theForm.StoreSize[4].checked==false) 
	{
        alert("Please select Store Size");     
		theForm.StoreSize[0].focus();   
        return false;
    }
    
    theForm.submit();
    return false;
}

function isValidEmail(email, required) {
    if (required==undefined) {   // if not specified, assume it's required
        required=true;
    }
    if (email==null) {
        if (required) {
            return false;
        }
        return true;
    }
    if (email.length==0) {  
        if (required) {
            return false;
        }
        return true;
    }
    if (! allValidChars(email)) {  // check to make sure all characters are valid
        return false;
    }
    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
        return false;
    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        return false;
    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character
        return false;
    } else if (email.indexOf("..") >=0) { // two periods in a row is not valid
	return false;
    } else if (email.indexOf(".") == email.length) {  // . must not be the last character
	return false;
    }
    return true;
}

function allValidChars(email) {
  var parsed = true;
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
  for (var i=0; i < email.length; i++) {
    var letter = email.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
      continue;
    parsed = false;
    break;
  }
  return parsed;
}

function CheckLoginForm()
{
    var theForm = window.document.frm;
    var flag = true ;
    
	if(!isValidEmail(theForm.EmailAddress.value)) 
	{
        alert("Please enter a valid email address");     
		theForm.EmailAddress.focus();   
        return false;
    }
    
    if(theForm.Password.value=="") 
	{
        alert("Please enter Password");     
		theForm.Password.focus();   
        return false;
    }
            
    theForm.submit();
    return false;
}

function CheckGetPassForm()
{
    var theForm = window.document.frm;
    var flag = true ;
    
	if(!isValidEmail(theForm.EmailAddress.value)) 
	{
        alert("Please enter a valid email address");     
		theForm.EmailAddress.focus();   
        return false;
    }
            
    theForm.submit();
    return false;
}

