//Jquery document ready routines here $( document ).ready(function() { $('.mnuBtn_tdvd,.mnuBtn_tb,.mnuBtn_ast').bind('mouseover', openSubMenu); $('.mnuBtn_tdvd,.mnuBtn_tb,.mnuBtn_ast').bind('mouseout', closeSubMenu); function openSubMenu() { $(this).find('.mnuBtnSubdiv').css('visibility', 'visible'); }; function closeSubMenu() { $(this).find('.mnuBtnSubdiv').css('visibility', 'hidden'); }; $('#checkoutDIVactive').hide(); $('#checkoutDIVinactive').show(); //jquery setup for the basket - START $( ".basketItemQty" ).spinner({ min: 0, change: function( event, ui ) { var v = parseInt($(this).val()); var prodID = $(this).attr('id'); var total=0; if (isNaN(v)) { $(this).val('1'); } else if (v < 0) { $(this).val(0); } else { $(this).val(v); } $('.subtotalRow').hide(); $('.shippingRow').hide(); $('.discountRow').hide(); $('.totalRow').hide(); $('#checkoutBasket').hide(); $('.basketChangedRow').show(); $('#updateBasket').show(); $("#subtotal_"+prodID).html("£"+(parseFloat($("#price_"+prodID).val()) * parseInt($(this).val())).toFixed(2)); $("[id^='subtotal_']").each(function() { var num = ($(this).text()).replace(/[^0-9\.]+/g, ""); total += parseFloat(num); }); $("#grandtotal").html("£"+total.toFixed(2)); }, spin: function( event, ui ) { var prodID = $(this).attr('id'); var total=0; $('.subtotalRow').hide(); $('.shippingRow').hide(); $('.discountRow').hide(); $('.totalRow').hide(); $('#checkoutBasket').hide(); $('.basketChangedRow').show(); $('#updateBasket').show(); $("#subtotal_"+prodID).html("£"+(parseFloat($("#price_"+prodID).val()) * parseInt($(this).val())).toFixed(2)); $("[id^='subtotal_']").each(function() { var num = ($(this).text()).replace(/[^0-9\.]+/g, ""); total += parseFloat(num); }); $("#grandtotal").html("£"+total.toFixed(2)); }, start: function( event, ui ) { var prodID = $(this).attr('id'); var total=0; $('.subtotalRow').hide(); $('.shippingRow').hide(); $('.discountRow').hide(); $('.totalRow').hide(); $('#checkoutBasket').hide(); $('.basketChangedRow').show(); $('#updateBasket').show(); $("#subtotal_"+prodID).html("£"+(parseFloat($("#price_"+prodID).val()) * parseInt($(this).val())).toFixed(2)); $("[id^='subtotal_']").each(function() { var num = ($(this).text()).replace(/[^0-9\.]+/g, ""); total += parseFloat(num); }); $("#grandtotal").html("£"+total.toFixed(2)); }, stop: function( event, ui ) { var prodID = $(this).attr('id'); var total=0; $('.subtotalRow').hide(); $('.shippingRow').hide(); $('.discountRow').hide(); $('.totalRow').hide(); $('#checkoutBasket').hide(); $('.basketChangedRow').show(); $('#updateBasket').show(); $("#subtotal_"+prodID).html("£"+(parseFloat($("#price_"+prodID).val()) * parseInt($(this).val())).toFixed(2)); $("[id^='subtotal_']").each(function() { var num = ($(this).text()).replace(/[^0-9\.]+/g, ""); total += parseFloat(num); }); $("#grandtotal").html("£"+total.toFixed(2)); } }); //jquery setup for the basket - END //Any tabs on the page $( "#tabs" ).tabs(); //Any buttons on the page $( "input[type=submit],button,input[type=button]" ).button(); }); function newsletterSignup(email){ $.get( "///newsletter_signup.asp", { e: email } ).done(function(){ var n = noty({ layout: 'center', type: 'success', text: 'Thank you, your newsletter signup has been received.

We will now send you an email - please click the link in the email to confirm your subscription', animation: { open: {height: 'toggle'}, close: {height: 'toggle'}, easing: 'swing', speed: 100 }, timeout: 0, modal: true, killer:true }); }); }; function toggleCart(prodID,title,img,size,colour,goToDetailPage,category){ var str = img.src; if(str == null) str = "add_to"; var ret = ""; var cartItemCount="0"; var cartTotalPrice="0"; if (str.indexOf("add_to") > 0){ if (goToDetailPage==true){ window.location='///'+category+'/'+prodID+'/'+title.replace(/ /g,"_")+'.html'; }else{ $.get( "///amend_cart.asp", { process: "add", prodID: prodID, size: size, colour: colour } ) .done(function( data ) { ret=data; cartItemCount = ret.split(',')[0] cartTotalPrice = ret.split(',')[1] if (cartItemCount=="0"){ $('#checkoutDIVactive').hide(); $('#checkoutDIVinactive').show(); str='

Your shopping basket is empty.

'; }else{ $('#checkoutDIVactive').show(); $('#checkoutDIVinactive').hide(); if (cartItemCount=="1") { str='

You have 1 item in your shopping basket.

'; $('#basket_contents').html("1 item, £"+parseFloat(cartTotalPrice).toFixed(2)); }else{ str='

You have '+cartItemCount+' items in your shopping basket.

'; $('#basket_contents').html(cartItemCount+" items, £"+parseFloat(cartTotalPrice).toFixed(2)); } } var n = noty({ layout: 'topRight', type: 'success', text: title+" ADDED to your basket!"+str, animation: { open: {height: 'toggle'}, close: {height: 'toggle'}, easing: 'swing', speed: 100 }, timeout: 2000, modal: false, killer:true }); img.src='///images/remove_from_cart_97w.png'; }); } }else{ $.get( "///amend_cart.asp", { process: "remove", prodID: prodID, size: size, colour: colour } ) .done(function( data ) { ret=data; cartItemCount = ret.split(',')[0] cartTotalPrice = ret.split(',')[1] if (cartItemCount=="0"){ $('#checkoutDIVactive').hide(); $('#checkoutDIVinactive').show(); str='

Your shopping basket is empty.

'; }else{ $('#checkoutDIVactive').show(); $('#checkoutDIVinactive').hide(); if (cartItemCount=="1") { str='

You have 1 item in your shopping basket.

'; $('#basket_contents').html("1 item, £"+parseFloat(cartTotalPrice).toFixed(2)); }else{ str='

You have '+cartItemCount+' items in your shopping basket.

'; $('#basket_contents').html(cartItemCount+" items, £"+parseFloat(cartTotalPrice).toFixed(2)); } } var n = noty({ layout: 'topRight', type: 'error', text: title+" REMOVED from your basket!"+str, animation: { open: {height: 'toggle'}, close: {height: 'toggle'}, easing: 'swing', speed: 100 }, timeout: 2000, modal: false, killer:true }); img.src='///images/add_to_cart_97w.png'; }); } } function toggleCartLarge(prodID,title,img,size,colour,goToDetailPage,category){ var str = img.src; if(str == null) if(img.innerText != "Remove from cart") str = "/images/add_to_cart.png"; else str = ""; var ret = ""; var cartItemCount="0"; var cartTotalPrice="0"; if (str.indexOf("add_to") > 0){ if (goToDetailPage==true){ window.location='///'+category+'/'+prodID+'/'+title.replace(/ /g,"_")+'.html'; }else{ $.get( "///amend_cart.asp", { process: "add", prodID: prodID, size: size, colour: colour } ) .done(function( data ) { ret=data; cartItemCount = ret.split(',')[0] cartTotalPrice = ret.split(',')[1] if (cartItemCount=="0"){ $('#checkoutDIVactive').hide(); $('#checkoutDIVinactive').show(); str='

Your shopping basket is empty.

'; }else{ $('#checkoutDIVactive').show(); $('#checkoutDIVinactive').hide(); if (cartItemCount=="1") { str='

You have 1 item in your shopping basket.

'; $('#basket_contents').html("1 item, £"+parseFloat(cartTotalPrice).toFixed(2)); }else{ str='

You have '+cartItemCount+' items in your shopping basket.

'; $('#basket_contents').html(cartItemCount+" items, £"+parseFloat(cartTotalPrice).toFixed(2)); } } var n = noty({ layout: 'topRight', type: 'success', text: title+" ADDED to your basket!"+str, animation: { open: {height: 'toggle'}, close: {height: 'toggle'}, easing: 'swing', speed: 100 }, timeout: 2000, modal: false, killer:true }); if(img.src != null) img.src='///images/remove_from_cart.png'; else img.innerHTML = "Remove from cart"; }); } }else{ $.get( "///amend_cart.asp", { process: "remove", prodID: prodID, size: size, colour: colour } ) .done(function( data ) { ret=data; cartItemCount = ret.split(',')[0] cartTotalPrice = ret.split(',')[1] if (cartItemCount=="0"){ $('#checkoutDIVactive').hide(); $('#checkoutDIVinactive').show(); str='

Your shopping basket is empty.

'; }else{ $('#checkoutDIVactive').show(); $('#checkoutDIVinactive').hide(); if (cartItemCount=="1") { str='

You have 1 item in your shopping basket.

'; $('#basket_contents').html("1 item, £"+parseFloat(cartTotalPrice).toFixed(2)); }else{ str='

You have '+cartItemCount+' items in your shopping basket.

'; $('#basket_contents').html(cartItemCount+" items, £"+parseFloat(cartTotalPrice).toFixed(2)); } } var n = noty({ layout: 'topRight', type: 'error', text: title+" REMOVED from your basket!"+str, animation: { open: {height: 'toggle'}, close: {height: 'toggle'}, easing: 'swing', speed: 100 }, timeout: 2000, modal: false, killer:true }); if(img.src != null) img.src='///images/add_to_cart.png'; else img.innerHTML = "Add to cart"; }); } }