function setupRemoveAjax() { $("a.remove").click(function () { var a = $(this).attr("href"); a = a.substring(a.indexOf("=") + 1); var b = $(this).closest("tr"); var c = $(b).find("input").val(); var d = $("tr.total td:nth-child(3)").text(); $.ajax({ url: "/snippets/xShop/shopController.php?ajaxReq=1&remove=" + a, async: false, success: function (a) { $(b).fadeOut(300, function () { $(this).remove(); loadCartPreview(); $("tr.total td:nth-child(3)").text(parseInt(d) - parseInt(c)); $("tr.total td:nth-child(5)").text("$" + a); if (a == "0.00") { $(".controls").fadeOut(200, function () { $(this).remove() }) } }) } }); return false }) } function loadCartPreview(a) { var b = $.ajax({ url: "/snippets/xShop/shopController.php?cartpreview=1", async: false }).responseText; $("#cart").empty().append(b); $("#cart a.view").mouseup(function () { if ($("#cart").hasClass("active")) { $("#cart").removeClass("active") } else { $("#cart").addClass("active") } $("#cart .preview").toggle("slide", { direction: "up", easing: "easeOutCirc" }, 300) }); $("html").unbind().mousedown(function () { if ($("#cart .preview").css("display") == "block") { $("#cart").removeClass("active"); $("#cart .preview").hide("slide", { direction: "up", easing: "easeOutCirc" }, 300) } }); $("#cart").unbind().mousedown(function (a) { a.stopPropagation() }); if (a) { $("#cart").addClass("active"); $("#cart .preview").show("slide", { direction: "up", easing: "easeOutCirc" }, 300); setTimeout(function () { if ($("#cart .preview").css("display") == "block") { $("#cart").removeClass("active"); $("#cart .preview").hide("slide", { direction: "up", easing: "easeOutCirc" }, 300) } }, 2e3) } } function prepareZoom(a) { var b = $(a).children()[0].id; var c = $(a).children().length; if (b == "f0") { $(a).css("display", "block").addClass("active") } else { setTimeout(function () { $(a).css("display", "none") }, 500) } if (b == "f" + (c - 1)) { setTimeout(function () { $("#full").css({ height: "auto", overflow: "visible" }) }, 500) } } function $_GET(a) { var b = window.location.search.substring(1); var c = b.split("&"); for (i = 0; i < c.length; i++) { var d = c[i].split("="); if (d[0] == a) { return d[1] } } } jQuery(function (a) { a("form#search input:first-child").focus(function () { if (this.value == this.defaultValue) { this.value = "" } }).blur(function () { if (this.value == "") { this.value = this.defaultValue } }); if (a("#cart").length) { loadCartPreview() } if (a("#t0").length) { a("#thumbs img").mousedown(function () { var b = this.id.replace("t", "#f"); var c = this.id.replace("t", "#t"); if (a(b).hasClass("cloud-zoom")) { if (!a(b).parent().hasClass("active")) { a("#full .active").removeClass("active").fadeOut(300, function () { a(b).parent().fadeIn(200).addClass("active"); a("#thumbs .active").removeClass("active"); a(c).addClass("active") }) } } else { if (!a(b).hasClass("active")) { a("#full .active").removeClass("active").fadeOut(300, function () { a(b).fadeIn(200).addClass("active"); a("#thumbs .active").removeClass("active"); a(c).addClass("active") }) } } }) } if (a("form#shopProduct").length) { a("form#shopProduct").submit(function () { a(this).ajaxSubmit({ url: "../snippets/xShop/shopController.php?ajaxReq=1", type: "post", success: function (b) { var c = a('
"); a("#controls").prepend(c); a("#controls .message").show("pulsate", { times: 3 }, 300); setTimeout(function () { a("#controls .message").fadeOut(300, function () { a(this).remove() }) }, 3e3); loadCartPreview(true) } }); return false }) } if (a("form#shopCart").length) { a("form#shopCart").submit(function () { a(this).ajaxSubmit({ url: "/snippets/xShop/shopController.php?ajaxReq=1", type: "post", success: function (b) { var c = a(''); a(c).append(b); a(document.body).prepend(c); var d = a("#temp table.cart"); var e = a("#temp p").text(); a(".xShopCart.edit").prepend('"); a(".xShopCart.edit .message").show("pulsate", { times: 3 }, 300); setTimeout(function () { a(".xShopCart.edit .message").fadeOut(300, function () { a(this).remove() }) }, 3e3); a("#temp").remove(); a(".xShopCart.edit table.cart").replaceWith(d); setupRemoveAjax(); loadCartPreview(); if (a("form#shopCart input#proceed").hasClass("clicked")) { window.location = "./checkout/" } } }); return false }); a("form#shopCart input#proceed").click(function () { a(this).addClass("clicked"); a("form#shopCart").submit(); return false }); setupRemoveAjax() } if (a(".xShopCartAddress").length) { switch (a(".ship_options input:checked").val()) { case "1": a("fieldset.shipping").css("display", "block"); break; case "2": a("fieldset.shipping").css("display", "none"); a("fieldset.ship_options .freight").css("display", "none"); break; default: a("fieldset.shipping").css("display", "none"); break } a('input[name="ship_option"]').change(function () { switch (a(this).val()) { case "1": a("fieldset.shipping").fadeIn(200); a("fieldset.ship_options .freight").fadeIn(200); break; case "2": a("fieldset.shipping").fadeOut(200); a("fieldset.ship_options .freight").fadeOut(200); break; default: a("fieldset.shipping").fadeOut(200); a("fieldset.ship_options .freight").fadeIn(200); break } }) } })