$JQ=jQuery.noConflict();$JQ(document).ready(function(){Psycle.Init();Psycle.Catalog.ImageScrollerJump=300;});$JQ(window).load(function(){Psycle.Loaded();});Psycle={Init:function(){if(!$JQ.browser.msie||($JQ.browser.msie&&$JQ.browser.version>=8)){$JQ('.selectbox').each(function(){$JQ(this).selectbox();});}
Psycle.Catalog.Init();},Loaded:function(){Psycle.Catalog.InitAfterLoad();},getDimensionsBrowser:function(){var dimensionsBrowser=new Array();dimensionsBrowser={width:0,height:0};if(typeof window.innerWidth!='undefined'){dimensionsBrowser.width=window.innerWidth,dimensionsBrowser.height=window.innerHeight}
else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0){dimensionsBrowser.width=document.documentElement.clientWidth,dimensionsBrowser.height=document.documentElement.clientHeight}
else{dimensionsBrowser.width=document.getElementsByTagName('body')[0].clientWidth,dimensionsBrowser.height=document.getElementsByTagName('body')[0].clientHeight}
return dimensionsBrowser;}};Psycle.Catalog={ImageScrollerJump:100,ImageContainerOffsetTop:0,Zooming:false,Init:function(){$JQ('ul.products-grid').find('img').not(':hidden').each(function(){var product_id=$JQ(this).attr('id').replace('image-standard-','');if($JQ('#image-rollover-'+product_id).length){$JQ('#image-standard-'+product_id).bind('mouseover',function(){$JQ('#image-standard-'+product_id).hide();$JQ('#image-rollover-'+product_id).show();});$JQ('#image-rollover-'+product_id).bind('mouseout',function(){$JQ('#image-rollover-'+product_id).hide();$JQ('#image-standard-'+product_id).show();});}});$JQ('button').live('mouseover',function(){if($JQ(this).attr('id')=='')on_class='button-hover';else on_class=$JQ(this).attr('id')+'-on';$JQ(this).addClass(on_class);});$JQ('button').live('mouseout',function(){if($JQ(this).attr('id')=='')on_class='button-hover';else on_class=$JQ(this).attr('id')+'-on';$JQ(this).removeClass(on_class);});$JQ('.tabbed-content').find('.tab').each(function(){$JQ(this).click(function(){$JQ('.tabbed-content').find('.tab').each(function(){$JQ(this).removeClass('active');});$JQ(this).addClass('active');$JQ('.tab-container').find('div').each(function(){$JQ(this).addClass('no-display');});var thisid=$JQ(this).attr('id')+'-content';$JQ('.'+thisid).removeClass('no-display');});});$JQ('.image-container').find('.image').each(function(){$JQ(this).bind('mouseover',function(){$JQ('#main_image').attr('src',$JQ(this).find('.image_url_std').html());$JQ('#large_image').attr('src',$JQ(this).find('.image_url_lrg').html());});});$JQ('#up_arrow').bind('click',function(){if($JQ(this).hasClass('disabled'))return true;Psycle.Catalog.ImageContainerOffsetTop-=Psycle.Catalog.ImageScrollerJump;if(Psycle.Catalog.ImageContainerOffsetTop<0)Psycle.Catalog.ImageContainerOffsetTop=0;$JQ('.image-container').animate({scrollTop:Psycle.Catalog.ImageContainerOffsetTop});Psycle.Catalog.CheckImageScrollerButtons();});$JQ('#down_arrow').bind('click',function(){if($JQ(this).hasClass('disabled'))return true;Psycle.Catalog.ImageContainerOffsetTop+=Psycle.Catalog.ImageScrollerJump;if(!((Psycle.Catalog.ImageContainerOffsetTop+$JQ('.image-container').innerHeight())<$JQ('.image-container').attr('scrollHeight'))){Psycle.Catalog.ImageContainerOffsetTop-=Psycle.Catalog.ImageScrollerJump;Psycle.Catalog.ImageContainerOffsetTop+=$JQ('.image-container').attr('scrollHeight')-(Psycle.Catalog.ImageContainerOffsetTop+$JQ('.image-container').innerHeight());}
$JQ('.image-container').animate({scrollTop:Psycle.Catalog.ImageContainerOffsetTop});Psycle.Catalog.CheckImageScrollerButtons();});$JQ('#narrow-by-list').find('dt').each(function(){$JQ(this).bind('click',function(){Psycle.Catalog.SetLayerMenu($JQ(this).attr('id').replace('-heading',''));});});Psycle.Catalog.SetLayerMenu();if($JQ('.product-main-image').length){$JQ('.product-main-image-overlay').css('top',$JQ('.product-main-image').offset().top+'px').css('left',$JQ('.product-main-image').offset().left+'px');if($JQ.browser.msie){$JQ('.product-main-image-overlay').css('width',$JQ('.product-main-image').width()-20).css('height',$JQ('.product-main-image').height()-80);}
else{$JQ('.product-main-image-overlay').css('width',$JQ('.product-main-image').width()-20+'px').css('height',$JQ('.product-main-image').height()-80+'px');}
$JQ('.product-main-image-overlay').bind('mousemove',function(evt){if(!Psycle.Catalog.Zooming)return;var top=evt.pageY-$JQ('.product-main-image-overlay').offset().top;var left=evt.pageX-$JQ('.product-main-image-overlay').offset().left;var width=$JQ('#zoom-box').width();var height=$JQ('#zoom-box').height();try{if($JQ.browser.msie){$JQ('#zoom-box').css('top',(top-parseInt(height/2))).css('left',(left-parseInt(width/2)));}
else{$JQ('#zoom-box').css('top',(top-parseInt(height/2))+'px').css('left',(left-parseInt(width/2))+'px');}}
catch(e){}
Psycle.Catalog.SetZoomImagePos();});$JQ('.product-main-image-overlay').bind('mouseout',function(){Psycle.Catalog.DisableZoom();});Psycle.Catalog.DisableZoom();}},EnableZoom:function(){Psycle.Catalog.Zooming=true;$JQ('#zoom-box').show();$JQ('.product-zoom').show();},DisableZoom:function(){Psycle.Catalog.Zooming=false;$JQ('#zoom-box').hide();$JQ('.product-zoom').hide();},SetZoomImagePos:function(){var z=$JQ('.product-main-image');var zp=$JQ('#zoom-box').position();var scaleW=z.width()/zp.left;var scaleH=z.height()/zp.top;var l=$JQ('#large_image');var lleft=l.width()/scaleW;var ltop=(l.height()/scaleH)+150;try{if($JQ.browser.msie){l.css('top','-'+ltop);l.css('left','-'+lleft);}
else{l.css('top','-'+ltop+'px');l.css('left','-'+lleft+'px');}}
catch(e){}},InitAfterLoad:function(){Psycle.Catalog.CheckImageScrollerButtons();},SetLayerMenu:function(menu){if($JQ('#'+menu+'-heading').find('div.arrow').hasClass('arrow-active')){$JQ('#'+menu+'-container').animate({height:'toggle',opacity:'hide'},'slow');$JQ('#'+menu+'-heading').find('div.arrow').removeClass('arrow-active');}
else{$JQ('#narrow-by-list').find('dd').each(function(){$JQ(this).hide();});$JQ('div.arrow').each(function(){$JQ(this).removeClass('arrow-active');});if(menu){$JQ('#'+menu+'-container').animate({height:'toggle',opacity:'show'},'slow');$JQ('#'+menu+'-heading').find('div.arrow').addClass('arrow-active');}}},CheckImageScrollerButtons:function(){if(Psycle.Catalog.ImageContainerOffsetTop>0)
$JQ('#up_arrow').removeClass('disabled');else
$JQ('#up_arrow').addClass('disabled');if((Psycle.Catalog.ImageContainerOffsetTop+$JQ('.image-container').innerHeight())>=$JQ('.image-container').attr('scrollHeight'))
$JQ('#down_arrow').addClass('disabled');else
$JQ('#down_arrow').removeClass('disabled');},LaunchSizeChart:function(){$JQ('#sizechart').dialog({modal:true,draggable:false,resizable:false,title:'Size Chart',width:350});}};
