function vdirectmailform(directmailform)
{
	var reason = "";
	var badcolor = '#FF9980';
	var goodcolor = '#DDDDDD';
	var templength = "";
	var email = "";
	

	//----------------------------------------------------------- NAME
	templength = reason.length;
	reason += IsEmptyField(directmailform.name);
	if (reason.length > templength) 
	{
		directmailform.name.style.background = badcolor;	
	}
	else
	{
		directmailform.name.style.background = goodcolor;
	}
	//----------------------------------------------------------- COMPANY
	templength = reason.length;
	reason += IsEmptyField(directmailform.company);
	if (reason.length > templength) 
	{
		directmailform.company.style.background = badcolor;	
	}
	else
	{
		directmailform.company.style.background = goodcolor;
	}
	//----------------------------------------------------------- COMPANY
	templength = reason.length;
	reason += IsEmptyField(directmailform.address1);
	if (reason.length > templength) 
	{
		directmailform.address1.style.background = badcolor;	
	}
	else
	{
		directmailform.address1.style.background = goodcolor;
	}
	//----------------------------------------------------------- CITY
	templength = reason.length;
	reason += IsEmptyField(directmailform.city);
	if (reason.length > templength) 
	{
		directmailform.city.style.background = badcolor;	
	}
	else
	{
		directmailform.city.style.background = goodcolor;
	}
	//----------------------------------------------------------- STATE
	templength = reason.length;
	reason += IsEmptyField(directmailform.state);
	if (reason.length > templength) 
	{
		directmailform.state.style.background = badcolor;	
	}
	else
	{
		directmailform.state.style.background = goodcolor;
	}
	//----------------------------------------------------------- Zip
	templength = reason.length;
	reason += ValidZipCode(directmailform.zip.value);
	if (reason.length > templength) 
	{
		directmailform.zip.style.background = badcolor;	
	}
	else
	{
		directmailform.zip.style.background = goodcolor;
	}
	//----------------------------------------------------------- Area Code
	templength = reason.length;
	reason += IsNumeric(directmailform.areacode, 3);
	if (reason.length > templength) 
	{
		directmailform.areacode.style.background = badcolor;	
	}
	else
	{
		directmailform.areacode.style.background = goodcolor;
	}
	//----------------------------------------------------------- Phone Part 1
	templength = reason.length;
	reason += IsNumeric(directmailform.phonep1, 3);
	if (reason.length > templength) 
	{
		directmailform.phonep1.style.background = badcolor;	
	}
	else
	{
		directmailform.phonep1.style.background = goodcolor;
	}
	//----------------------------------------------------------- Phone Part 2
	templength = reason.length;
	reason += IsNumeric(directmailform.phonep2, 4);
	if (reason.length > templength) 
	{
		directmailform.phonep2.style.background = badcolor;	
	}
	else
	{
		directmailform.phonep2.style.background = goodcolor;
	}
	//----------------------------------------------------------- Email Address
	templength = reason.length;
	reason += IsAEmail(directmailform.email);
	if (reason.length > templength) 
	{
		directmailform.email.style.background = badcolor;	
	}
	else
	{
		directmailform.email.style.background = goodcolor;
	}
	
	

	if (reason != "") 
	{
    	return false;
  	}
  	else
  	{
		return true;
	}
}



function IsNumeric(sNumber, sLength)
{
   	var IsNumber="";
    var re = /[^0-9]/;

	if (re.test(sNumber.value))
	{
		IsNumber = "Not a Number\n";
	}
   
    if (sNumber.value.length != sLength)
    {
	   IsNumber = "Number Field is Not Correct Length\n";
    }
   
    return IsNumber;
}

function IsCleanText(sText, sLength)
{
	var IsClean="";

    if (sText.value.length > sLength)
    {
	    IsClean="Text too Long\n";
    }    
    
    if (sText.value.length==0)
    {
	   IsClean = "Text field is Empty\n";
    }  
   
    return IsClean;
}

function IsEmptyField(sText)
{
	var Empty="";
   
    
    if (sText.value.length==0)
   	{
		Empty = "Text field is Empty\n";
   	}  
   
    return Empty;
}

function IsAEmail(Email) {
	
	var error="";                      
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]\'\`]/ ;
   
    if (Email.value == "") {
	    
        error = "You didn't enter an email address.\n";
        
    } else if (!emailFilter.test(Email.value)) {    
	      
        error = "Please enter a valid email address.\n";
        
    } else if (Email.value.match(illegalChars)) {
	    
        error = "The email address contains illegal characters.\n";
        
    } else {
        
    }
    
    return error;
	
}

function ValidZipCode(Zip) {
   var re = /^\d{5}([\-]\d{4})?$/;
   var results = re.test(Zip);
   var error="";
   if (results == false)
   {
	
		error = "Invalid Zip Code.\n";
   }
 
	return error;
}

function autotab(original,destination)
{
	
	if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))

	destination.focus()
	
}
