var main_image=jQuery('div.detail_image div.jqzoom img');var thumbs=jQuery('#gallery li a[rel=pch_beauty_swap], #product_list_shot div.list_shot a[rel=pch_beauty_swap]');var jqimg=jQuery('div.jqzoom');var detail_col=jQuery('div.detail_col');if(jqimg.length>0)
{jQuery(function(){var jqimg_offset=jqimg.offset().left+jqimg.width();var detail_offset=detail_col.offset().left-jqimg_offset-22;zoom_options={xzoom:413,yzoom:350,offset:detail_offset,top_offset:0,preload:1,lens:1,track:false}
jqimg.not('.zoom-disabled').jqueryzoom(zoom_options);});if(thumbs.length>0)
{var swap_map={"src":"href","longdesc":"rev"}
options={callback:display_gallery_link};main_image.beautySwap(thumbs,swap_map,options);}
if(window.location.hash.length>0)
{var hash=window.location.hash
var prefix_reg=/^\#pch_/;var image_index=hash.replace(prefix_reg,'');jQuery('#'+image_index).find('a').click();}}
jQuery('#detail_tab_control').tabs({idPrefix:'ui-tabs-pch'});jQuery('#details_tab_body').removeAttr('style');var details_tab=jQuery('#details_tab_rem');var sales_tab=jQuery('#sales_tab_rem');var details_tab_trigger=jQuery('#details_tab');var sales_tab_trigger=jQuery('#sales_tab').click();details_tab_trigger.click(function(e){e.preventDefault();return false;});sales_tab_trigger.click(function(e){e.preventDefault();return false;});sales_tab.parents('li').addClass('active_tab');sales_tab.click
(function(e)
{e.preventDefault();sales_tab_trigger.click();jQuery(this).parents('li').addClass('active_tab');details_tab.parents('li').removeClass('active_tab');return false;});details_tab.click
(function(e)
{e.preventDefault();details_tab_trigger.click();jQuery(this).parents('li').addClass('active_tab');sales_tab.parents('li').removeClass('active_tab');return false;});jQuery('#display_press').click(function(e){e.preventDefault();jQuery('li.press_item.press_hidden').show();jQuery(this).hide();});jQuery('#display_color_products').click
(function(e)
{e.preventDefault();var container=jQuery('#other_color_products_container');container.find('div.display_contents').slideToggle('fast');});jQuery('#where_to_buy a').hover
(function(){jQuery(this).addClass('action_button_hover');},function(){jQuery(this).removeClass('action_button_hover');}).mousedown(function(){jQuery(this).addClass('activestate')}).mouseup(function(){jQuery(this).removeClass('activestate')}).mouseout(function(){jQuery(this).removeClass('activestate')})
jQuery('tr.selectable').add('li.press_item').hoverClass('highlight');if(window.dealer==1||window.retailenabled==1)
{jQuery('table.view_product').useBag();var control_buttons=jQuery('input[type=reset], #checkout_submit, #wish_submit, #cart_submit');control_buttons.disableButton
("jQuery('input.newQty').length == 0",{watchTrigger:jQuery('input.qty'),triggerEvent:['focus','blur','change'],noticeText:'No Items selected!',spanclass:'no_update'})}
if(jQuery('#msrp_bubble').length>0)
helpbox('msrp',{width:245,anchor:'above',offset:{top:-25,left:15}});function display_gallery_link(thumb)
{var $thumb=jQuery(thumb);var gallery_link=$thumb.siblings('span.gallery_link');var gallery_link_display=jQuery('#jqzoom_notice span.gallery_link');if(gallery_link.length==0)
gallery_link_display.fadeOut('fast').html('&nbsp;');else
{gallery_link_display.fadeOut
('fast',function()
{gallery_link_display.html(gallery_link.html());setTimeout("show_gallery_link()",1000);});}}
function show_gallery_link()
{var gallery_link_display=jQuery('#jqzoom_notice span.gallery_link');var link=jQuery('a',gallery_link_display);gallery_link_display.fadeIn
(600,function()
{}).attr('filter','');}
var variants=jQuery('#product_color_siblings');if(variants.length>0)
{var blocks=jQuery('div.color_blocks.viewproduct div');var name_display=jQuery('p#variant_color_name');blocks.hoverClass('highlight');}
jQuery('a.big_preview').live('mouseover',function(){var $this=jQuery(this);var message=$this.siblings('.product_care_info');$this.qtip({content:{text:message},show:{ready:true},hide:{fixed:true},style:{classes:{content:'product_info_text',title:'product_info_title'},padding:5,border:{width:5,color:'#cecece'},width:440},position:{target:false,corner:{tooltip:'centerRight',target:'centerLeft'},adjust:{y:0,screen:true}}});});jQuery('a.ui-dialog-titlebar-close').live('click',function(e){jQuery.qtip("hide").qtip("destroy");})
var downinc_submit=jQuery('#cart_submit_downinc');downinc_submit.mousedown(function(e){e.preventDefault();jQuery(this).val('submitting...').attr('disabled',true);var form=jQuery(this).parents('form');jQuery.post(form.attr('action'),form.serialize(),function(data){jQuery('#downinc_popup').dialog('close');downinc_submit.removeAttr('disabled').val('Add to Cart');jQuery('.downinc_toggle.edit').find('span.flip').html('Edit');});});var downinc_triggers=jQuery('tr.downinc td.quantity input');downinc_triggers.each(function(){var $this=jQuery(this);if($this.val()>0)
$this.addClass('valid');else $this.removeClass('valid');$this.change(function(){if($this.val()>0)
$this.addClass('valid');else $this.removeClass('valid');});});var downinc_toggle=jQuery('.downinc_toggle');downinc_toggle.click(function(e){e.preventDefault();var $this=jQuery(this);var base=$this.attr('id').substr($this.attr('id').indexOf('_')+1,$this.attr('id').length);var type=jQuery.trim($this.siblings('.base_type_info').html());$this.addClass('edit');jQuery("#down_products, div.featherbed").find("[class^='down_group_']").hide();switch(type)
{case'duvet_cover':jQuery('tfoot.down').show();jQuery(".down_group_duvet").show();break;case'duvet_cover_feather':jQuery('tfoot.down').show();jQuery(".down_group_duvet").show();break;case'featherbed':jQuery('div.featherbed').show();jQuery('tfoot.down').hide();jQuery(".down_group_featherbed").show();break;case'sham':jQuery('tfoot.down').show();jQuery(".down_group_pillow, .down_group_pillow_protector").show().parents('table').find('tfoot').show();break;case'cases_feather':jQuery('tfoot.down').show();jQuery(".down_group_pillow, .down_group_pillow_protector").show().parents('table').find('tfoot').show();break;default:}
jQuery("[id^='base_']").hide();jQuery('.down_inc').show();jQuery('#base_'+base).show();});downinc_triggers.each(function(){var trig=jQuery(this);var table_id=trig.parents('table').attr('id');var base=table_id.substr(table_id.lastIndexOf('_')+1,table_id.length)
var size_row=trig.parents("tr").find('td.size').html().toUpperCase();var open_type=jQuery.trim(trig.siblings('.product_type_val').html());var button=jQuery('#down_'+base);var di_count=jQuery('tr.downinc td.quantity input.valid',jQuery('table#view_product_'+base)).length;if(di_count>0)
button.show();else button.hide();var sizer='';if(trig.val()==0)
jQuery('#base_'+base).find(sizer).hide();else
jQuery('#base_'+base).find(sizer).show();trig.change(function(){var trig_type=jQuery.trim(trig.siblings('.product_type_val').html());var down_group_switch='';switch(trig_type)
{case'duvet_cover':jQuery('.down_group_duvet').attr('active',"true");var cover_message=this.message
var cover_display_container=jQuery('.duvet_qty_display')
cover_display_container.find('em').html('').remove();if(this.qty>1)
cover_message+='s'
if(cover_display_container.html().length>0)
cover_message=', <br />'+cover_message
cover_display_container.append(cover_message);break;case'sham':jQuery('.down_group_pillow, .down_group_pillow_protector').attr('active',"true")
var sham_message=this.message
var sham_display_container=jQuery('.pillow_qty_display, .protector_qty_display')
sham_display_container.find('em').html('').remove();if(this.qty>1)
sham_message+='s'
if(sham_display_container.html().length>0)
sham_message=', <br />'+sham_message
sham_display_container.append(sham_message);break;case'accents':break;default:}
var di_count=jQuery('tr.downinc td.quantity input.valid',jQuery('table#view_product_'+base)).length;if(di_count>0)
{button.show();jQuery('.down_group_'+down_group_switch).show();}
else
button.hide();});});if(jQuery('div.featherbed').length>0)
jQuery('.featherbed_toggle').show();var downinc_popup=jQuery('#downinc_popup');var downinc_options={modal:false,dialogClass:'downinc_pop',minHeight:400,width:790,resizable:false,show_title:true,title:'Down Bedding'}
downinc_popup.pchDialog(downinc_toggle,downinc_options);jQuery('div.details_bubble').each(function(){var $this=jQuery(this);var trigger=$this.siblings('h3').find('a.product-details-link');var anchor=$this.siblings('table.view_product');var dialog_width=parseInt($this.css('width').replace('px',''));var dialog_title=$this.siblings('h3').find('strong').html();var dialog_options={position:'anchor',anchor:'left-center',width:dialog_width,minHeight:50,dialogClass:'viewproduct-details ui-corner-none',show_title:true,title:dialog_title,anchor_element:anchor,zIndex:250,offset:{left:-20,top:-50},triggerToggle:true,persist:true};$this.pchDialog(trigger,dialog_options);});var notice=jQuery('tr.in_cart_key td div.in_cart_notice');var notice_closed=jQuery.cookie('in_cart_closed');var show_notice=notice.length>0&&!notice_closed;if(show_notice)
{notice.find('a.close').click
(function()
{notice.slideUp();jQuery.cookie('in_cart_closed',true);});notice.slideDown();};var nav_selector='#topnav div.nav li:not(.dropnav),'
+'h3.toggle_next,'
+'h2.toggle_next,'
+'#retail_leftnav h3.group_header, #content h2.nav_header,'
+'div.external_subcat,'
+'#retail_leftnav ul.hover_contents li,'
+'#retail_leftnav div.hover_contents div.nav_thumb,'
+'#content div.color_blocks.listproduct div';jQuery(nav_selector).hoverClass('highlight');if(jQuery('#homepage').length==0)
{jQuery('#worlds_container #worlds_list li').hover
(function()
{if(jQuery(this).hasClass('inactive'))
jQuery(this).removeClass('inactive').addClass('was_inactive');},function()
{if(jQuery(this).hasClass('was_inactive'))
jQuery(this).removeClass('was_inactive').addClass('inactive');});}
var clickedonce=false;jQuery('#login').click(function(){if(!clickedonce)this.select();clickedonce=true;});var popup=jQuery('#login-bubble');var trigger=jQuery('a.login_bubble_link');var options={position:'anchor',anchor:'tr',width:'24em',height:'auto',minHeight:'100',title:'Login'};popup.pchDialog(trigger,options);
