/*
 * eSellerPro Lib 0.3.3
 * copyright (c) Sandbourne Systems
 */

function prependSign(a){if(a==""){return a+"?"}else{return a+"&"}}function decode(a){return decodeURIComponent(a.split("+").join(" "))}function getQueryVariables(){var a={};document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g,function(){a[decode(arguments[1])]=decode(arguments[2])});return a}function pricePresent(){price_min=Math.floor(price_min);price_left=Math.floor(price_left);price_max=Math.ceil(price_max);price_right=Math.ceil(price_right);if(price_min==price_max){return false}else{return true}}(function(a){a.fn.exists=function(){return jQuery(this).length>0}})(jQuery);(function(a){a.fn.brandSlider=function(e){var f=this;var d=0;var e=a.extend({interval:5000,speed:1000},e);return this.each(function(){var h=a(this);g(h);setTimeout(function(){c(h)},e.interval)});function g(h){var j=a("li",h).size();var i=a("li",h).outerWidth(true);h.css("width",(1+j)*i)}function c(h){b(h);d=setTimeout(function(){c(h)},e.interval)}function b(h){var i=a("li",h).outerWidth(true);var k=a("li:first",h);var j=a("li:last",h);k.clone().appendTo(h);h.animate({left:-i},e.speed,function(){k.remove();h.css("left",0)})}}})(jQuery);(function(a){a.fn.tabbedContainer=function(b){var d=this;var b=a.extend({},b);return this.each(function(){c(a(this))});function c(e){a(".Tabs a",e).each(function(f){a(this).click(function(i){var h=f;a(".Tabs a",e).each(function(j){if(j==h){a(this).addClass("Selected")}else{a(this).removeClass("Selected")}});a(".Tab-Content",e).each(function(j){if(j==h){a(this).removeClass("Deselected")}else{a(this).addClass("Deselected")}});var g=a(this).attr("href");if(g==""||g=="#"){i.preventDefault()}})});if (!$('.Tabs a',e).hasClass('Selected')) a(".Tabs a:first",e).addClass("Selected");a(".Tab-Content:gt(0)",e).addClass("Deselected")}}})(jQuery);(function(a){a.fn.dropdowns=function(b){var c=this;var b=a.extend({},b);return this.each(function(){d(a(this))});function d(e){a("li a",e).each(function(){var g=a(this).parent().find("ul");var f=a(this);a(this).mouseenter(function(){g.show();f.addClass("hover")});a(this).mouseleave(function(){g.hide();f.removeClass("hover")});g.hover(function(){a(this).show();f.addClass("hover")});g.mouseleave(function(){a(this).hide();f.removeClass("hover")})})}}})(jQuery);(function(a){a.fn.advancedSearch=function(c){var e=this;var c=a.extend({key:"cfsearch",value:"cfvalue"},c);return this.each(function(){b(a(this))});function b(f){var g=a("form",f);if(a("input[type=submit]",f).exists()){a("form",f).submit(function(h){d(g);h.preventDefault()})}else{if(a("input[type=button]",f).exists()){a("input[type=button]",f).click(function(h){d(g);h.preventDefault()})}}}function d(k){var g=k.attr("action");var l="";var h=1;var f="";var j="";a("option:selected",k).each(function(){if(a(this).val()!="-1"){f=a(this).parent().attr("name");if(f=="searchPrice"){l=prependSign(l)+f+"="+a(this).val()}else{if(f=="Category"){j=a(this).val()}else{l=prependSign(l)+c.key+h+"="+f+"&"+c.value+h+"="+a(this).val();h++}}}});if(l!=""){if(j!=""){document.location.href="/"+j+"/"+l}else{document.location.href=g+l}}}}})(jQuery);(function(a){a.fn.filterAction=function(c){var d=this;var b=getQueryVariables();var c=a.extend({key:"cfsearch",value:"cfvalue"},c);return this.each(function(){if(a(this).is("select")){a(this).change(function(){e()})}else{if(a(this).is("div")){e()}else{a(this).click(function(){e()})}}});function e(){var g="";var j=null;var h=1;a("#Menu-Filter table").each(function(){var k=a(this).attr("id");var i=0;a(this).find("input:checked").each(function(){j=a(this).attr("name");if(i==0){g=prependSign(g)+c.key+h+"="+k+"&"+c.value+h+"="+j;h++}else{g+=","+j}i++})});if(a("#Slider-Price-Range").exists()){price_left=a("#Slider-Price-Range").slider("values",0);price_right=a("#Slider-Price-Range").slider("values",1)}if(a("select[name=searchPrice]").val()!="-1"&&(!a("#Slider-Price-Range").exists()||b.searchPrice!=a("select[name=searchPrice]").val())){g=prependSign(g)+"searchPrice="+a("select[name=searchPrice]").val()}else{if(price_min!=price_left||price_right!=price_max){j=price_left+"t"+price_right;g=prependSign(g)+"searchPrice="+j}}if(categoryID!=""){g=prependSign(g)+"catid="+categoryID}if(searchquery!=""){g=prependSign(g)+"searchquery="+searchquery}if(a("select[name=SearchSortBy]").val()!="-1"){g=prependSign(g)+"SearchSortBy="+a("select[name=SearchSortBy]").val()}f(g)}function f(g){a("#LoadingBG").css("top",a(document).scrollTop()).css("display","block");document.location.href=g}}})(jQuery);(function(a){a.fn.sortFilter=function(c){var e=this;var b=getQueryVariables();var c=a.extend({key:"cfsearch",value:"cfvalue"},c);return this.each(function(){d(a(this))});function d(f){if(b.SearchSortBy){a("select[name=SearchSortBy]").val(b.SearchSortBy)}if(b.searchPrice){a("select[name=searchPrice]").val(b.searchPrice)}a("select",f).filterAction()}}})(jQuery);(function(a){a.fn.menuFilter=function(e){var f=this;var b=getQueryVariables();var d=pricePresent();var e=a.extend({key:"cfsearch",value:"cfvalue",keyRange:"cfrangename",valRange:"cfrangevalue"},e);return this.each(function(){c(a(this))});function c(g){var j=1;while(true){if(b[e.key+j]&&b[e.key+j]||b[e.keyRange+j]&&b[e.valRange+j]){var h=b[e.value+j].split(",");for(var k in h){a("input[name="+h[k]+"]",g).attr("checked",true);anchor_item=a("<a></a>").addClass("Filter-Close").attr("href",h[k]);new_item=a("<p></p>").addClass("Filter-Selection").text(h[k]);a("#Selection div").append(new_item).append(anchor_item);a("#td"+h[k]).addClass("hover");a("#th"+h[k]).addClass("hover")}j++;continue}break}if(j>1){a("#Selection",g).show();a("#Selection a",g).click(function(i){a("input[name="+a(this).attr("href")+"]",g).attr("checked","");i.preventDefault()});a("#Selection a",g).filterAction()}a("input",g).filterAction();if(d){if(b.searchPrice){prices=b.searchPrice.split("t");prices[0]=parseInt(prices[0]);prices[1]=parseInt(prices[1]);if(prices[0]<=prices[1]){if(prices[0]>price_min&&prices[0]<price_max){price_left=prices[0]}if(prices[1]>price_min&&prices[1]<price_max){price_right=prices[1]}}}a("#Slider-Price-Range",g).slider({range:true,min:price_min,max:price_max,values:[price_left,price_right],slide:function(i,l){a("#Price-Left",g).html("&pound;"+l.values[0]);a("#Price-Right",g).html("&pound;"+l.values[1])},change:function(i,l){a(this).filterAction()}});a("#Price-Left",g).html("&pound;"+a("#Slider-Price-Range").slider("values",0));a("#Price-Right",g).html("&pound;"+a("#Slider-Price-Range").slider("values",1))}else{a("#Price",g).hide()}}}})(jQuery);
