var shareScroll = {};var sortProducts = {};var checkAddToBasket = {};var checkOrderSummary = {};var remove = {};var err,s,q,s_bits;var applyDiscount = {};$(document).ready(function () { /* Sort */ sortProducts = function(x) {	window.open(x+$("#sort").attr('value')+'/','_self'); }; /* Thumbnails */ $(".thumb-link").click(function () {  var id_bits = this.id.split("_");	for (i=1; i<=3; i++) {		if (i == id_bits[2]) {			$("div#prod-pic-"+i).show();		} else {			$("div#prod-pic-"+i).hide();		}	}  }); /* Remove */ $("img.remove").click(function() {	var r = $(this).attr('id').split("_");	var msg = window.confirm('Remove this item from your basket?');	if (msg) {	 	window.open('/twins-shop/your-basket/?do=remove-item&b='+r[1]+'&d='+r[2],'_self');	} }); /* Buttons */ $("#buttonBasket").click(function() {	window.open('/twins-shop/your-basket/','_self'); }); $("#buttonEdit").click(function() {	window.open('/twins-shop/order/delivery/','_self'); }); $("#returnToList").click(function() {	window.history.go(-1); }); /* Add to Basket */ checkAddToBasket = function() {	err = 1;	if ($("#o").attr('value') != '') {		for (var i=1; i<=$("#o").attr('value'); i++) {			var s = $("#s_"+i).attr('value');			var q = $("#q_"+i).attr('value');			if (s && q) {				if (s != '' && q != '') {					s_bits = s.split("_");					if (s_bits[0] > 0 && s_bits[1] > 0 && s_bits[2] > 0) {						err = 0;					}				}			}		}	}	if (err == 0) {		return true;	} else {		alert("Please select the size and quantity your require.");		return false;	} }; /* Order Summary */ checkOrderSummary = function() {	var terms = $("#terms").attr('checked');	if (terms) {		return true;	} else {		alert('Please read and agree to our Terms & Conditions');		return false;	} }; /* Where */ $("#where").change(function() { 	if (this.value == 'other') { 		$("#other-div").show(); 	} else { 		$("#other-div").hide(); 	} });  /* Gift List */ $("a.giftlist").click(function() {	var msg = window.confirm('Save your basket as a gift list?');	if (msg) {	 	window.open('/twins-shop/order/gl/','_self');	} }); /* Share Scroll */ shareScroll = function(x) {	$.scrollTo(x,800); }; /* Gallery */ $('#gallery').innerfade({ 	speed: 3000,	timeout: 4500 }); /* Discount */ applyDiscount = function() { 	window.open("/basket.php?do=discount-code&code="+$('#discount').val(),"_self"); };/* tell a friend fancybox */$('.tell-a-friend').fancybox({    'type' :  'iframe',    'width' : 586,    'height' : 345,    'overlayOpacity': 0.8,    'titleShow': false});});
