/* sni-hgrm.js - Wed, 11 Jan 2012 16:55:39 -0500 */
if( typeof(SNI.HGRM) == "undefined" ) { SNI.HGRM = {}; }
SNI.HGRM.ANIMATION_SPEED = 150;

if(typeof(SNI.Util)=="undefined"){SNI.Util={};}
if(window.console===undefined){var names=['log','debug','info','warn','error','assert','dir','dirxml','group','groupEnd','time','timeEnd','count','trace','profile','profileEnd'],len=names.length,i=0;window.console={};for(i=0,i<len;i<len;i+=1){window.console[names[i]]=function(){};}}
SNI.Util.truncate=function(str,length,truncation){length=length||30;truncation=truncation==undefined?'...':truncation;return str.length>length?str.slice(0,length-truncation.length)+truncation:str;};SNI.Util.onMDready=function(myfn,tmlim){if(tmlim==undefined){tmlim=5000;}
n=0;nlim=tmlim/100;timerID=window.setInterval(function(){++n;if(n>nlim){window.clearInterval(timerID);}
else if(typeof(mdManager)!="undefined"){window.clearInterval(timerID);myfn();}},100);};SNI.Util.moveToView=function(element,options){options=$.extend({anchor:null,align:'left',topOffset:0,leftOffset:0,positionInViewport:true},options);element=$(element);if(options.anchor!==null){var anchor=$(options.anchor);var offset=anchor.offset();if(options.align=='right'){options.leftOffset+=anchor.width();}
options.topOffset+=offset.top;options.leftOffset+=offset.left;}
element.css({top:options.topOffset,left:options.leftOffset});if(options.positionInViewport){SNI.Util.positionInViewport(element);}
element.fadeIn('350');};SNI.Util.getOffset=function(element){element=$(element);var hidden=element.is(":hidden");if(hidden){element.show();}
var offset=element.offset();if(hidden){element.hide();}
return offset;};SNI.Util.positionInViewport=function(element){element=$(element);var windowOffset=63;var offset=SNI.Util.getOffset(element);var width=element.width();var height=element.height();var win=$(window);var browserWidth=win.width();var browserHeight=win.height();var scrollX=win.scrollLeft();var scrollY=win.scrollTop()+windowOffset;if(offset.top<scrollY){element.css({top:scrollY});}else if(offset.top+height>(scrollY-windowOffset)+browserHeight){element.css({top:((scrollY-windowOffset)+(browserHeight-height))});}
if(offset.left<scrollX){element.css({left:scrollX});}else if(offset.left+width>scrollX+browserWidth){element.css({left:((scrollX+browserWidth)-width)});}};SNI.Util.Cookie.session=function(cookieName,key,value){var cookie=this.get(cookieName);if(typeof value=='undefined'){if(cookie==null){return null;}else{var values=this.getPersistValues(cookie);return values[key];}}else{if(cookie==null){var values={};values[key]=escape(value);}else{var values=this.getPersistValues(cookie);values[key]=value;}
this.set(cookieName,this.buildPersistString(values));}};SNI.Util.Toolbar=function(config){var page_url=document.location.href;var page_type=mdManager.getPageType();var page_title=mdManager.getPageTitle();var share_url=SNI.Util.Url.setParameter(document.location.href,"soc","share");var email_module=$("#email-a-friend");var email_module_path=SNI.Config.emailModulePath;var email_subject="Check Out This Page on HGTVRemodels.com";var email_body="thought you would be interested in this link to \""+page_title+"\" on HGTVRemodels.com:";var email_comments="I think this is just what you've been looking for.";var email_link="";var showPrintLink=(mdManager.getPageType()==="CHANNEL"||mdManager.getPageType()==="PLAYER"||(mdManager.getParameterString('DelvFrmt').indexOf('GALLERY')>-1))?false:true;var configObj=$.extend({toolBarConfig:{printPage:showPrintLink},tweetUrl:share_url,pageUrl:page_url,emailModule:email_module,emailModulePath:email_module_path,emailSubject:email_subject,emailBody:email_body,emailLink:email_link,emailComments:email_comments,emailPageTitle:page_title},config,true);SNI.HGRM.globalToolbar.init(configObj);};SNI.Util.scrollNodeIntoView=(function($){return function(cfg){var DEFAULT_CONFIGS={},doc=$('html, body');cfg=$.extend(DEFAULT_CONFIGS,cfg);doc.animate({scrollTop:cfg.n.offset().top-cfg.special_offset},750);};})(jQuery);SNI.Util.getParameterByName=function(name){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null)return"";return decodeURIComponent(results[1].replace(/\+/g," "));};SNI.Util.overlay=(function($){return{is_showing:false,contents:'',open:function(cfg){var DEFAULT_CONFIGS={wrapper:'#overlay',inner:'#overlay-content',inlineVideo:0,fill:SNI.HGRM.TheaterModules.fill,empty:function(outer,inner){inner.fadeOut('slow',function(){inner.html('');SNI.Util.overlay.close();});}},bd=$('body'),hd=$('header:first'),wrapper,inner;cfg=$.extend(DEFAULT_CONFIGS,cfg);hd.after(function(idx,html){var attr=cfg.wrapper.replace('#',''),node_attrs={id:attr,'class':attr},n=$('<div />',node_attrs);wrapper=n;return n;});$(wrapper).click(function(){SNI.Util.overlay.close(cfg);});wrapper.after(function(idx,html){var attr=cfg.inner.replace('#',''),node_attrs={id:attr,'class':attr},n=$('<div />',node_attrs);inner=n;return n;});SNI.Util.overlay.opens=function(){$(inner).css('top',cfg.offset);SNI.Util.overlay.is_showing=true;wrapper.show().animate({opacity:.75},350,function(){cfg.fill({url:cfg.url,inlineVideo:cfg.inlineVideo});});var advParent=$('.sni-e .lead.flush .mrec');advParent.css('height',$(advParent).height()+'px');$(advParent).children().hide();$('#leaderboard-wrap #leaderboard').css('visibility','hidden');};SNI.Util.overlay.opens();inner=$(cfg.inner);inner.bind('click',function(evt){evt.stopPropagation();evt.preventDefault();var tar=$(evt.target);if(tar.is('#'+inner.attr('id'))||tar.is('#overlay-inner > div.close:first *')){SNI.Util.overlay.is_showing=false;cfg.empty(wrapper,inner);}});$(document).bind('keyup',function(evt){if(evt.keyCode===27&&SNI.Util.overlay.is_showing===true){SNI.Util.overlay.is_showing=false;cfg.empty(wrapper,inner);}});},close:function(cfg){var DEFAULT_CONFIGS={wrapper:'#overlay'},wrapper;cfg=$.extend(DEFAULT_CONFIGS,cfg);$('#overlay-content').hide();$('#overlay-content').remove();var advParent=$('.sni-e .mrec');$(advParent).children().show()
$(advParent).css('height','auto')
$('#leaderboard-wrap #leaderboard').css('visibility','visible');wrapper=$(cfg.wrapper).animate({opacity:0},350,function(){wrapper.remove();});SNI.Util.overlay.contents='';}};})(jQuery);SNI.Util.HookIMGResize=function(citeId,aTagId){$(citeId).bind('click',function(evt){evt.stopPropagation();evt.preventDefault();$(aTagId).click();});};SNI.Util.IMGResize=(function($){return{sizes:{'lg':{width:'616px',height:'462px',vertical_dimensions:{width:'616px',height:'821px'}},'al':{width:'266px',height:'200px',vertical_dimensions:{width:'266px',height:'354px'}},'med':{width:'160px',height:'120px',vertical_dimensions:{width:'160px',height:'120px'}},'tzhz':{width:'120px',height:'90px',vertical_dimensions:{width:'90px',height:'120px'}},'ab':{width:'160px',height:'120px',vertical_dimensions:{width:'120px',height:'160px'}}},grow:function(cfg){var animate=function(){var p=cfg.img.parent(),ico=p.find('.ico:first'),newsize=SNI.Util.IMGResize.sizes[cfg.newsize];p.spinner();if(cfg.is_vertical===true){newsize=SNI.Util.IMGResize.sizes[cfg.newsize].vertical_dimensions;}
ico.fadeOut('350',function(){p.spinner('remove');if(cfg.headline.n.length===0){cfg.headline.n=cfg.img;}
SNI.Util.scrollNodeIntoView(cfg.headline);p.parent().addClass('active');cfg.img.animate($.extend(newsize,cfg.props),{duration:350,complete:function(){p.find('.ico em:first').text('Shrink Photo').parent().delay(0).fadeIn('350');cfg.img.removeClass('animating');}});});},prep=function(){if(cfg.fluff!==false&&typeof cfg.fluff.pregrow!=='undefined'){cfg.fluff.pregrow();}};prep();cfg.img.one('load',function(evt){animate();});cfg.img.attr('src',cfg.newsrc);},shrink:function(cfg){var p=cfg.img.parent();ico=p.find('.ico:first'),originalsize=cfg.originalsize;if(cfg.is_vertical===true){originalsize=cfg.originalsize.vertical_dimensions;}
ico.fadeOut('350',function(){p.parent().removeClass('active');cfg.img.stop().animate($.extend(originalsize,cfg.props),{duration:350,complete:function(){if(cfg.fluff!==false&&typeof cfg.fluff.postshrink!=='undefined'){cfg.fluff.postshrink();}
p.find('.ico em:first').text('Enlarge Photo').parent().delay(0).fadeIn('350');cfg.img.attr('src',cfg.newsrc);cfg.img.removeClass('animating');}});});},init:function(cfg){var DEFAULT_CONFIG={module:'',context:''},img,img_sm_url,img_lg_url,treatments={},fluff=false,headline,references={},originalsize,newsize,suffix=/\_(lg|lead|al|med|tz|sm|ab|tzhz)\.jpg$/ig,is_vertical=function(str,imgClass){if(imgClass=='vertical')return true;str=str||'';if(str.split('_').shift()==='3x4'){return true;}
return false;},get_suffix=function(str){str=str||'';return str.split('_').pop();},originalsize_is_vertical,newsize_is_vertical;cfg=$.extend(DEFAULT_CONFIG,cfg);cfg.module=$(cfg.module);img=cfg.module.find('img:first');img_sm_url=img.attr('src');img_lg_url=cfg.module.attr('href');references.li=img.parent().parent();references.nextli=references.li.next();references.previmg=references.li.prev('li').find('img:first');treatments={'before':{headline:{n:cfg.module.prev('h5'),special_offset:20},references:references,pregrow:function(){treatments.before.references.li.animate({'padding-left':'0px'},{duration:350});if(treatments.before.references.nextli.hasClass('active')===false){treatments.before.references.nextli.find('cite:first').css('margin-left','7px');}},postshrink:function(){headline.special_offset=15;SNI.Util.scrollNodeIntoView(headline);treatments.before.references.li.animate({'padding-left':'28px'},{duration:350});if(treatments.before.references.nextli.hasClass('active')===false){treatments.before.references.nextli.find('cite:first').removeAttr('style');}}},'after':{headline:{n:cfg.module.prev('h5'),special_offset:-270},references:references,pregrow:function(){if(treatments.after.references.previmg.attr('height')===200){headline.special_offset=-270}else headline.special_offset=15;},postshrink:function(){if(treatments.after.references.previmg.attr('height')===200){headline.special_offset=15;}
else{headline.special_offset=15;}
treatments.after.references.li.find('cite:first').removeAttr('style');SNI.Util.scrollNodeIntoView(headline);}}};if(cfg.context!==''&&typeof cfg.context!=='undefined'){fluff=treatments[cfg.context];headline=treatments[cfg.context].headline;}else{headline={n:cfg.module.parent().prev('h4'),special_offset:10};}
originalsize=img.attr('src').match(suffix)[0].replace('.jpg','');imgClass=img.attr('class');originalsize_is_vertical=is_vertical(originalsize,imgClass);originalsize=get_suffix(originalsize);newsize=img_lg_url.match(suffix)[0].replace('.jpg','');newsize_is_vertical=originalsize_is_vertical;newsize=get_suffix(newsize);return cfg.module.bind('click',function(evt){evt.stopPropagation();evt.preventDefault();if(img.hasClass('animating')===false){img.addClass('animating');if(img.parent().parent().hasClass('active')){SNI.Util.IMGResize.shrink({is_vertical:originalsize_is_vertical,img:img,newsrc:img_sm_url,fluff:fluff,originalsize:SNI.Util.IMGResize.sizes[originalsize],props:cfg.shrinkprops,headline:headline});}
else{SNI.Util.IMGResize.grow({is_vertical:newsize_is_vertical,img:img,newsrc:img_lg_url,newsize:newsize,fluff:fluff,props:cfg.growprops,headline:headline});}}});}};})(jQuery);SNI.Util.hideAndSlide=function(trigger,panel){trigger=$(trigger);panel=$(panel);trigger.click(function(){panel.slideDown("fast");$('html, body').animate({scrollTop:panel.offset().top-14},'slow');$(this).remove();return false;});};SNI.Util.Ellipsize=function(selector,max){var dots='...';var text=$(selector).html();if(text.length<=max)return text;var end=text.lastIndexOf(' ',(max-3));if(end==-1)return text.substring(0,(max-3))+dots;var newEnd=end;while((text.substring(0,newEnd)+dots).length<max){end=newEnd;newEnd=text.indexOf(' ',end+1);if(newEnd==-1)newEnd=text.length;}
return text.substring(0,end)+dots;};$(function(){$('#carousel .crsl-item span.last').each(function(){$(this).html(SNI.Util.Ellipsize(this,30));});});
if(typeof(SNI.Common)=='undefined'){SNI.Common={};}
SNI.Common.Carousel=function(element,config){config=$.extend({btnNext:element+" .btn.next",btnPrev:element+" .btn.prev",visible:1,circular:false,displayPage:false,miniNav:false,speed:'fast',btnGo:""},config);return $(element+' .crsl-wrap').jCarouselLite({btnNext:config.btnNext,btnPrev:config.btnPrev,visible:config.visible,circular:config.circular,scroll:config.scroll!=undefined?config.scroll:config.visible,displayPage:(config.displayPage),btnNavigation:(config.displayPage)?false:true,miniNav:config.miniNav,container:element,mouseWheel:true,speed:config.speed,btnGo:config.btnGo});};SNI.Common.Accordion=function(element,config){var ca=this;ca.overflowFix=($.browser.mozilla&&parseFloat($.browser.version)<=1.9);SNI.Common.Accordion.dynamicFix=($.browser.msie&&parseInt($.browser.version)<8);config=$.extend({autoheight:true,header:'.acco-link',change:ca.change,animated:'easeOutSine'},config);var acco=$(element).accordion(config);if(ca.overflowFix||ca.dynamicFix){$(config.header,acco).click(function(){var link=$(this);if(!link.hasClass('ui-state-active')){if(ca.dynamicFix){$('.ui-accordion-content .crsl',acco).hide();}
if(ca.overflowFix){$('.ui-accordion-content .list, .ui-accordion-content .thumbs',acco).css('overflow','hidden');}}});}};SNI.Common.Accordion.change=function(event,ui){if(SNI.Common.Accordion.dynamicFix){$('.crsl',ui.newContent).show();}
if(SNI.Common.Accordion.overflowFix){$('.list, .thumbs',ui.newContent).css('overflow','auto');}};SNI.Common.Tabs=function(element,config){if(config.selected=="random"){var countTabs=$(element).find(".tabs").children().size();var random=Math.floor(Math.random()*(countTabs));config=$.extend(config,{selected:random});}
var tabs=$(element).tabs(config);};
if(typeof(SNI.HGRM.IS)=='undefined'){SNI.HGRM.IS={};}
SNI.HGRM.IS.FB={};SNI.HGRM.IS.FB.like=function(config){config=$.extend({'layout':'button_count','show_faces':'true','width':'50','font':'trebuchet ms','colorscheme':'light'},config);return SNI.IS.FB.like(config);};SNI.HGRM.IS.FB.login=function(config){return SNI.IS.FB.login(config);};SNI.HGRM.IS.Twitter={};SNI.HGRM.IS.Twitter.share=function(config){config=$.extend({messages:{prefix:{DEFAULT:"",RECIPE:"Get the recipe:",COMPANIES:"Get local info:",MENU:"Get the menu:",GALLERY:"Browse the photos:",CHANNEL:"Watch the video:",ARTICLE:"Read the article:"},via:"@HGTVRemodels"},shareThisSrc:"http://w.sharethis.com/button/sharethis.js#publisher=87e14ce7-dc4d-40d2-ada1-38b20bfad22c&amp;type=website&amp;post_services=email%2Cfacebook%2Ctwitter%2Cgbuzz%2Cmyspace%2Cdigg%2Csms%2Cwindows_live%2Cdelicious%2Cstumbleupon%2Creddit%2Cgoogle_bmarks%2Clinkedin%2Cbebo%2Cybuzz%2Cblogger%2Cyahoo_bmarks%2Cmixx%2Ctechnorati%2Cfriendfeed%2Cpropeller%2Cwordpress%2Cnewsvine&amp;button=false"},config,true);return SNI.IS.Twitter.share(config);}
if(typeof(SNI.HGRM.globalToolbar)=="undefined"){SNI.HGRM.globalToolbar={};}
SNI.HGRM.globalToolbar={toolbar:"#global-toolbar",revealModule:function(trigger,module){module.fadeIn(SNI.HGRM.ANIMATION_SPEED);module.addClass("active");SNI.HGRM.globalToolbar.loadCaptcha();return false;},closeModule:function(trigger,module,speed){if(speed==null){speed=SNI.HGRM.ANIMATION_SPEED;}
module.fadeOut(speed);if($(trigger).hasClass("active")){$(trigger).removeClass("active");}},loadCaptcha:function(){var emailModule=$("#email-a-friend");var emailForm=emailModule.find("form");var addtime=new Date().getTime();emailForm.find('#captcha-img').html('<img src="http://'+SNI.Config.domain+'/app/emailservice2/captchaImg?generateNew=true&t='+addtime+'" height="30" width="93" />');},printPage:function(){var config=SNI.HGRM.globalToolbar.config;var module=$('#tb-print');var printDropDown=$("#email-a-friend");module.append($('<a>').attr({'href':config.printUrl,'target':'_blank'}).text("Print"));if(printDropDown){var module=$("#print-select");var printLink=$('#print a.print');printLink.click(function(event){var linkPos=printLink.offset().left;module.css("left",(linkPos-240));event.preventDefault();SNI.HGRM.globalToolbar.revealModule(".print",module);});$("em.close").click(function(){SNI.HGRM.globalToolbar.closeModule(".print",module);});$("#email").click(function(){SNI.HGRM.globalToolbar.closeModule(".print",module);});}},createEmail:function(){var config=SNI.HGRM.globalToolbar.config;var module=$('#tb-email');var emailModule=$("#email-a-friend");module.append($('<a>').attr({'href':'#'}).text("E-Mail")).click(function(event){event.preventDefault()});$('#email-a-friend').load(config.emailModulePath,function(){SNI.HGRM.globalToolbar.emailAFriend();$(".close, .box .hd span, .cancel a").click(function(){SNI.HGRM.globalToolbar.closeModule("#email",emailModule);return false;});});module.click(function(){SNI.HGRM.globalToolbar.revealModule("#email",$("#email-a-friend"));});},emailAFriend:function(){var config=SNI.HGRM.globalToolbar.config;var null_value="";var emailModule=$("#email-a-friend");var emailForm=emailModule.find("form");var emailSubject=emailForm.find('input[name="subject"]').val(config.emailSubject);var emailComments=emailForm.find('textarea[name="body"]').val(config.emailComments);var fromName=emailForm.find('input[name="from_name"]');var success=emailModule.find('.success');$("#captcha-request a").click(function(){SNI.HGRM.globalToolbar.loadCaptcha();return false;});$(".form-submit a").click(function(){SNI.HGRM.globalToolbar.closeModule("#email",emailModule);return false;});if(mdManager.getPageTitle){var success_message=emailModule.find('.success span');success_message.text(config.emailPageTitle+" ");}else{success_message.text('this page');}
var captcha_msg="Whoops. Please enter the characters in the image to verify you are human.";emailForm.validate({errorPlacement:function(error,element){error.appendTo(".error-wrap.eaf");},errorLabelContainer:'.error-wrap.eaf ul',wrapper:"li",rules:{from_name:{required:true},from_email:{required:true,email:true},to_emails:{required:true,multipleEmails:true},captcha_answer:{required:true}},messages:{from_name:{required:"Whoops. Please enter your name."},from_email:{required:"Whoops. Please enter your e-mail address.",email:"Whoops. Please check the format of your e-mail address and re-enter (i.e. jeff@hgtvremodels.com)."},to_emails:{required:"Whoops. Please enter at least one friend e-mail address.",multipleEmails:"Whoops. One or more of your friend e-mail addresses is not formatted correctly. Please check the format and re-enter (i.e. jeff@hgtvremodels.com)."},captcha_answer:{required:captcha_msg}},showErrors:function(errorMap,errorList){if(errorList.length){this.errorList=[this.errorList[0]];this.defaultShowErrors();$('.error-wrap').css('display','block').fadeIn();}},submitHandler:function(){var txtarea_comment=emailComments.val();var msg_body='';msg_body+=fromName.val()+' '+config.emailBody+"\n\n";msg_body+="http://"+location.hostname;msg_body+=mdManager.getParameter("Url")+"\n\n";if(emailComments.val()!=null_value){msg_body+="Comments from "+fromName.val()+":\n";msg_body+=emailComments.val();}
emailComments.val(msg_body);var form_data=emailForm.serialize();emailModule.find('.message').hide().removeClass("alert");emailForm.find('fieldset').hide();emailForm.find("label").removeClass("error");emailForm.find('button').addClass('disabled').attr('disabled','disabled');emailForm.find('.cancel').addClass("disabled");emailForm.find('.loader').show();$.ajax({type:"POST",url:emailForm.attr("action"),dataType:'json',data:form_data,cache:false,success:function(data){emailForm.find('.loader').hide();var response=$(data);var emailSent=data.emailSent;var captchaCorrect=data.captchaAnswerValid;if(!emailSent){emailComments.val(txtarea_comment);emailForm.find('fieldset').show();emailForm.find('button').removeClass('disabled').removeAttr('disabled');emailForm.find('.cancel').removeClass("disabled");if(!captchaCorrect){emailForm.find("label[for='captcha_answer']").addClass("error");$("#captcha_answer").select();emailModule.find('.message').addClass("alert").text(captcha_msg).show();}else{emailForm.find("label[for='friends-email']").addClass("error");$("#friends-email").select();emailModule.find('.message').addClass("alert").text("Whoops. The e-mail could not be sent to one or more of your friends. Please check the format of their e-mail address and re-enter (i.e. joe@foodnetwork.com).").show();}}else{var page_title=mdManager.getPageTitle();success.show();$('.boot .center').append('<a class="btn closer">Close</a>');$('.boot .center span, .boot .center button').hide();$('.error-wrap').hide();function resetForm(){emailModule.hide();success.hide();emailComments.val(txtarea_comment);emailModule.find('.message').text("All fields are required.").show();emailForm.find("input:text").each(function(){$(this).val("");});emailForm.find('button').removeClass('disabled').removeAttr('disabled').show();$('.boot .center').remove('.closer');emailForm.find('.cancel').removeClass("disabled");emailForm.find('.closer').hide();emailForm.find('fieldset').show();emailForm.show();}
var timeout=setTimeout(function(){SNI.HGRM.globalToolbar.closeModule("#email",emailModule,300);resetForm();},3000);$(".close, .closer").click(function(){clearTimeout(timeout);resetForm();SNI.HGRM.globalToolbar.closeModule("#email",emailModule);});}},error:function(){emailForm.find('.loader').hide();emailComments.val();emailForm.find('fieldset').show();emailForm.find('button').removeClass('disabled').removeAttr('disabled');emailForm.find('.cancel').removeClass("disabled");emailModule.find('.message').addClass("alert").text("Whoops. We encountered an error when trying to e-mail this page. Please wait a few moments and try again.").show();}});emailForm.submit(function(){return false;});}});},toolbarElement:$(SNI.HGRM.globalToolbar.toolbar),fbShare:function(){SNI.HGRM.IS.FB.like({element:"#tb-facebook"});},twitterShare:function(){SNI.HGRM.IS.Twitter.share({element:"#tb-tweet"});},init:function(configObj){if(configObj.toolBarConfig){var toolBarConfig=$.extend({createEmail:true,printPage:true,twitterShare:true,fbShare:true},configObj.toolBarConfig);SNI.HGRM.globalToolbar.config=configObj;$.each(toolBarConfig,function(index,value){if(!value){}else{SNI.HGRM.globalToolbar[index].apply(this)}})}else{SNI.HGRM.globalToolbar.config=configObj;SNI.HGRM.globalToolbar.createEmail();SNI.HGRM.globalToolbar.printPage();SNI.HGRM.globalToolbar.twitterShare();SNI.HGRM.globalToolbar.fbShare();}
var config=SNI.HGRM.globalToolbar.config;var page_section=mdManager.getParameterString("SctnDspName");SNI.HGRM.Omniture.SingleVar("#global-toolbar",page_section+":Social Toolbar:"+config.emailPageTitle,"FOOD");}};
if(typeof SNI==='undefined'){SNI={}}
if(SNI.HGRM===undefined){SNI.HGRM={}}
SNI.HGRM.GlobalHeader=(function($){var GlobalHeader=function(){var GlobalHeader=this;var globalNav=function(){var globalNav=this;globalNav.MENU_DELAY_OUT=500;globalNav.MENU_DELAY_IN=100;if(typeof SNI.Config.navHoverDelayOut=='number'){globalNav.MENU_DELAY_OUT=SNI.Config.navHoverDelayOut;}
if(typeof SNI.Config.navHoverDelayIn=='number'){globalNav.MENU_DELAY_IN=SNI.Config.navHoverDelayIn;}
globalNav.oSiteNav={};globalNav.navSelector="header:first nav";globalNav.jQnav={};globalNav.init=function(){globalNav.jQnav=$(globalNav.navSelector);initNavBar(globalNav.jQnav.find(".nav-wrap ul"));globalNav.setSelectedTab(globalNav.getTabToSelect(mdManager));globalNav.loadDropsDta();return;};function initNavBar($navtabs){var navTimerOut,navTimerIn=null;$navtabs.children("li.nav").hover(function(e){var $this=$(this);clearTimeout(navTimerOut);navTimerOut=null;if($this.hasClass("dd-on")){return;}
$navtabs.find("li.nav").removeClass("dd-on");clearTimeout(navTimerIn);navTimerIn=null;navTimerIn=setTimeout(function(){$this.addClass("dd-on");},globalNav.MENU_DELAY_IN);},function(e){var $this=$(this);clearTimeout(navTimerIn);navTimerIn=null;clearTimeout(navTimerOut);navTimerOut=null;navTimerOut=setTimeout(function(){$this.removeClass("dd-on");},globalNav.MENU_DELAY_OUT);});return;}
globalNav.getTabToSelect=function(md){var tabKey="xyz";if(((typeof md.getParameter("SctnName"))!="undefined")&&(md.getParameter("SctnName")!="")){tabKey=md.getParameter("SctnName");}
return tabKey;};globalNav.setSelectedTab=function(tabKey){var retVal=false;if($.isEmptyObject(globalNav.jQnav)){globalNav.jQnav=$(globalNav.navSelector).eq(0);}
tabKey=tabKey.toLowerCase().replace(/ /g,'-');var $tTabs=globalNav.jQnav.find(".nav-wrap > ul > li");$tTabs.removeClass("sel savesel");var $tTab=$tTabs.filter(".tab-"+tabKey);if($tTab.length>0){$tTab.addClass("sel savesel");retVal=true;}
return retVal;};globalNav.loadDropsDta=function(){$.ajax({url:SNI.Config.navDropJsonPath+"&callback=SNI.HGRM.GlobalHeader.globalNav.processNavLoad",dataType:'script',cache:true,timeout:45000,error:SNI.HGRM.GlobalHeader.globalNav.errorNavLoad});};globalNav.processNavLoad=function(jsondta){globalNav.oSiteNav=jsondta;fillDrops();return;};globalNav.errorNavLoad=function(oXHR,sError){return;}
function fillDrops(){var i,o=[],myHtml;if(typeof globalNav.oSiteNav!="object")return false;if($.isArray(globalNav.oSiteNav.navGrps)){for(i=0;i<globalNav.oSiteNav.navGrps.length;i++){o=o.concat(globalNav.oSiteNav.navGrps[i].topTabs);}}else if($.isArray(globalNav.oSiteNav.topTabs)){o=globalNav.oSiteNav.topTabs;}else{return false;}
var bShivIt=(typeof window.innerShiv==="function")&&$.browser.msie&&($.browser.version<9);for(i=0;i<o.length;i++){if((typeof o[i].keyName=="string")&&$.isArray(o[i].linkGrps)){$thisTab=$("nav").find("li.tab-"+o[i].keyName);if((typeof $thisTab!="object")||($thisTab.length==0))continue;myHtml=fmtOneDropHtml(o[i],"gh-t"+(i+1));if(myHtml!=""){if(bShivIt){myHtml=innerShiv(myHtml);}
$thisTab.append(myHtml);}}}
setHandlers();positionDrops();return true;}
function fmtOneDropHtml(oTab,relVal){function evalObj(o){for(var a=o.split('.'),r=window,k;k=a.shift();r=r[k]);return r;}
function fixUrl(url,dom){if(url.search(/^http(s?):\/\//)==-1){if(typeof dom==="string"){dom=evalObj(dom);}else{dom=SNI.Config.domain;}
url="http://"+dom+url;}
return url;}
function fmtALink(oLnk){var retHtml="";if(typeof oLnk!="object"){return retHtml;}
if(((typeof oLnk.text)!="string")||((typeof oLnk.url)!=="string")){return retHtml;}
var url=fixUrl(oLnk.url,oLnk.domain);retHtml='<a href="'+url+'"';retHtml+=' rel="'+relVal+'-'+(++linkCt)+'"';if(((typeof oLnk.newWin)=="string")&&oLnk.newWin=="true"){retHtml+=' target=\"_blank\"';}
retHtml+='>'+oLnk.text+'</a>';return retHtml;}
function fmtLinkGrp(oLG,bLast){var retHtml="";var extraClass="";var aHtml;if((typeof bLast!='undefined')&&bLast){extraClass+=" last";}
if((typeof oLG.type!='undefined')){if(oLG.type=="search"){extraClass+=" special";}}else{oLG.type="links";}
if(extraClass!=""){extraClass=' class="'+$.trim(extraClass)+'"';}
retHtml+="<section"+extraClass+">";if((typeof oLG.dspName)=="string"){retHtml+='<div class="hd"><p>'+oLG.dspName+'</p></div>';}
retHtml+='<div class="bd">';if(oLG.type=="links"){if($.isArray(oLG.links)){retHtml+='<ul>';var mhalf=Math.round(oLG.links.length/2,0);for(var m=0;m<oLG.links.length;m++){if(m==mhalf){retHtml+="</ul>";retHtml+="<ul>";}
if((aHtml=fmtALink(oLG.links[m]))!=""){retHtml+='<li>'+aHtml+'</li>';}}
retHtml+="</ul>";}
if((aHtml=fmtALink(oLG.cta))!=""){retHtml+='<p class="cta">'+aHtml+'</p>';}
if((aHtml=fmtALink(oLG.oneLink))!=""){retHtml+='<p>'+aHtml+'</p>';}}else if(oLG.type=="search"){if(typeof oLG.action=='string'&$.isArray(oLG.fields)){var myAction=oLG.action;if(myAction.indexOf("http://")==-1){myAction=fixUrl(myAction,oLG.domain);}
retHtml+='<form id="'+oLG.id+'" class="global-search" action="'+myAction+'" method="get">';formScript="";retHtml+='<div class="input">';for(var i=0;i<oLG.fields.length;i++){if(typeof oLG.fields[i].type!="string"){oLG.fields[i].type="text";}
retHtml+='<input name="'+oLG.fields[i].name+'" type="'+oLG.fields[i].type+'"';if(typeof oLG.fields[i].value==="string"){retHtml+=' value="'+oLG.fields[i].value+'"';}
retHtml+=' />';if(typeof oLG.fields[i].prompt==="string"){myPreventDefault="";if(typeof oLG.fields[i].preventDefault=="string"){myPreventDefault=', '+oLG.fields[i].preventDefault;}
formScript+='SNI.Util.inputField("#'+oLG.id+' input:eq('+i+')",  "'+oLG.fields[i].prompt.replace(/"/g,'\\"')+'"'+myPreventDefault+');';}}
retHtml+='</div>';retHtml+='<button type="submit" title="Search" class="btn search"><span>Search</span></button>';retHtml+='</form>';retHtml+='<script>'+formScript+'</script>';}}
retHtml+="</div>";retHtml+="</section>";return retHtml;}
var retHtml="";var linkCt=0;for(var i=0;i<oTab.linkGrps.length;i++){retHtml+=fmtLinkGrp(oTab.linkGrps[i],(i==(oTab.linkGrps.length-1)));}
if(retHtml!=""){var myHtml=retHtml;var myClass='';if(typeof oTab.treatment==="string"&&oTab.treatment.length>0){myClass=' '+oTab.treatment;}
retHtml="<div class=\"box drop clean"+myClass+"\"><em></em>";retHtml+=myHtml;retHtml+="</div>";}
return retHtml;}
function positionDrops(){var $dropBoxes=globalNav.jQnav.find(".box");var $peakElt=$dropBoxes.children("em");var peakWidth=parseInt($peakElt.css("width"));var peakIndent=parseInt($peakElt.css("left"));function positionOneDrop(i,e){var $thisBox=$(e);var $thisTab=$thisBox.siblings("a");var newOffset=((($thisTab.outerWidth()-peakWidth))/2-peakIndent)+"px";if($thisTab.parent().hasClass('e')){$thisBox.css({"right":newOffset});}else{$thisBox.css({"left":newOffset});}
return;}
$dropBoxes.each(positionOneDrop);return;}
function setHandlers(){$("#rmr-search").submit(function(e){var searchVal=$("#rmr-search input[name='rmr-term']").val();if($.trim(searchVal).length>0){SNI.HGRM.RMRSearch.globalSearch(searchVal);}else{$("#rmr-search input[name='rmr-term']").get(0).focus();}
e.preventDefault();});$("#hdr-kudzu-search").submit(function(e){if($("#hdr-kudzu-search input[name='searchVal']").val().trim()==''){$("#hdr-kudzu-search input[name='currentLocation']").blur();}
return;});return;}};GlobalHeader.globalNav=new globalNav();GlobalHeader.globalSearch=function(element,autosuggest,forceDefaultValue){var searchValue='Find remodeling advice & inspiration';var _preventDefault=true;if(forceDefaultValue){if(mdManager.getParameterString("type")=="SEARCH"){searchValue=mdManager.getParameterString("searchTerm");if(mdManager.getParameterString("noSearchResults")=="Did You Mean"){var tmpValue=mdManager.getParameterString("dymterm");if(tmpValue.length>0){searchValue=tmpValue;}}
_preventDefault=false;}}
SNI.Util.inputField(element+' input',searchValue,_preventDefault,!_preventDefault);if(forceDefaultValue&&!_preventDefault){$(element+' input').removeClass("input-hint");}
if(window.location.hostname!=SNI.Config.domain){autosuggest=false;}
if(autosuggest===true){function findValue(li){if(li==null){}else{return li.selectValue;}}
function selectItem(li){findValue(li);}
function formatItem(row,i,num,prev){var formattedItem;if(prev.length>0&&row[0].indexOf(prev)>=0){formattedItem=row[0].replace(prev,"<em>"+prev+"</em>")}
return formattedItem||row[0];}
$(element+" input").autocomplete(SNI.Config.autoSuggestService,{delay:10,width:320,minChars:3,matchSubset:1,matchContains:0,cacheLength:10,onItemSelect:selectItem,onFindValue:findValue,formatItem:formatItem,autoFill:true,backspaceAutofill:true,resultsShow:{method:"slideDown",duration:300},resultsHide:{method:"slideUp",duration:300},stylizedOverlay:true,formElement:$(element+' form'),maxItemsToShow:7,svcTermInPath:true});}
$(element+' form').submit(function(){var $form=$(this);var $searchInput=$form.find('input');var searchText=$.trim($searchInput.val());if(searchText==''||searchText.toLowerCase()=='search'){$searchInput.get(0).focus();return false;}
return true;});};GlobalHeader.myHGRM=function(){$("#my-hgrm .not-signed-in #ur-login").attr("href","http://"+SNI.Community.UR.Core.getLoginLink());$("#my-hgrm .not-signed-in #ur-register").attr("href","http://"+SNI.Community.UR.Core.getRegisterLink());if(SNI.Community.UR.logged_in){$('#my-hgrm .signed-in .hello a, #my-hgrm .signed-in .drop .feature a').text(SNI.Community.UR.ViewingUserDisplayName);if(typeof SNI.Community.UR.ViewingUserAvatar==="string"&&SNI.Community.UR.ViewingUserAvatar.length>0){$('#my-hgrm .signed-in .hello').before('<li class="avatar"><img width="20" height="20" src="'+SNI.Community.UR.ViewingUserAvatar+'" /></li>');$("#my-hgrm .signed-in .drop .feature").prepend('<img width="48" height="48" src="'+SNI.Community.UR.ViewingUserAvatar+'" />');}
$('#my-hgrm .signed-in a').not('.btn').each(function(){$(this).attr("href","http://"+SNI.Community.ur3Domain+$(this).attr("href").match(/^(http:\/\/[^\/]*)?(.*)/)[2]);});$('#my-hgrm .signed-in a.btn').attr("href","http://"+SNI.Community.UR.Core.logout());var $dd=$('#my-hgrm .box');$('#my-hgrm .signed-in .arrow').hover(function(){$dd.show();},function(){var timer=setTimeout(function(){$dd.hide();clearTimeout(timer);timer=null;},100);});$('#my-hgrm .not-signed-in').hide();$('#my-hgrm .signed-in').show();}};GlobalHeader.init=function(){GlobalHeader.globalNav.init();GlobalHeader.globalSearch('header:first .search',true,true);GlobalHeader.myHGRM();};};return new GlobalHeader();})(jQuery);SNI.HGRM.RMRSearch=(function($){var r=function(){var r=this;r.cleanSearchQuery=function(input){var temp=input;temp=temp.replace(/[^a-zA-Z 0-9&']+/g,"-");temp=temp.replace(/%/g," ");temp=temp.replace(/~/g," ");temp=temp.replace(/#/g," ");temp=temp.replace(/\?/g," ");temp=temp.replace(/\$/g," ");temp=temp.replace(/  /g," ");temp=temp.replace(/  /g," ");temp=temp.replace(/--/g,"-");temp=temp.replace(/-/g,"--");temp=temp.replace(/ /g,"-");temp=escape(temp);return temp;}
r.globalSearch=function(searchVal){searchVal=r.cleanSearchQuery(searchVal)
var myPath="http://"+SNI.Config.Community.ur3Domain+SNI.Config.Community.searchPath.replace("@term@",searchVal);window.location=myPath;return;}};return new r();})(jQuery);
$.ui=$.ui||{};$.fn.extend({dropdown:function(options,data){if(navigator.userAgent.match(/iPhone|android|blackberry/i)){return;}
var args=Array.prototype.slice.call(arguments,1);return this.each(function(){if(typeof options=="string"){var dropdown=$.data(this,"ui-dropdown");dropdown[options].apply(dropdown,args);}else if(!$(this).is(".ui-dropdown")){$.data(this,"ui-dropdown",new $.ui.dropdown(this,options));}});}});$.ui.dropdown=function(container,options){this.element=$(container);this.options=options=$.extend({},$.ui.dropdown.defaults,options);this.options.title=this.options.title||this.element.find('option.select-title').text();this.element.addClass("ui-dropdown");this.list=buildList(this.element,this.options);this.element.after(this.list);this.css={position:this.element.css('position'),left:this.element.css('left')};this.element.hide();if(this.element.attr('disabled')){this.disable();}else{this.enable();}
this.element.bind('focus',{dropdown:this},this.activate);this.element.blur(hideDropDowns);this.element.keydown(function(event){event.preventDefault();});};$.extend($.ui.dropdown,{defaults:{title:'',disabled:false}});$.ui.dropdown.prototype={enable:function(){var element=this.element;var list=this.list;this.options.disabled=false;this.element.removeAttr('disabled');this.list.find('.disabled').removeClass('disabled');var handle=this.list.find('dt a');handle.mousedown(function(){hideDropDowns();list.find('dd').show();$(this).parent('dt').addClass('active');$('body').bind("mousedown",bodyClicked);return false;});return element;},disable:function(){this.options.disabled=true;this.element.attr('disabled','disabled');this.list.find('dt').addClass('disabled');var handle=this.list.find('dt a');handle.unbind('mousedown');return this.element;},destroy:function(){this.list.remove();this.element.show();this.element.removeClass("ui-dropdown");$.removeData(this.element,"ui-dropdown");},reset:function(){this.list.remove();this.options.title=this.element.find('option.select-title').text();this.list=buildList(this.element,this.options);this.element.after(this.list);},select:function(){var select=this.element.get(0);var option=select.selectedIndex>-1?select[select.selectedIndex]:false;if(option){this.list.find('dt a').html(option.text+'<em></em>');}},activate:function(event){var dropdown=event&&event.data?event.data.dropdown:this;if(!dropdown.options.disabled){hideDropDowns();dropdown.list.find('dd').show();dropdown.list.find('dt').addClass('active');}}};function buildList(element,options){var select=element.get(0);var option=select.selectedIndex>-1?select[select.selectedIndex]:false;var selected=option?option.text:'';var ddList='<dl class="dd-list">';ddList+=options.disabled?'<dt class="dd-dt disabled">':'<dt class="dd-dt">';ddList+='<a>'+selected+'<em></em></a></dt>';ddList+='<dd style="display: none;">';ddList+='<div class="dd-bd box drop half">';if(options.title){ddList+='<div class="hd tint"><p>'+options.title+'</p><span></span></div>';}
ddList+='<div class="bd fill">';ddList+='</div>';ddList+='</dd>';ddList+='</dl>';ddList=$(ddList);ddList.find('.hd span').click(function(){hideDropDowns();return false;});var list=$('<ul class="dd-ul single"></ul>');element.children('option:not(.select-title)').each(function(i){var link=$('<a href="#">'+$(this).text()+'</a>');link.click(function(){ddList.find('dt a').html($(this).text()+'<em></em>');element.find('option:not(.select-title)')[i].selected=true;hideDropDowns();element.trigger('change');return false;});var item=$('<li class="dd-li"></li>').append(link);list.append(item);});ddList.find('.bd').append(list);return ddList;}
function hideDropDowns(event){if(event&&$.browser.mozilla&&$(event.target).hasClass('dd-ul')){return true;}
$('.dd-list dd').hide();$('.dd-list .active').removeClass('active');$('body').unbind("mousedown",bodyClicked);return true;}
function bodyClicked(event){var element=$(event.target);if(element.parents().is('.dd-list')){return false;}else{hideDropDowns();}}
$.ui=$.ui||{};$.fn.extend({dependent_dropdowns:function(options,data){var args=Array.prototype.slice.call(arguments,1);return this.each(function(){if(typeof options=="string"){var dependent_dropdowns=$.data(this,"ui-dependent-dropdowns");dependent_dropdowns[options].apply(dependent_dropdowns,args);}else if(!$(this).is(".ui-dependent-dropdowns")){$.data(this,"ui-dependent-dropdowns",new $.ui.dependent_dropdowns(this,options));}});}});$.ui.dependent_dropdowns=function(container,options){this.element=$(container);this.options=options=$.extend({},$.ui.dependent_dropdowns.defaults,options);this.dropdowns=this.options.dropdowns||this.element.find('select');this.data=this.options.data;this.element.addClass("ui-dependent-dropdowns");var dd=this;$.each(this.dropdowns,function(i,val){$(val).dropdown();$(val).bind("change",function(){index=$.inArray(this,dd.dropdowns);if(index!=-1){dd._updateValues(index+1);}});});this.enable();};$.ui.dependent_dropdowns.prototype={enable:function(){this._updateValues(0);this.defaults();},disable:function(){},destroy:function(){$.each(this.dropdowns,function(key,value){$(value).destroy();});this.element.removeClass("ui-dependent-dropdowns");$.removeData(this.element,"ui-dependent-dropdowns");},defaults:function(){if(this.data.defaults){var now=new Date();var hours=now.getHours()<10?'0'+now.getHours():now.getHours();var minutes=now.getMinutes()<10?'0'+now.getMinutes():now.getMinutes();var time=hours.toString()+minutes.toString();var dd=this;$.each(this.data.defaults,function(key,values){times=key.split('-');if(dd._checkTime(times[0],times[1],time)){index=0;$.each(values,function(k,v){if(select=dd.dropdowns[index]){$(select).find('option').each(function(){if($(this).val()==v){this.selected=true;$(select).dropdown('select');$(select).trigger('change');}});}
index++;});}});}},_updateValues:function(index){if(index==null){index=0;}
if(dropdown=this.dropdowns[index]){values=this._findValues(this.data.values,0,index);previous_value=$(dropdown).val()||false;if(this.data.titles&&this.data.titles[index]){options='<option value="" class="select-title">'+this.data.titles[index]+'</option>';}else{options='';}
if(values){$.each(values,function(key,val){options+='<option value="'+key+'"';if(previous_value&&previous_value==key){options+=' selected="selected"';}
options+='>'+val.label+'</option>';});}
if(!values){$(dropdown).dropdown('disable');}
$(dropdown).html(options);$(dropdown).dropdown('reset');if(values){$(dropdown).dropdown('enable');}
this._updateValues(index+1);}},_findValues:function(values,start_index,end_index){if(start_index==end_index){return values;}else{values=values[$(this.dropdowns[start_index]).val()];if(values){return this._findValues(values.values,start_index+1,end_index);}else{return null;}}},_updateDropdown:function(dropdown){if(index=$.inArray(dropdown,this.dropdowns)){this._updateValues(index+1);}},_checkTime:function(from_time,to_time,time){if(to_time<from_time){if(time>=from_time&&time<2400){return true;}else if(time<to_time&&time>=0){return true;}}else if(time>=from_time&&time<to_time){return true;}
return false;}};
if(typeof SNI==='undefined'){SNI={};}
if(SNI.Community===undefined){SNI.Community={};}
if(SNI.Community.UR===undefined){SNI.Community.UR={};}
SNI.Community.UR.init=function(){if(typeof SNI.Community.siteName=='string'){if(typeof this.ViewingUserName=='string'){this.logged_in=true;}}else{var user=new SNI.UR.UrUser(new SNI.UR.ApplicationConfig());if(user.isLoggedIn==true){this.ViewingUserId=user.getUserId();this.ViewingUserName=user.getEmail();this.ViewingUserDisplayName=user.getUserName();this.logged_in=true;}}};SNI.Community.UR.logout=function(){var destURL=document.location;document.location="http://my.hgtvremodels.com/redirectors/logout_redirector.jsp?DEST_URL="+escape(destURL);};SNI.Community.UR.extendedInit=function()
{if(typeof SNI.Community.siteName=='string')
{if(typeof this.ViewingUserName=='string')
{this.logged_in=true;}}
else
{var user=new SNI.UR.UrUser(new SNI.UR.ApplicationConfig());if(user.isLoggedIn==true)
{this.ViewingUserId=user.getUserId();this.ViewingUserName=user.getEmail();this.ViewingUserDisplayName=user.getUserName();this.ViewingUserAvatar=user.getAvatar();this.logged_in=true;}}};SNI.Community.UR.Core.extendedInit();SNI.Community.UR.extendedInit();
if(typeof(SNI.HGRM.Omniture)=='undefined'){SNI.HGRM.Omniture={};}
SNI.HGRM.Omniture.ClickTrack=SNI.Omniture.MultiVar;SNI.HGRM.Omniture.MultiVar=SNI.Omniture.MultiVar;SNI.HGRM.Omniture.SingleVar=SNI.Omniture.SingleVar;SNI.HGRM.Omniture.CrossLinkTrack=SNI.Omniture.CrossLinkTrack;SNI.HGRM.Omniture.HotSpotClick=function(){return;}
SNI=SNI||{};SNI.HGRM=SNI.HGRM||{};SNI.HGRM.DynamicAds=SNI.DynamicAds;SNI.HGRM.DynamicAds=(function(d){d.fmt_interstitial=function(){var hRet="";hRet+='<div class="interwrap">';hRet+='<a href="#" class="close"><span></span>Skip Ad</a>';hRet+='<h6 class="mrec">Advertisement</h6>';hRet+='<div class="inter-container">';if(d.iparm.iFmt.toLowerCase()=="swf"){hRet+='<div id="interad">'
+'<a class="no-flash-message" href="http://www.adobe.com/go/getflashplayer">'
+'<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />'
+'</a>'
+'</div>';}else{if(d.iparm.iHREF!=""){hRet+='<a href="'+d.iparm.iHREF+'">';}
hRet+='<img src ="'+d.iparm.iURL+'" />';if(d.iparm.iHREF!=""){hRet+='</a>';}}
hRet+='<iframe class="tracker" width="0" height="0" frameborder="0"></iframe>';hRet+='</div>';hRet+='</div>';return hRet;}
return d;})(SNI.HGRM.DynamicAds);
SNI.HGRM.Dynlead={init:function(elem,config){SNI.HGRM.Dynlead.config=$.extend({delay:4000,fadeSpeed:'slow',changeOn:'mouseover'},config);SNI.HGRM.Dynlead.timeout=null;SNI.HGRM.Dynlead.activeItem=null;SNI.HGRM.Dynlead.contents=$('.dl-content li',elem);SNI.HGRM.Dynlead.nav=$('.dl-menu li',elem);$('.dl-content li:gt(0)',elem).hide();this.enable();},enable:function(){SNI.HGRM.Dynlead.nav.bind(SNI.HGRM.Dynlead.config.changeOn,function(){var item=$(this);var itemActive=item.hasClass('active');SNI.HGRM.Dynlead.nextItem(item);return itemActive;});this.nextItem();},nextItem:function(nextItem){clearTimeout(SNI.HGRM.Dynlead.timeout);SNI.HGRM.Dynlead.timeout=null;if(SNI.HGRM.Dynlead.activeItem){if(!nextItem.hasClass('active')){var activeContent=SNI.HGRM.Dynlead.itemContent(SNI.HGRM.Dynlead.activeItem);activeContent.css({opacity:1});activeContent.stop();activeContent.fadeOut(SNI.HGRM.Dynlead.config.fadeSpeed);SNI.HGRM.Dynlead.itemContent(nextItem).fadeIn(SNI.HGRM.Dynlead.config.fadeSpeed);SNI.HGRM.Dynlead.nav.removeClass('active');nextItem.addClass('active');SNI.HGRM.Dynlead.activeItem=nextItem;}}else{SNI.HGRM.Dynlead.activeItem=SNI.HGRM.Dynlead.nav.eq(0).addClass('active');}
var activeIndex=SNI.HGRM.Dynlead.nav.index(SNI.HGRM.Dynlead.activeItem);var nextIndex=SNI.HGRM.Dynlead.nextItemIndex(activeIndex);nextItem=SNI.HGRM.Dynlead.nav.eq(nextIndex);SNI.HGRM.Dynlead.timeout=setTimeout(function(){SNI.HGRM.Dynlead.nextItem(nextItem);},SNI.HGRM.Dynlead.config.delay);},nextItemIndex:function(activeIndex){return SNI.HGRM.Dynlead.nav.length>activeIndex+1?activeIndex+1:0;},itemContent:function(item){var index=SNI.HGRM.Dynlead.nav.index(item);return SNI.HGRM.Dynlead.contents.eq(index);}};
(function($){if(typeof(SNI.HGRM.MenuHandler)=='undefined'){SNI.HGRM.MenuHandler={};}
SNI.HGRM.MenuHandler={pro_style_id:'#pro-style',pro_category_id:'#pro-category',pod_grid:'.pod.grid',pod_grid_child:'.pod.grid .bd.three-across',dd_label:'.click-wrap .btn.pull',pagiClass:'.pagi',resPerPage:24,currentPage:1,categoryId:'',styleId:'',prevCategoryId:'',prevStyleId:'',categoryFilter:'',styleFilter:'',showroom:0,space_detail:0,on_page_load:1,category_name:'',getJsonUrl:function(){var jsnUrlStart='/hgrm/cda/modules/roomStyleJSON/0,,HGRM';var jsnUrlEnd=',00.html';return jsnUrlStart+'_'+SNI.HGRM.MenuHandler.categoryId+'_'+SNI.HGRM.MenuHandler.styleId+'_'+SNI.HGRM.MenuHandler.showroom+'_'+SNI.HGRM.MenuHandler.currentPage+jsnUrlEnd;},toTitleCase:function(str){return str.replace(/\w\S*/g,function(txt){return txt.charAt(0).toUpperCase()+txt.substr(1).toLowerCase();});},highLightSubnav:function(){$.each($('.local-nav ul li a'),function(){if(SNI.HGRM.MenuHandler.showroom&&!SNI.HGRM.MenuHandler.on_page_load)return;if(SNI.HGRM.MenuHandler.category_name==$(this).html()){$(this).addClass('sel');SNI.HGRM.MenuHandler.on_page_load=0;}else $(this).removeClass('sel');});},getResultsData:function(){jQuery.ajax({type:'GET',dataType:'json',url:SNI.HGRM.MenuHandler.getJsonUrl(),success:function(data,textStatus,jqXHR){SNI.HGRM.MenuHandler.renderResults(data);SNI.HGRM.MenuHandler.prepareResultsData();},error:function(jqXHR,textStatus,errorThrown){alert('Error: '+' Sorry, we are experiencing difficulties fetching the necessary data.');}});},renderResults:function(jsonData){if(!jsonData||jsonData.resultsCount<1||jsonData.filters.length<1)return;SNI.HGRM.MenuHandler.updatedDropDowns(jsonData.filters);SNI.HGRM.MenuHandler.updatedResults(jsonData.results);SNI.HGRM.MenuHandler.updatedXofY(jsonData.currentPage,jsonData.resultsCount);SNI.HGRM.MenuHandler.updatePagination(jsonData.currentPage,jsonData.totalPages,jsonData.resultsCount);},hidePagination:function(){$(SNI.HGRM.MenuHandler.pagiClass).hide();},showPagination:function(){$(SNI.HGRM.MenuHandler.pagiClass).show();},getPagiLink:function(index,currentPage){if(index==currentPage)return'<span class="current">'+index+'</span>';return'<a href="javascript:void(0);">'+index+'</a>';},updatePagination:function(currentPage,totalPages,resultsCount){if($('.pagi').length==0){$('.sni-w').append(' <div class="pagi">'+'<a class="nextprev prev" href=""><em></em> Previous Page</a>'+'<a href="">1</a>'+'<span class="current">2</span>'+'<span class="nextprev prev">Next Page <em></em></span>'+'<div>');}
var prevPage='.nextprev.prev',nextPage='.nextprev.next',pagiLinks='.pagi a',addedEllipsis=false,pagiHtml=(currentPage>1)?'<a href="javascript:void(0);" class="nextprev prev">&larr; Previous</a>':'';if(totalPages<2){SNI.HGRM.MenuHandler.hidePagination();return;}
var rangeLow=currentPage-2;var rangeHigh=currentPage+2;pagiHtml+=SNI.HGRM.MenuHandler.getPagiLink(1,currentPage);for(var i=2;i<totalPages;i++){if((rangeLow<i)&&(i<rangeHigh)){pagiHtml+=SNI.HGRM.MenuHandler.getPagiLink(i,currentPage);}else if(!addedEllipsis){pagiHtml+='<span>....</span>';addedEllipsis=true;}}
pagiHtml+=SNI.HGRM.MenuHandler.getPagiLink(totalPages,currentPage);if(currentPage!=totalPages)pagiHtml+='<a href="javascript:void(0);" class="nextprev next">&rarr; Next</a>';$(SNI.HGRM.MenuHandler.pagiClass).html(pagiHtml);SNI.HGRM.MenuHandler.showPagination();},updatedXofY:function(currentPage,resultsCount){var from=(currentPage-1)*24+1;var to=(from+23)<resultsCount?from+23:resultsCount;$('div.lead.rule span.left cite.in.cap').text('Showing '+from+'-'+to+' of '+resultsCount+' '+SNI.HGRM.MenuHandler.category_name);},updatedResults:function(results){var filter_vals='#'+SNI.HGRM.MenuHandler.categoryFilter+SNI.HGRM.MenuHandler.styleFilter;lis='',filters=(filter_vals=='#')?'':filter_vals;$.each(results,function(index){var item=$(this)[0];if(index%3==0)lis+='<div class="bd three-across"><ul>';lis+='<li>'+'<a href="'+item.url+filters+'"><img width="160" height="120" alt="'+item.title+'" src="'+item.image+'"></a>'+'<a href="'+item.url+filters+'">'+item.title+'</a>'+'<cite class="cap"><span>'+item.designer+'</span></cite>'+'</li>';if(index==results.length||(index>0&&index%3==2))lis+='</ul></div>';});$('.sni-w div.pod.grid').html(lis);},updatedDropDowns:function(filters){SNI.HGRM.MenuHandler.generateDropDowns(SNI.HGRM.MenuHandler.pro_style_id,filters.style);SNI.HGRM.MenuHandler.generateDropDowns(SNI.HGRM.MenuHandler.pro_category_id,filters.category);},generateDropDowns:function(menuId,filters){var lis='',selId=$(menuId).attr('data-id');$.each(filters,function(){var item=$(this)[0],sel=(selId==item.id)?' class="selected" ':'';if(item.disp)lis+='<li><a href="javascript:void(0);" data-id="'+item.id+'" onclick="javascript:void(0);">'+item.name+'</a></li>';else lis+='<li><span'+sel+'>'+item.name+'</span></li>';});$(menuId+' ul').html(lis);},prepareResultsData:function(response){var gridHeight=$(SNI.HGRM.MenuHandler.pod_grid_child).height();if(response==="start"){$(SNI.HGRM.MenuHandler.pod_grid).css('height',gridHeight);$(SNI.HGRM.MenuHandler.pod_grid).spinner();$(SNI.HGRM.MenuHandler.pod_grid_child).fadeOut('fast');setTimeout(function(){SNI.HGRM.MenuHandler.getResultsData();},1000);}
else{$(SNI.HGRM.MenuHandler.pod_grid).css('height','auto');$(SNI.HGRM.MenuHandler.pod_grid).append('<div class="hr"><hr></div>');$(SNI.HGRM.MenuHandler.pod_grid).spinner('remove');$(SNI.HGRM.MenuHandler.pod_grid_child).fadeIn('fast');}},portfolioFilters:function(){var sni_w='.sni-w',click_wrap='.click-wrap',click_btn='.click-wrap .btn, .click-wrap .more',display_menu='.click-wrap .box',close_btn='.click-wrap .box .hd span',menu_link='.click-wrap .box a';SNI.HGRM.MenuHandler.category_name=SNI.HGRM.MenuHandler.toTitleCase(mdManager.getParameterString('SctnDspName').split('_').slice(1).join(' '));if('PORTFOLIO_DETAIL'==mdManager.getParameterString('DelvFrmt'))SNI.HGRM.MenuHandler.space_detail=1;SNI.HGRM.MenuHandler.highLightSubnav();$(sni_w).delegate('.pagi a','click',function(e){e.stopPropagation();e.preventDefault();var newPage=parseInt($(this).html());if(isNaN(newPage)){newPage=SNI.HGRM.MenuHandler.currentPage;if($(this).hasClass('prev'))newPage--;else if($(this).hasClass('next'))newPage++;if(newPage==SNI.HGRM.MenuHandler.currentPage){return;}}
SNI.HGRM.MenuHandler.currentPage=newPage;SNI.HGRM.MenuHandler.prepareResultsData('start');$('html, body').animate({scrollTop:285},'slow');});$(click_wrap).delegate(menu_link,'click',function(e){e.stopPropagation();e.preventDefault();var link=$(this);var dd=$(this).parents(click_wrap);if(SNI.HGRM.MenuHandler.space_detail){SNI.HGRM.ProGallery.refreshPortfolioPage(link.attr('href'),dd.attr('id'));return;}
if('#'+dd.attr('id')==SNI.HGRM.MenuHandler.pro_style_id){SNI.HGRM.MenuHandler.prevStyleId=SNI.HGRM.MenuHandler.styleId;SNI.HGRM.MenuHandler.styleId=link.attr('data-id');SNI.HGRM.MenuHandler.styleFilter='/style/'+link.text().replace(/\s/g,'+');if(!SNI.HGRM.MenuHandler.styleId)SNI.HGRM.MenuHandler.styleFilter='';}else{SNI.HGRM.MenuHandler.prevCategoryId=SNI.HGRM.MenuHandler.categoryId;SNI.HGRM.MenuHandler.categoryId=link.attr('data-id');SNI.HGRM.MenuHandler.categoryFilter='/space/'+link.text().replace(/\s/g,'+');if(!SNI.HGRM.MenuHandler.categoryId)SNI.HGRM.MenuHandler.categoryFilter='';}
dd.children(SNI.HGRM.MenuHandler.dd_label).html(link.text()+' <span></span>');SNI.HGRM.MenuHandler.currentPage=1;SNI.HGRM.MenuHandler.prepareResultsData('start');$(close_btn).trigger('click');});},toggleBox:function(){var click_wrap='.click-wrap',click_btn='.click-wrap .btn.pull, .click-wrap .more',display_menu='.click-wrap .box',close_btn='.click-wrap .hd.tint span',menu_link='.click-wrap .box a';SNI.HGRM.MenuHandler.closeBox();$(click_wrap).delegate(click_btn,'click',function(e){if($(this).hasClass('sel')){$(this).removeClass('sel').siblings(display_menu).removeClass('show');SNI.HGRM.StoreVariable.activeMenu='';}else{$(this).addClass('sel').siblings(display_menu).addClass('show');if(typeof SNI.HGRM.StoreVariable.activeMenu.removeClass=='function'){SNI.HGRM.StoreVariable.activeMenu.removeClass('sel').siblings(display_menu).removeClass('show');}
SNI.HGRM.StoreVariable.activeMenu=$(this);}
e.stopPropagation();e.preventDefault();});$(click_wrap).delegate(close_btn,'click',function(e){$(this).closest(display_menu).removeClass('show');$(click_btn).removeClass('sel');SNI.HGRM.StoreVariable.activeMenu='';e.stopPropagation();});if(typeof SNI.HGRM.StoreVariable==='undefined'){SNI.HGRM.StoreVariable={};SNI.HGRM.StoreVariable.activeMenu='';}
$('body').children().andSelf().click(function(e){if($(e.target).parents().is(display_menu)){e.stopPropagation();}else if(typeof SNI.HGRM.StoreVariable.activeMenu.removeClass=='function'){SNI.HGRM.StoreVariable.activeMenu.removeClass('sel').siblings(display_menu).removeClass('show');SNI.HGRM.StoreVariable.activeMenu='';}});},closeBox:function(){var display_menu='.box';var close_btn='.box .box.drop.half span, .close-btn';var box_wrapper='.lead, .pod';$(close_btn).click(function(){$(this).closest(box_wrapper).fadeOut('fast');return false;});},moreBox:function(t,d){$(t).hover(function(){$(this).children(d).show();},function(){$(this).children(d).hide();});},searchFilters:function(){var $toggleBtn=$('.narrow-results-btn');var $searchBox=$('#narrow-results-box');var $closeBtn=$('#narrow-results-box > .hd > span');var $showMore=$('#narrow-results-box .cta > a');var $boxContainers=$searchBox.find('.cta');var defaultMsg='Hide Narrowing Filters';var toggleMsg='Narrow Your Results';$toggleBtn.click(function(){$searchBox.slideToggle('fast',function(){if($(this).is(':hidden')){$toggleBtn.text(toggleMsg);}else{$toggleBtn.text(defaultMsg);}});return false;});$closeBtn.click(function(){$searchBox.slideUp('fast',function(){$toggleBtn.text(toggleMsg);});return false;});$showMore.click(function(e){var $_self=$(this);if(!$_self.siblings('.box').hasClass('active')){$boxContainers.children('.box').removeClass('active').fadeOut('fast');$_self.siblings('.box').addClass('active').fadeIn('fast');}else{$_self.siblings('.box').removeClass('active').fadeOut('fast');}
e.stopPropagation();return false;});$('html').click(function(e){$boxContainers.children('.box').removeClass('active').fadeOut('fast');});}};})(jQuery);
if(SNI.HGTV===undefined){SNI.HGTV={};}
if(SNI.HGTV.Photogallery3===undefined){SNI.HGTV.Photogallery3={};}
(function($){var DEFAULT_CONFIG={type:'full-page',gallery_title:"",current_index:0,initial_load:false,thumbnail_loader:"http://www.sndimg.com/webhgrm/rm10/imgs/le/loader-dark.gif",default_product_image_sm:"http://www.sndimg.com/webhgrm/rm10/imgs/le/product_unavailable_sm.jpg",default_product_image_lg:"http://www.sndimg.com/webhgrm/rm10/imgs/le/product_unavailable_al.jpg",images:null};var PhotoGallery=function(element,config){for(var prop in DEFAULT_CONFIG){if(!config.hasOwnProperty(prop)){config[prop]=DEFAULT_CONFIG[prop];}}
config.images=config.images||imageData;var gallery=this,gallery_element,count_label,photo_display,thumbnails_button,thumbnails_frame,next_button,previous_button,ad_unit,photo_description,photo_author,caption_head,caption,toggler,endframe_info,endframe_container,template_element,hsproduct_wrapper,ymal,ymal_list,_load_once,current_index,loader_img=new Image(),default_product_img_sm=new Image(),default_product_img_lg=new Image(),inter_next=false,print_link,inter_refreshed=true,dyn_load_origin;loader_img.src=config.thumbnail_loader;function doDynOmni(i){++i;var omniVars=new Object();if(mdManager.getParameterString("oUrl")==""){mdManager.setParameter("oUrl",mdManager.getParameterString("Url"));}
mdManager.setParameter("Url",mdManager.getParameter("oUrl")+"?i="+parseInt(i,10));if(i<10){i='0'+parseInt(i,10);}
mdManager.setParameter("UniqueId",mdManager.getParameterString("UniqueId").replace(/(.*?)-([0-9]{1,2})$/,"$1-"+i));if(typeof s=="object"){omniVars=new Object();if(dyn_load_origin!=""){omniVars.prop26="HGTV : Photo Gallery : "+config.gallery_title+" : "+dyn_load_origin+" : "+i;dyn_load_origin="";}
s.t(omniVars);}
return;}
function createImageWrapper(current_data){var clone=template_element.clone(),clone_image=clone.find("a img"),new_image=new Image(),toggler=clone.children(".pg-toggler");clone.attr("id","pg-photo-"+current_data.iid);clone.find("a.photo").attr("href",current_data.pgUrl).click(function(e){if(current_data.bhs!=-1){gallery.nextPhoto(e);var omniParams={section:"HGTV Remodels: Photo Gallery",module:(config.gallery_title||$("head title").text()),linkText:"Photo Click:"+current_index};SNI.Omniture.dynamicSingleVar(omniParams);}
return false;});clone.children(".pg-hotspots").remove();clone_image.attr("alt",current_data.ialt);jQuery(new_image).load(function(response,status,xhr){clone.appendTo(photo_display);current_data.image_wrapper=clone;clone_image.attr("src",new_image.src);clone_image.attr("style","");clone.attr("style","");if(current_data.bvert){setupToggler(toggler,current_index);toggler.show();}
else{toggler.hide();clone.removeClass("pg-fitted");}
applyHotspots(current_data);gallery_element.removeClass("loading");thumbnails_button.removeClass("dis");next_button.removeClass("dis");previous_button.removeClass("dis");clone.hide();clone.fadeIn("fast");}).error(function(){gallery_element.removeClass("loading");gallery_element.addClass("pg-errored");});new_image.src=current_data.iurl;}
function setupToggler(toggler,index){var enlarge=toggler.find(".pg-enlarge");var shrink=toggler.find(".pg-shrink");var current_data=config.images[index];current_data.image_wrapper.addClass("pg-fitted");current_data.toggler=toggler;current_data.toggler.enlarge=enlarge;current_data.toggler.shrink=shrink;enlarge.click(function(){current_data.image_wrapper.animate({width:"616px"},200);current_data.image_wrapper.find("a.photo img").animate({width:"616px"},200);enlarge.hide();shrink.show();var t=setTimeout(function(){verifyWrapperHeight();},450);});enlarge.children(".pg-toggler-button").hover(function(){enlarge.children(".pg-toggler-label").show();},function(){enlarge.children(".pg-toggler-label").hide();});enlarge.children(".pg-toggler-label").hover(function(){enlarge.children(".pg-toggler-label").show();},function(){enlarge.children(".pg-toggler-label").hide();});shrink.click(function(){current_data.image_wrapper.animate({width:"339px"},250);current_data.image_wrapper.find("a.photo img").animate({width:"339px"},250);shrink.hide();enlarge.show();var t=setTimeout(function(){verifyWrapperHeight();},450);});shrink.children(".pg-toggler-button").hover(function(){shrink.children(".pg-toggler-label").show();},function(){shrink.children(".pg-toggler-label").hide();});shrink.children(".pg-toggler-label").hover(function(){shrink.children(".pg-toggler-label").show();},function(){shrink.children(".pg-toggler-label").hide();});}
function shortenCaptionText(index){var current_data=config.images[index];var caption_length=207;var cap_start,cap_end='';if(current_data.ititle.length>41){caption_length=157;}
var cap=current_data.icap,truncated_cap=SNI.Util.truncateHtml(cap,caption_length),rendered_content=truncated_cap.success?truncated_cap.output+'<span class="pg-cap-elipse">&#8230; <span class="pg-show-caption">More</span></span>':cap;caption_head.html(current_data.ititle);caption.html(rendered_content);caption.find(".pg-show-caption").click(function(){caption.find(".pg-cap-elipse").hide();caption.hide().html(cap).fadeIn(175).slideDown(175);var t=setTimeout(function(){verifyWrapperHeight();},450);});}
function loadPhotoInfo(index,bFirst){var current_data=config.images[index];var next_index=(index+1)%config.images.length;doDynOmni(index);if(!bFirst){SNI.Nielsen.trackNSE();}
next_button.attr("href",config.images[next_index].pgUrl);if(print_link.length>0){var i=index+1;var plink=print_link.attr("href");if(i<10){i='0'+parseInt(index+1,10);}
plink=plink.replace(/(.*ARTICLE-PRINT-PHOTO-GALLERY-CURRENT).*?(,00.html)$/,"$1_"+i+"$2");print_link.attr("href",plink);}
gallery_element.addClass("loading");if(current_data.iid!="endframe"){count_label.html(index+1);photo_description.show();endframe_info.hide();shortenCaptionText(index);if(current_data.rtitle&&current_data.rtitle!=""){ymal.show();if(current_data.rtxt){ymal.find("h4").text(current_data.rtxt);}
ymal_list.html('<li><a href="'+current_data.rurl+'">'+current_data.rtitle+'</a></li>');}
else{ymal.hide();}
if(current_data.creator){photo_author.children(".pg-author-name").html(current_data.creator);photo_author.show();if(config['type']=='inline')photo_display_parent.attr('style','padding-bottom:0;');}else{photo_author.hide();if(config['type']=='inline')photo_display_parent.attr('style','padding-bottom:70px;');}}else{photo_description.hide();photo_author.hide();if(config['type']=='inline')photo_display_parent.attr('style','padding-bottom:70px;');endframe_info.show();ymal.hide();photo_display.prepend("<div class='mask' />");$(".pg-endframe .tabs .products-btn .btn").click();}
$(thumbnails_frame.find(".pg-thumbnails li")[index]).addClass("pg-selected-thumbnail");if(!current_data.image_wrapper){createImageWrapper(current_data);}else{gallery_element.removeClass("loading");current_data.image_wrapper.fadeIn("fast");}
gallery_element.trigger("load-photo-complete",{gallery:gallery,photo:current_data});if(!config['initial_load'])var t=setTimeout(function(){verifyWrapperHeight();},450);config['initial_load']=false;}
function verifyWrapperHeight(){if(top!=self)top.SNI.HGRM.adjustFrameWrapperHeight($('.photo-gallery').height());}
function applyHotspots(current_data){if(typeof SNI.HGTV.Photogallery3.Hotspots==="object"){$(SNI.HGTV.Photogallery3.Hotspots.images).each(function(){var hotspotImage=this;if(hotspotImage.id==current_data.iid&&!current_data.hotspotSet){current_data.hotspotSet=true;var hotspots_container=$('<div class="pg-hotspots"></div>').appendTo(current_data.image_wrapper);var hotspots_products,hotspot_items_info;var list_html=[],product_info_html=[],panel_html=[];list_html.push('<h3>Products From This Photo:</h3><ul class="pg-hotspot-list">');product_info_html.push('<ul class="pg-hsproducts">');panel_html.push('<div class="pg-hotspot-panel clrfix">'+'<div class="l">'+'<div class="pg-close-hspanel pg-close">'+'<img src="'+current_data.itnurl.replace('_sm.jpg','_med.jpg')+'" />'+'<span><a href="javascript: void(0);">Back to this Photo</a></span>'+'</div>');var showProducts=function(e){SNI.HGRM.Omniture.HotSpotClick(e.data.hotspot,"c");current_data.image_wrapper.fadeOut("fast",function(){hotspots_products.find("ul.pg-hotspot-list li.selected").removeClass("selected");hotspot_items_info.hide();$(hotspots_products.find("ul.pg-hotspot-list li")[e.data.index]).addClass("selected");$(hotspot_items_info[e.data.index]).show();current_data.image_wrapper.product_panel.fadeIn("fast",function(){current_data.image_wrapper.addClass("pg-hide-hotspots");hsproduct_wrapper.fadeIn("fast");});});};var hoverIn=function(){$(this).children().fadeIn("fast");};var hoverOut=function(){$(this).children().fadeOut("fast");};var product_image_url,product_description;$(hotspotImage.hotspots).each(function(index){var hotspot=this;product_image_url=hotspot.imageURL;product_description=hotspot.description;if(product_description.length>180){product_description=product_description.substring(0,180)+'... <a class="hotspot_readmore_'+index+'" href="'+hotspot.url+'">Read More</a>';}
if(hotspot.imageURL==="null"||hotspot.imageURL==""||hotspot.imageURL==null){product_image_url=default_product_img_lg.src;}
list_html.push('<li>'+hotspot.name+'</li>');product_info_html.push('<li class="clrfix">'
+'<p class="strong"><a class="hotspot_readmore_'+index+'" href="'+hotspot.url+'" target="_blank">'+hotspot.name+'</a></p>'
+' <div class="pg-hsproduct-img"><a class="hotspot_readmore_'+index+'" href="'+hotspot.url+'" target="_blank"><img src="'+product_image_url+'" alt="'+hotspot.name+'" width="266" height="200" /></a></div>'
+' <p>'+product_description+'</p>'
+' <a class="pg-hsproduct-moreinfo btn small hotspot_readmore_'+index+'" href="'+hotspot.url+'" target="_blank">'
+' <span>More info</span></a>'
+'</li>');var hotspotCSS={left:hotspot.hotspotXPercent+"%",top:hotspot.hotspotYPercent+"%"};var hotspot_element=$('<div class="pg-hotspot"><span class="pg-hotspot-name">'+hotspot.name+'</span></div>').appendTo(hotspots_container);hotspot_element.css(hotspotCSS);hotspot_element.bind("click",{hotspot:hotspot,index:index},function(e){hoverOut.apply(this,[e]);showProducts.apply(this,[e]);});hotspot_element.mouseover(hoverIn)
hotspot_element.mouseout(hoverOut);});list_html.push('</ul>');product_info_html.push('</ul>');panel_html.push(list_html.join("\n"));panel_html.push('</div><div class="r">');panel_html.push(product_info_html.join("\n"));panel_html.push('</div><span class="pg-close-btn pg-close">close</span></div>');hotspots_products=$(panel_html.join("\n")).appendTo(hsproduct_wrapper);current_data.image_wrapper.product_panel=hotspots_products;hotspot_items_info=hotspots_products.find("ul.pg-hsproducts li");$(hotspot_items_info[0]).show();hotspots_products.find("ul.pg-hotspot-list li").each(function(index){$(this).click(function(){SNI.HGRM.Omniture.HotSpotClick(hotspotImage.hotspots[index],"c");hotspots_products.find("ul.pg-hotspot-list li.selected").removeClass("selected");hotspot_items_info.hide();$(this).addClass("selected");$(hotspot_items_info[index]).show();});});hotspots_products.find(".pg-close-btn, .pg-close").click(function(){hsproduct_wrapper.fadeOut("fast",function(){current_data.image_wrapper.product_panel.hide();current_data.image_wrapper.removeClass("pg-hide-hotspots");current_data.image_wrapper.fadeIn("fast");});});hotspots_products.find("ul.pg-hsproducts li").each(function(index){$(this).find("a.hotspot_readmore_"+index).click(function(e){SNI.HGRM.Omniture.HotSpotClick(hotspotImage.hotspots[index],"1");e.stopPropagation();return true;});});}});gallery_element.trigger("hotspot-render-complete",{gallery:gallery});}}
gallery.title=config.gallery_title;gallery.previousPhoto=function(e){if($(this).data("block")!="yes"){var new_index;if(!previous_button.hasClass("pg-disabled")){if(gallery_element.hasClass("pg-errored")){gallery_element.removeClass("pg-errored");}
dyn_load_origin="Previous";inter_next=false;new_index=current_index-1;gallery.goToPhoto(new_index);gallery_element.trigger("previous-photo",{gallery:gallery,index:new_index,element:previous_button});}}
e.preventDefault();};gallery.nextPhoto=function(e){if($(this).data("block")!="yes"){var new_index;if(!next_button.hasClass("pg-disabled")){if(gallery_element.hasClass("pg-errored")){gallery_element.removeClass("pg-errored");}
dyn_load_origin="Next";inter_next=true;new_index=((current_index+1)%config.images.length);gallery.goToPhoto(new_index);gallery_element.trigger("next-photo",{gallery:gallery,index:new_index,element:next_button});}}
e.preventDefault();};_load_once=function(){thumbnails_frame.find(".hd span.pg-close-btn").click(function(e){gallery.hideThumbnails(e);});thumbnails_frame.find(".pg-thumbnail").each(function(){var thumb_container=$(this);var thumb=$(thumb_container.children("img"));thumb.attr("src",loader_img.src);var img=new Image();$(img).load(function(){thumb_container.removeClass("pg-thumbnails-loading");thumb.attr("src",img.src);});thumb_container.addClass("pg-thumbnails-loading");img.src=thumb.attr("data-src");});$(thumbnails_frame.find(".pg-thumbnails li")[current_index]).addClass("pg-selected-thumbnail");_load_once=function(){return;};};gallery.showThumbnails=function(e){if(!gallery_element.hasClass("loading")){gallery.toggleThumbnails(e);gallery_element.trigger("show-thumbnails",{gallery:gallery,element:thumbnails_button});}
e.stopPropagation();};gallery.hideThumbnails=function(e){if($(thumbnails_frame).is(":visible")){thumbnails_button.removeClass("sel");thumbnails_frame.fadeOut("fast");gallery_element.trigger("hide-thumbnails",{gallery:gallery,element:thumbnails_button});}
e.stopPropagation();};gallery.toggleThumbnails=function(e){if(!gallery_element.hasClass("loading")){_load_once();if(thumbnails_button.hasClass("sel")){thumbnails_button.removeClass("sel");}else{thumbnails_button.addClass("sel");}
thumbnails_frame.animate({opacity:'toggle'},function(){if($(this).is(":hidden")){gallery_element.trigger("hide-thumbnails",{gallery:gallery,element:thumbnails_button});}else{gallery_element.trigger("show-thumbnails",{gallery:gallery,element:thumbnails_button});}});gallery_element.trigger("toggle-thumbnail",{gallery:gallery,element:thumbnails_button});}
e.stopPropagation();};gallery.goToPhoto=function(index,evt){if(gallery_element.hasClass("pg-errored")){gallery_element.removeClass("pg-errored");}
if(!gallery_element.hasClass("loading")){if(current_index>=0){if(config.type==='inline'&&index===(config.images.length-1&&typeof evt!=='undefined')){if((index-1)===current_index){endframe_container.show();$('.pg-author-name').html('&nbsp;');$('.pg-enlarge').hide();current_index=index+1;}else{endframe_container.hide();current_index=index-1;$('.pg-enlarge').show();}
loadPhotoInfo(current_index);}else if(config.type==='inline'&&current_index===config.images.length){endframe_container.hide();gallery_element.addClass("loading");SNI.HGRM.DynamicAds.refresh();hsproduct_wrapper.hide();config.images[current_index-2].image_wrapper.hide();current_index=0;if(current_index<=0){current_index=0;previous_button.addClass("pg-disabled");}else if(current_index>0&&previous_button.hasClass("pg-disabled")){previous_button.removeClass("pg-disabled");}
loadPhotoInfo(current_index);}else{gallery_element.addClass("loading");SNI.HGRM.DynamicAds.refresh();hsproduct_wrapper.hide();var previous_data=config.images[current_index];var current_data=config.images[index];if(previous_data.image_wrapper){if(previous_data.iid=='endframe'){$('.pg-photo-wrapper').hide();$('.pg-photo-display-wrapper .mask').remove();}
if(current_data.iid!='endframe')previous_data.image_wrapper.hide();if(previous_data.image_wrapper.product_panel){previous_data.image_wrapper.product_panel.hide();previous_data.image_wrapper.removeClass("pg-hide-hotspots");}
thumbnails_frame.find(".pg-thumbnails li.pg-selected-thumbnail").removeClass("pg-selected-thumbnail");previous_button.attr("href",previous_data.pgUrl);}
current_index=index;if(current_index<=0){current_index=0;previous_button.addClass("pg-disabled");}else if(current_index>0&&previous_button.hasClass("pg-disabled")){previous_button.removeClass("pg-disabled");}
loadPhotoInfo(current_index);}}}};gallery_element=$(element);photo_display_parent=gallery_element.find(".pg-viewport .pg-photo-display");photo_display=gallery_element.find(".pg-viewport .pg-photo-display-wrapper");count_label=gallery_element.find(".pg-navigation .pg-photo-count .count");thumbnails_button=gallery_element.find(".pg-navigation a.thumbs");thumbnails_frame=gallery_element.find(".pg-navigation .pg-thumbnails-frame");next_button=gallery_element.find(".pg-navigation .next");previous_button=gallery_element.find(".pg-navigation .prev");template_element=photo_display.children(".pg-photo-wrapper");photo_description=$(".pg-viewport .pg-photo-description");photo_author=$(".cap.pg-author");caption_head=photo_description.children("h5");caption=photo_description.children("p");endframe_info=$(".pg-viewport .pg-endframe-info");endframe_container=$(gallery_element).find(".pg-endframe");hsproduct_wrapper=$('<div class="pg-photo-hsproduct-wrapper"></div>').appendTo(photo_display);ymal=gallery_element.find(".pg-you-might-like");ymal_list=ymal.find("ul");print_link=$("#print-select a.this");current_index=config.current_index;gallery.element=gallery_element;config.images.push({iid:"endframe",image_wrapper:$(photo_display).children(".pg-endframe")});var pageNum=SNI.Util.getParameterByName('pgNum');if(pageNum!=""&&!isNaN(pageNum)){current_index=pageNum-1;}
if(!config.images[current_index]){current_index=0;}
$(count_label).html(current_index+1)
if(current_index!=0){template_element.hide();if(config['type']=='inline')config['initial_load']=true;gallery.goToPhoto(current_index);}else{shortenCaptionText(current_index)
SNI.Nielsen.trackNSE();}
if(config.images[current_index].iid!="endframe"){if(current_index==0){previous_button.addClass("pg-disabled");}
config.images[current_index].image_wrapper=template_element;toggler=template_element.children(".pg-toggler");if(config.images[current_index].bvert==1){setupToggler(toggler,current_index);toggler.show();}else{template_element.removeClass("pg-fitted");}
config.images[current_index].image_wrapper.find("a.photo").click(function(e){if(config.images[current_index].bhs!=-1){gallery.nextPhoto(e);var omniParams={section:"HGTV Remodels : Photo Gallery",module:(config.gallery_title||$("head title").text()),linkText:"Photo Click:"+current_index};SNI.Omniture.dynamicSingleVar(omniParams);}
return false;});}
var applyHotspotImg=config.images[current_index];if(config.hotspotURL){$.ajax({url:config.hotspotURL,dataType:"script",timeout:10000,success:function(data){SNI.HGRM.buildProductsTab=function(){var endframe_products=[];applyHotspots(applyHotspotImg);var count=0;default_product_img_sm.src=config.default_product_image_sm;default_product_img_lg.src=config.default_product_image_lg;$(config.images).each(function(){var image=this;var product_image_url;var even_class;if(image.bhs!=0){$(SNI.HGTV.Photogallery3.Hotspots.images).each(function(){$(this.name).each(function(){alert(this.html);$(this).html(SNI.Util.Ellipsize(this,45));});if(image.iid==this.id){$(this.hotspots).each(function(){count++;even_class="";product_image_url=this.imageURL;if(this.imageURL=="null"||this.imageURL==""||this.imageURL==null){product_image_url=default_product_img_sm.src;}
if((count%2)==0){even_class=" even";}
endframe_products.push('<li class="clrfix hs-product'+even_class+'">'+'<div class="pg-endframe-product-img">'+'<a href="'+this.url+'"><img src="'+product_image_url+'" /></a>'+'</div>'+'<p><a href="'+this.url+'">'+this.name+'</a></p>'+'</li>');});}});}});if(endframe_products.length>0){var endframe_products_list=$('.products').append($('<span class="pg-close-btn">x</span><ul class="pg-endframe-products">'+endframe_products.join("\n")+'</ul>'));var $endframe_products=endframe_products_list.find("li.hs-product");$($endframe_products[$endframe_products.length-1]).addClass("last");endframe_container.find(".pg-close-btn").click(function(){endframe_container.hide();$('.pg-photo-display-wrapper .mask').remove();});if(($endframe_products.length%2)==0){$($endframe_products[$endframe_products.length-2]).addClass("last");}else{$('<li class="last"></li>').appendTo(endframe_products_list);}
$(".pg-endframe .tabs .ymal-btn .btn").click(function(){$(".pg-endframe .tabs .products-btn .btn").removeClass("sel");$(this).addClass("sel");$(".pg-endframe-content .products").hide();$(".pg-endframe-content .recommend").fadeIn("fast");});$(".pg-endframe .tabs .products-btn .btn").click(function(){$(".pg-endframe .tabs .ymal-btn .btn").removeClass("sel");$(this).addClass("sel");$(".pg-endframe-content .recommend").hide();$(".pg-endframe-content .products").fadeIn("fast");});$(".products-btn").show();$(".pg-endframe .tabs .ymal-btn .btn").click();}
else{$(".pg-endframe .tabs .ymal-btn .btn").hide();$(".pg-endframe").removeClass('tabbed');}
gallery_element.trigger("endframe-render-complete",{gallery:gallery});};$("head").append('<script type="text/javascript">'+data+' \n SNI.HGRM.buildProductsTab(); </script>');},complete:function(){loadPhotoInfo(current_index,true);applyHotspots(config.images[current_index]);}});}
thumbnails_button.click(gallery.toggleThumbnails);thumbnails_frame.find(".pg-thumbnails li").each(function(index){var thumb=$(this);var resetNextForInterstitial=false;thumb.click(function(e){if($('.photo-gallery').hasClass('interstitial-show')){$('.photo-gallery').removeClass('interstitial-show');resetNextForInterstitial=true;}
$('.photo-gallery').removeClass('interstitial-show');dyn_load_origin="Thumbnail";gallery.goToPhoto(index,e);gallery.hideThumbnails(e);$(gallery_element).trigger("click-thumbnail",{gallery:gallery,thumb:thumb});if(resetNextForInterstitial){next_button.click();}
e.stopPropagation();});});thumbnails_frame.click(function(e){e.stopPropagation();});$(document).click(function(e){gallery.hideThumbnails(e);});previous_button.click(gallery.previousPhoto);gallery_element.find(".pg-error .btn").click(function(e){gallery.goToPhoto(current_index);e.preventDefault();});next_button.click(gallery.nextPhoto);endframe_container.find(".pg-close-btn").click(function(){endframe_container.hide();$('.pg-photo-display-wrapper .mask').remove();});endframe_container.find(".replay").click(gallery.nextPhoto);endframe_container.find("div.thumb a,h3 a.next-title,div.content h4 a").click(function(e){var link=$(this);var title=link.attr("title")||link.text();var params={section:"HGTV Remodels:Photo Gallery",module:"EF:"+config.gallery_title,linkText:"Related Photo Gallery: "+title};SNI.Omniture.dynamicSingleVar(params);});SNI.HGRM.DynamicAds.init({container:gallery_element,insert_tgt:photo_display,dismiss_elts:[next_button,previous_button]});return gallery;};SNI.HGRM.PhotoGallery=PhotoGallery;})(jQuery);
if(typeof(SNI.HGRM.TravelingLib)=="undefined"){SNI.HGRM.TravelingLib={};}
SNI.HGRM.TravelingLib={itemsPerPage:9,itemsInList:20,itemsPerRow:3,libraryUrl:SNI.Config.snapPlayListUrl+"/feeds/channel-video/",viewingPage:1,currentVideoDuration:null,currentVideoId:null,videoPaused:false,pageParams:false,currentView:'thumbs',sortOrder:'RA',pageType:'',channels:[],channelInfo:{},pagesData:{},initialLoad:true,initialInlineLoad:true,params:{},init:function(){var lib=this;var params=lib.params();lib.params=params;lib.getChannelList();lib.changeSelectedChannel();if((lib.pageType!='channel')&&(params.channel)&&($.inArray(params.channel+"",lib.channels)>-1)){$(".traveling-lib .sections li[data-channel='"+params.channel+"'] a").click();if(params.video)lib.viewingPage=lib.findVideoInChannel(params.video,params.channel);}
var channelId=lib.getChannelId();lib.videoView(channelId);$("div.toggle-view input:radio").change(function(){lib.toggleViewOption($(this).val());});$('div.toggle-view label').click(function(){var label=$(this).attr('for');$('#'+label).change();});lib.lastPlayedVideoId=null;},fixThumbPos:function(offset){var elems=$(".fix-pos");var isChannel=$(document.getElementById("video")).hasClass("channel-detail");return $.each(elems,function(){var isPlaying=$(this).parent().css("position","relative").hasClass("playing");var leftPos=$(this).css("margin-left","0").prev().find(".title-and-time").outerWidth(true)+((offset||30)+(isChannel?60:0)+(isPlaying?30:0));return $(this).css("left",leftPos);});},resetInlinePlayingClass:function(){$('#carousel .crsl-wrap ul li').removeClass('playing');},setInlinePlayingDesc:function(val){$('.pod.inline p:first').html(val);},setInlinePlayingTitle:function(title,time){$('.pod.inline h4').html('<strong>'+title+'</strong><cite class="in cap">'+time+'</cite></h4>');},instantiateInlineSnapPlayer:function(){var lib=this;var i=parseInt(SNI.Util.getParameterByName("pgNum"))-1;if(i==0){snap=new SNI.HGRM.Player.FullSizeNoPlaylist('video-player',snapPlayerChannelId,snapPlayerVideoId,SNI.HGRM.TravelingLib.inlineVideoSnapHandler);}else{var li=$('#carousel ul li').eq(i);snap=new SNI.HGRM.Player.FullSizeNoPlaylist('video-player',$(li).attr('data-channel'),$(li).attr('data-id'),SNI.HGRM.TravelingLib.inlineVideoSnapHandler);$(li).addClass('playing');SNI.HGRM.TravelingLib.setInlinePlayingDesc($(li).find('a.vid-btn img').attr('title'));SNI.HGRM.TravelingLib.setInlinePlayingTitle($(li).find('a span.last').html(),$(li).find('span.cap').html());var t=setTimeout(function(){$('#carousel ul li').eq(0).removeClass('playing');},100);}},wireInlinePlayerCarouselLinks:function(){var lib=this;$('#carousel .crsl-wrap ul li a').bind('click',function(evt){evt.stopPropagation();evt.preventDefault();SNI.HGRM.TravelingLib.resetInlinePlayingClass();var li=$(this).closest('li');$(li).addClass('playing');snap.loadPlaylist($(li).attr('data-channel'),'',$(li).attr('data-id'));SNI.HGRM.TravelingLib.setInlinePlayingDesc($(li).find('a.vid-btn img').attr('title'));SNI.HGRM.TravelingLib.setInlinePlayingTitle($(li).find('a span.last').html(),$(li).find('span.cap').html());});},params:function(){var query=jQuery.query.get();var channel,video;if(query.channel){channel=query.channel;}
if(query.video){video=query.video;}
return{'channel':channel,'video':video};},toggleViewOption:function(view){lib=this;var resetSelected=function(){$('div.toggle-view label').removeClass('selected');}
resetSelected();if(view=='icons'){lib.currentView='thumbs';var html='';$('div.traveling-lib div.video-list ul.videos.sponsored li.sponsored').each(function(){var li=$(this);html+='<li class="'+li.attr("class")+'" data-id ="'+li.attr("data-id")+'" data-channel="'+li.attr("data-channel")+'">'+li.html()+'</li>';});$('div.traveling-lib div.video-list ul.videos.sponsored li.sponsored').remove();$('div.traveling-lib div.video-list ul.videos.content').prepend(html);$('div.toggle-view #view-icon-label').addClass('selected');$('div.traveling-lib div.video-list').attr('class','video-thumbs');$('div.traveling-lib div.video-thumbs li.sponsored').click(function(){var channel_id=$(this).attr('data-channel');var vid_id=$(this).attr('data-id');$('ul.videos li').removeClass('playing');$(this).addClass('playing');lib.playVideo(vid_id,channel_id,lib.viewingPage);return false;});}else if(view=='list'){lib.currentView=view;var html='';$('div.traveling-lib div.video-thumbs ul.videos.content li.sponsored').each(function(){var li=$(this);html+='<li class="'+li.attr("class")+'" data-id ="'+li.attr("data-id")+'" data-channel="'+li.attr("data-channel")+'">'+li.html()+'</li>';});$('div.traveling-lib div.video-thumbs ul.videos.content li.sponsored').remove();$('div.traveling-lib div.video-thumbs ul.videos.sponsored').append(html);$('div.toggle-view #view-list-label').addClass('selected');$('div.traveling-lib div.video-thumbs').attr('class','video-list');$('div.traveling-lib div.video-list li.sponsored').each(function(){$(this).click(function(){var channel_id=$(this).attr('data-channel');var vid_id=$(this).attr('data-id');$('ul.videos li').removeClass('playing');$(this).addClass('playing');lib.playVideo(vid_id,channel_id,lib.viewingPage);return false;});});lib.fixThumbPos();}else{throw"Not a recognized View."}},toggleView:function(view,channel_id){var lib=this;lib.loadStream(channel_id,lib.viewingPage);},videoView:function(channel_id){var lib=this;var toggled=$("div.toggle-view input:radio").filter(':checked').val();lib.toggleView(toggled,channel_id);},loadStream:function(channelId,page){var lib=this;var library_url=lib.buildLibraryUrl(channelId,page);lib.showLoading();if((!lib.pagesData[channelId])||(!lib.pagesData[channelId][page])){$.ajax({dataType:'script',url:library_url,success:function(result,textStatus){lib.hideLoading();if(typeof snapTravelingLib=="undefined"){eval(result);}
if(!lib.pagesData[channelId]){lib.pagesData[channelId]={};}
lib.pagesData[channelId][page]=snapTravelingLib[0];lib.buildThumbs(snapTravelingLib[0]);},complete:function(){if(lib.initialLoad&&lib.pageType!='channel'&&lib.params.channel){SNI.HGRM.TravelingLib.setPlayingVideo(lib.params.video,lib.params.channel,lib.viewingPage);}else if(lib.initialLoad&&lib.pageType=='channel'&&lib.params.video){SNI.HGRM.TravelingLib.setPlayingVideo(lib.params.video,lib.currentChannelId,lib.viewingPage);}
lib.initialLoad=false;}});}else{lib.buildThumbs(lib.pagesData[channelId][page]);}},buildThumbs:function(data){var settings={};var lib=this;var first_item=data.first;lib.first_item=data.first;var last_item=data.last;var total_items=data.total;var sponsorvideo_length=data.sponsor_videos.length;var viewing=this.buildViewingInfo(first_item,last_item,total_items);var current_page=this.getCurrentPage(last_item);var total_pages=this.getTotalPages(total_items,sponsorvideo_length);var pagi=this.buildPagination(current_page,total_pages,viewing);var build_a_video=function(values,sponsored,index,videoCount){var title=values.label;var duration=values.length;var image_src=values.thumbnailURL;var description=values.description;var firstSponsored='';var lastSponsored='';if(sponsored&&index==0)firstSponsored='first_sp';if(sponsored&&index==videoCount-1)lastSponsored='last_sp';var is_playing='';var sponsored_text=(sponsored)?'<span class="sponsored">Sponsored Video</span>':'';if(values.id==lib.currentVideoId){is_playing=' class=" playing  '+firstSponsored+' '+lastSponsored+' "';if(sponsored){is_playing=is_playing.replace('playing','playing sponsored ');}}else is_playing=(sponsored)?' class="sponsored '+firstSponsored+' '+lastSponsored+' "':'';var imgWidth=(lib.pageType=='channel')?120:92;var imgHeight=(lib.pageType=='channel')?90:69;markup=''+'<li data-id="'+values.id+'" data-channel="'+values.channelId+'" '+is_playing+'>'+'<a href="javascript:void(0);" class="video-info">'+'<p class="title-and-time">'+title+'  <span>('+duration+')</span></p>'+'<p class="playing">PLAYING</p>'+'</a>'+'<div class="box drop quart fix-pos">'+'<div class="bd">'+'<div class="vid-btn">'+
sponsored_text+'<img src="'+image_src+'" width="'+imgWidth+'" height="'+imgHeight+'" alt="'+title+'" />'+'<span class="ico"></span>'+'</div>'+'<p class="small last">'+title+'</p>'+'<p class="small desc">'+description+'</p>'+'<p class="vid-length">('+duration+')</p>'+'<p class="playing">PLAYING</p>'+'</div>'+'</div'+'</li>';return markup;};var sponsor_html="";var sponsor_list_html='<ul class="videos '+lib.pageType.toString()+' sponsored clrfix"><li class="perm"><p>Sponsored Videos</p></li></ul>';if(data['sponsor_videos']&&(data['sponsor_videos'].length>0)){$.each(data['sponsor_videos'],function(key,value){sponsor_html+=build_a_video(value,true,key,data['sponsor_videos'].length);});}
var html='<div class="loader hide-slide"><span></span></div><ul class="'+lib.pageType+' videos content clrfix">';html=html+sponsor_html;if(data['videos']&&(data['videos'].length>0)){$.each(data['videos'],function(key,value){html+=build_a_video(value);});}
html+='</ul>';html=$(html.toString());var lastRow=Math.ceil($('li',html).length/lib.itemsPerRow);$('li:nth-child('+last_item+'n)',html).each(function(){$(this).addClass('last');});if(lib.pageType!='channel'){$('li:nth-child('+lib.itemsPerRow+'n-2)',html).each(function(){$(this).addClass('left');});$('li:nth-child('+lib.itemsPerRow+'n-1)',html).each(function(){$(this).addClass('center');});$('li:nth-child('+lib.itemsPerRow+'n)',html).each(function(){$(this).addClass('right');});$('li',html).each(function(index){if(index==3||index==4||index==5){$(this).addClass('second-row');}
if(index==6||index==7||index==8){$(this).addClass('third-row');}
if(Math.ceil((index+1)/lib.itemsPerRow)==lastRow)$(this).addClass('last-row');});}else if(lib.pageType=='channel'){$('li:nth-child('+lib.itemsPerRow+'n-3)',html).each(function(){$(this).addClass('left');});$('li:nth-child('+lib.itemsPerRow+'n-2)',html).each(function(){$(this).addClass('center');});$('li:nth-child('+lib.itemsPerRow+'n-1)',html).each(function(){$(this).addClass('center');});$('li:nth-child('+lib.itemsPerRow+'n)',html).each(function(){$(this).addClass('right');});$('li',html).each(function(index){if(index==4||index==5||index==6||index==7){$(this).addClass('second-row');}
if(Math.ceil((index+1)/lib.itemsPerRow)==lastRow)$(this).addClass('last-row');});}
$('li',html).click(function(){var channel_id=$(this).attr('data-channel');var vid_id=$(this).attr('data-id');$('ul.videos li').removeClass('playing');$(this).addClass('playing');lib.playVideo(vid_id,channel_id,current_page);return false;});if(data['sponsor_videos']&&(data['sponsor_videos'].length>0)){$('div.video-'+lib.currentView).html(sponsor_list_html).append(html).append(pagi);}else{$('div.video-'+lib.currentView).html(html).append(pagi)};$('div.viewing p.count').html(viewing);if(lib.currentView=='list')lib.fixThumbPos(0);},playVideo:function(vidId,channelId,currentPage){var lib=this;snap.loadPlaylist(channelId,'',vidId);this.setPlayingVideo(vidId,channelId,currentPage);var title_location=$('.sni-w .pod h4').offset().top;$('html,body').animate({scrollTop:title_location},1000);},buildPagination:function(currentPage,totalPages,viewingInfo){var lib=this;var html='<div class="'+lib.pageType+' pagination"><div class="pagi clrfix">';html+='<span class="page-range">'+viewingInfo+'</span>';if(currentPage>1){html+='<a class="nextprev prev" href="#">&larr; Previous</a> ';}else{html+='<span class="nextprev prev">&larr; Previous</span> ';}
if(totalPages<10){html+=lib.getPaginationHtml(1,totalPages,currentPage,totalPages);}else{if(currentPage<6){html+=lib.getPaginationHtml(1,currentPage+2,currentPage,totalPages);}else{html+=lib.getPaginationHtml(1,2,currentPage,totalPages);html+='<span>...</span>';html+=lib.getPaginationHtml(currentPage-2,currentPage+2,currentPage,totalPages);}
if(currentPage<totalPages-4){html+='<span>...</span>';html+=lib.getPaginationHtml(totalPages-1,totalPages,currentPage,totalPages);}else{html+=lib.getPaginationHtml(currentPage+3,totalPages,currentPage,totalPages);}}
if(currentPage<totalPages){html+='<a class="nextprev next" href="#">Next &rarr;</a>';}else{html+='<span class="nextprev next">Next &rarr;</span>';}
html+='</div></div>';html=$(html);var sectionId=lib.getChannelId();$('a.prev',html).click(function(){lib.loadStream(sectionId,currentPage-1);lib.viewingPage=currentPage-1;return false;});$('a.next',html).click(function(){lib.loadStream(sectionId,currentPage+1);lib.viewingPage=currentPage+1;return false;});$('a.page',html).click(function(){lib.loadStream(sectionId,$(this).text());lib.viewingPage=$(this).text();return false;});return html;},getPaginationHtml:function(fromPage,toPage,currentPage,totalPages){var html='';for(var i=fromPage;i<=toPage;i++){if(i>0&&i<=totalPages){if(i==currentPage){html+='<span class="current">'+i+'</span> ';}else{html+='<a href="#" class="page">'+i+'</a> ';}}}
return html;},getTotalPages:function(totalItems,sponsorvideo_length){var lib=this;if(sponsorvideo_length>0){var tempItemsPerPage;sponsorvideo_length=='1'?tempItemsPerPage='7':tempItemsPerPage='8';return Math.ceil(totalItems/tempItemsPerPage);}else
return Math.ceil(totalItems/lib.itemsPerPage);},getCurrentPage:function(lastItem){var lib=this;if((lib.first_item+0)>7&&(lib.first_item+0)<=9){return 2;}
return Math.ceil(lastItem/lib.itemsPerPage);},buildViewingInfo:function(firstItem,lastItem,totalItems){return firstItem+" - "+lastItem+" of "+totalItems+" Videos";},buildLibraryUrl:function(channelId,page){if(channelId=="all-videos"){var player_id=$('.traveling-lib .sections li[data-channel="'+channelId+'"]').attr('data-player');return this.libraryUrl+"0,,HGRM_PLAYER_"+player_id+"_"+page+"_"+this.itemsPerPage+",00.json";}else{return this.libraryUrl+"0,,HGRM_CHANNEL_"+channelId+"_"+page+"_"+this.itemsPerPage+",00.json";}},changeSelectedChannel:function(){var lib=this;$('.traveling-lib .sections li a').click(function(){$(this).parents('ul').find('li a').each(function(){$(this).parent().removeClass('ui-state-active');});$(this).parent().addClass('ui-state-active');var channel=$(this).parent().attr('data-channel');lib.viewingPage=1;lib.videoView(channel);return false;});},getChannelList:function(){var lib=this;$('.traveling-lib .sections li').each(function(){var channel=$(this).attr('data-channel');if(channel!='all-videos'){lib.channels.push(channel);}});return lib.channels;},getChannelId:function(){return $('.traveling-lib .sections li.ui-state-active').attr('data-channel');},findVideoInChannel:function(video_id,channel_id){var lib=this;var items_per_page=lib.itemsPerPage;var channel_listing=lib.channelInfo[channel_id+""];if(channel_listing&&channel_listing.length&&$.inArray(video_id+"",channel_listing)){var position=$.inArray(video_id+"",channel_listing);return Math.ceil((position+1)/items_per_page);}
return 1;},showLoading:function(){var lib=this;vw=lib.currentView;$('.traveling-lib .video-'+vw+' .pagi').addClass('hide-slide');$('.traveling-lib .video-'+vw+' .videos').addClass('hide-slide');$('.traveling-lib .video-'+vw+' .loader').removeClass('hide-slide');},hideLoading:function(){var lib=this;vw=lib.currentView;$('.traveling-lib .video-'+vw+' .loader').addClass('hide-slide');$('.traveling-lib .video-'+vw+' .videos').removeClass('hide-slide');$('.traveling-lib .video-'+vw+' .pagi').removeClass('hide-slide');},getCurrentPlayingPage:function(videoPosition){var pos=Math.ceil((parseInt(videoPosition)+1)/SNI.HGRM.TravelingLib.itemsPerPage);return pos;},snapHandler:function(eventType,eventInfo){var lib=this;var event=SNI.HGRM.TravelingLib.evaluateJSON(eventInfo);SNI.HGRM.TravelingLib.currentVideoId=event.videoId;if(eventType=='playerReady'){SNI.HGRM.TravelingLib.resetPlayingVideo(SNI.HGRM.TravelingLib.currentVideoId,event.channelId);}else if(eventType=='itemBegin'){if(event.itemType!='ad'){var currPage=SNI.HGRM.TravelingLib.getCurrentPlayingPage(event.currentPlaylistPosition);SNI.HGRM.TravelingLib.setPlayingVideo(event.videoId,event.channelId,currPage);}}else if(eventType=='itemEnd'){if(event.itemType!='ad'){SNI.HGRM.TravelingLib.resetPlayingVideo(event.videoId,event.channelId);if(event.currentPlaylistPosition!=0){var position=SNI.HGRM.TravelingLib.addOne(event.currentPlaylistPosition);if(SNI.HGRM.TravelingLib.pageType=='channel'){if(SNI.HGRM.TravelingLib.getModEight(position)==0){$('#video-library .pagination .nextprev.next').click();}}else{if(SNI.HGRM.TravelingLib.getModNine(position)==0){$('#video-library .pagination .nextprev.next').click();}}}}}else if(eventType=='itemPause'){if(event.itemType!='ad'){SNI.HGRM.TravelingLib.pauseVideo(event.videoId,event.channelId);}}else if(eventType=='itemResume'){if(event.itemType!='ad'){SNI.HGRM.TravelingLib.resumeVideo(event.videoId,event.channelId);}}else if(eventType=='done'){SNI.HGRM.TravelingLib.resetPlayingVideo(event.videoId,event.channelId);var channels=SNI.HGRM.TravelingLib.channels;var channel_index=channels.indexOf(event.channelId);var next_channel=channels[(channel_index-(-1))];if((channel_index-(-1))>=channels.length){next_channel=channels[0];}
if($('.traveling-lib .sections li a.selected').parent().attr('data-channel')=='all-videos'){SNI.HGRM.TravelingLib.playVideo('',next_channel);}}else{throw'SNAP Callback Error';}},evaluateJSON:function(json){return eval('('+json+')');},setPlayingVideo:function(video_id,channel_id,currentPage){var lib=this;var title='';var length='';var desc='';lib.resetPlayingVideo();var videos=lib.pagesData[channel_id][currentPage].videos.concat(lib.pagesData[channel_id][currentPage].sponsor_videos);$.each(videos,function(index,value){if(value.id==video_id&&value.channelId==channel_id){title=value.label;length=['(',value.length,')'].join('');desc=value.description;return false;}});var liSelector=[".traveling-lib ul.videos [data-id='",video_id,"']"];var currently_playing=$(liSelector.join('')).eq(0);currently_playing.addClass('playing');$('.sni-w .pod h4 strong').html(title);$('.sni-w .pod h4 cite.cap').html(length);$('.sni-w .pod p.video-desc').html(desc);lib.currentVideoDuration=length;lib.lastPlayedVideoId=video_id;},resetPlayingVideo:function(){$('.traveling-lib ul.videos li').removeClass('playing');},inlineVideoSnapHandler:function(eventType,eventInfo){var lib=SNI.HGRM.TravelingLib;eventInfo=$.parseJSON(eventInfo);if(eventType=='itemBegin'){if(eventInfo.itemType=='content'){if(!eventInfo.videoTitle)return;var videoId=eventInfo.videoId;if(lib.getModFive(eventInfo.currentPlaylistPosition)==0){$('.controls.btn-nav span').each(function(){var attr=$(this).attr('data-load-img');if(attr==eventInfo.currentPlaylistPosition)$(this).click();});}
lib.resetInlinePlayingClass();$('#carousel .crsl-wrap ul li').each(function(){var attr=$(this).attr('data-id');if(attr==videoId)$(this).addClass('playing');});lib.setInlinePlayingDesc(eventInfo.videoDescription);lib.setInlinePlayingTitle(eventInfo.videoTitle,eventInfo.videoDuration);};}},addOne:function(num){return parseInt(num)+1;},getModFive:function(num){return(parseInt(num)%5);},getModEight:function(num){return(parseInt(num)%8);},getModNine:function(num){return(parseInt(num)%9);}};
function HgrmAd(adtype,adsize,pos,keywords){if(pos<0||pos==undefined){pos=1;}
if(keywords==undefined){keywords="";}
var ad=new DartAd();ad.setUrl("http://"+SNI.Ads._adServerHostname+"/js.ng/");if(adtype=='BIGBOX'&&pos==5){ad.addParameter("adtype",'BIGBOX');}else{ad.addParameter("adtype",adtype);}
if(adtype=='LEADERBOARD'){ad.addParameter("Params.styles","SNI_LEADERBOARD");}
ad.addParameter("adsize",adsize);ad.addParameter("PagePos",pos);ad.useFeature("tile");if(keywords!=""){var words=keywords.split(" ");for(i=0;i<words.length;i++){ad.addParameter("keyword",words[i]);}}
switch(adtype){default:writeAd(ad);break;}}
function writeAd(ad){if(typeof adRestrictionManager!='undefined'){ad.useIframe=adRestrictionManager.isIframe(ad,mdManager);if(adRestrictionManager.isActive(ad,mdManager)!=false){adManager.createAd(ad);}}else{adManager.createAd(ad);}}
function LeaderboardAd(pos){if(pos<0||pos==undefined||pos==''){pos=1;}
HgrmAd('LEADERBOARD','468x60',pos);}
function VswAd(pos){if(pos<0||pos==undefined||pos==''){pos=1;}
HgrmAd('VSW','',pos);}
function PushdownAd(pos){if(pos<0||pos==undefined){pos=1;}
HgrmAd('PUSHDOWN','',pos);}
function GoogleBigboxAd(pos){if(pos<0||pos==undefined){pos=1;}
HgrmAd('GOOGLE_BIGBOX','',pos);}
function GoogleLeaderboardAd(pos){if(pos<0||pos==undefined){pos=1;}
HgrmAd('GOOGLE_LEADERBOARD','',pos);}
function BigboxAd(pos,keywords){if(typeof(mdManager)!=undefined&&mdManager.getParameterString("VideoPlayer")==""){if(pos<0||pos==undefined){pos=1;}
HgrmAd('BIGBOX','',pos,keywords);}}
function BigboxAd300x150(pos,keywords){if(pos<0||pos==undefined){pos=1;}
HgrmAd('SPONSORSHIP_CONTENT','',pos,keywords);}
function SuperstitialAd(pos){if(pos<0||pos==undefined){pos=1;}
HgrmAd('SUPERSTITIAL','',pos);}
function VideoPlayerAd(adtype,adsize,pos){var ad=new AdUrl();ad.setUrl("http://"+SNI.Ads._adServerHostname+"/html.ng/");if(adtype!=''){ad.addParameter("adtype",adtype);}
if(adsize!=''){ad.addParameter("adsize",adsize);}
if(!pos||pos==''){pos=1;}
ad.addParameter("PagePos",pos);ad.useFeature("tile");writeAd(ad);return ad.buildExpandedUrl();}
function getDartEnterpriseUrl(adtype,pos){adtype=adtype.toUpperCase();var strUrl=VideoPlayerAd(adtype,'',pos);return strUrl;}
function setDartEnterpriseBanner(adType,sync_banner){if(adType=='LEADERBOARD'){if($("#leaderboard").length>0){boxW=728;boxH=90;$("#leaderboard").html("<iframe src='"+sync_banner+"\' width=\'"+boxW+"\' height=\'"+boxH+"\'"+"frameborder='0' scrolling='no' marginheight='0' marginwidth='0'></iframe>");}}else{if($("#bigbox").length>0){boxW=300;boxH=250;if(sync_banner.indexOf("336x850")>-1){boxW=336;boxH=850;}else if(sync_banner.indexOf("300x600")>-1){boxW=300;boxH=600;}
$("#bigbox").html("<iframe src='"+sync_banner+"\' width=\'"+boxW+"\' height=\'"+boxH+"\'"+"frameborder='0' scrolling='no' marginheight='0' marginwidth='0'></iframe>");}}
return;}
function setDefaultBigboxAd(){if(typeof(mdManager)!=undefined&&mdManager.getParameterString("VideoPlayer")==""){return;}
var default_ad=VideoPlayerAd('BIGBOX','',5);if($("#bigbox").length>0){boxW=300;boxH=250;if(default_ad.indexOf("336x850")>-1){boxW=336;boxH=850;}else if(default_ad.indexOf("300x600")>-1){boxW=300;boxH=600;}
$("#bigbox").html("<iframe src='"+default_ad+"\' width=\'"+boxW+"\' height=\'"+boxH+"\'"+"frameborder='0' scrolling='no' marginheight='0' marginwidth='0'></iframe>");}}
function MultiLogoAd(adtype,logoNum){var ad=new DartAd();if(logoNum==undefined||logoNum==''||logoNum>4||logoNum<1){logoNum=4;}
if(adtype==undefined||adtype==''){adtype='LOGO';}
ad.setUrl("http://"+SNI.Ads._adServerHostname+"/snDigitalLogo"+logoNum+".html?");ad.addParameter("adtype",adtype);ad.addParameter("PagePos",1);if(logoNum>0){writeAd(ad);$(document).ready(function(){if($(".sponsor-multi-logo a img").length>0){if($(".sponsor-multi-logo").parent().hasClass("west-spons")){$(".sponsor-multi-logo").prepend("<em>Sponsored by:</em>");$(".west-spons").css("display","block");}else{$(".sponsor-multi-logo").prepend("<em>Sponsored by:</em>");}}});}}
function sponsorLinks(adtype,linkNum){var ad=new DartAd();if(linkNum==undefined||linkNum==''||linkNum>6||linkNum<1){linkNum=6;}
if(adtype==undefined||adtype==''){adtype='SPONSORLINKS';}
ad.setUrl("http://"+SNI.Ads._adServerHostname+"/sndigital_textlinks.html?");ad.addParameter("adtype",adtype);ad.addParameter("PagePos",1);if(linkNum>0){writeAd(ad);}}
function WDGuidedNavSearchAds(adtype,pos,keywords,filters,pageNo){var ad=new DartAd();if(pos<0||pos==undefined){pos=1;}
if(pageNo>0&&pageNo!=undefined){ad.addParameter("Page",pageNo);}
ad.setUrl("http://"+SNI.Ads._adServerHostname+"/js.ng/");ad.addParameter("adtype",adtype);ad.addParameter("adsize","");ad.addParameter("PagePos",pos);var words=keywords.split(" ");for(i=0;i<words.length;i++){ad.addParameter("keyword",words[i]);}
var words=filters.split(" ");for(i=0;i<words.length;i++){ad.addParameter("filter",words[i]);}
writeAd(ad);}
function WDGuidedNavSiteAdAds(adtype,keywords,filters,pageNo){WDGuidedNavSearchAds(adtype,1,keywords,filters,pageNo);}
(function($){if(typeof(SNI.HGRM.ArticleInfo)=="undefined"){SNI.HGRM.ArticleInfo={};}
SNI.HGRM.ArticleInfo={moreTags:function(){var $tags=$(".article-info .tags");var $more_tags=$tags.find(".more-tags");var $trigger=$tags.find("div.more");var fadeOutTimeout,fadeInTimeout;$more_tags.css({top:"15px",left:"0px"});$trigger.hover(function(e){clearTimeout(fadeOutTimeout);$trigger.addClass("on");fadeInTimeout=setTimeout(function(){$more_tags.fadeIn("fast");},100);},function(e){clearTimeout(fadeInTimeout);$trigger.removeClass("on");fadeOutTimeout=setTimeout(function(){$more_tags.fadeOut("fast");},100);});$("body").click(function(){$more_tags.fadeOut("fast");});}}})(jQuery);
if(typeof(SNI.HGRM.Player)=='undefined'){SNI.HGRM.Player={};}
SNI.HGRM.Player.Configs={FullSize:{dimensions:{width:'576',height:'512'},flashvars:{playerSize:"FullScreenWide",config:SNI.Config.snapConfigs+"snap-style.xml,"+SNI.Config.snapConfigs+"snap-config-std.xml"}},FullSizeNoPlaylist:{dimensions:{width:'576',height:'347'},flashvars:{playerSize:"FullScreenWide",config:SNI.Config.snapConfigs+"snap-style.xml,"+SNI.Config.snapConfigs+"snap-config-std.xml"}},RightRail:{dimensions:{width:'320',height:'360'},flashvars:{playerSize:"RightRail",config:SNI.Config.snapConfigs+"snap-style.xml,"+SNI.Config.snapConfigs+"snap-config-rr.xml"}},RecipePage:{dimensions:{width:'185',height:'162'},flashvars:{autoPlay:false,showMenu:false,enableNowPlayingOverlay:false,enableRelatedMenu:false,enableRelatedInfoIcon:false,enableEmail:false,enableShare:false,enableHomePageMode:true,playerSize:"Inline",config:SNI.Config.snapConfigs+"snap-style.xml,"+SNI.Config.snapConfigs+"snap-config-rr.xml"}},RightRailNoPlaylist:{dimensions:{width:'320',height:'263'},flashvars:{playerSize:"RightRail",config:SNI.Config.snapConfigs+"snap-style.xml,"+SNI.Config.snapConfigs+"snap-config-rr.xml"}},Blog:{dimensions:{width:'320',height:'263'},flashvars:{config:SNI.Config.snapConfigs+"snap-style.xml,"+SNI.Config.snapConfigs+"snap-config-rr.xml"}},Lead:{enableSyncAdFix:1,dimensions:{width:'400',height:'300'},flashvars:{playerSize:"Inline",config:SNI.Config.snapConfigs+"snap-style.xml,"+SNI.Config.snapConfigs+"snap-config-std.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}}};SNI.Player.UserInterfaceConfigs=SNI.Util.mergeObjects(SNI.Player.UserInterfaceConfigs,SNI.HGRM.Player.Configs,true);SNI.HGRM.Player.FullSize=SNI.Player.FullSize;SNI.HGRM.Player.Big=SNI.HGRM.Player.FullSize;SNI.HGRM.Player.VideoLibrary=SNI.HGRM.Player.FullSize;SNI.HGRM.Player.TravelingVideoLibrary=function(divId,channelId,videoId,callback,ui_config){var originalSponsor=mdManager.getParameter('Sponsorship');var tvlEventHandler=function(eventType,eventInfo){SNI.Player.callbackSystem(eventType,eventInfo);var data=$.parseJSON(eventInfo);var currentSponsor=mdManager.getParameter('Sponsorship');if(typeof(data.sponsorshipValue)=='string'){var channelSponsor=data.sponsorshipValue;currentSponsor=channelSponsor!=''?channelSponsor:originalSponsor;mdManager.setParameter('Sponsorship',currentSponsor);adManager.setParameter('Topic',currentSponsor);}
else if(currentSponsor!=originalSponsor){currentSponsor=originalSponsor;mdManager.setParameter('Sponsorship',currentSponsor);adManager.setParameter('Topic',currentSponsor);}};ui_config=SNI.Util.mergeObjects({flashvars:{playerSize:"FullScreen"}},ui_config,true);return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.Player.UserInterfaceConfigs.FullSizeNoPlaylist,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_callback_user":callback,"fcn_callback_system":tvlEventHandler});};SNI.HGRM.Player.FullSizeNoPlaylist=SNI.Player.FullSizeNoPlaylist;SNI.HGRM.Player.VideoAsset=SNI.HGRM.Player.FullSizeNoPlaylist;SNI.HGRM.Player.RightRail=SNI.Player.RightRail;SNI.HGRM.Player.RightRailNoPlaylist=SNI.Player.RightRailNoPlaylist;SNI.HGRM.Player.Blog=function(divId,channelId,videoId,ui_config){buildChannelFeedUrlForBlogs=function(chId){return'http://www.foodnetwork.com/food/channel/xml/0,,'+chId+',00.xml';};return new SNI.Player.Blog(divId,channelId,videoId,buildChannelFeedUrlForBlogs,ui_config);};SNI.HGRM.Player.Lead=function(divId,channelId,videoId,callback,ui_config){return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.Player.UserInterfaceConfigs.Lead,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_callback_user":callback});};SNI.HGRM.Player.DynamicLead=function(divId,channelId,videoId,ui_config){return new SNI.HGRM.Player.FullSizeNoPlaylist(divId,channelId,videoId,null,SNI.Util.mergeObjects({flashvars:{autoPlay:false,enableRelatedInfoIcon:false,enableNowPlayingOverlay:false,playerSize:"Inline",enableHomePageMode:true},dimensions:{width:272,height:229}},ui_config,true));};SNI.HGRM.Player.RecipePage=function(divId,channelId,videoId,ui_config){return new SNI.HGRM.Player.FullSizeNoPlaylist(divId,channelId,videoId,null,SNI.Util.mergeObjects(SNI.Player.UserInterfaceConfigs.RecipePage,ui_config,true));};
SNI.HGRM.TheaterModules=SNI.HGRM.TheaterModules||{};SNI.HGRM.adjustFrameWrapperHeight=function(h){$('#overlay-inner').animate({height:h},250);};SNI.HGRM.TheaterModules=(function($){return{fill:function(cfg){var DEFAULT_CONFIG={inlineVideo:0,inner:$('#overlay-content'),item_info:'',btn_close:$('<span />',{'class':'modal-btn modal-btn-close',html:'close x'}),contentInnerHeight:630},iframe=$('<iframe />',{id:'photo-gal-frame',css:{border:'0 none',width:'994px',height:'100%',display:'none',background:'#242424'},overflow:'hidden',frameborder:'0',scrolling:'no'}),contentInnerTemplate=['<div class="overlay-content-inner" id="overlay-inner" style="height:'+DEFAULT_CONFIG.contentInnerHeight+'px">','<div class="box close inline">','<div class="hd">','<em>Close</em><span></span>','</div>','</div>','</div>'],n=$('<div />').prepend(contentInnerTemplate.join('')).find("div").eq(0).append(iframe);iframe.load(function(){$('#overlay-inner').addClass('loaded');iframe.css('display','inline');if(cfg.inlineVideo){var inlineVideoIframe=document.getElementById('photo-gal-frame');inlineVideoIframe.contentWindow.SNI.HGRM.TravelingLib.instantiateInlineSnapPlayer();inlineVideoIframe.contentWindow.SNI.Common.Carousel('#carousel',{visible:5});inlineVideoIframe.contentWindow.SNI.HGRM.TravelingLib.wireInlinePlayerCarouselLinks();}
$('#photo-gal-frame').contents().find('html').css('background-color','#242424');});cfg=$.extend(DEFAULT_CONFIG,cfg);iframe.attr('src',cfg.url);if(SNI.Util.overlay.contents!=='gallery'){cfg.inner.html('').prepend(n);$('#overlay-content').css('position','absolute').show().find('div:first').fadeIn('fast',function(){SNI.Util.overlay.contents='gallery';});}
else{cfg.inner.fadeIn('fast');}},init:function(cfg){var DEFAULT_CONFIG={clickables:$('a.gal-btn'),offset:0,inlineVideo:0,scroll_headline_into_view:function(cfg){var doc=$('html,body');doc.animate({scrollTop:cfg.headline.offset().top-cfg.special_offset},750);}};if(cfg.url.match(/inline_channel/g))cfg.inlineVideo=1;var cfg=$.extend(DEFAULT_CONFIG,cfg);var module_bd=cfg.clickables.closest('div.bd'),pod_headline=cfg.clickables.parent().prev('h4'),strip_headline=module_bd.find('h5:first');cfg.clickables.parent().find('a').bind('click',function(evt){evt.stopPropagation();evt.preventDefault();if(pod_headline.length>0){cfg.offset=$(pod_headline).offset().top;cfg.scroll_headline_into_view({headline:pod_headline,special_offset:14});}else if(strip_headline.length>0){cfg.offset=$(strip_headline).offset().top;cfg.scroll_headline_into_view({headline:strip_headline,special_offset:20});}else{cfg.offset=$(module_bd).offset().top;cfg.scroll_headline_into_view({headline:module_bd,special_offset:20});}
SNI.Util.overlay.open(cfg);});}};})(jQuery);
SNI.HGRM.Newsletters={inlineSubscribe:function(form){var $form=$(form);$form.validate({errorPlacement:function(error,element){error.appendTo(".error-wrap.news");},errorLabelContainer:'.error-wrap.news ul',wrapper:"li",showErrors:function(errorMap,errorList){if(errorList.length){this.defaultShowErrors();$('.error-wrap.news').css('display','block').fadeIn();}},rules:{emailaddress:{required:true,email:true},terms:{required:true}},messages:{emailaddress:{required:"Please enter an e-mail address",email:"Whoops. Please check the format of your e-mail address and re-enter (e.g. sally@gmail.com)"},terms:{required:"Please agree to the Terms of Use"}}});}};
SNI.HGRM.Contact={init:function(){var flashVersion;$("input[name|='optionaldata13']").val(navigator.userAgent);if(swfobject){flashVersion=swfobject.getFlashPlayerVersion();$("input[name|='optionaldata14']").val(flashVersion.major+"."+flashVersion.minor+"."+flashVersion.release);}
$("input[name|='optionaldata15']").val(SNI.Community.UR.ViewingUserId);$('select').dropdown();$('#contact').validate({errorContainer:'.error-wrap',errorLabelContainer:'.error-wrap ul',wrapper:"li",rules:{optionaldata5:"required",optionaldata6:"required",email:{required:true,email:true},confirm:{required:true,equalTo:"#email"},fname:"required",lname:"required",optionaldata4:"required",optionaldata7:"required"},messages:{optionaldata5:"Please select a reason for contacting us",optionaldata6:"Please select what this is regarding",email:{required:"Please enter your e-mail address",email:"Please check the format of your e-mail address and re-enter (i.e. joe@gmail.com)"},confirm:{required:"Please confirm your e-mail address",equalTo:"Please make sure your e-mail and confirmation e-mail match"},fname:"Please enter your first name",lname:"Please enter your last name",optionaldata4:"Please enter your zip code",optionaldata7:"Please enter your message"},showErrors:function(errorMap,errorList){if(errorList.length){this.defaultShowErrors();$('html, body').animate({scrollTop:$('.error-wrap').offset().top-10},'slow');$('.error-wrap').fadeIn();}}});},liveChat:function(){$('form').validate({errorContainer:'.error-wrap',errorLabelContainer:'.error-wrap ul',wrapper:"li",rules:{fname:"required",lname:"required",email:{required:true,email:true},confirm:{required:true,equalTo:"#email"}},messages:{fname:"Please enter your first name",lname:"Please enter your last name",email:{required:"Please enter your e-mail address",email:"Please check the format of your e-mail address and re-enter (i.e. joe@HGRM.com)"},confirm:{required:"Please confirm your e-mail address",equalTo:"Please make sure your e-mail and confirmation e-mail match"}},showErrors:function(errorMap,errorList){if(errorList.length){this.errorList=[this.errorList[0]];this.defaultShowErrors();$('.error-wrap').css('display','block').fadeIn();}}});}};
(function($){var oTabs=function(){oTabs=this;oTabs.$wrap={};oTabs.$Nav={};oTabs.$Cont={};oTabs.nseTrack=function($elt){var retVal=false;if(typeof SNI.Nielsen=="undefined")return retVal;if(oTabs.$Wrap.attr("id")=="ss-ideas"){SNI.Nielsen.trackNSE();retVal=true;}
return retVal;};oTabs.init=function($modWrap,nInit){oTabs.$Wrap=$modWrap;oTabs.$Nav=$modWrap.find(".filter");oTabs.$Cont=$modWrap.find(".filter-cont");oTabs.$Nav.addClass("dis");oTabs.$Nav.find("li a").click(function(){if(oTabs.$Nav.hasClass("dis")||$(this).parent().hasClass("sel")){return false;}
oTabs.$Nav.find("li.sel").removeClass("sel");$(this).parent().addClass("sel");oTabs.nseTrack($(this));oTabs.fTransOut(oTabs.$Wrap.find(".filter-cont > li#"+$(this).attr("rel")));return false;});oTabs.$Cont.append('<li class="loader"><span></span></li>');idx=0;if((typeof nInit!="undefined")&&(nInit!=0)){if(nInit<0){idx=Math.floor(Math.random()*oTabs.$Nav.find("li").length);}
else if(nInit<oTabs.$Nav.find("li").length){idx=nInit;}}
oTabs.$Nav.find("li").eq(idx).addClass("sel");oTabs.fTransIn(oTabs.$Cont.find("li#"+oTabs.$Nav.find("li.sel a").attr("rel")));return;};oTabs.fTransOut=function($elt){oTabs.$Nav.addClass("dis");oTabs.$Cont.find("li.loader").fadeIn(250);oTabs.$Cont.find("li.sel").animate({opacity:0,height:"toggle"},{duration:500,complete:function(){$(this).removeClass("sel");oTabs.fTransIn($elt);}});};oTabs.fTransIn=function($elt){oTabs.$Cont.find("li.loader").fadeOut(250);$elt.find("img").each(function(i,e){SNI.Util.LazyLoad($(e));});$elt.animate({opacity:1,height:"toggle"},{duration:500,complete:function(){$(this).addClass("sel");if($.browser.msie){$(this).css({opacity:''});}
oTabs.$Nav.removeClass("dis");}});return;};};SNI.FilterTabs=new oTabs;})(jQuery);
(function($){$.fn.spinner=function(options){var opts=$.extend({},$.fn.spinner.defaults,options);return this.each(function(){var l=0,t=0,w=0,h=0,shim=0,$s;var $this=$(this);if(options=='remove'||options=='close'){var $s=$this.data('spinner');var o=$this.data('opts');if(typeof $s!='undefined'){$s.remove();$this.removeData('spinner').removeData('opts');if(o.hide)$this.css('visibility','visible');o.onFinish.call(this);return;}}
var pos=$this.offset();w=$this.outerWidth()-14;h=$this.outerHeight()-14;if(h>opts.height)shim=Math.round((h-opts.height)/2);else if(h<opts.height)shim=0-Math.round((opts.height-h)/2);t=pos.top+shim+'px';if(opts.position=='right'){l=pos.left+w+10+'px';}else if(opts.position=='left'){l=pos.left-opts.width-10+'px';}else{l=pos.left+Math.round(.5*w)-Math.round(.5*opts.width)+'px';}
opts.onStart.call(this);if(opts.hide)$this.css('visibility','hidden');$s=$('<div style="display:none;padding:10px;background:#000;opacity:.8;-moz-border-radius:4px;border-radius:4px;position: absolute; left: '+l+'; top: '+t+';width: '+opts.width+'px; height: '+opts.height+'px; z-index: '+opts.zIndex+';"><img src="'+opts.img+'" /></div>');$s.appendTo('body').fadeIn(350);$this.data('spinner',$s).data('opts',opts);});};$.fn.spinner.defaults={position:'center',img:'http://www.sndimg.com/webhgrm/rm10/imgs/le/loader-dark.gif',height:32,width:32,zIndex:1001,hide:false,onStart:function(){},onFinish:function(){}};})(jQuery);
if(typeof(SNI.HGRM.ProGallery)=="undefined"){SNI.HGRM.ProGallery={};}
SNI.HGRM.ProGallery={site_name:'HGRM',sni_w:'div.site-wrapper div.sni-w',cxf_service:'/hgrmcxfwebservice/browsebyroom',portf_service:'/app/PortfolioService/index.json?portfolio=',current_portf_id:'',fetch_portf_id:'',gallery_wrap:'.pro-gallery .photo-gallery',navigation:'div.photo-gallery div.pg-navigation',photo_count:'.filter-wrap .p-wrap',change_portfolio:'a.nextprev',next_portfolio:'a.nextprev.next',prev_portfolio:'a.nextprev.prev',photo_outer_wrapper:'.pg-photo-display-wrapper',photo_wrapper:'.pg-photo-wrapper',photo_description:'.pg-photo-description',photo_title:'.pg-photo-description h1',photo_desc:'.pg-photo-description h2',portf_photo_href:'.pg-photo-wrapper a.photo',portf_photo:'.pg-photo-wrapper a.photo img',filters_class:'.click-wrap ul.single li a',filters_close:'.box.drop .hd span',filters_more:'.click-wrap .btn, .click-wrap .more',filters_wrap:'.click-wrap .box',hotspot_object:'#sponsored_hotspot',category_filter:'.pro-filters #pro-category',style_filter:'.pro-filters #pro-style',designer_link:'.master .pro-info h5 a, #carousel .hd h4 a',secondary_designer_div:'.pro .master',portf_style:'',portf_category:'',portf_designer:'',portf_loop:[],author_name:'.pg-author-name',toggler:'.pg-photo-display .pg-toggler',remove_filter:'.pro-filters .bd.bdr.center a',narrow_by:'div.pro-filters div.narrowby',current_filter:'',sponsor_multi_logo:'.sponsor-multi-logo',error_thrown:false,init:function(){SNI.HGRM.ProGallery.setupToggler();SNI.HGRM.MenuHandler.space_detail=1;SNI.HGRM.ProGallery.current_portf_id=SNI.HGRM.ProGallery.getPortfIdFromUrl(window.location.href);SNI.HGRM.ProGallery.checkUrlFilters();SNI.HGRM.ProGallery.getFilterData(false,true);$(window).hashchange(function(){SNI.HGRM.ProGallery.hashChange();});$(SNI.HGRM.ProGallery.change_portfolio).bind('contextmenu',function(e){e.stopPropagation();e.preventDefault();window.open($(this).attr('href'));});$(SNI.HGRM.ProGallery.gallery_wrap).delegate(SNI.HGRM.ProGallery.portf_photo,'click',function(e){e.stopPropagation();e.preventDefault();$(SNI.HGRM.ProGallery.next_portfolio).click();});$(SNI.HGRM.ProGallery.navigation).delegate(SNI.HGRM.ProGallery.remove_filter,'click',function(e){e.stopPropagation();e.preventDefault();if($(this).parents(SNI.HGRM.ProGallery.category_filter).length>0){SNI.HGRM.ProGallery.portf_category='';}
else{SNI.HGRM.ProGallery.portf_style='';}
SNI.HGRM.ProGallery.getFilterData(true);$(this).closest(SNI.HGRM.ProGallery.filters_wrap).removeClass('show');$(SNI.HGRM.ProGallery.filters_more).removeClass('sel');});$(SNI.HGRM.ProGallery.navigation).delegate(SNI.HGRM.ProGallery.filters_class,'click',function(e){e.stopPropagation();e.preventDefault();if($(this).parents(SNI.HGRM.ProGallery.category_filter).length>0){SNI.HGRM.ProGallery.portf_category=$(this).attr('data-filter');$(SNI.HGRM.ProGallery.category_filter+' a.btn.pull').attr('data-url',SNI.HGRM.ProGallery.portf_category);}else{SNI.HGRM.ProGallery.portf_style=$(this).attr('data-filter');$(SNI.HGRM.ProGallery.style_filter+' a.btn.pull').attr('data-url',SNI.HGRM.ProGallery.portf_style);}
SNI.HGRM.ProGallery.getFilterData(true);$(this).closest(SNI.HGRM.ProGallery.filters_wrap).removeClass('show');$(SNI.HGRM.ProGallery.filters_more).removeClass('sel');});$(SNI.HGRM.ProGallery.filters_close).click(function(){$(SNI.HGRM.ProGallery.gallery_wrap).click();});$(SNI.HGRM.ProGallery.navigation).delegate(SNI.HGRM.ProGallery.change_portfolio,'click',function(e){e.stopPropagation();e.preventDefault();SNI.HGRM.ProGallery.fetch_portf_id=SNI.HGRM.ProGallery.getPortfIdFromUrl($(this).attr('href'));SNI.HGRM.ProGallery.updateHash({'portfolioId':SNI.HGRM.ProGallery.fetch_portf_id});});$(document).keydown(function(e){if(e.keyCode==37){$(SNI.HGRM.ProGallery.prev_portfolio).click();}
else if(e.keyCode==39){$(SNI.HGRM.ProGallery.next_portfolio).click();}
else{return true;}});$(SNI.HGRM.ProGallery.sni_w).delegate(SNI.HGRM.ProGallery.designer_link,'click',function(e){e.stopPropagation();e.preventDefault();SNI.HGRM.ProGallery.portf_designer=$(this).attr('data-designer');var designerName=this.text;SNI.HGRM.ProGallery.portf_category='';SNI.HGRM.ProGallery.portf_style='';SNI.HGRM.ProGallery.hideErrorPanel();SNI.HGRM.ProGallery.getFilterData(false,false,true);$(SNI.HGRM.ProGallery.photo_count).find('.type').text(designerName);$(SNI.HGRM.ProGallery.photo_count).find('.browse').hide();$(SNI.HGRM.ProGallery.narrow_by).html('<a class="view-all" href="javascript:void(0);" onclick="SNI.HGRM.ProGallery.viewAllPortfolios();">View All Galleries</a>');var targetOffset=$(SNI.HGRM.ProGallery.narrow_by).offset().top-21;$('body,html').animate({scrollTop:targetOffset},400);return false;});if($(SNI.HGRM.ProGallery.author_name).length==0){$(SNI.HGRM.ProGallery.photo_description).prepend('<cite class="cap pg-author"><span class="pg-author-name"></span></cite>').hide();}
if($(SNI.HGRM.ProGallery.photo_title).length==0){$('cite.cap.pg-auther').after('<h1></h1>').hide();}
if($(SNI.HGRM.ProGallery.photo_desc).length==0){$(SNI.HGRM.ProGallery.photo_title).after('<h2></h2>').hide();}
SNI.HGRM.DynamicAds.init({container:SNI.HGRM.ProGallery.photo_outer_wrapper,insert_tgt:SNI.HGRM.ProGallery.photo_outer_wrapper,dismiss_elts:[SNI.HGRM.ProGallery.next_portfolio,SNI.HGRM.ProGallery.prev_portfolio]});SNI.HGRM.Omniture.ClickTrack(SNI.HGRM.ProGallery.change_portfolio,"Pro Gallery Viewer");},updateNextPrevLinks:function(){var portfolios=SNI.HGRM.ProGallery.portf_loop,prev_index=0,next_index=0;if(portfolios.length<1){SNI.HGRM.ProGallery.errorPanel('no_photos');$(SNI.HGRM.ProGallery.portf_photo).hide();return;}
if(portfolios.length==2){if(SNI.HGRM.ProGallery.current_portf_id==portfolios[0].id){prev_index=1;next_index=1;}}else if(portfolios.length==1){}else{for(var i=0;i<portfolios.length;i++){if(portfolios[i].id==SNI.HGRM.ProGallery.current_portf_id){prev_index=(i==0)?(portfolios.length-1):i-1;next_index=(i==portfolios.length-1)?0:i+1;break;}}}
$(SNI.HGRM.ProGallery.next_portfolio).attr('href',portfolios[next_index].url);$(SNI.HGRM.ProGallery.prev_portfolio).attr('href',portfolios[prev_index].url);},highLightSubnav:function(){var category=SNI.HGRM.ProGallery.portf_category.replace('/space/','').replace(/\+/g,' ');$.each($('.local-nav ul li a'),function(){if(category==$(this).html().replace('&amp;','and')){$(this).addClass('sel');}else $(this).removeClass('sel');});},viewAllPortfolios:function(){SNI.HGRM.ProGallery.portf_category='';SNI.HGRM.ProGallery.portf_style='';SNI.HGRM.ProGallery.portf_designer='';SNI.HGRM.ProGallery.getFilterData(true);},updateFilterValues:function(filter_selector,filter_data){var filter=filter_data,options=filter.options;$(filter_selector+' ul.single li a').each(function(index){var dropdown_val=$(this).html().replace('&amp;','&'),available=false,selected=false,filter_val='';for(var i=0;i<options.length;i++){if(dropdown_val==options[i].t){available=true;selected=options[i].sel;filter_val=options[i].v;break;}}
if(!available||selected){var sel='';if(selected){sel=' class="selected" ';$(filter_selector+' a.btn.pull').html(dropdown_val+'<span></span>');$(filter_selector+' a.btn.pull').attr('data-url','/'+filter.selector+'/'+filter_val);}
$(this).parent().html('<span'+sel+'>'+dropdown_val+'</span>');}else{$(this).attr('data-filter','/'+filter.selector+'/'+filter_val);}});},updateFilters:function(data){SNI.HGRM.ProGallery.updateFilterValues(SNI.HGRM.ProGallery.category_filter,data.filters.category);SNI.HGRM.ProGallery.updateFilterValues(SNI.HGRM.ProGallery.style_filter,data.filters.style);},checkUrlFilters:function(){var url_params=window.location.hash;if(url_params&&url_params.length>1){url_params=url_params.replace('#','');var style=url_params.match(/\/style\/[a-zA-Z\+]*/),category=url_params.match(/\/space\/[a-zA-Z\+]*/),designer_id=url_params.match(/\/designerId\/\w*/g);if(category){SNI.HGRM.ProGallery.portf_category=category[0];SNI.HGRM.ProGallery.highLightSubnav();}else{$(SNI.HGRM.ProGallery.photo_count).find('span.type').html('Spaces');}
if(style){SNI.HGRM.ProGallery.portf_style=style[0];}
if(designer_id){SNI.HGRM.ProGallery.portf_designer=designer_id[0];}}},getCFXServiceUrl:function(){return SNI.HGRM.ProGallery.cxf_service+SNI.HGRM.ProGallery.portf_category+SNI.HGRM.ProGallery.portf_style+SNI.HGRM.ProGallery.portf_designer;},getFilterData:function(refresh_page,on_init,pro_loop){jQuery.ajax({type:'GET',url:SNI.HGRM.ProGallery.getCFXServiceUrl(),dataType:'json',success:function(data,textStatus,jqXHR){if(refresh_page){SNI.HGRM.ProGallery.refreshPortfolioPage(data);return;}
SNI.HGRM.ProGallery.portf_loop=data.rooms;if(on_init){SNI.HGRM.ProGallery.getHashId();}
SNI.HGRM.ProGallery.updateFilters(data);SNI.HGRM.ProGallery.updateNextPrevLinks();SNI.HGRM.ProGallery.updateRoomCount(data);if(pro_loop&&data.count!=0){var exists=false;for(var i=0;i<data.count;i++){if(SNI.HGRM.ProGallery.current_portf_id==data.rooms[i].id){exists=true;break;}}
if(!exists){SNI.HGRM.ProGallery.fetch_portf_id=data.rooms[0].id;SNI.HGRM.ProGallery.updatePageContent();return false;}
if(SNI.HGRM.ProGallery.error_thrown){$(SNI.HGRM.ProGallery.photo_description+','+SNI.HGRM.ProGallery.portf_photo).show();}}},error:function(jqXHR,textStatus,errorThrown){SNI.HGRM.ProGallery.errorPanel();}});},refreshPortfolioPage:function(resp){var old_path=window.location.pathname,filters='#'+SNI.HGRM.ProGallery.portf_style+SNI.HGRM.ProGallery.portf_category+SNI.HGRM.ProGallery.portf_designer,new_url=resp.rooms[0].url+filters;if(filters=='#'){filters='';}
window.location.replace(new_url);if(old_path==resp.rooms[0].url){var t=setTimeout('window.location.reload()',500);}},getPortfIdFromUrl:function(url){return url.match(/\/[0-9]{2,9}?\/index\.html/g)[0].split('/')[1];},getJsonUrl:function(){return SNI.HGRM.ProGallery.portf_service+SNI.HGRM.ProGallery.fetch_portf_id+'&site='+SNI.HGRM.ProGallery.site_name;},updateDesigners:function(designers){var associateDesc='<p>Also associated with this project:</p>',pro='.sni-w .pro',pro_div='.pro .master',pro_count=designers.length;if(pro_count>0){var master_pro_div='.pro .master.main .pro-info';$(master_pro_div+' h5 a').attr('data-designer','/designerId/'+designers[0].id);$(master_pro_div+' h5 a').html(designers[0].name);$(master_pro_div+' ul').remove();$(master_pro_div).append(designers[0].text);}
if(pro_count>1){if($(pro_div+':eq(1)').length==0){$(pro).append('<div class="master"></div>');$(pro_div+':eq(1)').append(associateDesc);}
$(pro_div+':eq(1) .pro-info').remove();for(var i=1;i<pro_count;i++){$(pro_div+':eq(1)').append('<div class="pro-info">'+'<h5><a data-designer="/designerId/'+designers[i].id+'" href="javascript:void(0);">'+designers[i].name+'</a></h5>'+
designers[i].text+'</div>');}}else $(pro_div+':eq(1)').hide();},updateCarousel:function(designerPhotos){if(!designerPhotos||!designerPhotos.portfolios){$('#carousel').hide();return;}
var heading=$('#carousel .hd h4 a'),carousel='<div class="crsl-wrap"><ul>',portfolios=designerPhotos.portfolios;if(!portfolios||(portfolios.length<2)){$('#carousel').hide();return;}else{$('#carousel').show();}
heading.attr('href','javascript:void(0);');heading.html('More Photos from '+designerPhotos.designerName);for(var i=0;i<portfolios.length;i++){carousel+='<li>'+'<a title="'+portfolios[i].title+'"  href="'+portfolios[i].url+'">'+'<img width="120" height="90" alt="'+portfolios[i].title+'" data-src="'+portfolios[i].image.imgUrl+'"/>'+'</a>'+'<span class="small"><a href="'+portfolios[i].url+'">'+portfolios[i].title+'</a></span>'+'</li>';}
carousel+='</ul></div>';$('#carousel .crsl-wrap').remove();$('#carousel div.nav').remove();$('#carousel div.prev-btn').remove();$('#carousel div.next-btn').remove();$('#carousel').append(carousel);SNI.Common.Carousel('#carousel',{visible:4});if(portfolios.length>4){$('#carousel a.btn.next').removeClass('disabled');}else{$('#carousel a.btn.next').addClass('disabled');}},updateRightRail:function(modules){$('.sni-e').html('');$('.sni-e').append(modules.editorialPods);$('.sni-e').append(modules.sponsorPods);$('.sni-e').append(modules.rateMyRemodel);$('.sni-e').append(modules.popularIn);},updateViewer:function(data){var img=new Image(),title=data.portfolioTitle,desc=data.designerNotes,metadata=data.metaData,browserTitle=metadata.roomStyle+' '+metadata.categoryDspName;if(data&&data.portfoliosFromDesigner&&data.portfoliosFromDesigner.designerName){browserTitle+=' from '+data.portfoliosFromDesigner.designerName;}
document.title=browserTitle+' : Pro Galleries : HGTV Remodels';if(data.images&&!$.isArray(data.images[0].imgAuthor)){$(SNI.HGRM.ProGallery.author_name).text("Courtesy of: "+data.images[0].imgAuthor).parent().show();}else{$(SNI.HGRM.ProGallery.author_name).parent().hide();}
if(title&&!$.isArray(title)){$(SNI.HGRM.ProGallery.photo_title).html(title).show();}else{$(SNI.HGRM.ProGallery.photo_title).hide();}
if(desc&&!$.isArray(desc)){$(SNI.HGRM.ProGallery.photo_desc).html(desc).show();}else{$(SNI.HGRM.ProGallery.photo_desc).hide();}
if(data.multimedia&&data.multimedia.path){$(SNI.HGRM.ProGallery.photo_wrapper).append('<div id="sponsored_hotspot"></div>');$('#sponsored_hotspot').flash({swf:data.multimedia.path,width:616,height:462,wmode:'transparent',allowscriptaccess:'always'});$(SNI.HGRM.ProGallery.photo_wrapper).removeClass('pg-fitted');}else{$(img).load(function(response,status,xhr){if(data.images[0].bvert=='true'){$(SNI.HGRM.ProGallery.photo_wrapper).addClass('pg-fitted').attr('style','.');$(SNI.HGRM.ProGallery.toggler).show().find('.pg-enlarge').show();}else{$(SNI.HGRM.ProGallery.toggler).hide();$(SNI.HGRM.ProGallery.photo_wrapper).removeClass('pg-fitted');}
if(!$(SNI.HGRM.ProGallery.portf_photo_href).length){$(SNI.HGRM.ProGallery.photo_wrapper).append('<a class="photo" title="Next Photo"></a>');}
$(SNI.HGRM.ProGallery.portf_photo_href).html('').append(this);}).error(function(){SNI.HGRM.ProGallery.errorPanel('no_photos');$(SNI.HGRM.ProGallery.portf_photo).hide();}).attr('src',data.images[0].lgUrl);}
SNI.HGRM.ProGallery.hideErrorPanel();$(SNI.HGRM.ProGallery.photo_wrapper).fadeIn();},updateHash:function(data){window.location.hash="/id-"+data.portfolioId+SNI.HGRM.ProGallery.portf_style+SNI.HGRM.ProGallery.portf_category+SNI.HGRM.ProGallery.portf_designer;},getHashId:function(){var deep_link_id=window.location.hash.match(/\/id-[0-9]{2,9}/);if(deep_link_id){SNI.HGRM.ProGallery.fetch_portf_id=deep_link_id[0].split('-')[1];SNI.HGRM.ProGallery.updatePageContent();}},updateAds:function(data){mdManager.setParameter('UniqueId','HGRM-PORTFOLIO-'+SNI.HGRM.ProGallery.current_portf_id+'-1');$.each(data.metaData,function(key,val){mdManager.setParameter(key,val);});if(typeof s=="object"){s.t();}
SNI.Nielsen.trackNSE();},updateRoomCount:function(data){var roomCount=data.count;var countWrap='.p-wrap .count';$(countWrap).text(roomCount);},updatePageContent:function(){$(SNI.HGRM.ProGallery.toggler).hide('fast');$(SNI.HGRM.ProGallery.portf_photo).fadeOut('fast');$(SNI.HGRM.ProGallery.photo_wrapper).attr('style','').find('.pg-shrink').hide();$(SNI.HGRM.ProGallery.hotspot_object).remove();$(SNI.HGRM.ProGallery.sponsor_multi_logo).remove();try{jQuery.ajax({type:'GET',dataType:'json',url:SNI.HGRM.ProGallery.getJsonUrl(),success:function(data,textStatus,jqXHR){if(data.sponsorFlag=='Y'){var filters='#'+SNI.HGRM.ProGallery.portf_category+SNI.HGRM.ProGallery.portf_style;if(filters=='#'){filters='';}
window.location.replace(data.portfolioUrl+filters);return;}
SNI.HGRM.ProGallery.current_portf_id=SNI.HGRM.ProGallery.fetch_portf_id;SNI.HGRM.ProGallery.updateNextPrevLinks();SNI.HGRM.ProGallery.updateViewer(data);SNI.HGRM.ProGallery.updateDesigners(data.designers);SNI.HGRM.ProGallery.updateCarousel(data.portfoliosFromDesigner);SNI.HGRM.ProGallery.updateRightRail(data.rightRail);SNI.HGRM.ProGallery.updateAds(data);SNI.HGRM.DynamicAds.refresh();SNI.HGRM.ProGallery.refreshSocial(data);},error:function(jqXHR,textStatus,errorThrown){SNI.HGRM.ProGallery.errorPanel();}});}catch(e){}},hashChange:function(){SNI.HGRM.ProGallery.getHashId();},hideErrorPanel:function(){$('div.pg-error.pod').hide();},errorPanel:function(type){SNI.HGRM.ProGallery.error_thrown=true;var errorContent;if(type=='no_photos'){errorContent='<div class="pg-error pod" style="display:block;top:150px;">'
+'<h4>There were no photos found for this designer.</h4>'
+'<p>Please click the button below to reload your content.</p>'
+'<a class="btn">Reload</a>'
+'</div>';}
else{errorContent='<div class="pg-error pod" style="display:block;top:150px;">'
+'<h4>Please forgive us, our photos are <em>really</em> popular.</h4>'
+'<p>Please click the button below to reload your content.</p>'
+'<a class="btn">Reload</a>'
+'</div>';}
if(SNI.HGRM.ProGallery.error_thrown){$(SNI.HGRM.ProGallery.photo_outer_wrapper).append(errorContent);$(SNI.HGRM.ProGallery.photo_description+','+SNI.HGRM.ProGallery.portf_photo).hide();}
$('.btn').click(function(){$(this).parent().remove();SNI.HGRM.ProGallery.viewAllPortfolios();SNI.HGRM.ProGallery.error_thrown=false;});},refreshSocial:function(data){var url='http://'+SNI.Config.domain+data.portfolioUrl;var page_title=data.portfolioTitle;mdManager.setParameter("RoomType",page_title);var config=SNI.HGRM.globalToolbar.config;config.emailPageTitle=page_title;config.emailLink=url;$('#tb-facebook').empty().append($('<iframe />').attr('src','http://www.facebook.com/plugins/like.php?href='+url+'&amp;send=false&layout=button_count&amp;show_faces=false&amp;width=250&amp;action=like&amp;colorscheme=light&amp;font=trebuchet+ms&amp;height=21').attr('scrolling','no').attr('frameborder','no').attr('style','border:none; overflow:hidden; width:250px; height:21px;').attr('allowTransparency','true'));SNI.HGRM.IS.Twitter.share({share_url:url,messages:{tweet_msg:page_title+" @HGTVRemodels"}});},setupToggler:function(){var enlarge=$(SNI.HGRM.ProGallery.photo_wrapper).find('.pg-enlarge'),shrink=$(SNI.HGRM.ProGallery.photo_wrapper).find('.pg-shrink'),enlarge_width='616px',shrink_width='339px',enlarge_height='height:auto';enlarge.click(function(){$(SNI.HGRM.ProGallery.photo_wrapper).animate({width:enlarge_width},200);$(SNI.HGRM.ProGallery.portf_photo).animate({width:enlarge_width},200);$(SNI.HGRM.ProGallery.portf_photo).attr('style',enlarge_height);enlarge.hide();shrink.show();});enlarge.children('.pg-toggler-button').hover(function(){enlarge.children('.pg-toggler-label').show();},function(){enlarge.children('.pg-toggler-label').hide();});enlarge.children('.pg-toggler-label').hover(function(){enlarge.children('.pg-toggler-label').show();},function(){enlarge.children('.pg-toggler-label').hide();});shrink.click(function(){$(SNI.HGRM.ProGallery.photo_wrapper).animate({width:'339px'},250);$(SNI.HGRM.ProGallery.portf_photo).animate({width:'339px'},250);shrink.hide();enlarge.show();});shrink.children('.pg-toggler-button').hover(function(){shrink.children('.pg-toggler-label').show();},function(){shrink.children('.pg-toggler-label').hide();});shrink.children('.pg-toggler-label').hover(function(){shrink.children('.pg-toggler-label').show();},function(){shrink.children('.pg-toggler-label').hide();});}};(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);(function(f,h,i){function k(a,c){var b=(a[0]||0)-(c[0]||0);return b>0||!b&&a.length>0&&k(a.slice(1),c.slice(1))}function l(a){if(typeof a!=g)return a;var c=[],b="";for(var d in a){b=typeof a[d]==g?l(a[d]):[d,m?encodeURI(a[d]):a[d]].join("=");c.push(b)}return c.join("&")}function n(a){var c=[];for(var b in a)a[b]&&c.push([b,'="',a[b],'"'].join(""));return c.join(" ")}function o(a){var c=[];for(var b in a)c.push(['<param name="',b,'" value="',l(a[b]),'" />'].join(""));return c.join("")}var g="object",m=true;try{var j=i.description||function(){return(new i("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version")}()}catch(p){j="Unavailable"}var e=j.match(/\d+/g)||[0];f[h]={available:e[0]>0,activeX:i&&!i.name,version:{original:j,array:e,string:e.join("."),major:parseInt(e[0],10)||0,minor:parseInt(e[1],10)||0,release:parseInt(e[2],10)||0},hasVersion:function(a){a=/string|number/.test(typeof a)?a.toString().split("."):/object/.test(typeof a)?[a.major,a.minor]:a||[0,0];return k(e,a)},encodeParams:true,expressInstall:"expressInstall.swf",expressInstallIsActive:false,create:function(a){if(!a.swf||this.expressInstallIsActive||!this.available&&!a.hasVersionFail)return false;if(!this.hasVersion(a.hasVersion||1)){this.expressInstallIsActive=true;if(typeof a.hasVersionFail=="function")if(!a.hasVersionFail.apply(a))return false;a={swf:a.expressInstall||this.expressInstall,height:137,width:214,flashvars:{MMredirectURL:location.href,MMplayerType:this.activeX?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}}attrs={data:a.swf,type:"application/x-shockwave-flash",id:a.id||"flash_"+Math.floor(Math.random()*999999999),width:a.width||320,height:a.height||180,style:a.style||""};m=typeof a.useEncode!=="undefined"?a.useEncode:this.encodeParams;a.movie=a.swf;a.wmode=a.wmode||"opaque";delete a.fallback;delete a.hasVersion;delete a.hasVersionFail;delete a.height;delete a.id;delete a.swf;delete a.useEncode;delete a.width;var c=document.createElement("div");c.innerHTML=["<object ",n(attrs),">",o(a),"</object>"].join("");return c.firstChild}};f.fn[h]=function(a){var c=this.find(g).andSelf().filter(g);/string|object/.test(typeof a)&&this.each(function(){var b=f(this),d;a=typeof a==g?a:{swf:a};a.fallback=this;if(d=f[h].create(a)){b.children().remove();b.html(d)}});typeof a=="function"&&c.each(function(){var b=this;b.jsInteractionTimeoutMs=b.jsInteractionTimeoutMs||0;if(b.jsInteractionTimeoutMs<660)b.clientWidth||b.clientHeight?a.call(b):setTimeout(function(){f(b)[h](a)},b.jsInteractionTimeoutMs+66)});return c}})(jQuery,"flash",navigator.plugins["Shockwave Flash"]||window.ActiveXObject);
