jQuery('div.text_overlay').hover
(function()
{jQuery(this).add('div.overlay_bg').addClass('highlight');},function()
{jQuery(this).add('div.overlay_bg').removeClass('highlight');});var menuStates=window.menuState;var navHeaders=jQuery('li.list h3.menu-title');navHeaders.add('#product_subcat h3.menu-title').addClass('mouseover');jQuery.each(navHeaders,function()
{var $this=jQuery(this);var menu=jQuery('span',$this).html().toLowerCase()
var state=menuStates[menu];$this.addClass('menu-'+state);if(state=='closed')
$this.next('ul.menu_links').hide();});jQuery('#searchparam').defaultText('    (type here to search...)');jQuery(function()
{jQuery('#searchparam').autocomplete('/autocomplete',{minChars:3,paramName:'searchparam',submitOnSelect:1});var externalLinks=jQuery("a[rel=external]");if(externalLinks.length>0)
externalLinks.externalLink();});var trail_images=jQuery('a.trail_image');if(trail_images.length>0)
{var options={attr:'rel',anchor:true,yOffset:170,xOffset:-98,disableLink:false,width:100}
trail_images.imagePreview(options);};var subcat=jQuery('#narrow');if(subcat.length>0)
{var texthint='(Filter These Results...)';jQuery('#subsearchparam').defaultText(texthint).autocomplete('/autocomplete',{minChars:3,paramName:'subsearchparam',submitOnSelect:1});jQuery('ul.menu_links',subcat).each(function()
{var $this=jQuery(this);var id=$this.attr('id');var trigger_id=id.replace('_links','');jQuery('#'+id).pchDialog
('#'+trigger_id,{position:'anchor',anchor:'subcat',timeout:15000,width:90,minHeight:20,dialogClass:' no-titlebar ui-corner-bottom menu_link'});});};var stock=window.showStock;if(stock==1)
showCartPopup();jQuery('select#view_rows').change(function()
{jQuery(this).parents('form').submit();});var product_images=jQuery('a.product_image');if(product_images.length>0)
{var options={attr:'rel',anchor:true,yOffset:210,xOffset:30,disableLink:false,width:228,height:250}
product_images.imagePreview(options);}
function showCartPopup()
{var products=jQuery('div.pb_thumb-stock, div.pb_thumb-stock-first');jQuery.each(products,function()
{var thumb=jQuery(this).find('div.pb_thumbnail');var base=jQuery(this).attr('id').replace('pb_','');var popup=jQuery('#cartPop_'+base);var description=jQuery('#pb_'+base+' p.desc a').html();popup.pchDialog(thumb,{position:'anchor',anchor:'listproduct_ordering',width:210,show_title:true,dialogClass:'cart_bubble',title:description});thumb.one('click',function()
{popup.find('table').useBag();});});jQuery('div.cartBubble input.cancel_button').click(function(event)
{event.preventDefault();jQuery('div.cartBubble:visible').dialog('close');return false;});jQuery('div.cartBubble input.cartPopSubmit').click(function(event)
{event.preventDefault();if(jQuery('input.newQty').length>0)
{var form=jQuery(this).parents('form');var formData=form.serialize();formData+='&ajax=true&action_type=add&bag_type=cart';var indicator=jQuery(this).siblings('img.indicator');indicator.show();var base=jQuery(this).parents('div.cartBubble').attr('id').replace('cartPop_','');jQuery.post
(form.attr('action'),formData,function(data)
{var bagCount=jQuery(data).children().html();var bagIcon=jQuery('#header li.bagicon');makeBagLink(bagIcon,bagCount);bagIcon.find('p a').animate({color:"#ffb"},450).animate({color:"white"},450);var image=jQuery('#pb_'+base+' div.pb_thumbnail');var origColor=image.css('backgroundColor')||'transparent';indicator.hide();jQuery('div.cartPop_'+base).dialog('close');image.animate({backgroundColor:"#ffb"},450).animate({backgroundColor:origColor},450);});var newQtyFields=form.find('input.newQty');jQuery.each(newQtyFields,function()
{var qtyField=jQuery(this);qtyField.attr('default',qtyField.val()).removeClass('newQty').parents('tr').removeClass('current').removeClass('selected').find('img.cancelRow').css('opacity',0.01);});}
return false;});}
function makeBagLink(bagIcon,bagCount)
{var bagitem_count=bagIcon.find('span.bagitem_count');var bagitem_count_text='('+bagCount+' item'+(bagCount>1?'s':'')+')';bagitem_count.html(bagitem_count_text);if(bagIcon.find('a').length==0)
{var url=window.location;if(/.*front_dev.*/.test(url))
url="/front_dev.php/bag/view";else url="/bag/view";var link_text='<a href="'+url+'"></a>';bagIcon.find('div img, span.ownerlink').wrap(link_text);bagIcon.find('span.countlink').wrap(link_text).parents('a').addClass('countlink');}};jQuery('#login_bubble_link, a.guest_signin_link').mousedown
(function(e)
{e.preventDefault();try
{show_retail_popup({"default_form":"signin"});}
catch(err)
{jQuery(this).attr('error',1);return true;}
return false;}).click
(function(e)
{var error=jQuery(this).attr('error')||0;if(error===1||error=='1')
return true;e.preventDefault();return false;});if(window.guest==1||window.guest=='1')
{jQuery('input.create_order').mousedown
(function(e)
{e.preventDefault();show_retail_popup();return false;}).click
(function(e)
{e.preventDefault();return false;});}