// Check Email Form
function checkEmailFriend(theForm)
{
if (!checkText(theForm.sFromName,"Please fill in the \"Name\" field!", "yes"))	{
	return false;
}
if (!checkEmail(theForm.sFromEmail,"Please use a properly formatted email!", "yes"))	{
	return false;
}
if (!checkText(theForm.sToName,"Please fill in the \"Name\" field!", "yes"))	{
	return false;
}
if (!checkEmail(theForm.sToEmail,"Please use a properly formatted email!", "yes"))	{
	return false;
}
if (!checkText(theForm.sSubject,"Please fill in the \"Subject\" field!", "yes"))	{
	return false;
}
return true;
}
// Check Email Form

// Check Contact Form
function checkContact(theForm)
{
if (!checkText(theForm.sName,"Please fill in the \"Name\" field!", "yes"))	{
	return false;
}
if (!checkEmail(theForm.sEmail,"Please use a properly formatted email!", "yes"))	{
	return false;
}
return true;
}
// Check Contact Form


// Add To Cart
function checkAddToCart(theForm)
{
if (!checkText(theForm.iOption,"Please select a product option!", "yes")) {
	return false;
}
  return true;
}
// Add To Cart

// Change Shipping
function changeShipping(id){
	window.location = "step2.asp?iShipping=" + id + "#shipping";
}
// Change Shipping


// Check Out System
function checkCheckOut(theForm)
{
if (!checkNumbers(theForm.cardnumber,"Please fill in the \"Credit Card Number\" field!", "yes"))	{
	return false;
}
if (!checkNumbers(theForm.cvmvalue,"Please fill in the \"CVM\" field!", "yes"))	{
	return false;
} 
if (theForm.termsOfUse.checked==false)
  {
    alert("You must authorize Chii Clothing Company to charge your credit card before proceeding!");
    theForm.termsOfUse.focus();
    return (false);
  }
	var v = document.getElementById('Submit');
  v.style.display = "none"; 
  document.getElementById('Submit2').style.display = "inline";
  return (true);
}
//


// Check Registration Step 3
function checkRegStep3(theForm)
{
if (!checkNumbers(theForm.cardnumber,"Please fill in the \"Credit Card Number\" field!", "yes"))	{
	return false;
}
if (!checkNumbers(theForm.cvmvalue,"Please fill in the \"CVM\" field!", "yes"))	{
	return false;
}
if (!checkBox(theForm.termsOfUse,"You must agree to the terms and conditions!", "yes"))	{
	return false;
}
return true;
}
// Check Registration

// Check Registration Step 2
function checkRegStep2(theForm)
{
if (!checkText(theForm.bCompany,"Please fill in the \"Company\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.sCertName,"Please fill in the \"Certificate Name\" field!", "yes"))	{
	return false;
}
return true;
}
// Check Registration


// Check Edit Shipping
function editShipping(theForm)
{
if (!checkText(theForm.sFirstName,"Please fill in the \"First Name\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.sLastName,"Please fill in the \"Last Name\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.sAddr1,"Please fill in the \"Address\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.sCity,"Please fill in the \"City\" field!", "yes"))	{
	return false;
}
if (!checkPullDown(theForm.sState,"Please select a  \"State\"!", "yes"))	{
	return false;
}
if (!checkText(theForm.sZip,"Please fill in the \"Zip\" field!", "yes"))	{
	return false;
}
if (!checkPhone(theForm.sPhone,"phone","yes"))	{
	return false;
}
if (!checkPhone(theForm.sFax,"fax","no"))	{
	return false;
  }
return true;
}

// Check Edit Billing
function editBilling(theForm)
{
if (!checkText(theForm.bFirstName,"Please fill in the \"First Name\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.bLastName,"Please fill in the \"Last Name\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.bAddr1,"Please fill in the \"Address\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.bCity,"Please fill in the \"City\" field!", "yes"))	{
	return false;
}
if (!checkPullDown(theForm.bState,"Please select a  \"State\"!", "yes"))	{
	return false;
}
if (!checkText(theForm.bZip,"Please fill in the \"Zip\" field!", "yes"))	{
	return false;
}
if (!checkPhone(theForm.bPhone,"phone","yes"))	{
	return false;
}
if (!checkPhone(theForm.bFax,"fax","no"))	{
	return false;
  }
return true;
}

// Check Edit Account
function editAccount(theForm)
{
if (!checkEmail(theForm.sUsername,"Please use a properly formatted email!", "yes"))	{
	return false;
}
if (!checkText(theForm.sPassword,"Please fill in the \"Password\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.sPassword2,"Please fill in the \"Confirm Password\" field!", "yes"))	{
	return false;
}
if (theForm.sPassword.value != theForm.sPassword2.value)
  {
    alert("Your passwords do not match.  Please re-confirm your password.");
    theForm.sPassword2.focus();
    return (false);
  }
return true;
}
// Check Registration



// Check Registration
function checkRegister(theForm)
{
if (!checkEmail(theForm.sUsername,"Please use a properly formatted email!", "yes"))	{
	return false;
}
if (!checkText(theForm.strCAPTCHA,"Please fill in the \"Verify Code\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.sPassword,"Please fill in the \"Password\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.sPassword2,"Please fill in the \"Confirm Password\" field!", "yes"))	{
	return false;
}
if (theForm.sPassword.value != theForm.sPassword2.value)
  {
    alert("Your passwords do not match.  Please re-confirm your password.");
    theForm.sPassword2.focus();
    return (false);
  }
if (!checkText(theForm.bFirstName,"Please fill in the \"First Name\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.bLastName,"Please fill in the \"Last Name\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.bAddr1,"Please fill in the \"Address\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.bCity,"Please fill in the \"City\" field!", "yes"))	{
	return false;
}
if (!checkPullDown(theForm.bState,"Please select a  \"State\"!", "yes"))	{
	return false;
}
if (!checkText(theForm.bZip,"Please fill in the \"Zip\" field!", "yes"))	{
	return false;
}
if (!checkPhone(theForm.bPhone,"phone","yes"))	{
	return false;
}
if (!checkPhone(theForm.bFax,"fax","no"))	{
	return false;
}
if (!checkText(theForm.sFirstName,"Please fill in the \"First Name\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.sLastName,"Please fill in the \"Last Name\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.sAddr1,"Please fill in the \"Address\" field!", "yes"))	{
	return false;
}
if (!checkText(theForm.sCity,"Please fill in the \"City\" field!", "yes"))	{
	return false;
}
if (!checkPullDown(theForm.sState,"Please select a  \"State\"!", "yes"))	{
	return false;
}
if (!checkText(theForm.sZip,"Please fill in the \"Zip\" field!", "yes"))	{
	return false;
}
if (!checkPhone(theForm.sPhone,"phone","yes"))	{
	return false;
}
if (!checkPhone(theForm.sFax,"fax","no"))	{
	return false;
}
return true;
}
// Check Registration




// duplicate address for user
function sameAddress(theForm)
{
	var strErrorVal = "The following fields are required for this Feature: ";
	var focus = 0;
	if (theForm.bFirstName.value == "")
	{
		strErrorVal += "First Name, ";
		focus = 1;
	}
	if (theForm.bLastName.value == "")
	{
		strErrorVal += "Last Name, ";
		focus = 2;
	}
	if (theForm.bAddr1.value == "")
	{
		strErrorVal += "Address, ";
		focus = 3;
	}
	 if ( (theForm.bCity.value == "") )
	{
		strErrorVal += "City, ";
		focus = 4;
	}
	 if ( (theForm.bState.value == "") )
	{
		strErrorVal += "State, ";
		focus = 5;
	}
	 if ( (theForm.bCountry.value == "") )
	{
		strErrorVal += "Country, ";
		focus = 6;
	}
 if ( (theForm.bZip.value == "") )
	{
		strErrorVal += "Zip, ";
		focus = 7;
	}
 if ( (theForm.bPhone.value == "") )
	{
		strErrorVal += "Phone ";
		focus = 8;
	}
	
if (focus != 0){
	theForm.sameAsBilling.checked=false;

	alert(strErrorVal); }
else {
theForm.sFirstName.value = theForm.bFirstName.value
theForm.sLastName.value = theForm.bLastName.value
theForm.sCompany.value = theForm.bCompany.value
theForm.sAddr1.value = theForm.bAddr1.value
theForm.sAddr2.value = theForm.bAddr2.value
theForm.sCity.value = theForm.bCity.value
theForm.sState.value = theForm.bState.value
theForm.sZip.value = theForm.bZip.value
theForm.sPhone.value = theForm.bPhone.value
theForm.sFax.value = theForm.bFax.value
	}
}
