function emailvalidation(entered, alertbox)
{
// E-mail Validation 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 valuevalidation(entered, min, max, alertbox, datatype)
{
// Value Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
}
if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}


function digitvalidation(entered, min, max, alertbox, datatype)
{
// Digit Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
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)
{
// Emptyfield Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function formvalidation(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form
with (thisform)
{
if (emptyvalidation(txtLName,"Please Enter in Your Last Name")==false) {txtLName.focus(); return false;};
if (emptyvalidation(txtFName,"Please Enter in Your First Name")==false) {txtFName.focus(); return false;};
if (emptyvalidation(txtAddress,"Please Enter in Your Address")==false) {txtAddress.focus(); return false;};
if (emptyvalidation(txtPhone1,"Please Enter in Your E-Mail Address")==false) {txtPhone1.focus(); return false;};
if (emptyvalidation(txtCity,"Please Enter in Your Phone Number")==false) {txtCity.focus(); return false;};
if (emptyvalidation(intZip,"Please Enter in Your Zip Code")==false) {intZip.focus(); return false;};
if (digitvalidation(intZip,5,5,"You MUST Enter 5 Digits","I")==false) {intZip.focus(); return false;};
//if (digitvalidation(txtPhone1,3,3,"You MUST Enter a 3 Digit Area Code","I")==false) {txtPhone1.focus(); return false;};
//if (digitvalidation(txtPhone2,3,3,"You MUST Enter a 3 Digit Prefix Code","I")==false) {txtPhone2.focus(); return false;};
//if (digitvalidation(txtPhone3,4,4,"You MUST Enter a 4 Phone Number","I")==false) {txtPhone3.focus(); return false;};
if(email.value!=txtEMailConfirm.value) {
alert( "Your confirmed e-mail address does not match the original e-mail address." );
txtEMailConfirm.focus();
return false ;
}	
if (emailvalidation(email,"Invalid E-mail")==false) {email.focus(); return false;};
if (valuevalidation(intTrouser,1,99,"The Number of Trousers MUST be Between 1-99")==false) {intTrouser.focus(); return false;};
if (valuevalidation(intBlouse,1,99,"The Number of Blouses MUST be Between 1-99")==false) {intBlouse.focus(); return false;};
if (valuevalidation(intShirt,1,99,"The Number of Shirts MUST be Between 1-99")==false) {intShirt.focus(); return false;};
if (valuevalidation(intJacket,1,99,"The Number of Jackets MUST be Between 1-99")==false) {intJacket.focus(); return false;};
if (valuevalidation(intJean,1,99,"The Number of Jeans MUST be Between 1-99")==false) {intJean.focus(); return false;};
if (valuevalidation(intLaundry,1,99,"The Number of Laundy MUST be Between 1-99")==false) {intLaundry.focus(); return false;};




//if (valuevalidation(Value,0,5,"Value MUST be in the range 0-5")==false) {Value.focus(); return false;};
//if (digitvalidation(Digits,3,4,"You MUST enter 3 or 4 integer digits","I")==false) {Digits.focus(); return false;};
//if (emptyvalidation(Whatever,"The textfield is empty")==false) {Whatever.focus(); return false;};
}
}