// JavaScript Document

function validated(string) 
{
    for (var i=0, output='', valid="1234567890 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#.,-_/"; i<string.length; i++)
	{
	   if (valid.indexOf(string.charAt(i)) != -1)
	   {
			output += string.charAt(i)
	   }
	}
    return output;
} 
	
function Form_Validator(named, theForm)
{
  
	 var aElm=document.body.getElementsByTagName('*');
			for(var i=0; i<aElm.length; i++) 
			{
				if(aElm[i].className==named) 
				{
					if (aElm[i].value.length < 1)
					{
						var id = aElm[i].id;
						var elementname = document.getElementById(""+id+"").name;
						elementname = String(elementname);
						alert("Sorry "+id+" is a required field.");
						return (false);	
						//theForm.elementname.focus();
					}
					if (aElm[i].name !== 'customerFIRSTNAME' && aElm[i].name !== 'customerTITLE')
					{
						if (aElm[i].value.length < 3)
						{
							var id = aElm[i].id;
							var elementname = document.getElementById(""+id+"").name;
							elementname = String(elementname);
							alert("Sorry "+id+" length is too small to be valid");
							return (false);	
							//theForm.elementname.focus();
						}
					}
				}
					
			} 
			
	return true;
}
