	function checkDistr() {
		if (document.form1.fname.value == "")		{alert("Please enter your FIRST NAME.");document.form1.fname.focus();return false;}
		if (document.form1.lname.value == "")		{alert("Please enter your LAST NAME.");document.form1.lname.focus();return false;}
		if (document.form1.company.value == "")		{alert("Please enter your COMPANY NAME.");document.form1.company.focus();return false;}
		if (document.form1.street.value == "")		{alert("Please enter your STREET.");document.form1.street.focus();return false;}
		if (document.form1.city.value == "")		{alert("Please enter your CITY.");document.form1.city.focus();return false;}
		if (document.form1.state.selectedIndex==0)	{alert("Please select your STATE.");document.form1.state.focus();return false;}
		if (document.form1.zip.value == "")			{alert("Please enter your ZIP CODE.");document.form1.zip.focus();return false;}
		if (!checkZipCode(document.form1.zip.value)){alert("Please enter a VALID ZIP CODE.");document.form1.zip.focus();return false;}
		if (document.form1.phone1.value == "" || document.form1.phone1.value <= 200) 
													{alert("Please enter a VALID TELEPHONE AREA CODE.");document.form1.phone1.focus();return false;}
		if (document.form1.phone2.value == "" || document.form1.phone2.value < 200) 
													{alert("Please enter a VALID TELEPHONE NUMBER.");document.form1.phone2.focus();return false;}
		if (document.form1.phone3.value == "")		{alert("Please enter a VALID TELEPHONE NUMBER.");document.form1.phone3.focus();return false;}
		if (document.form1.email.value == "")		{alert("Please enter your BILL-TO E-MAIL ADDRESS.");document.form1.email.focus();return false;}
		else {return emailCheck('1');}
	}

	var newwindow = null;
		function pop(dest) {
			var url = "includes/info_"+dest+".html";
			if (newwindow && !newwindow.closed && newwindow.location) {
				newwindow.location.href = url;
			}
			else {
				newwindow=window.open(url,"name","scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,width=600,height=450");
				if (!newwindow.opener) {newwindow.opener = self;}
			}
			var posX,posY;
			if (document.all) {posX = eval(window.screenLeft+203);posY = eval(window.screenTop+10);}
			else {posX = eval(window.screenX+203);posY = eval(window.screenY+104);}
			newwindow.moveTo(posX,posY);
			if (window.focus) {newwindow.focus();}
		}
	
	function help(what) {
		if (what=="cvv") {
			var msg="This is only required if you are paying by Credit card ...\n\n";
			msg=msg+"THE CVV NUMBER is an additional piece of data used by your Issuing Bank for added security.\n\n";
			msg=msg+"VISA and MASTERCARD - the CVV is a 3-digit number on the back of your card inside the signature\n";
			msg=msg+"block area.\n";
			msg=msg+"AMERICAN EXPRESS - the CVV is a 4-digit number printed on the front of your card above the\n";
			msg=msg+"last digit of your card number.\n";
			msg=msg+"Please understand that we are asking for this information for your secirity and protection ...\n\n";
		}
		else if (what=="tax") {
			var msg="We are required to collect "+salestaxrate+"% Sales Tax on all orders shipped to an\n";
			msg=msg+"address within the State of California.\n\n";
			msg=msg+"If you have a valid Resale License on file with us, no Sales Tax will be charged,\n";
			msg=msg+"regardless of the Shipping Destination.\n\n";
		}
		alert(msg);
		return;
	}
	
	function checker() {
		if (document.form1.fname.value == "")		{alert("Please enter your BILL-TO FIRST NAME.");document.form1.fname.focus();return false;}
		if (document.form1.lname.value == "")		{alert("Please enter your BILL-TO LAST NAME.");document.form1.lname.focus();return false;}
		if (document.form1.street.value == "")		{alert("Please enter your BILL-TO STREET.");document.form1.street.focus();return false;}
		if (document.form1.city.value == "")		{alert("Please enter your BILL-TO CITY.");document.form1.city.focus();return false;}
		if (document.form1.zip.value == "")			{alert("Please enter your BILL-TO ZIP CODE.");document.form1.zip.focus();return false;}
		var validzip = checkZipCode(document.form1.zip.value);
		if (!validzip)								{alert("The BILL-TO  ZIP CODE is invalid - please enter again.");document.form1.zip.focus();return false;}
		if (document.form1.phone1.value == "")		{alert("Please enter your BILL-TO AREA CODE.");document.form1.phone1.focus();return false;}
		if (document.form1.phone2.value == "")		{alert("Please enter your BILL-TO PHONE NUMBER.");document.form1.phone2.focus();return false;}
		if (document.form1.phone3.value == "")		{alert("Please enter your BILL-TO PHONE NUMBER.");document.form1.phone3.focus();return false;}
		if (document.form1.email.value == "")		{alert("Please enter your BILL-TO E-MAIL ADDRESS.");document.form1.email.focus();return false;}
		if (document.form1.authpickup.value==0)		{
			if (document.form1.sfname.value == "")		{alert("Please enter the SHIP-TO FIRST NAME.");document.form1.sfname.focus();return false;}
			if (document.form1.slname.value == "")		{alert("Please enter the SHIP-TO LAST NAME.");document.form1.slname.focus();return false;}
			if (document.form1.sstreet.value == "")		{alert("Please enter the SHIP-TO STREET.");document.form1.Sstreet.focus();return false;}
			if (document.form1.scity.value == "")		{alert("Please enter the SHIP-TO CITY.");document.form1.Scity.focus();return false;}
			if (document.form1.szip.value == "")		{alert("Please enter the SHIP-TO ZIP CODE.");document.form1.Szip.focus();return false;}
			var shipzip = checkZipCode(document.form1.szip.value);
			if (!shipzip)								{alert("The SHIP-TO ZIP CODE is invalid - please enter again.");document.form1.szip.focus();return false;}
			if (document.form1.sphone1.value == "")		{alert("Please enter your SHIP-TO AREA CODE.");document.form1.sphone1.focus();return false;}
			if (document.form1.sphone2.value == "")		{alert("Please enter your SHIP-TO PHONE NUMBER.");document.form1.sphone2.focus();return false;}
			if (document.form1.sphone3.value == "")		{alert("Please enter your SHIP-TO PHONE NUMBER.");document.form1.sphone3.focus();return false;}
			if (document.form1.semail.value == "")		{alert("Please enter your SHIP-TO E-MAIL ADDRESS.");document.form1.semail.focus();return false;}
		}
		else if (document.form1.carrier.value == "")	{
			alert("Please enter the name of the CARRIER WHICH WILL PICK UP YOUR ORDER.");document.form1.carrier.focus();return false;
		}
		if (document.form1.mandatoryPO.value=="1" && document.form1.po.value=="") {
			alert("Please enter your PURCHASE ORDER NUMBER.");document.form1.po.focus();return false;
		}
		if (!document.form1.tandc.checked)			{alert("Please READ AND ACCEPT the TERMS AND CONDITIONS.");document.form1.tandc.focus();return false;}
		if (document.form1.paymentSwitch.value=="cc") {
			if (document.form1.cccard.selectedIndex==0) {
				alert("Please select the CREDIT CARD you wish to use for payment.");
				document.form1.cccard.focus();
				return false;
			}
			if (doCCStuff("document.form1.ccnum"))	{
				if (!emailCheck("1")) {return false;}
				else {return emailCheck("2");}
			}
			else {return false;}
		}
		else {return emailCheck();}
	}

	function emailCheck(which) {
		if (which==1) {
			emailStr = document.form1.email.value;
			side = "Billing";
		}
		else {
			emailStr = document.form1.semail.value;
			side = "Ship-To";
		}
		var checkTLD=1;
		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
		var emailPat=/^(.+)@(.+)$/;
		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		var validChars="\[^\\s" + specialChars + "\]";
		var quotedUser="(\"[^\"]*\")";
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		var atom=validChars + '+';
		var word="(" + atom + "|" + quotedUser + ")";
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
		var matchArray=emailStr.match(emailPat);
		if (matchArray==null) {alert("The "+side+" E-mail address seems incorrect (check @ and .'s)");return false;}
		var user=matchArray[1];
		var domain=matchArray[2];
		for (i=0; i<user.length; i++) {
			if (user.charCodeAt(i)>127) {alert("The "+side+" E-mail address username contains invalid characters.");return false;}
		}
		for (i=0; i<domain.length; i++) {
			if (domain.charCodeAt(i)>127) {alert("The "+side+" E-mail address domain name contains invalid characters.");return false;}
		}
		if (user.match(userPat)==null) {alert("The "+side+" E-mail address username doesn't seem to be valid.");return false;}
		var IPArray=domain.match(ipDomainPat);
		if (IPArray!=null) {
			for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {alert("The "+side+" E-mail Destination IP address is invalid!");return false;}
			}
			return true;
		}
		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 "+side+" E-mail address domain name does not seem to be valid.");return false;}
		}
		if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
			alert("The "+side+" E-mail address address must end in a well-known domain or two letter " + "country.");
			return false;
		}
		if (len<2) {alert("The "+side+" E-mail address address is missing a hostname!");return false;}
		return true;
	}

	function checkZipCode(code)     {
		if (code.length < 5)			{return false;}
	    var fivecode = code.substring(0,5);
		if (fivecode == "00000")		{return false;}
		if (code.length == 5)    {
			if (!isNum(code)) {return false;}
			return true;
		}
		if (code.length == 10)   {
			if (!isNum(fivecode))       {return false;}
		    if (code.charAt(5) != "-") 	{return false;}
		    var ninecode = code.substring(6);
		    if (!isNum(ninecode))       {return false;}
			return true;
		}
		if (code.length == 7)    {
			if (isNum(code.charAt(0)))  {return false;}
			if (!isNum(code.charAt(1))) {return false;}
			if (isNum(code.charAt(2)))  {return false;}
			if (code.charAt(3) != " ")  {return false;}
			if (!isNum(code.charAt(4))) {return false;}
			if (isNum(code.charAt(5)))  {return false;}
			if (!isNum(code.charAt(6))) {return false;}
			return true;
		}
		return false;
	}

	function isNum(str) {
		var ch,i=0;
		for (i=0;i<str.length;i++)	{
			ch = str.charAt(i);
			if ((ch < "0" || "9" < ch) && ch != '-') {return false;}
		}
		return true;
	}
	
	function computeTax()	{
		if (taxable==0) {return true;}
		var tmp = document.form1.szip.value;
		if (document.form1.szip.value == "")	{
			alert("Please enter the ZIP CODE.");
			document.form1.szip.focus();
			return false;
		}
		var rate = 0;
		if (isNum(tmp) && eval(tmp) >= 90000 && eval(tmp) <= 96699)	{rate = (salestaxrate/100);}
		if (rate == 0)	{
			document.getElementById("chargesalestax").style.visibility="hidden";
			document.getElementById("nosalestax").style.visibility="visible";
			document.getElementById("totalwithsalestax").style.visibility="hidden";
			document.getElementById("totalwithnosalestax").style.visibility="visible";
		}
		else {
			document.getElementById("chargesalestax").style.visibility="visible";
			document.getElementById("nosalestax").style.visibility="hidden";
			document.getElementById("totalwithsalestax").style.visibility="visible";
			document.getElementById("totalwithnosalestax").style.visibility="hidden";
		}
		return true;
	}

	function copy()	{
		if (document.form1.sameas.checked)	{
			if (document.form1.fname.value == "")	{alert("Please enter your FIRST NAME ...");document.form1.fname.focus();return false;}
			if (document.form1.lname.value == "")	{alert("Please enter your LAST NAME ...");document.form1.lname.focus();return false;}
			if (document.form1.street.value == "")	{alert("Please enter your BILLING STREET ADDRESS.");document.form1.street.focus();return false;}
			if (document.form1.city.value == "")	{alert("Please enter your BILLING CITY NAME.");document.form1.city.focus();return false;}
			if (document.form1.zip.value == "")		{alert("Please enter your BILLING ZIP CODE.");document.form1.zip.focus();return false;}
			if (document.form1.state.selectedIndex==0) {alert("Please select your BILLING STATE.");document.form1.state.focus();return false;}
			if (document.form1.phone1.value == "" ||
				document.form1.phone2.value == "" ||
				document.form1.phone3.value == "")	{alert("Please enter your BILLING TELEPHONE NUMBER ...");document.form1.name.focus();return false;}
			if (document.form1.email.value == "")	{alert("Please enter your BILLING E-MAIL ADDRESS.");document.form1.email.focus();return false;}
			document.form1.sfname.value = document.form1.fname.value;
			document.form1.slname.value = document.form1.lname.value;
			document.form1.scompany.value = document.form1.company.value;
			document.form1.sstreet.value = document.form1.street.value;
			document.form1.sadd2.value = document.form1.add2.value;
			document.form1.scity.value = document.form1.city.value;
			if (document.getElementById("state")!=null) {document.form1.sstate.selectedIndex = document.form1.state.selectedIndex;}
			else for (i=0;i<document.form1.sstate.length;i++) {
				if (document.form1.sstate.options[i].value==document.form1.state.value) {document.form1.sstate.selectedIndex = i;}
			}
			document.form1.szip.value = document.form1.zip.value;
			document.form1.sphone1.value = document.form1.phone1.value;
			document.form1.sphone2.value = document.form1.phone2.value;
			document.form1.sphone3.value = document.form1.phone3.value;
			document.form1.semail.value = document.form1.email.value;
			computeTax();
			return true;
		}
		document.form1.sfname.value = "";
		document.form1.slname.value = "";
		document.form1.scompany.value = "";
		document.form1.sstreet.value = "";
		document.form1.sadd2.value = "";
		document.form1.scity.value = "";
		document.form1.sstate.selectedIndex = 0;
		document.form1.szip.value = "";
		document.form1.sphone1.value = "";
		document.form1.sphone2.value = "";
		document.form1.sphone3.value = "";
		document.form1.semail.value = "";
		document.getElementById("chargesalestax").style.visibility="hidden";
		document.getElementById("nosalestax").style.visibility="visible";
		document.getElementById("totalwithsalestax").style.visibility="hidden";
		document.getElementById("totalwithnosalestax").style.visibility="visible";
		return true;
	}

	function numeralsOnly() {
		var str,ch,newval="",i=0;
		str = document.form1.ccNum.value;
		for (i=0;i<str.length;i++)	{
			ch = str.charAt(i);
			if ((ch >= "0" && ch <= "9")) {newval = newval+ch;}
		}
		document.form1.ccNum.value = newval;
		return true;
	}

	function isCreditCard(st) {
		// Encoding only works on cards with less than 19 digits
		if (st.length > 19)	{return (false);}
		sum = 0;
		mul = 1;
		l = st.length;
		for (i = 0; i < l; i++) {
			digit = st.substring(l-i-1,l-i);
			tproduct = parseInt(digit ,10)*mul;
			if (tproduct >= 10)	{sum += (tproduct % 10) + 1;}
			else {sum += tproduct;}
			if (mul == 1)	{mul++;}
			else 			{mul--;}
		}
		var lun = sum % 10;
		if (lun == 0)	{return (true);}
		else			{return (false);}
	}
	
	function doCCStuff(form_element) {
		if (document.form1.cccard.selectedIndex==0)	{
			alert("Please select the CREDIT CARD TYPE ...");
			document.form1.cccard.focus();
			return (false);
		}
		if (document.form1.ccnum.value=="")	{
			alert("Please enter the CREDIT CARD NUMBER ...");
			document.form1.ccnum.focus();
			return (false);
		}
		if (document.form1.cvv.value=="")	{
			var msg = "Please enter the CREDIT CARD CVV NUMBER ...\n\n";
			msg = msg+"Your Card Verification Number ('CVV') is an additional protection - \n";
			msg = msg+"to ensure your credit card information is not being used fraudulently.\n\n";
			msg = msg+"Visa or Mastercard: enter the 3-digit number on the signature panel on\n";
			msg = msg+"the back of the card immediately following the Card number.\n\n";
			msg = msg+"American Express: enter the 4-digit, non-embossed number printed above the\n";
			msg = msg+"card number on the front of your card.";
			alert(msg);
			document.form1.cvv.focus();
			return (false);
		}
		if (!isNum(document.form1.cvv.value) || (document.form1.cccard.selectedIndex<4 && document.form1.cvv.value.length!=3) || (document.form1.cccard.selectedIndex==4 && document.form1.cvv.value.length!=4))	{
			var msg = "The CVV Number you entered cannot be verified ... please re-enter.\n\n";
			msg = msg+"Your Card Verification Number ('CVV') is an additional protection - \n";
			msg = msg+"to ensure your credit card information is not being used fraudulently.\n\n";
			msg = msg+"Visa or Mastercard: enter the 3-digit number on the signature panel on\n";
			msg = msg+"the back of the card immediately following the Card number.\n\n";
			msg = msg+"American Express: enter the 4-digit, non-embossed number printed above the\n";
			msg = msg+"card number on the front of your card.";
			alert(msg);
			document.form1.cvv.focus();
			return (false);
		}
		entry = document.form1.ccnum.value;
		if (entry && isCreditCard(entry))	{
			if (!doDateCheck())	{
				alert("Invalid Expiration date - please re-enter ...");
				document.form1.ccxMonth.focus();
				return (false);
			}
			if (document.form1.cccard.selectedIndex==1 &&
					document.form1.ccnum.value.substring(0,1)!=4)	{
				alert("The Credit Card number you entered is not a VISA number ... please re-select.");
				document.form1.cccard.focus();
				return (false);
			}
			if (document.form1.cccard.selectedIndex==2 &&
					document.form1.ccnum.value.substring(0,1)!=5)	{
				alert("The Credit Card number you entered is not a MASTERCARD number ... please re-select.");
				document.form1.cccard.focus();
				return (false);
			}
			if (document.form1.cccard.selectedIndex==3 &&
					document.form1.ccnum.value.substring(0,1)!=3)	{
				alert("The Credit Card number you entered is not an AMERICAN EXPRESS number ... please re-select.");
				document.form1.cccard.focus();
				return (false);
			}
			if (document.form1.cccard.selectedIndex==4 &&
					document.form1.ccnum.value.substring(0,1)!=6)	{
				alert("The Credit Card number you entered is not a DISCOVER number ... please re-select.");
				document.form1.cccard.focus();
				return (false);
			}
			return true;
		}
		else {
			if (entry == "")	{var errorMsg = "Please enter your Credit Card Number ...";}
			else				{var errorMsg = "The credit card number you entered could not be validated.\nPlease check the number and try again.";}
			alert(errorMsg);
			document.form1.ccnum.focus();
			return (false);
		}
	}
	
	function doDateCheck() {
		if (	document.form1.ccxMonth.selectedIndex==0 ||
				document.form1.ccxYear.selectedIndex==0	)	{return false;}
		var today = new Date();
		var month = today.getMonth()+1;
		var m_numb = document.form1.ccxMonth.selectedIndex;
		var m_txt=document.form1.ccxMonth.options[m_numb].text;
		var year = today.getYear()+1900;
		var y_numb = document.form1.ccxYear.selectedIndex;
		var y_txt=document.form1.ccxYear.options[y_numb].text;
		if (m_txt < month && y_txt == year)	{
			return (false);
		}
		return (true);
	}

	var popWindow = null;
	function popper() {
		if (popWindow && popWindow.open) {popWindow.close();}
		var dest = "terms.html";
		popWindow = window.open(dest,"terms","scrollbars=no,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,copyhistory=0,width=500,height=350");
		document.form1.tandc.checked=true;
		return;
	}

