

<!--
function MM_swapImgRestore() { //v3.0



  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;



}







function MM_preloadImages() { //v3.0



  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();



    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)



    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}



}



function MM_swapImage() { //v3.0



  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)



   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}


}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function isEmailAddr(email)
{
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function validRequired(formField,fieldLabel)
{
	var result = true;
	
	if (formField.value == "")
	{
		alert('Please enter a value for the "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}
	
	return result;
}

function allDigits(str)
{
	return inValidCharSet(str,"0123456789");
}

function inValidCharSet(str,charset)
{
	var result = true;

	// Note: doesn't use regular expressions to avoid early Mac browser bugs	
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))<0)
		{
			result = false;
			break;
		}
	
	return result;
}

function validEmail(formField,fieldLabel,required)
{
	var result = true;
	
	if (required && !validRequired(formField,fieldLabel))
		result = false;

	if (result && ((formField.value.length < 3) || !isEmailAddr(formField.value)) )
	{
		alert("Please enter a complete email address in the form: yourname@yourdomain.com");
		formField.focus();
		result = false;
	}
   
  return result;

}

function validNum(formField,fieldLabel,required)
{
	var result = true;

	if (required && !validRequired(formField,fieldLabel))
		result = false;
  
 	if (result)
 	{
 		if (!allDigits(formField.value))
 		{
 			alert('Please enter a number for the "' + fieldLabel +'" field.');
			formField.focus();		
			result = false;
		}
	} 
	
	return result;
}


function validInt(formField,fieldLabel,required)
{
	var result = true;

	if (required && !validRequired(formField,fieldLabel))
		result = false;
  
 	if (result)
 	{
 		var num = parseInt(formField.value,10);
 		if (isNaN(num))
 		{
 			alert('Please enter a number for the "' + fieldLabel +'" field.');
			formField.focus();		
			result = false;
		}
	} 
	
	return result;
}

function validateForm(theForm)
{
	// Customize these calls for your form

	// Start ------->
	
	if (!validRequired(theForm.email,"Email"))
	return false;
			
	if (!validRequired(theForm.email2,"Confirmation Email"))
	return false;
	
	if (!validRequired(theForm.password,"Password"))
	return false;
		
	if (!validRequired(theForm.x_first_name,"First Name"))
		return false;
		
	if (!validRequired(theForm.x_last_name,"Last Name"))
		return false;
		
	if (!validRequired(theForm.x_address1,"Billing Address 1"))
		return false;
		
	if (!validRequired(theForm.x_city,"City"))
		return false;
		
	if (!validRequired(theForm.x_zip,"Zip Code"))
		return false;
		
	if (!validRequired(theForm.x_phone,"Phone"))
		return false;
		
	if (!validRequired(theForm.x_ship_to_first_name,"Shipping First Name"))
		return false;
		
	if (!validRequired(theForm.x_ship_to_last_name,"Shipping Last Name"))
		return false;
		
	if (!validRequired(theForm.x_ship_to_address1,"Shipping Address 1"))
		return false;
		
	if (!validRequired(theForm.x_ship_to_city,"Shipping City"))
		return false;
		
	if (!validRequired(theForm.x_ship_to_zip,"Shipping Zip Code"))
		return false;
		

	if (!validRequired(theForm.x_card_num,"Credit Card Number"))
		return false;
				
	if (!validRequired(theForm.sec_code,"Security Code"))
		return false;



	// <--------- End
	
	return true;
}

function validate(field) {
var valid = "abcdefghijklmnopqrstuvwxyz0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Please Choose another password! Only characters and numbers are accepted!");
field.focus();
field.select();
   }
}

function clearDefault(el) {
	if (el.defaultValue == el.value) {
		el.value = ""
	}
}


var ShipFirst = "";
var ShipLast = "";
var ShipAddress1 = "";
var ShipAddress2 = "";
var ShipCity = "";
var ShipState = "";
var ShipStateIndex = "0";
var ShipZip = "";

function InitSaveVariables(form) {
ShipFirst = form.x_ship_to_first_name.value;
ShipLast = form.x_ship_to_last_name.value;
ShipAddress1 = form.x_ship_to_address1.value;
ShipAddress2 = form.x_ship_to_address2.value;
ShipCity= form.x_ship_to_city.value;
ShipStateIndex = form.x_ship_to_state.selectedIndex;
ShipState = form.x_ship_to_state[ShipStateIndex].value;
ShipZip = form.x_ship_to_zip.value;
}


function ShipToBillPerson(form) {
if (form.same_ship.checked) {
InitSaveVariables(form);
form.x_ship_to_first_name.value = form.x_first_name.value;
form.x_ship_to_last_name.value = form.x_last_name.value;
form.x_ship_to_address1.value = form.x_address1.value;
form.x_ship_to_address2.value = form.x_address2.value;
form.x_ship_to_city.value = form.x_city.value;
form.x_ship_to_state.selectedIndex = (form.x_state.selectedIndex);
form.x_ship_to_zip.value = form.x_zip.value;

}
else {
form.x_ship_to_first_name.value = ShipFirst;
form.x_ship_to_last_name.value = ShipLast;
form.x_ship_to_address1.value = ShipAddress1;
form.x_ship_to_address2.value = ShipAddress2;
form.x_ship_to_city.value = ShipCity;
form.x_ship_to_state.selectedIndex = ShipStateIndex;
form.x_ship_to_zip.value = ShipZip;

   }
}


function disableEntries(formObj)  
{  
  // Test if the checkbox were checked  
  if(formObj.same_ship.checked)  
  {  
    // The box was checked, let's disable some text elements  
    formObj.x_ship_to_first_name.disabled = true  
    formObj.x_ship_to_last_name.disabled = true 
    formObj.x_ship_to_address1.disabled = true 
    formObj.x_ship_to_address2.disabled = true 
    formObj.x_ship_to_city.disabled = true 
    formObj.x_ship_to_zip.disabled = true 
    formObj.x_ship_to_state.disabled = true 

  }  
  else  
  {  
    // The box was unChecked  
    formObj.x_ship_to_first_name.disabled = false  
    formObj.x_ship_to_last_name.disabled = false  
    formObj.x_ship_to_address1.disabled = false
    formObj.x_ship_to_address2.disabled = false 
    formObj.x_ship_to_city.disabled = false 
    formObj.x_ship_to_zip.disabled = false
    formObj.x_ship_to_state.disabled = false   
  }	  
}  


function validateZIP(field) {
var valid = "0123456789-";
var hyphencount = 0;

if (field.length!=5 && field.length!=10) {
alert("Please enter your 5 digit or 5 digit+4 zip code in the Billing Info.");
return false;
}
for (var i=0; i < field.length; i++) {
temp = "" + field.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
alert("Invalid characters in your Billing Info zip code.  Please try again.");
return false;
}
if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again in the Billing Info Zip Code field.");
return false;
   }
}
return true;
}


function validateShipZIP(field) {
var valid = "0123456789-";
var hyphencount = 0;

if (field.length!=5 && field.length!=10) {
alert("Please enter your 5 digit or 5 digit+4 zip code in the Shipping Info.");
return false;
}
for (var i=0; i < field.length; i++) {
temp = "" + field.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
alert("Invalid characters in your Shipping Info zip code.  Please try again.");
return false;
}
if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again in the Shipping Info Zip Code Field.");
return false;
   }
}
return true;
}


function US_phone(strValue){
// 2125551212 or 212-555-1212
//var re= /^[1-9]\d{2}\-?\d{3}\-?\d{4}$/;
//====================================================
// 212/555-1212 212/5551212
//var re= /^[1-9]\d{2}\/\d{3}\-?\d{4}$/;
//====================================================
//(212)555-1212 (212) 555-1212
//var re= /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
//====================================================
// 212.555.1212
var re= /^[1-9]\d{2}\-\d{3}\-\d{4}$/;
//====================================================
//1 (212) 555-1212 1(212)555-1212
//var re= /^1\s?\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
return re.test(strValue);
}

function val(theForm){
if(!US_phone(theForm.x_phone.value)){
 alert("Please enter your valid phone number in this format: 000-000-0000");
 return false;
 }else{
 return true;
}
}


<!--//
//function CheckAddress()
//{
//  sAddress = document.form1.x_ship_to_address1.value;
//  sAddress = sAddress.toUpperCase();
  // Keep adding more conditions
//  if ((sAddress.indexOf("BOX") >= 0) || (sAddress.indexOf("POST OFFICE") >= 0) || (sAddress.indexOf("PO") >= 0) || (sAddress.indexOf("P.O.") >= 0))
//  {
 //   alert("Orders may not be shipped to a PO Box. Please enter a residential address.");
//    return false;
//  }
//return true; 
//}
//-->
function CheckAddress()
{
  sAddress = document.form1.x_ship_to_address1.value;
  sAddress = sAddress.toUpperCase();
  // Keep adding more conditions
  if (
  (sAddress.indexOf("P.O.") >= 0) ||
  (sAddress.indexOf("PO#") >= 0) ||
  (sAddress.indexOf("P.O#") >= 0) ||
  (sAddress.indexOf("PO.#") >= 0) ||
  (sAddress.indexOf("P.O.#") >= 0) ||
  (sAddress.indexOf("PO BOX") >= 0) ||
  (sAddress.indexOf("P.O. BOX") >= 0) ||
  (sAddress.indexOf("P.O BOX") >= 0) ||
  (sAddress.indexOf("PO. BOX") >= 0) ||
  (sAddress.indexOf("POST OFFICE") >= 0) ||
  (sAddress.indexOf("P.O. ") >= 0) ||
  
  (sAddress.indexOf("PO  B") >= 0) ||

  (sAddress.indexOf("PO  #") >= 0) ||

  (sAddress.indexOf("PO #") >= 0) ||

  (sAddress.indexOf("P.O.  ") >= 0)

 )
  {
    alert("Orders may not be shipped to a PO Box. Please enter a residential address.");
    return false;
  }
return true; 
}

function checkEmailConf(theForm) {
    if (theForm.email.value != theForm.email2.value)
    {
        alert('Please check the confirm email field matches the first email field.');
        return false;
    } else {
        return true;
    }
}


//-->

