/* Copyright David B. Zwiefelhofer. All rights reserved. */ function shipping_amount(subtotal) { country_id = "36"; shipping = 0; if (subtotal && country_id) { if (country_id == 36) { // US if (subtotal <= 50) { shipping = 5; } else if (subtotal <= 200) { shipping = 10; } else { shipping = 20; } } else if (country_id == 6) { // Canada shipping = 50; } } return shipping; } function tax_amount(subtotal, shipping) { state_id = "0"; tax = 0; taxable = subtotal; if (taxable && state_id) { if (state_id == 50) { // Wisconsin tax = Math.round((0.056*taxable)*100)/100 } } return tax; } var supports_subpixel_letterspacing = subpixel_word_spacing(); var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; function touch_enabled() { try { document.createEvent("TouchEvent"); return true; } catch (e) { return false; } } window.goBack = function (e){ var defaultLocation = "https://www.andis.com/"; var oldHash = window.location.hash; history.back(); // Try to go back var newHash = window.location.hash; /* If the previous page hasn't been loaded in a given time (in this case * 1000ms) the user is redirected to the default location given above. * This enables you to redirect the user to another page. * * However, you should check whether there was a referrer to the current * site. This is a good indicator for a previous entry in the history * session. * * Also you should check whether the old location differs only in the hash, * e.g. /index.html#top --> /index.html# shouldn't redirect to the default * location. */ if( newHash === oldHash && (typeof(document.referrer) !== "string" || document.referrer === "") ){ window.setTimeout(function(){ // redirect to default location window.location.href = defaultLocation; },1000); // set timeout in ms } if(e){ if(e.preventDefault) e.preventDefault(); if(e.preventPropagation) e.preventPropagation(); } return false; // stop event propagation and browser default event } function subpixel_word_spacing() { var subpixelWordSpacing = false; if (document.defaultView && document.defaultView.getComputedStyle) { // Store the original word spacing on the document element var originalWordSpacing = document.defaultView.getComputedStyle(document.documentElement, null).wordSpacing; // Set the word-spacing to half a pixel document.documentElement.style.wordSpacing = '0.5px'; // This will return either 0px or 1px if sub-pixel word-spacing is not supported, otherwise // it will return 0.5px. subpixelWordSpacing = document.defaultView.getComputedStyle(document.documentElement, null).wordSpacing === '0.5px'; // Restore the original word-spacing document.documentElement.style.wordSpacing = originalWordSpacing; return subpixelWordSpacing; } else { return false; } } function dummy() { alert('dummy'); } function update_cart_display(num_items, sc_total) { //alert("num_iTems: " + num_items+" , "+sc_total); if (document.getElementById('cart_items')) { document.getElementById('cart_items').innerHTML = (num_items) ? num_items : 0; } if (document.getElementById('cart_items')) { document.getElementById('cart_items_label').innerHTML = (num_items) > 1 ? "items / " : "item / "; } if (document.getElementById('cart_total')) { document.getElementById('cart_total').innerHTML = (sc_total.length > 0) ? '$'+sc_total : "0.00"; } } var host = "https://www.andis.com/"; var ui = 0; var sck = ""; var num_items = 0; var sc_total = "0.00"; $(document).ready(function() { update_cart_display(num_items, sc_total); });