/*--- Avanquest WebEasy Custom Script ---*/

function emailvalidation(entered, alertbox) 
{ 
// Validation codes provided by Henrik Petersen / NetKontoret 
// Explained at www.echoecho.com/jsforms.htm 
// Please do not remove this line and the two lines above. 
with (entered) 
{ 
apos=value.indexOf("@");  
dotpos=value.lastIndexOf("."); 
lastpos=value.length-1; 
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)  
{if (alertbox) {alert(alertbox);} return false;} 
else {return true;} 
} 
} 
function digitvalidation(entered, min, max, alertbox, datatype) 
{ 
with (entered) 
{ 
checkvalue=parseFloat(value); 
if (datatype) 
{smalldatatype=datatype.toLowerCase(); 
if (smalldatatype.charAt(0)=="i")  
{checkvalue=parseInt(value); if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};  
} 
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue) 
{if (alertbox!="") {alert(alertbox);} return false;} 
else {return true;} 
} 
} 
function emptyvalidation(entered, alertbox) 
{ 
with (entered) 
{ 
if (value==null || value=="") 
{if (alertbox!="") {alert(alertbox);} return false;} 
else {return true;} 
} 
} 
function formvalidation(thisform) 
{ 
with (thisform) 
{ 
if (emptyvalidation(a_CompanyName,"Please provide Your Company Name")==false) {a_CompanyName.focus(); return false;}; 
if (emptyvalidation(d_YourName,"Please provide Your Name")==false) {d_YourName.focus(); return false;}; 
if (emptyvalidation(e_City,"Please provide Your City")==false) {e_City.focus(); return false;}; 
if (emptyvalidation(f_State,"Please provide Your State")==false) {f_State.focus(); return false;}; 
if (digitvalidation(g_Phone,10,11,"Please provide Your Phone Number with Area Code.  Just Numbers, NO DASHES.","I")==false) {g_Phone.focus(); return false;}; 
if (emailvalidation(Email,"Invalid E-mail")==false) {Email.focus(); return false;}; 
} 
}

/*--- EndOfFile ---*/
