function showhide(el) { var myelement = document.getElementById(el); if( !myelement.style.display || myelement.style.display == "none" ) { if(navigator.userAgent.indexOf("Firefox") != -1) myelement.style.display = "block"; else myelement.style.display = "block"; } else { myelement.style.display = "none"; } } function MM_jumpMenu(targ,selObj,restore){ var uri = selObj.options[selObj.selectedIndex].value; eval(targ+".location=uri"); if (restore) selObj.selectedIndex=0; } function popupWin(x, y){ w = screen.width; h = screen.height; sx = w/2-200; sy = h/2-200; window.open(x,'','status=yes, resizable=no, scrollbars=yes, toolbar=no, location=no, directories=no, menubar=no, width=490, height=500, top='+sy+', left='+sx+', screenX='+sx+', screenY='+sy); } function chkaff() { if (document.getElementById('terms').checked) { urchinTracker('/outgoing/affiliate'); return true; } else { alert('You must accept the affiliate program agreement'); return false; } } function qsSet(frmObj) { var qID = frmObj.name.substr(2); var qValue = frmObj.value; var qsField = document.getElementById('qs_'+qID); if ( typeof(qsField) !="undefined" ) { if ( qValue.toLowerCase() == "no" || qValue.toLowerCase() == "i will specify" || qValue.toLowerCase() == "i disagree" ) { qsField.disabled = false; } else { qsField.disabled = true; qsField.value=''; } } } function LimitText(fieldObj,maxChars) { var result = true; if (fieldObj.value.length >= maxChars) { alert("Your answer must be less than " + maxChars + " characters."); fieldObj.value = fieldObj.value.substr(0, maxChars); result = false; } if (window.event) window.event.returnValue = result; return result; } function CheckBMI() { if (document.questions.Weight.value != '' && document.questions.Height.value != '') { CalculateBMI(); } else { document.questions.dBMI.value = ''; document.questions.BMI.value = ''; } } function CalculateBMI() { if (isNaN(document.questions.Weight.value) || eval(document.questions.Weight.value)==0 || document.questions.Height.selectedIndex==0) { document.questions.dBMI.value = ''; document.questions.BMI.value = ''; } else { var Height = eval(document.questions.Height.options[document.questions.Height.selectedIndex].value)/39.36; var Weight = eval(document.questions.Weight.value)/2.2; document.questions.dBMI.value = Math.round(Weight/(Height*Height)); document.questions.BMI.value = document.questions.dBMI.value; } } // to here /// var DefaultObjectId; var DOMViewerObj=null; var DOMViewerName=null; var bFormValid = true; var errMsg = ''; var highlightcolor="#FFFFCC"; var ns6=document.getElementById && !document.all; var ie=document.all; var previous=''; var eventobj; //Regular expression to highlight only form elements var intended=/INPUT|TEXTAREA/; ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// var submitted = false; function checkForm() { changeShipping(document.orderForm.shipMethod.options[document.orderForm.shipMethod.selectedIndex].value); var ptVal = document.orderForm.paymentType.value; //if (document.orderForm.paymentType[0].checked == true) { if (ptVal == '0') { if (!checkCC()) return false; } if (submitted == false) { submitted = true; return true; } else { return false; } } ///////////////////////////////////////////////////////////////// var Bill_Address = ''; var Bill_Address2 = ''; var Bill_City = ''; var Bill_State = 0; var Bill_Zip = ''; var Bill_Country = ''; function InitSaveVariables() { Bill_Address = document.orderForm.Bill_Address.value; Bill_Address2 = document.orderForm.Bill_Address2.value; Bill_City = document.orderForm.Bill_City.value; Bill_State = document.orderForm.Bill_State.selectedIndex; Bill_Zip = document.orderForm.Bill_Zip.value; Bill_Country = document.orderForm.Bill_Country.value; } function ShipToBillPerson() { if (document.orderForm.copy.checked) { InitSaveVariables(); if (document.orderForm.Address2.value != '') { document.orderForm.Bill_Address.value = document.orderForm.Address1.value; document.orderForm.Bill_Address2.value = document.orderForm.Address2.value; } else { document.orderForm.Bill_Address.value = document.orderForm.Address1.value; } document.orderForm.Bill_City.value = document.orderForm.City.value; document.orderForm.Bill_State.selectedIndex = document.orderForm.State.selectedIndex; document.orderForm.Bill_Zip.value = document.orderForm.ZipCode.value; document.orderForm.Bill_Country.value = document.orderForm.Country.value; } else { document.orderForm.Bill_Address.value = Bill_Address; document.orderForm.Bill_Address2.value = Bill_Address2; document.orderForm.Bill_City.value = Bill_City; document.orderForm.Bill_State.selectedIndex = Bill_State; document.orderForm.Bill_Zip.value = Bill_Zip; document.orderForm.Bill_Country.value = Bill_Country; } } ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// function changeMed(val) { if (val != '') { document.orderForm.medSelected.value = 1; document.orderForm.submit(); } } ///////////////////////////////////////////////////////////////// function checkCC() { // var sCardText = new String(); // sCardText = document.orderForm.CardNumber.value; // var regexp; // regexp = / /g; // sCardText = sCardText.replace(regexp,""); // if(sCardText.length<=0) // { // alert('Please enter a valid card number without any spaces or dashes.'); // document.orderForm.CardNumber.focus(); // return false; // } // if (CheckNum(document.orderForm.CardNumber.value) == 0) // { // alert('Please enter a valid card number.'); // return false; // } // if (!checkExpDate()) // { // alert('Please enter a valid expiration date.'); // return false; // } return true; } ///////////////////////////////////////////////////////////////// function CheckNum(cardnum) { if (cardnum == '') return 0; if (isNaN(cardnum)) return 0; if (cardnum=='4111111111111111') return 0; if (cardnum=='4242424242424242') return 0; if (cardnum=='5454545454545454') return 0; if (!CheckLUHN(cardnum)) return 0; return 1; } ///////////////////////////////////////////////////////////////// function CheckLUHN(cardnum) { var RevNum = new String(cardnum); RevNum = Reverse(RevNum); var total = new Number(0); for ( var i = 0; i < RevNum.length; i += 1 ) { var temp = 0; if (i % 2) { temp = RevNum.substr(i, 1) * 2; if (temp >= 10) { var splitstring = new String(temp); temp = parseInt(splitstring.substr(0, 1)) + parseInt(splitstring.substr(1, 1)); } } else { temp = RevNum.substr(i, 1); } total += parseInt(temp); } // if there's no remainder, we return 1 (true) return (total % 10) ? 0 : 1; } ///////////////////////////////////////////////////////////////// function Reverse(strToReverse) { var strRev = new String; var i = strToReverse.length; while (i--) { strRev += strToReverse.charAt(i); } return strRev; } ///////////////////////////////////////////////////////////////// function checkExpDate() { var d = new Date; var curYear = d.getFullYear(); var curMonth = d.getMonth()+1; var expMonth = document.orderForm.ExpMonth.options[document.orderForm.ExpMonth.selectedIndex].value; var expYear = document.orderForm.ExpYear.options[document.orderForm.ExpYear.selectedIndex].value; if ((curYear > expYear) || ((curYear == expYear) && (curMonth > expMonth))) return false; return true; } ///////////////////////////////////////////////////////////////// function chkDate() { var bMonth = parseInt(document.orderForm.DOBMonth.options[document.orderForm.DOBMonth.selectedIndex].value); var bDay = document.orderForm.DOBDay.options[document.orderForm.DOBDay.selectedIndex].value; var bYear = document.orderForm.DOBYear.options[document.orderForm.DOBYear.selectedIndex].value; var bMsg = "Please choose a valid date."; if (bMonth == 2 && (bDay == 30 || bDay == 31)) { alert (bMsg + "\nFebruary contains less than 30 days."); document.orderForm.DOBDay.focus(); return false; } if (bMonth == 4 && bDay == 31 || bMonth == 6 && bDay == 31 || bMonth == 9 && bDay == 31 || bMonth == 11 && bDay == 31 ) { alert (bMsg + "\nThe month selected contains less than 31 days."); document.orderForm.DOBDay.focus(); return false; } if (isLeapYear(bYear)) { if (bMonth == 2 && bDay > 28) { alert (bMsg + "\nThe date you have chosen is not a valid date."); document.orderForm.DOBDay.focus(); return false; } else { return true; } } else { return true; } } ///////////////////////////////////////////////////////////////// function isLeapYear(Year) { if ( ( Year % 4 == 0 ) && (( Year % 100 != 0 ) || ( Year % 400 == 0 ))) { return (true); } else { return (false); } } ///////////////////////////////////////////////////////////////// function chkYear() { var d = new Date; var curYear = d.getFullYear(); var curMonth = d.getMonth()+1; var curMonthDay = d.getDate(); var bYear = document.orderForm.DOBYear.options[document.orderForm.DOBYear.selectedIndex].value; var bMonth = document.orderForm.DOBMonth.options[document.orderForm.DOBMonth.selectedIndex].value; var bDay = document.orderForm.DOBDay.options[document.orderForm.DOBDay.selectedIndex].value; if ((curYear-bYear)>18) { return true; } else if ((curYear-bYear)==18) { if ((curMonth-bMonth)>0 || ((curMonth-bMonth)==0 && (curMonthDay-bDay)>=0)) return true; } alert("Please be advised that you must be Over 18 to place an order."); document.orderForm.DOBYear.focus(); return false; } ///////////////////////////////////////////////////////////////// //Check whether element clicked is form element ///////////////////////////////////////////////////////////////// function checkel(which) { if (which.style && intended.test(which.tagName)) { if (ns6 && eventobj.nodeType==3) eventobj=eventobj.parentNode.parentNode; return true; } else return false; } ///////////////////////////////////////////////////////////////// //Highlight form element ///////////////////////////////////////////////////////////////// function highlight(e) { eventobj = ns6 ? e.target : event.srcElement; if (previous!='') { if (checkel(previous)) previous.style.backgroundColor=''; previous=eventobj; if (checkel(eventobj)) eventobj.style.backgroundColor=highlightcolor; } else { if (checkel(eventobj)) eventobj.style.backgroundColor=highlightcolor; previous=eventobj; } } ///////////////////////////////////////////////////////////////// function toTitleCase(frmObj) { var index; var tmpStr; var tmpChar; var preString; var postString; var strlen; var re; var tmpArr; var inpString; var j; tmpStr = frmObj.value.toLowerCase(); strLen = tmpStr.length; if (strLen > 0) { for (index = 0; index < strLen; index++) { if (index == 0) { tmpChar = tmpStr.substring(0,1).toUpperCase(); postString = tmpStr.substring(1,strLen); tmpStr = tmpChar + postString; } else { tmpChar = tmpStr.substring(index, index+1); if ((tmpChar == " " || tmpChar == "-" || tmpChar == ",") && index < (strLen-1)) { tmpChar = tmpStr.substring(index+1, index+2).toUpperCase(); preString = tmpStr.substring(0, index+1); postString = tmpStr.substring(index+2,strLen); tmpStr = preString + tmpChar + postString; } } } } //Handle special cases //Mid-Word Caps... re = /\bMc|\bMac|\O\'|\B-|\,|\.|\/|\(/; //' tmpArr = tmpStr.match(re); if(tmpArr != null) { preString = tmpStr.substring(0,tmpArr.lastIndex); tmpChar = tmpStr.charAt(tmpArr.lastIndex); postString = tmpStr.substring(tmpArr.lastIndex+1,tmpStr.length); tmpChar = tmpChar.toUpperCase(); tmpStr = preString + tmpChar + postString; } frmObj.value = tmpStr; } ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// function matchFound(sInput,re) { var tmpArr; tmpArr = sInput.match(re); if (tmpArr != null) return true; return false; } ///////////////////////////////////////////////////////////////// function getRef(obj) { if(typeof obj == "string") obj= document.getElementById(obj); return obj; } ///////////////////////////////////////////////////////////////// function setStyle(obj, style, value) { getRef(obj).style[style]= value; } /* USAGE: obj = object reference or element id. style = the style to be changed. value = the value assigned to the style. */ ///////////////////////////////////////////////////////////////// function setClassName(obj, className) { getRef(obj).className= className; } ///////////////////////////////////////////////////////////////// /* The Browser object */ Browser = { isSupported : function() { return (Boolean(document.getElementsByTagName) && Boolean(document.getElementById)); }, // toString is ignored by for - in loop. Why? toString : function() {return navigator.userAgent;}, isOpera : function() {return this.toString().indexOf("Opera") > 0;}, isNS4 : function() {return (Boolean(document.layers) && this.toString().indexOf("Netscape") == -1);}, isNS6 : function() {return (Boolean(document.getElementById) && this.toString().indexOf("Netscape") == -1);}, isIE : function() {return !this.isOpera() && this.toString().indexOf("MSIE") > 0;}, isIE5 : function() {return !this.isOpera() && this.toString().indexOf("MSIE 5") > 0;}, isIE5_0 : function() {return !this.isOpera() && this.toString().indexOf("MSIE 5.0") > 0;}, isIE6 : function() {return !this.isOpera() && this.toString().indexOf("MSIE 6") > 0;}, isGecko : function() {return !this.isOpera() && this.toString().indexOf("Gecko") > 0;}, isMoz : function() {return this.isGecko() && this.toString().indexOf("Netscape") == -1;}, isMac : function() {return this.toString().indexOf("Mac") > 0;}, isMac_IE5 : function() {return this.isIE5() && this.isMac();} }; ///////////////////////////////////////////////////////////////// function writeBrowser() { document.writeln("
");
document.writeln(padString("Browser.toString()", 21)+" = ", Browser.toString());
for(var x in Browser) document.writeln(padString("Browser."+x +"()", 21)+" = " + Browser[x]());
document.writeln("<"+"/pre>");
}
function checkstate() {
var state = document.getElementById('State');
var state = state.options[state.selectedIndex].value;
if (/^AZ|MO|MT|NV|OH|VA|UT$/.test(state))
{
document.getElementById('stateholder').innerHTML = "ATTENTION: The product(s) you have chosen cannot be shipped to your address at the present time. Please choose an import alternative
Click here to review your shopping cart contents.
";
document.getElementById('placeorder').innerHTML = "ATTENTION: The product(s) you have chosen cannot be shipped to your address at the present time. Please choose an import alternative
Click here to review your shopping cart contents.
";
return false;
} else {
document.getElementById('stateholder').innerHTML = "";
document.getElementById('placeorder').innerHTML = "";
return true;
}
}