// JavaScript Document function checkMaxChar(id, limit) { object = document.getElementById(id); var objectLength = eval(object.value.length); var diff = objectLength - limit; var msg = "Too many characters entered, you have entered "+objectLength+" characters, please adjust your entry to no more than "+limit+" characters"; if(objectLength > limit) { alert(msg); return false; } else { return true; } } function openNewsletter() { var url = 'newsletter-signup.html'; var winName = 'Newsletter Signup'; var feat = 'height=400,width=400,status=yes,toolbar=no,menubar=no,location=no'; url = 'http://www.kitchenwarehouse.com.au/'+url; var WindowObj = window.open(url,winName,feat); } function updateShipping() { disable = document.getElementById('custShipSame').checked; document.getElementById('custShipName').disabled = disable; document.getElementById('custShipStreet').disabled = disable; document.getElementById('custShipCity').disabled = disable; document.getElementById('custShipState').disabled = disable; document.getElementById('custShipPostcode').disabled = disable; document.getElementById('custShipCountry').disabled = disable; } function doSignup() { var winName = 'Signup'; var feat = 'height=400,width=400,status=yes,toolbar=no,menubar=no,location=no,resize=yes'; var email = document.newsletterForm.email.value; var url = 'http://lists.perthweb.com.au/subscribe.kw.cfm?listId=sales&domainId=kitchenwarehouse.com.au&emailAddr='+email+'&firstname=&lastname='; var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (filter.test(email)) var WindowObj = window.open(url,winName,feat); else alert('You have entered an invalid email address.\n Please enter a valid address and try again.'); } function doFullImage(obj) { url = obj.href; var winName = 'Image'; var feat = 'height=636,width=639,status=no,toolbar=no,menubar=no,location=no'; var WindowObj = window.open(url,winName,feat); } function doSearch() { url = 'http://www.kitchenwarehouse.com.au/index.cfm/fa/product.searchprod/keywords/'; string = document.getElementById('keywords').value; if(string == "") { alert("You must enter keywords to search by"); } else { window.location = url + string; } } function advertisedSwitch( ) { url = 'http://www.kitchenwarehouse.com.au/index.cfm/fa/product.search/groupID/'; id = document.getElementById('advertisedDropDown').value; if(id > 0) { url = url + id + '/'; window.location = url; } } function brandsSwitch( ) { url = 'http://www.kitchenwarehouse.com.au/index.cfm/fa/product.search/brandID/'; id = document.getElementById('brandsDropDown').value; if(id > 0) { url = url + id + '/'; window.location = url; } } function giftSwitch() { url = 'http://www.kitchenwarehouse.com.au/index.cfm/fa/product.search/groupID/'; id = document.getElementById('giftIdeasDropDown').value; if(id > 0) { url = url + id + '/'; window.location = url; } } function brandsInCatSwitch(obj) { url = 'http://www.kitchenwarehouse.com.au/index.cfm/fa/product.search/brandID/'; id = obj.value; if(id > 0) { url = url + id + '/'; window.location = url; } } function allSpecialSwitch( ) { url = 'http://www.kitchenwarehouse.com.au/index.cfm/fa/product.detail/productID/'; id = document.getElementById('allSpecialDropDown').value; if(id > 0) { url = url + id + '/'; window.location = url; } } function newDownSwitch( ) { url = 'http://www.kitchenwarehouse.com.au/index.cfm/fa/product.detail/productID/'; id = document.getElementById('newDropDown').value; if(id > 0) { url = url + id + '/'; window.location = url; } } function paymentDesc(url,winName) { var feat = 'height=400,width=450,status=yes,toolbar=no,menubar=no,location=no'; var WindowObj = window.open(url,winName,feat); } function clear_field( theid ) { value = document.getElementById('' + theid + '').value; if ( value == 'Sign up to our newsletter' || value == 'Type Here To Search' ) { document.getElementById('' + theid + '').value = ''; } } function checkMail( url ) { if(url == "" || url == null) { url = "/index.cfm/fa/customer.login"; } var strEmail = document.logcostumer.loginEmail.value; var strPassword = document.logcostumer.loginPassword.value; var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( (strEmail == '') || (strPassword == '') ) { alert("Please make sure you have entered both your email and password."); document.logcostumer.loginEmail.focus(); return false; } else if (!filter.test(strEmail)) { alert("The email address seems to be invalid. Please try again."); document.logcostumer.loginEmail.focus(); return false; } else { document.logcostumer.action = url; document.logcostumer.submit(); } } function max_char(val) { var max = 250 if (val.giftMessage.value.length > max) { val.giftMessage.value = val.giftMessage.value.substring(0,max) rest = 0 } else { rest = max - val.giftMessage.value.length } }