function narrowSearch_product_list(s_sb,s_cc,s_cid,s_subcid,s_vid,viewall,s_lev,fj) {
	var cidDD = 0;
	var vidDD = 0;
	var ns1DD = 0;
	var ns2DD = 0;
	var ns3DD = 0;
	var ns4DD = 0;
	
	if (document.frmNarrowSearch.s_cid) {
		cidDD = document.frmNarrowSearch.s_cid.options[document.frmNarrowSearch.s_cid.selectedIndex].value;
	}
	
	if (document.frmNarrowSearch.s_vid) {
		vidDD = document.frmNarrowSearch.s_vid.options[document.frmNarrowSearch.s_vid.selectedIndex].value;
	}
	
	if (document.frmNarrowSearch.s_ns1) {
		ns1DD = document.frmNarrowSearch.s_ns1.options[document.frmNarrowSearch.s_ns1.selectedIndex].value;
	}

	if (document.frmNarrowSearch.s_ns2) {
		ns2DD = document.frmNarrowSearch.s_ns2.options[document.frmNarrowSearch.s_ns2.selectedIndex].value;
	}
	
	if (document.frmNarrowSearch.s_ns3) {
		ns3DD = document.frmNarrowSearch.s_ns3.options[document.frmNarrowSearch.s_ns3.selectedIndex].value;
	}
	
	if (document.frmNarrowSearch.s_ns4) {
		ns4DD = document.frmNarrowSearch.s_ns4.options[document.frmNarrowSearch.s_ns4.selectedIndex].value;
	}
	
	if(s_sb == 1) {
		document.frmNarrowSearch.action = '/product_list.asp?s_cid=' + s_cid + '&s_subcid=0&s_cc=' + s_cc + '&s_sb=' + s_sb + '&s_vid=' + vidDD + '&s_ns1=' + ns1DD + '&s_ns2=' + ns2DD + '&s_ns3=' + ns3DD + '&s_ns4=' + ns4DD + '&s_lev=' + s_lev + '&viewall=' + viewall + '&fj=' + fj;
	}
	else if(s_sb == 2) {
		document.frmNarrowSearch.action = '/product_list.asp?s_cid=' + cidDD + '&s_subcid=0&s_cc=' + s_cc + '&s_sb=' + s_sb + '&s_vid=' + s_vid + '&s_ns1=' + ns1DD + '&s_ns2=' + ns2DD + '&s_ns3=' + ns3DD + '&s_ns4=' + ns4DD + '&s_lev=' + s_lev + '&viewall=' + viewall + '&fj=' + fj;
	}
	
	document.frmNarrowSearch.submit();
}

function popup_window(target) {
	leftPos = 0;
	if (screen) {
  		leftPos = screen.width-650;
	}
  	myWindow = window.open( target , 'popupWin', 'width=467,height=717,left='+leftPos+',top=25,toolbar=no,location=no,status=no,directories=no,menubar=no,scrollbars=yes,resizable=no');
	if (window.focus) {myWindow.focus()}
}

function validateEmailForm_default() {
	if(document.email_list.txtEmailAddr.value == '') {
		alert('Please enter your email address.');
		document.email_list.txtEmailAddr.focus();
		return false;
	}
	if(document.email_list.txtEmailAddr.value.length > 50) {
		alert('Your email address is too long.  Please re-enter your email address.');
		document.email_list.txtEmailAddr.focus();
		return false;
	}
	return true;
}

function emailCheck (emailStr,formElement) {
if (emailStr == '')
	{
	return true;
	}
	else {
		emailStr = emailStr.toLowerCase();
/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|travel|jobs|mobi)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert("Email address seems incorrect (check @ and .'s)");
formElement.value = '';
formElement.focus();
return false;
}

var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
formElement.value = '';
formElement.focus();
return false;

   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
formElement.value = '';
formElement.focus();
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("The username doesn't seem to be valid.");
formElement.value = '';
formElement.focus();
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
formElement.value = '';
formElement.focus();
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
formElement.value = '';
formElement.focus();
return false;

   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
formElement.value = '';
formElement.focus();
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("This address is missing a hostname!");
formElement.value = '';
formElement.focus();
return false;
}

// If we've gotten this far, everything's valid!
return true;
}
}

function addCartItem_product_detail(numberInStock,thePhoneNum) {
	var theQty = document.frmProductDetail.txtQuantity.value;
	var tooMany = 0;

	if(theQty == '') {
		alert('Please enter a quantity.');
		document.frmProductDetail.txtQuantity.focus();
		return false;
	}
	if(isNaN(theQty)) {
		alert('The quantity must be a numeric value.');
		document.frmProductDetail.txtQuantity.focus();
		return false;
	}
	if(theQty > numberInStock) {
		alert('The quantity that you have selected for this item is on backorder. Please call Amethyst at ' + thePhoneNum + ' to check availability.');
		document.frmProductDetail.txtQuantity.focus();
		return false;
	}
	if (theQty <= 0) {
		alert('The quantity you enter must be greater than zero.');
		document.frmProductDetail.txtQuantity.focus();
		return false;
	}
	return true;
}

function goCheckout_viewcart() {
	document.frmViewCart.action = '/processcart.asp?checkout=1&rm=0';
	document.frmViewCart.submit();
}

function checkVal_viewcart(theVal,theSCID) {
	var theQty = parseInt(theVal.value);
	var theNumInStockField = 'document.frmViewCart.NumberInStock' + theSCID + '.value';
	var theNumInStock = parseInt(eval(theNumInStockField));
	if(isNaN(theQty)) {
		alert('The quantity you enter must be a numeric value.');
		theVal.focus()
	}
	else {
		if (theQty > parseFloat(eval(theNumInStockField))) {
			alert('The quantity you requested is not available.  Please re-enter the quantity.');
			theVal.value = 1;
			theVal.focus()
		}
	}
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function goLogin_customerlogin_exist() {
	if(document.frmLoginExist.txtEmailAddr.value == '') {
		alert('Please enter your email address.');
		document.frmLoginExist.txtEmailAddr.focus();
	}
	else if(document.frmLoginExist.txtPassword.value == '') {
		alert('Please enter your password.');
		document.frmLoginExist.txtPassword.focus();
	}
	else {
		document.frmLoginExist.submit();
	}
}

function goLogin_customerlogin_new() {
	if(document.frmLoginNew.txtEmailAddr.value == '') {
		alert('Please enter your email address.');
		document.frmLoginNew.txtEmailAddr.focus();
	}
	else {
		document.frmLoginNew.submit();
	}
}

function validateForm_bill_ship() {
	var theForm = document.frmBillShip;
	if(theForm.txtBillFirstName.value == '') {
		alert('Please enter your billing address first name.');
		theForm.txtBillFirstName.focus();
	}
	else if(theForm.txtBillLastName.value == '') {
		alert('Please enter your billing address last name.');
		theForm.txtBillLastName.focus();
	}
	else if(theForm.txtBillAddress1.value == '') {
		alert('Please enter your billing address.');
		theForm.txtBillAddress1.focus();
	}
	else if(theForm.txtBillCity.value == '') {
		alert('Please enter your billing city.');
		theForm.txtBillCity.focus();
	}
	else if(theForm.txtBillCity.value == '') {
		alert('Please enter your billing city.');
		theForm.txtBillCity.focus();
	}
	else if(theForm.selBillCountry.options[theForm.selBillCountry.selectedIndex].value == 0) {
		alert('Please select your billing country.');
		theForm.selBillCountry.focus();
	}
	else if((theForm.selBillCountry.options[theForm.selBillCountry.selectedIndex].value == 1 || theForm.selBillCountry.options[theForm.selBillCountry.selectedIndex].value == 2) && (theForm.selBillState.options[theForm.selBillState.selectedIndex].value == 0)) {
		alert('Please select a billing state/province.');
		theForm.selBillState.focus();
	}
	else if((theForm.selBillCountry.options[theForm.selBillCountry.selectedIndex].value == 1 || theForm.selBillCountry.options[theForm.selBillCountry.selectedIndex].value == 2) && (theForm.txtBillPostalCode.value == '')) {
		alert('Please enter your billing zip/postal code.');
		theForm.txtBillPostalCode.focus();
	}
	else if(theForm.txtBillPhoneNum.value == '') {
		alert('Please enter your billing phone number.');
		theForm.txtBillPhoneNum.focus();
	}
	else if(theForm.txtShipFirstName.value == '') {
		alert('Please enter your shiping address first name.');
		theForm.txtShipFirstName.focus();
	}
	else if(theForm.txtShipLastName.value == '') {
		alert('Please enter your shiping address last name.');
		theForm.txtShipLastName.focus();
	}
	else if(theForm.txtShipAddress1.value == '') {
		alert('Please enter your shiping address.');
		theForm.txtShipAddress1.focus();
	}
	else if(theForm.txtShipCity.value == '') {
		alert('Please enter your shiping city.');
		theForm.txtShipCity.focus();
	}
	else if(theForm.txtShipCity.value == '') {
		alert('Please enter your shiping city.');
		theForm.txtShipCity.focus();
	}
	else if(theForm.selShipCountry.options[theForm.selShipCountry.selectedIndex].value == 0) {
		alert('Please select your shiping country.');
		theForm.selShipCountry.focus();
	}
	else if((theForm.selShipCountry.options[theForm.selShipCountry.selectedIndex].value == 1 || theForm.selShipCountry.options[theForm.selShipCountry.selectedIndex].value == 2) && (theForm.selShipState.options[theForm.selShipState.selectedIndex].value == 0)) {
		alert('Please select a shiping state/province.');
		theForm.selShipState.focus();
	}
	else if((theForm.selShipCountry.options[theForm.selShipCountry.selectedIndex].value == 1 || theForm.selShipCountry.options[theForm.selShipCountry.selectedIndex].value == 2) && (theForm.txtShipPostalCode.value == '')) {
		alert('Please enter your shiping zip/postal code.');
		theForm.txtShipPostalCode.focus();
	}
	else if(theForm.txtShipPhoneNum.value == '') {
		alert('Please enter your shiping phone number.');
		theForm.txtShipPhoneNum.focus();
	}
	else if(theForm.txtPassword.value == '') {
		alert('Please enter your password.');
		theForm.txtPassword.focus();
	}
	else if(theForm.txtPassword.value != theForm.txtPasswordConfirm.value) {
		alert('Your passwords do not match.  Please re-enter your password.');
		theForm.txtPasswordConfirm.focus();
	}
	else {
		theForm.submit();
	}
}

function validateForm_bill_ship_np() {
	var theForm = document.frmBillShip;
	if(theForm.txtBillFirstName.value == '') {
		alert('Please enter your billing address first name.');
		theForm.txtBillFirstName.focus();
	}
	else if(theForm.txtBillLastName.value == '') {
		alert('Please enter your billing address last name.');
		theForm.txtBillLastName.focus();
	}
	else if(theForm.txtBillAddress1.value == '') {
		alert('Please enter your billing address.');
		theForm.txtBillAddress1.focus();
	}
	else if(theForm.txtBillCity.value == '') {
		alert('Please enter your billing city.');
		theForm.txtBillCity.focus();
	}
	else if(theForm.txtBillCity.value == '') {
		alert('Please enter your billing city.');
		theForm.txtBillCity.focus();
	}
	else if(theForm.selBillCountry.options[theForm.selBillCountry.selectedIndex].value == 0) {
		alert('Please select your billing country.');
		theForm.selBillCountry.focus();
	}
	else if((theForm.selBillCountry.options[theForm.selBillCountry.selectedIndex].value == 1 || theForm.selBillCountry.options[theForm.selBillCountry.selectedIndex].value == 2) && (theForm.selBillState.options[theForm.selBillState.selectedIndex].value == 0)) {
		alert('Please select a billing state/province.');
		theForm.selBillState.focus();
	}
	else if((theForm.selBillCountry.options[theForm.selBillCountry.selectedIndex].value == 1 || theForm.selBillCountry.options[theForm.selBillCountry.selectedIndex].value == 2) && (theForm.txtBillPostalCode.value == '')) {
		alert('Please enter your billing zip/postal code.');
		theForm.txtBillPostalCode.focus();
	}
	else if(theForm.txtBillPhoneNum.value == '') {
		alert('Please enter your billing phone number.');
		theForm.txtBillPhoneNum.focus();
	}
	else if(theForm.txtShipFirstName.value == '') {
		alert('Please enter your shiping address first name.');
		theForm.txtShipFirstName.focus();
	}
	else if(theForm.txtShipLastName.value == '') {
		alert('Please enter your shiping address last name.');
		theForm.txtShipLastName.focus();
	}
	else if(theForm.txtShipAddress1.value == '') {
		alert('Please enter your shiping address.');
		theForm.txtShipAddress1.focus();
	}
	else if(theForm.txtShipCity.value == '') {
		alert('Please enter your shiping city.');
		theForm.txtShipCity.focus();
	}
	else if(theForm.txtShipCity.value == '') {
		alert('Please enter your shiping city.');
		theForm.txtShipCity.focus();
	}
	else if(theForm.selShipCountry.options[theForm.selShipCountry.selectedIndex].value == 0) {
		alert('Please select your shiping country.');
		theForm.selShipCountry.focus();
	}
	else if((theForm.selShipCountry.options[theForm.selShipCountry.selectedIndex].value == 1 || theForm.selShipCountry.options[theForm.selShipCountry.selectedIndex].value == 2) && (theForm.selShipState.options[theForm.selShipState.selectedIndex].value == 0)) {
		alert('Please select a shiping state/province.');
		theForm.selShipState.focus();
	}
	else if((theForm.selShipCountry.options[theForm.selShipCountry.selectedIndex].value == 1 || theForm.selShipCountry.options[theForm.selShipCountry.selectedIndex].value == 2) && (theForm.txtShipPostalCode.value == '')) {
		alert('Please enter your shiping zip/postal code.');
		theForm.txtShipPostalCode.focus();
	}
	else if(theForm.txtShipPhoneNum.value == '') {
		alert('Please enter your shiping phone number.');
		theForm.txtShipPhoneNum.focus();
	}
	else {
		theForm.submit();
	}
}

function sameShip() {
	var theForm = document.frmBillShip;
	if(theForm.chkBillShipSame.checked) {
		theForm.txtShipFirstName.value = theForm.txtBillFirstName.value;
		theForm.txtShipLastName.value = theForm.txtBillLastName.value;
		theForm.txtShipAddress1.value = theForm.txtBillAddress1.value;
		theForm.txtShipAddress2.value = theForm.txtBillAddress2.value;
		theForm.txtShipAddress3.value = theForm.txtBillAddress3.value;
		theForm.txtShipCity.value = theForm.txtBillCity.value;
		theForm.selShipState.value = theForm.selBillState.value;
		theForm.txtShipPostalCode.value = theForm.txtBillPostalCode.value;
		theForm.selShipCountry.value = theForm.selBillCountry.value;
		theForm.txtShipPhoneNum.value = theForm.txtBillPhoneNum.value;
		theForm.txtShipPhoneExt.value = theForm.txtBillPhoneExt.value;
	}
	else {
		theForm.txtShipFirstName.value = '';
		theForm.txtShipLastName.value = '';
		theForm.txtShipAddress1.value = '';
		theForm.txtShipAddress2.value = '';
		theForm.txtShipAddress3.value = '';
		theForm.txtShipCity.value = '';
		theForm.selShipState.value = 0;
		theForm.txtShipPostalCode.value = '';
		theForm.selShipCountry.value = 0;
		theForm.txtShipPhoneNum.value = '';
		theForm.txtShipPhoneExt.value = '';
	}
}

function changeShipAmt_verify(theShipAmt,theOrderTotal,theAvailableOnlineCreditAmt,theSalesTax) {
    if(theAvailableOnlineCreditAmt > 0) {
        verifyUpdate_verify(6,0);
    }
    else {
	    var newTotal;
	    newTotal = theOrderTotal + parseFloat(theShipAmt) + theSalesTax + parseFloat(document.frmOrderVerify.txtGiftWrapFeeDisplay.value.replace("$",""));
	    newTotal = formatNumber(newTotal,2,' ','.','','','-','');
	    document.frmOrderVerify.txtShipDisplay.value = '$' + formatNumber(theShipAmt,2,' ','.','','','-','');
	    document.frmOrderVerify.txtOrderTotalDisplay.value = '$' + newTotal;
	    document.frmOrderVerify.txtOrderTotalDisplayCC.value = '$' + newTotal;
	}
}

function giftWrap_verify(theGiftWrapFee,theOrderTotal,theAvailableOnlineCreditAmt,theSalesTax) {
    if(theAvailableOnlineCreditAmt > 0) {
        verifyUpdate_verify(6,0);
    }
    else {
	    var newTotal;
	    newTotal = theOrderTotal + parseFloat(theGiftWrapFee) + theSalesTax + parseFloat(document.frmOrderVerify.txtShipDisplay.value.replace("$",""));
	    newTotal = formatNumber(newTotal,2,' ','.','','','-','');
	    document.frmOrderVerify.txtGiftWrapFeeDisplay.value = '$' + formatNumber(theGiftWrapFee,2,' ','.','','','-','');
	    document.frmOrderVerify.txtOrderTotalDisplay.value = '$' + newTotal;
	    document.frmOrderVerify.txtOrderTotalDisplayCC.value = '$' + newTotal;
	}
}

function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {var x = Math.round(num * Math.pow(10,dec));if (x >= 0) n1=n2='';var y = (''+Math.abs(x)).split('');var z = y.length - dec; if (z<0) z--; for(var i = z; i < 0; i++) y.unshift('0');y.splice(z, 0, pnt); while (z > 3) {z-=3; y.splice(z,0,thou);}var r = curr1+n1+y.join('')+n2+curr2;return r;}


function validateForm_payment_type() {
	var theForm = document.frmPaymentType;
	if(theForm.txtCCNumber.value == '') {
		alert('Please enter your credit card number.');
		theForm.txtCCNumber.focus();
	}
	else if(theForm.selExpMonth.options[theForm.selExpMonth.selectedIndex].value == 0) {
		alert('Please select the expiration month for your credit card.');
		theForm.selExpMonth.focus();
	}
	else if(theForm.selExpYear.options[theForm.selExpYear.selectedIndex].value == 0) {
		alert('Please select the exiration year for your credit card.');
		theForm.selExpYear.focus();
	}
	else if(theForm.txtCVV2.value == '') {
		alert('Please enter the security code on your credit card.');
		theForm.txtCVV2.focus();
	}
	else {
		theForm.submit();
	}
}

function verifyUpdate_verify(updateType,aid) {
	theForm = document.frmOrderVerify;
	theForm.action = '/verify_update.asp?ut=' + updateType + '&aid=' + aid;
	
	if(updateType == 5) {
		var cvv2Blank = 0;
		if(theForm.txtCVV2) {
			if(theForm.txtCVV2.value == '') {
				cvv2Blank = 1;
			}
		}
		if(cvv2Blank == 1) {
			alert('Please enter the Credit Card Security Code.');
			theForm.txtCVV2.focus();
		}
		else if(theForm.txtEmailAddrConfirm.value == '') {
			alert('Please enter the email address you want the order confirmation sent to.');
			theForm.txtEmailAddrConfirm.focus();
		}
		else {
			theForm.submit();
		}
	}
	else if(updateType == 4) {
		if(theForm.txtPromoCode.value == '') {
			alert('Please enter a coupon code.');
			theForm.txtPromoCode.focus();
		}
		else {
			theForm.submit();
		}
	}
	else {
		theForm.submit();
	}
}

function addNewAddress(theDom) {
	document.location.href = theDom + 'address_detail.asp?aid=0&atype=1';
}

function shipToAddress_shipping_addresses(theAddress,theDom) {
	document.location.href = theDom + 'shipping_address_select.asp?sid=' + theAddress;
}

function editAddress(aid,theDom) {
	document.location.href = theDom + 'address_detail.asp?aid=' + aid + '&atype=1';
}

function validateForm_address_detail(billOrShip) {
	var theForm = document.frmAddress;
	
	if(theForm.txtFirstName.value == '') {
		alert('Please enter a first name.');
		theForm.txtFirstName.focus();
	}
	else if(theForm.txtLastName.value == '') {
		alert('Please enter a last name.');
		theForm.txtLastName.focus();
	}
	else if(billOrShip == 1 && theForm.txtAddressName.value == '') {
		alert('Please enter a name for the address.');
		theForm.txtAddressName.focus();
	}
	else if(theForm.txtAddress1.value == '') {
		alert('Please enter the address.');
		theForm.txtAddress1.focus();
	}
	else if(theForm.txtCity.value == '') {
		alert('Please enter a city.');
		theForm.txtCity.focus();
	}
	else if(theForm.selCountry.options[theForm.selCountry.selectedIndex].value == 0) {
		alert('Please select a country.');
		theForm.selCountry.focus();
	}
	else if((theForm.selCountry.options[theForm.selCountry.selectedIndex].value == 1 || theForm.selCountry.options[theForm.selCountry.selectedIndex].value == 2) && (theForm.selState.options[theForm.selState.selectedIndex].value == 0)) {
		alert('Please select a state/province.');
		theForm.selState.focus();
	}
	else if((theForm.selCountry.options[theForm.selCountry.selectedIndex].value == 1 || theForm.selCountry.options[theForm.selCountry.selectedIndex].value == 2) && (theForm.txtPostalCode.value == '')) {
		alert('Please enter a zip/postal code.');
		theForm.txtPostalCode.focus();
	}
	else if(theForm.txtPhoneNum.value == '') {
		alert('Please enter a daytime phone number.');
		theForm.txtPhoneNum.focus();
	}
	else {
		theForm.submit();
	}
}

function addressSelect_verify(theAddress,theDom) {
	if(theAddress == 9999) {
		document.location.href = theDom + 'address_detail.asp?aid=0&atype=1';
	}
	else if(theAddress !=0) {
		document.location.href = theDom + 'shipping_address_select.asp?sid=' + theAddress;
	}
}

function validateForm_contact_us() {
	if(document.frmContactUs.txtEmailAddr.value == '') {
		alert('Please enter your email address.');
		document.frmContactUs.txtEmailAddr.focus();
	}
	else if(document.frmContactUs.txtComments.value == '') {
		alert('Please enter your questions/comments.');
		document.frmContactUs.txtComments.focus();
	}
	else {
		document.frmContactUs.submit();
	}
}

function clearForm_contact_us() {
	document.frmContactUs.txtFirstName.value = '';
	document.frmContactUs.txtLastName.value = '';
	document.frmContactUs.txtEmailAddr.value = '';
	document.frmContactUs.txtComments.value = '';
}

function validateForm_email_a_friend() {
	if(document.frmEmailFriend.txtYourFirstName.value == '') {
		alert('Please enter your first name.');
		document.frmEmailFriend.txtYourFirstName.focus();
	}
	else if(document.frmEmailFriend.txtYourLastName.value == '') {
		alert('Please enter your last name.');
		document.frmEmailFriend.txtYourLastName.focus();
	}
	else if(document.frmEmailFriend.txtYourEmailAddr.value == '') {
		alert('Please enter your email address.');
		document.frmEmailFriend.txtYourEmailAddr.focus();
	}
	else if(document.frmEmailFriend.txtFriendsFirstName.value == '') {
		alert('Please enter your friend\'s first name.');
		document.frmEmailFriend.txtFriendsFirstName.focus();
	}
	else if(document.frmEmailFriend.txtFriendsLastName.value == '') {
		alert('Please enter your friend\'s last name.');
		document.frmEmailFriend.txtFriendsLastName.focus();
	}
	else if(document.frmEmailFriend.txtFriendsEmailAddr.value == '') {
		alert('Please enter your friend\'s email address.');
		document.frmEmailFriend.txtFriendsEmailAddr.focus();
	}
	else {
		document.frmEmailFriend.submit();
	}
}

function clearForm_email_a_friend() {
	document.frmEmailFriend.txtYourFirstName.value = '';
	document.frmEmailFriend.txtYourLastName.value = '';
	document.frmEmailFriend.txtYourEmailAddr.value = '';
	document.frmEmailFriend.txtFriendsFirstName.value = '';
	document.frmEmailFriend.txtFriendsLastName.value = '';
	document.frmEmailFriend.txtFriendsEmailAddr.value = '';
	document.frmEmailFriend.txtMessage.value = '';
}

function addToWishList_product_detail(theProductID) {
	
	var qty;
	if(document.frmProductDetail.txtQuantity) {
		qty = document.frmProductDetail.txtQuantity.value;
	}
	else {
		qty = 1;
	}
	
	if (qty == '') {
		alert('Please enter the quantity for the item you want to add to your wishlist.');
		document.frmProductDetail.txtQuantity.focus();
	}
	else if(isNaN(qty)) {
		alert('The quantity must be a numeric value.');
		document.frmProductDetail.txtQuantity.focus();
	}
	else {
		document.location.href = '/login_status_check.asp?fr=2&s_pid=' + theProductID + '&qty=' + qty;
	}
}

function goRemove_wish_list(theID) {
	var agree=confirm('You are about to delete this item from your wish list.  Continue?');
	if (agree) {
		document.location.href = '/wish_list_remove.asp?wlid=' + theID;
	}
}

function clearForm_forgot_password() {
	document.frmForgotPassword.txtEmailAddr.value = '';
}

function validateForm_forgot_password() {
	if(document.frmForgotPassword.txtEmailAddr.value == '') {
		alert('Please enter your email address.');
		document.frmForgotPassword.txtEmailAddr.focus();
	}
	else {
		document.frmForgotPassword.submit();
	}
}

function openCVV2_checkout_2() {
	xyz = window.open("/cvv2desc.asp","CVV2","Height=430,Width=400,Status=yes");
}

function validateForm_create_account_wl() {
	var theForm = document.frmCreateAccountWL;
	if(theForm.txtFirstName.value == '') {
		alert('Please enter your first name.');
		theForm.txtFirstName.focus();
	}
	else if(theForm.txtLastName.value == '') {
		alert('Please enter your last name.');
		theForm.txtLastName.focus();
	}
	else if(theForm.txtPassword.value == '') {
		alert('Please enter your password.');
		theForm.txtPassword.focus();
	}
	else if(theForm.txtPassword.value != theForm.txtPasswordConfirm.value) {
		alert('The passwords you entered do not match.  Please re-enter your password.');
		theForm.txtPassord.focus();
	}
	else {
		theForm.submit();
	}
}

function goContinue_my_account() {
	var strTarget = document.frmMyAccount.selWhatToDo.options[document.frmMyAccount.selWhatToDo.selectedIndex].value;
	if(strTarget == 0) {
		alert('Please select what you want to do from the dropdown list.');
		document.frmMyAccount.selWhatToDo.focus();
	}
	else {
		document.location.href = strTarget;
	}
}

function validateForm_customer_addrma() {
	var elementNum;
	var anyItems;
	anyItems = 0;
	elementNum = document.frmAddRMA.elements.length;

	for (i = 0; i < elementNum; i++) {
		if ((i != 0) && (i % 2 != 0)) {
			if (frmAddRMA.elements[i].checked) {
				anyItems = anyItems + 1;
			}
		}
	}
	if (anyItems > 0) {
		document.frmAddRMA.submit();
	}
    else {
		alert('You must select at least one item for the RMA.');
	}
}

function ftSearch_toprightinc() {
	if(document.frmFTSearch.FTSearch.value == '') {
		alert('Please enter your search criteria.');
		document.frmFTSearch.FTSearch.focus();
		return false;
	}
	
	if(document.frmFTSearch.FTSearch.value == 'Search this site') {
		alert('Please enter your search criteria.');
		document.frmFTSearch.FTSearch.focus();
		return false;
	}
	
	return true;
}

function ftSearch_clearbox() {
	if(document.frmFTSearch.FTSearch.value == 'Search this site') {
		document.frmFTSearch.FTSearch.value = '';
		document.frmFTSearch.FTSearch.focus();
	}
}

function validateForm_create_account_general() {
	var theForm = document.frmCreateAccountGen;
	if(theForm.txtFirstName.value == '') {
		alert('Please enter your first name.');
		theForm.txtFirstName.focus();
	}
	else if(theForm.txtLastName.value == '') {
		alert('Please enter your last name.');
		theForm.txtLastName.focus();
	}
	else if(theForm.txtPassword.value == '') {
		alert('Please enter your password.');
		theForm.txtPassword.focus();
	}
	else if(theForm.txtPassword.value != theForm.txtPasswordConfirm.value) {
		alert('The passwords you entered do not match.  Please re-enter your password.');
		theForm.txtPassord.focus();
	}
	else {
		theForm.submit();
	}
}

function validateForm_unsubscribe() {
	if(document.frmUnsubscribe.txtEmailAddress.value == '') {
		alert('Please enter your email address.');
		document.frmUnsubscribe.txtEmailAddress.focus();
	}
	else {
		document.frmUnsubscribe.submit();
	}
}