function narrow(form,menu){var val = '';if (form.brand.options[form.brand.options.selectedIndex].value != '') {val = '?brand=' + form.brand.options[form.brand.options.selectedIndex].value;}if (form.family.options[form.family.options.selectedIndex].value != '' && form.brand.options[form.brand.options.selectedIndex].value != '' && menu != 'a') {val += '&family=' + form.family.options[form.family.options.selectedIndex].value;}if (form.series.options[form.series.options.selectedIndex].value != '' && form.brand.options[form.brand.options.selectedIndex].value != '' && menu != 'a' && menu != 'b') {val += '&series=' + form.series.options[form.series.options.selectedIndex].value;}if (form.model.options[form.model.options.selectedIndex].value != '' && form.brand.options[form.brand.options.selectedIndex].value != '' && menu != 'a' && menu != 'b' && menu != 'c') {val += '&model=' + form.model.options[form.model.options.selectedIndex].value;}if (form.part.options[form.part.options.selectedIndex].value != '' && form.brand.options[form.brand.options.selectedIndex].value != '') {val += '&part=' + form.part.options[form.part.options.selectedIndex].value;}else if (form.part.options[form.part.options.selectedIndex].value != '' && form.brand.options[form.brand.options.selectedIndex].value == '') {val = '?part=' + form.part.options[form.part.options.selectedIndex].value;}if (form.other.options[form.other.options.selectedIndex].value != '' && form.part.options[form.part.options.selectedIndex].value != '' && menu != 'e') {val += '&other=' + form.other.options[form.other.options.selectedIndex].value;}self.location=self.location.pathname + val;}function clearText(thefield){if (thefield.defaultValue==thefield.value) {thefield.value = "";}} function openEmailForm(){window.open('http://' + document.domain + '/zkarlo-contact-form.php','emailwindow','width=650,height=600,left=75,top=0,screenX=75,screenY=0,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');}function openShippingCalculator(){window.open('http://' + document.domain + '/zkarlo-shipping-rates.php','shipcalcwindow','width=650,height=400,left=75,top=100,screenX=75,screenY=100,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');}function openPrivacyPolicy(){window.open('http://' + document.domain + '/zkarlo-privacy-policy-popup.php','privacywindow','width=650,height=600,left=75,top=0,screenX=75,screenY=0,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');}function openShippingPolicy(){window.open('http://' + document.domain + '/zkarlo-shipping-policy.php','shippingwindow','width=650,height=450,left=75,top=75,screenX=75,screenY=75,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');}function openReturnPolicy(){window.open('http://' + document.domain + '/zkarlo-return-policy.php','returnwindow','width=650,height=400,left=75,top=100,screenX=75,screenY=100,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');}function openPlaceOrder(){window.open('http://' + document.domain + '/placing-an-order.php','orderwindow','width=650,height=350,left=75,top=125,screenX=75,screenY=125,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');}function openPaymentMethods(){window.open('http://' + document.domain + '/zkarlo-payment-methods.php','paymentwindow','width=650,height=350,left=75,top=125,screenX=75,screenY=125,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');}function checkEmailForm(form){if (isEmpty(form.name, 'You must enter your name.')) {return false;}else if (isEmpty(form.email, 'You must enter a valid email address. e.g. name@host.com')) {return false;}else if (!isEmail(form.email)) {alert('You must enter a valid email address. e.g. name@host.com');form.email.focus();return false;}else if (isPhone(form.phone, 'You must enter a valid phone number. e.g. 954-787-8738')) {return false;}else if (isEmpty(form.message, 'You must enter a message.')) {return false;}else {form.send.disabled = true;form.send.value = "Please Wait...";return true;}}function checkAddressInfo(form){if (form.account && isEmpty(form.confirmEmail, 'Please confirm your email address.')) {return false;}else if (form.account && isEmpty(form.password, 'Please enter your password.')) {return false;}else if (form.account && isEmpty(form.confirmPassword, 'Please confirm your password.')) {return false;}else if (form.account && isEmpty(form.securityQuestion, 'Please select a security question.')) {return false;}else if (form.account && isEmpty(form.securityAnswer, 'Please enter your security answer.')) {return false;}else if (isEmpty(form.shipFirstName, 'Please enter your first name.')) {return false;} else if (isEmpty(form.shipLastName, 'Please enter your last name.')) {return false;} else if (isEmpty(form.shipAddress1, 'Please enter your address.')) {return false;} else if (isEmpty(form.shipCity, 'Please enter your city, town, or locality.')) {return false;} else if (form.shipCountry.value == 'United States' && isEmpty(form.shipState, 'Please enter your state. e.g. MN')) {return false;} else if (form.shipCountry.value == 'United States' && isEmpty(form.shipZipCode, 'Please enter your zip code.')) {return false;} else if (isEmpty(form.billFirstName, 'Please enter your first name.')) {return false;} else if (isEmpty(form.billLastName, 'Please enter your last name.')) {return false;} else if (isEmpty(form.billAddress1, 'Please enter your billing address.')) {return false;} else if (isEmpty(form.billCity, 'Please enter your billing city, town, or locality.')) {return false;} else if (form.billCountry.value == 'United States' && isEmpty(form.billState, 'Please enter your billing state. e.g. MN')) {return false;} else if (form.billCountry.value == 'United States' && isEmpty(form.billZipCode, 'Please enter your billing zip code.')) {return false;} else if (form.shipPhone.value == '' && form.billPhone.value == '') {alert('Please enter your phone number.');form.billPhone.focus();return false;} else if (isPhone(form.shipPhone, 'Please enter a valid phone number.')) {return false;} else if (isPhone(form.billPhone, 'Please enter a valid phone number.')) {return false;}else if (isEmpty(form.email, 'Please enter your email address.')) {return false;}else if (!isEmail(form.email)) {alert('Please enter a valid email address.');form.email.focus();return false;} else {return true;}}function checkShippingMethod(form){shipping = false;if (form.ship_method.checked) { shipping = true;}else { for (i = 0; i < form.ship_method.length; i++) {if (form.ship_method[i].checked) {shipping = true;}}}if (shipping === false) {alert('Please select a shipping method.');return false;}else {return true;}}function checkPaymentMethod(form){if (isCredit() && isEmpty(form.creditNumber, 'Please enter your credit card number. e.g. 4585656845784558')) {return false;} else if (isCredit() && isCCNumber(form.creditNumber, 'Please enter a valid credit card number. e.g. 4585656845784558')) {return false;} else if (isCredit() && isEmpty(form.creditVerify, 'Please enter your CID number.')) {return false;} else if (isCredit() && isCCID(form.creditVerify, 'Please enter a valid CID number.')) {return false;} else {return true;}}function checkMakePaymentInfo(form){if (isEmpty(form.credit_number, 'Please enter a valid credit card number. e.g. 8976564545434523')) {return false;} else if (isCCNumber(form.credit_number, 'Please enter a valid credit card number. e.g. 8976564545434523')) {return false;} else if (isEmpty(form.credit_verify, 'Please enter a valid CCID number.')) {return false;} else if (isCCID(form.credit_verify, 'Please enter a valid CCID number.')) {return false;}else if (isEmpty(form.txtAmount, 'Please enter a payment amount.')) {return false;} else if (isEmpty(form.txtFirstName, 'Please enter your first name.')) {return false;} else if (isEmpty(form.txtLastName, 'Please enter your last name.')) {return false;} else if (isEmpty(form.txtAddress1, 'Please enter your billing address.')) {return false;} else if (isEmpty(form.txtCity, 'Please enter your billing city.')) {return false;} else if (isEmpty(form.txtState, 'Please enter your billing state.')) {return false;} else if (isEmpty(form.txtPostalCode, 'Please enter your billing postal/zip code.')) {return false;} else if (form.txtShipPhone.value == '' && form.txtBillPhone.value == '' && form.txtEmailAddress.value == '') {alert('You have not provided a way for us to contact you, please provide an email address or phone number.');form.txtShipPhone.focus();return false;} else if (isPhone(form.txtShipPhone, 'Please enter a valid phone number.')) {return false;} else if (isPhone(form.txtBillPhone, 'Please enter a valid phone number.')) {return false;} else if (!isEmail(form.txtEmailAddress)) {alert('Please enter a valid email address.');form.txtEmailAddress.focus();return false;} else {form.btnSubmit.disabled = true;form.btnSubmit.value = "Please Wait...";return true;}}function trim(str){return str.replace(/^\s+|\s+$/g,'');}function isEmpty(formElement, message){formElement.value = trim(formElement.value);_isEmpty = false;if (formElement.value == '') {_isEmpty = true;alert(message);formElement.focus();}return _isEmpty;}function isPhone(formElement, message){formElement.value = trim(formElement.value);_notValid = false;if (formElement.value != '') {stripped = formElement.value.replace(/[\(\)\.\-\ ]/g, '');if (stripped.length < 10) {_notValid = true;alert(message);formElement.focus();}else if (isNaN(parseInt(stripped))) {_notValid = true;alert(message);formElement.focus();}}return _notValid;}function isEmail(formElement){formElement.value = trim(formElement.value);_notValid = true;if (formElement.value != '') {_notValid = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;return _notValid.test(formElement.value);}return _notValid;}function isNotPaypal(){_isNotPaypal = false;for (i=0;i<document.frmCheckout.optPayment.length;i++) {if (document.frmCheckout.optPayment[i].checked) {user_input = document.frmCheckout.optPayment[i].value;}}if (user_input != 'paypal') {_isNotPaypal = true;}return _isNotPaypal;}function isCredit(){_isCredit = false;for (i=0;i<document.frmCheckout.optPayment.length;i++) {if (document.frmCheckout.optPayment[i].checked) {user_input = document.frmCheckout.optPayment[i].value;}}if (user_input == 'credit') {_isCredit = true;}return _isCredit;}function isCCID(formElement, message){formElement.value = trim(formElement.value);_notValid = false;if (formElement.value.length < 3) {_notValid = true;alert(message);formElement.focus();}else if (formElement.value.length > 4) {_notValid = true;alert(message);formElement.focus();}else if (isNaN(parseInt(formElement.value))) {_notValid = true;alert(message);formElement.focus();}return _notValid;}function isCCNumber(formElement, message){formElement.value = trim(formElement.value);_notValid = false;if (formElement.value.length < 12) {_notValid = true;alert(message);formElement.focus();}else if (formElement.value.length > 19) {_notValid = true;alert(message);formElement.focus();}else if (isNaN(parseInt(formElement.value))) {_notValid = true;alert(message);formElement.focus();}return _notValid;}function messageLength(field, cntfield, maxchar){if (field.value.length > maxchar) {field.value = field.value.substring(0, maxchar);}else {cntfield.value = maxchar - field.value.length;}}function openWindow(popupLink){window.open (popupLink,"picturewindow","scrollbars=1,width=700,height=550,left=50,top=25,screenX=50,screenY=25"); }function loadThumb(number,server){document.partImage.src=(server + "ZkarloImages/ProductImages/" + number + ".jpg");}function loadThumb2(number,page,server){document.partImage.src=(server + "ZkarloImages/ThumbnailImages/ThumbLarge-" + number + ".jpg");document.getElementById("viewImage").href=page;}function checkNumber(textBox){while (textBox.value.length > 0 && isNaN(textBox.value)) {textBox.value = textBox.value.substring(0, textBox.value.length - 1);}}function initialize() {if (GBrowserIsCompatible()) {var myMap = new GMap2(document.getElementById("zkarlo_map"));var myLatitude = 44.740274;var myLongitude = -93.328095;var myLocation = new GLatLng(myLatitude, myLongitude);var myMarker = new GMarker(myLocation);myMap.setCenter(myLocation, 11);myMap.setUIToDefault();myMap.addOverlay(myMarker);}}