(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);_M_jQ=jQuery.noConflict();;_M_jQ(document).ready(function(){var reload_nav=true;var reload_compare=true;var page_url="";var cartDeleteText="";function setReload_nav(a){window.reload_nav=a;}
function getReload_nav(){return window.reload_nav;}
function setReload_compare(a){window.reload_compare=a;}
function getReload_compare(){return window.reload_compare;}
function setCartDeleteText(a){window.cartDeleteText=a;}
setReload_nav(true);setReload_compare(true);var hash=location.hash.slice(1);if(hash!=""){handleHashChange();}
_M_jQ(window).hashchange(function(e){handleHashChange();});function StartSlider(){min_price=0;max_price=parseInt(_M_jQ("input#price_maximum").val());step_val=_M_jQ("input#step_value").val();step_val=parseInt(step_val);_M_jQ("#slider-range-price").slider({range:true,min:0,max:max_price,step:step_val,values:[_M_jQ("#init_price_minimum").val(),_M_jQ("#init_price_maximum").val()],slide:function(event,ui){_M_jQ("input#price_maximum").val(_M_jQ("#slider-range-price").slider("values",1));_M_jQ("input#price_minimum").val(_M_jQ("#slider-range-price").slider("values",0));},change:function(event,ui){_M_jQ("input#price_maximum").val(_M_jQ("#slider-range-price").slider("values",1));_M_jQ("input#price_minimum").val(_M_jQ("#slider-range-price").slider("values",0));new_url=ajaxListURL(_M_jQ("#price_slider_url").val())+"&price="+_M_jQ("#slider-range-price").slider("values",0)+","+_M_jQ("#slider-range-price").slider("values",1);setReload_nav(true);setReload_compare(false);window.location.hash=hashUrl(new_url);}});_M_jQ("input#price_maximum").val(_M_jQ("#slider-range-price").slider("values",1));_M_jQ("input#price_minimum").val(_M_jQ("#slider-range-price").slider("values",0));}
StartSlider();_M_jQ("table.pager select,table.view-by select").live('change',function(){setReload_nav(false);setReload_compare(false);window.location.hash=hashUrl(_M_jQ(this).val());return false;});_M_jQ("table.pager a, table.view-by a").live('click',function(){setReload_nav(false);setReload_compare(false);window.location.hash=hashUrl(_M_jQ(this).attr("href"));return false;});_M_jQ(".box.layered-nav #narrow-by-list a, .box.layered-nav .currently a, .box.layered-nav .actions a, .box.layered-nav .narrowed-category li a").live("click",function(){setReload_nav(true);setReload_compare(true);if(_M_jQ(this).attr("id")=="price-filter-button"){step_val=parseInt(_M_jQ("input#step_value").val());request_price_min=Math.floor(_M_jQ("#price_minimum").val()/step_val)*step_val;request_price_max=Math.ceil(_M_jQ("#price_maximum").val()/step_val)*step_val;new_url=ajaxListURL(_M_jQ("#price_slider_url").val())+"&price="+request_price_min+","+request_price_max;window.location.hash=hashUrl(new_url);}else{window.location.hash=hashUrl(_M_jQ(this).attr("href"));}
return false;});_M_jQ(".col-main p.add-to a").live('click',function(){if(!_M_jQ(this).hasClass("link-cart")){setReload_nav(false);setReload_compare(true);loadAjaxProductsList(_M_jQ(this).attr("href"),false,true);return false;}});_M_jQ(".box.mini-compare-products a.widget-btn, .box.mini-compare-products .actions a").live('click',function(){setReload_nav(false);setReload_compare(true);loadAjaxProductsList(_M_jQ(this).attr("href"),false,true);return false;});_M_jQ("#price_minimum, #price_maximum").live("keyup",function(event){if(event.keyCode==13){_M_jQ("#price-filter-button").click();}});function handleHashChange(){var hash=location.hash.slice(1);path=window.location.href;path=path.split("#")[0];path=path.split("?")[0];path=ajaxListURL(path+"?"+hash);nv=getReload_nav();cm=getReload_compare();loadAjaxProductsList(path,nv,cm,false);setReload_nav(true);setReload_compare(true);}
function loadAjaxProductsList(e,f,g,h){e=ajaxListURL(e);_M_jQ(".col-main").append("<div class=\"products-list-loader\"><div></div></div>");if(f){_M_jQ(".box.layered-nav").append("<div class=\"products-list-loader\"><div></div></div>");}
_M_jQ.get(e,{},function(a,b,c){if(b=="error"){_M_jQ(".col-main").html("<p>There was an error making the AJAX request</p>");}else{var d=_M_jQ("<div />").html(a);_M_jQ(".col-main").html(d.find('.col-main').html());if(f){_M_jQ(".box.layered-nav").html(d.find('.box.layered-nav').html());StartSlider();}
if(g){_M_jQ(".box.mini-compare-products").html(d.find('.box.mini-compare-products').html());}
if(h){_M_jQ(".block-cart").html(d.find('.block-cart').html());}
if(typeof(window.ajaxproload)=="function"){ajaxproload();}}})}
function ajaxListURL(a){if(a.indexOf("ajax=1")<0){if(a.indexOf("?")<0){a=a+"?ajax=1";}else{a=a+"&ajax=1";}}
return a;}
function hashUrl(a){a.match(/\?(.+)$/);var params=RegExp.$1;if(params.indexOf("ajax=1")>=0){params=params.replace("ajax=1&","");params=params.replace("&ajax=1","");params=params.replace("ajax=1","");}
return params;}
_M_jQ("#products-list button.btn-cart").live("click",function(){loadAjaxProductsList(_M_jQ(this).attr("rel"),false,false,true);return false;});});
