(function($){var BELOW_THE_FOLD_THRESHOLD=250,TOOLTIP_OFFSET=18,TOOLTIP_THRESHOLD=600,belowFold=function(element,offset){var fold=$(window).height()+$(window).scrollTop();return fold<=$(element).offset().top-offset;};$.extend($.expr[':'],{"below-the-fold":function(el){return belowFold(el,BELOW_THE_FOLD_THRESHOLD);},"above-the-fold":function(el){return!belowFold(el,BELOW_THE_FOLD_THRESHOLD);}});$.setupTooltips=function(){$('#content-container div.products-collage li.product, #content-container div.products-slider li.product').each(function(){var $this=$(this),$tooltip=$('.info',$this);$tooltip.append($('.swatches',$tooltip)).addClass('tooltip').wrapInner('<div class="tooltip-content"></div>');$this.hoverIntent({sensitivity:10,interval:100,timeout:200,over:function(){var $tooltip=$('.info',$this);if($this.offset().left<=TOOLTIP_THRESHOLD)
$tooltip.addClass('tooltip-right').removeClass('tooltip-left').css("left",$this.width()-TOOLTIP_OFFSET+"px");else
$tooltip.addClass('tooltip-left').removeClass('tooltip-right').css("left",-($tooltip.width())+TOOLTIP_OFFSET+"px");$.browser.msie?$('.tooltip',this).show().parent().css('z-index','2100'):$('.tooltip',this).fadeIn(200);},out:function(){$.browser.msie?$('.tooltip',this).hide().parent().css('z-index','2000'):$('.tooltip',this).fadeOut(500);}});});};$.bindLazyLoading=function(){var lazyLoadTimer=null;$(window).unbind('scroll.productLazyLoadImages').bind('scroll.productLazyLoadImages',function(){if(lazyLoadTimer)return;lazyLoadTimer=setTimeout(function(){var $lazyLoadingImgs=$('ul.products img.lazy-load');if(!$lazyLoadingImgs.length){$(window).unbind('scroll.productLazyLoadImages');return false;}
$lazyLoadingImgs.show().filter(':above-the-fold').each(function(){var $this=$(this);$this.attr('src',$this.metadata().src).removeClass('lazy-load');});lazyLoadTimer=null;},300);}).trigger('scroll.productLazyLoadImages');};$.fn.setParentActive=function(){return this.each(function(){$(this).parent().addClass('active').siblings().removeClass('active');});};})(jQuery);$(function(){function displayProducts(){$.setupTooltips();};$.fragmentChange(true);var $form=$('#product-filter'),$pagesContainer=$('#pages-container,#pages-container-2'),$thumbsContainer=$('#thumbnails-container');$(document).bind('fragmentChange',function(){$thumbsContainer.html('<div class="loading"><h2>Loading...</h2></div>');var formData=$.queryString($form.serialize()),data=$.extend(formData,$.fragment());if(data.startResult&&data.startResult>1&&data.categoryName&&data.categoryID)
cmCreatePageviewTag("Cat: "+data.categoryName,data.categoryID,null,null);$.getJSON('/index.cfm/fuseaction/products.ajaxBrowse/',data,function(data){$pagesContainer.each(function(){this.innerHTML=data.pagination;});$thumbsContainer.empty().get(0).innerHTML=data.thumbnails;$thumbsContainer.show();displayProducts();$(document).trigger('productsLoaded');});});if(window.location.hash)
$(document).trigger('fragmentChange');else
displayProducts();$('div.pages a').live('click',function(){$('#thumbnails-container').html('<div class="loading"><h2>Loading...</h2></div>');var start=parseInt($(this).attr('rel'),10);if(start&&!isNaN(start)){$.setFragment({startResult:start});return false;}});$('input[name=sizeFilterSetOptionIDList]').click(function(){$('#filter-onlysizes').attr('checked','checked');});$('#filter-allsizes').click(function(){$('input[name=sizeFilterSetOptionIDList]').removeAttr('checked');});$('#product-filter').find('input[name=action], input[name=sizes]').click(function(){$(this).closest('form').submit();});$('a.apply').click(function(){$(this).closest('form').submit();return false;});$('a.clear-filter').click(function(){$('#filtered-price, #filtered-color, #filtered-size').attr('checked',null);$('#filter-price option:first, #filter-color option:first').attr('selected',true);$('#filter-onlysizes, input[name=sizeFilterSetOptionIDList]').removeAttr('checked');$('#filter-allsizes').attr('checked','checked');return false;});$('#pcs-filters').addClass('modal');WEBLINC.modals.childModal($('#content-container div.v-products-browsepagetemplate div.options li.sort-pairing'));$('li.sort-pairing').each(function(){$(this).hoverIntent({sensitivity:10,interval:100,timeout:200,over:function(){if($.browser.msie){$('div.modal select',this).mouseleave(function(event){event.stopPropagation();});$('div.modal',this).show();}else
$('div.modal',this).fadeIn(200);},out:function(){$.browser.msie?$('div.modal',this).hide():$('div.modal',this).fadeOut(500);}});});});