/* sni-hgtv - Thu, 02 Sep 2010 12:49:19 -0400 */

if( typeof(SNI.HGTV) == "undefined" ) {
	SNI.HGTV = {};
}

SNI.HGTV.ANIMATION_SPEED = 150;


if(typeof(SNI)=='undefined'){SNI={};}
if(typeof(SNI.Community)=='undefined'){SNI.Community={};}
if(typeof(SNI.Community.UR)=='undefined'){SNI.Community.UR={};}
SNI.Community.UR={init:function(){if((SNI.Community.siteName==undefined)||(SNI.Community.siteName==null)){SNI.Community.UR.urUser=new SNI.UR.UrUser(new HGTVApplicationConfig());if(SNI.Community.UR.urUser.isLoggedIn==true){SNI.Community.UR.ViewingUserId=SNI.Community.UR.urUser.getUserId();SNI.Community.UR.ViewingUserName=SNI.Community.UR.urUser.getEmail();SNI.Community.UR.ViewingUserDisplayName=SNI.Community.UR.urUser.getUserName();if((SNI.Community.UR.ViewingUserDisplayName==undefined)||(SNI.Community.UR.ViewingUserDisplayName==null)||(SNI.Community.UR.ViewingUserDisplayName=='')){if((SNI.Community.UR.ViewingUserName!=null)){if(SNI.Community.UR.ViewingUserName.indexOf("@")==-1){SNI.Community.UR.ViewingUserDisplayName=SNI.Community.UR.ViewingUserName;}else{SNI.Community.UR.ViewingUserDisplayName=SNI.Community.UR.ViewingUserName.substring(0,SNI.Community.UR.ViewingUserName.indexOf("@"));}}}
SNI.Community.UR.ViewingUserPostalCode=SNI.Community.UR.urUser.getPostalCode();SNI.Community.UR.logged_in='true';}else{}}
else if((SNI.Community.UR.ViewingUserName!=undefined)&&(SNI.Community.UR.ViewingUserName!=null)){if((SNI.Community.UR.ViewingUserDisplayName==undefined)||(SNI.Community.UR.ViewingUserDisplayName==null)||(SNI.Community.UR.ViewingUserDisplayName=='')){if(SNI.Community.UR.ViewingUserName!=null){if(SNI.Community.UR.ViewingUserName.indexOf("@")==-1){SNI.Community.UR.ViewingUserDisplayName=SNI.Community.UR.ViewingUserName;}else{SNI.Community.UR.ViewingUserDisplayName=SNI.Community.UR.ViewingUserName.substring(0,SNI.Community.UR.ViewingUserName.indexOf("@"));}}}
SNI.Community.UR.logged_in='true';}},logout:function(){var destURL=document.location;document.location="http://my.hgtv.com/redirectors/logout_redirector.jsp?DEST_URL="+escape(destURL);}};
HGTVApplicationConfig.prototype=new SNI.UR.ApplicationConfig();function HGTVApplicationConfig(){HGTVApplicationConfig.prototype=new SNI.UR.ApplicationConfig();this.loginServer["DEV"]="http://vdev2.scrippsnetworks.com/";this.loginServer["STAGE"]="http://swwd.scrippsweb.com/";this.loginServer["PROD"]="http://web.hgtv.com/";this.urVersion=urVersion;function urVersion(){return 1;}}
(function($){$.fn.jcarousel=function(o){if(typeof o=='string'){var instance=$(this).data('jcarousel'),args=Array.prototype.slice.call(arguments,1);return instance[o].apply(instance,args);}else
return this.each(function(){$(this).data('jcarousel',new $jc(this,o));});};var defaults={vertical:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:'normal',easing:'swing',auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:'<div></div>',buttonPrevHTML:'<div></div>',buttonNextEvent:'click',buttonPrevEvent:'click',buttonNextCallback:null,buttonPrevCallback:null};$.jcarousel=function(e,o){this.options=$.extend({},defaults,o||{});this.locked=false;this.container=null;this.clip=null;this.list=null;this.buttonNext=null;this.buttonPrev=null;this.wh=!this.options.vertical?'width':'height';this.lt=!this.options.vertical?'left':'top';var skin='',split=e.className.split(' ');for(var i=0;i<split.length;i++){if(split[i].indexOf('jcarousel-skin')!=-1){$(e).removeClass(split[i]);skin=split[i];break;}}if(e.nodeName=='UL'||e.nodeName=='OL'){this.list=$(e);this.container=this.list.parent();if(this.container.hasClass('jcarousel-clip')){if(!this.container.parent().hasClass('jcarousel-container'))this.container=this.container.wrap('<div></div>');this.container=this.container.parent();}else if(!this.container.hasClass('jcarousel-container'))this.container=this.list.wrap('<div></div>').parent();}else{this.container=$(e);this.list=this.container.find('ul,ol').eq(0);}if(skin!=''&&this.container.parent()[0].className.indexOf('jcarousel-skin')==-1)this.container.wrap('<div class=" '+skin+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass('jcarousel-clip'))this.clip=this.list.wrap('<div></div>').parent();this.buttonNext=$('.jcarousel-next',this.container);if(this.buttonNext.size()==0&&this.options.buttonNextHTML!=null)this.buttonNext=this.clip.after(this.options.buttonNextHTML).next();this.buttonNext.addClass(this.className('jcarousel-next'));this.buttonPrev=$('.jcarousel-prev',this.container);if(this.buttonPrev.size()==0&&this.options.buttonPrevHTML!=null)this.buttonPrev=this.clip.after(this.options.buttonPrevHTML).next();this.buttonPrev.addClass(this.className('jcarousel-prev'));this.clip.addClass(this.className('jcarousel-clip')).css({overflow:'hidden',position:'relative'});this.list.addClass(this.className('jcarousel-list')).css({overflow:'hidden',position:'relative',top:0,left:0,margin:0,padding:0});this.container.addClass(this.className('jcarousel-container')).css({position:'relative'});var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var li=this.list.children('li');var self=this;if(li.size()>0){var wh=0,i=this.options.offset;li.each(function(){self.format(this,i++);wh+=self.dimension(this,di);});this.list.css(this.wh,wh+'px');if(!o||o.size===undefined)this.options.size=li.size();}this.container.css('display','block');this.buttonNext.css('display','block');this.buttonPrev.css('display','block');this.funcNext=function(){self.next();};this.funcPrev=function(){self.prev();};this.funcResize=function(){self.reload();};if(this.options.initCallback!=null)this.options.initCallback(this,'init');if($.browser.safari){this.buttons(false,false);$(window).bind('load.jcarousel',function(){self.setup();});}else
this.setup();};var $jc=$.jcarousel;$jc.fn=$jc.prototype={jcarousel:'0.2.4'};$jc.fn.extend=$jc.extend=$.extend;$jc.fn.extend({setup:function(){this.first=null;this.last=null;this.prevFirst=null;this.prevLast=null;this.animating=false;this.timer=null;this.tail=null;this.inTail=false;if(this.locked)return;this.list.css(this.lt,this.pos(this.options.offset)+'px');var p=this.pos(this.options.start);this.prevFirst=this.prevLast=null;this.animate(p,false);$(window).unbind('resize.jcarousel',this.funcResize).bind('resize.jcarousel',this.funcResize);},reset:function(){this.list.empty();this.list.css(this.lt,'0px');this.list.css(this.wh,'10px');if(this.options.initCallback!=null)this.options.initCallback(this,'reset');this.setup();},reload:function(){if(this.tail!=null&&this.inTail)this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;if(this.options.reloadCallback!=null)this.options.reloadCallback(this);if(this.options.visible!=null){var self=this;var di=Math.ceil(this.clipping()/this.options.visible),wh=0,lt=0;$('li',this.list).each(function(i){wh+=self.dimension(this,di);if(i+1<self.first)lt=wh;});this.list.css(this.wh,wh+'px');this.list.css(this.lt,-lt+'px');}this.scroll(this.first,false);},lock:function(){this.locked=true;this.buttons();},unlock:function(){this.locked=false;this.buttons();},size:function(s){if(s!=undefined){this.options.size=s;if(!this.locked)this.buttons();}return this.options.size;},has:function(i,i2){if(i2==undefined||!i2)i2=i;if(this.options.size!==null&&i2>this.options.size)i2=this.options.size;for(var j=i;j<=i2;j++){var e=this.get(j);if(!e.length||e.hasClass('jcarousel-item-placeholder'))return false;}return true;},get:function(i){return $('.jcarousel-item-'+i,this.list);},add:function(i,s){var e=this.get(i),old=0,add=0;if(e.length==0){var c,e=this.create(i),j=$jc.intval(i);while(c=this.get(--j)){if(j<=0||c.length){j<=0?this.list.prepend(e):c.after(e);break;}}}else
old=this.dimension(e);e.removeClass(this.className('jcarousel-item-placeholder'));typeof s=='string'?e.html(s):e.empty().append(s);var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var wh=this.dimension(e,di)-old;if(i>0&&i<this.first)this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-wh+'px');this.list.css(this.wh,$jc.intval(this.list.css(this.wh))+wh+'px');return e;},remove:function(i){var e=this.get(i);if(!e.length||(i>=this.first&&i<=this.last))return;var d=this.dimension(e);if(i<this.first)this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+d+'px');e.remove();this.list.css(this.wh,$jc.intval(this.list.css(this.wh))-d+'px');},next:function(){this.stopAuto();if(this.tail!=null&&!this.inTail)this.scrollTail(false);else
this.scroll(((this.options.wrap=='both'||this.options.wrap=='last')&&this.options.size!=null&&this.last==this.options.size)?1:this.first+this.options.scroll);},prev:function(){this.stopAuto();if(this.tail!=null&&this.inTail)this.scrollTail(true);else
this.scroll(((this.options.wrap=='both'||this.options.wrap=='first')&&this.options.size!=null&&this.first==1)?this.options.size:this.first-this.options.scroll);},scrollTail:function(b){if(this.locked||this.animating||!this.tail)return;var pos=$jc.intval(this.list.css(this.lt));!b?pos-=this.tail:pos+=this.tail;this.inTail=!b;this.prevFirst=this.first;this.prevLast=this.last;this.animate(pos);},scroll:function(i,a){if(this.locked||this.animating)return;this.animate(this.pos(i),a);},pos:function(i){var pos=$jc.intval(this.list.css(this.lt));if(this.locked||this.animating)return pos;if(this.options.wrap!='circular')i=i<1?1:(this.options.size&&i>this.options.size?this.options.size:i);var back=this.first>i;var f=this.options.wrap!='circular'&&this.first<=1?1:this.first;var c=back?this.get(f):this.get(this.last);var j=back?f:f-1;var e=null,l=0,p=false,d=0,g;while(back?--j>=i:++j<i){e=this.get(j);p=!e.length;if(e.length==0){e=this.create(j).addClass(this.className('jcarousel-item-placeholder'));c[back?'before':'after'](e);if(this.first!=null&&this.options.wrap=='circular'&&this.options.size!==null&&(j<=0||j>this.options.size)){g=this.get(this.index(j));if(g.length)this.add(j,g.children().clone(true));}}c=e;d=this.dimension(e);if(p)l+=d;if(this.first!=null&&(this.options.wrap=='circular'||(j>=1&&(this.options.size==null||j<=this.options.size))))pos=back?pos+d:pos-d;}var clipping=this.clipping();var cache=[];var visible=0,j=i,v=0;var c=this.get(i-1);while(++visible){e=this.get(j);p=!e.length;if(e.length==0){e=this.create(j).addClass(this.className('jcarousel-item-placeholder'));c.length==0?this.list.prepend(e):c[back?'before':'after'](e);if(this.first!=null&&this.options.wrap=='circular'&&this.options.size!==null&&(j<=0||j>this.options.size)){g=this.get(this.index(j));if(g.length)this.add(j,g.find('>*').clone(true));}}c=e;var d=this.dimension(e);if(d==0){return 0;}if(this.options.wrap!='circular'&&this.options.size!==null&&j>this.options.size)cache.push(e);else if(p)l+=d;v+=d;if(v>=clipping)break;j++;}for(var x=0;x<cache.length;x++)cache[x].remove();if(l>0){this.list.css(this.wh,this.dimension(this.list)+l+'px');if(back){pos-=l;this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-l+'px');}}var last=i+visible-1;if(this.options.wrap!='circular'&&this.options.size&&last>this.options.size)last=this.options.size;if(j>last){visible=0,j=last,v=0;while(++visible){var e=this.get(j--);if(!e.length)break;v+=this.dimension(e);if(v>=clipping)break;}}var first=last-visible+1;if(this.options.wrap!='circular'&&first<1)first=1;if(this.inTail&&back){pos+=this.tail;this.inTail=false;}this.tail=null;if(this.options.wrap!='circular'&&last==this.options.size&&(last-visible+1)>=1){var m=$jc.margin(this.get(last),!this.options.vertical?'marginRight':'marginBottom');if((v-m)>clipping)this.tail=v-clipping-m;}while(i-->first)pos+=this.dimension(this.get(i));this.prevFirst=this.first;this.prevLast=this.last;this.first=first;this.last=last;return pos;},animate:function(p,a){if(this.locked||this.animating)return;this.animating=true;var self=this;var scrolled=function(){self.animating=false;if(p==0)self.list.css(self.lt,0);if(self.options.wrap=='circular'||self.options.wrap=='both'||self.options.wrap=='last'||self.options.size==null||self.last<self.options.size)self.startAuto();self.buttons();self.notify('onAfterAnimation');};this.notify('onBeforeAnimation');if(!this.options.animation||a==false){this.list.css(this.lt,p+'px');scrolled();}else{var o=!this.options.vertical?{'left':p}:{'top':p};this.list.animate(o,this.options.animation,this.options.easing,scrolled);}},startAuto:function(s){if(s!=undefined)this.options.auto=s;if(this.options.auto==0)return this.stopAuto();if(this.timer!=null)return;var self=this;this.timer=setTimeout(function(){self.next();},this.options.auto*1000);},stopAuto:function(){if(this.timer==null)return;clearTimeout(this.timer);this.timer=null;},buttons:function(n,p){if(n==undefined||n==null){var n=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!='first')||this.options.size==null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap=='first')&&this.options.size!=null&&this.last>=this.options.size)n=this.tail!=null&&!this.inTail;}if(p==undefined||p==null){var p=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!='last')||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=='last')&&this.options.size!=null&&this.first==1)p=this.tail!=null&&this.inTail;}var self=this;this.buttonNext[n?'bind':'unbind'](this.options.buttonNextEvent+'.jcarousel',this.funcNext)[n?'removeClass':'addClass'](this.className('jcarousel-next-disabled')).attr('disabled',n?false:true);this.buttonPrev[p?'bind':'unbind'](this.options.buttonPrevEvent+'.jcarousel',this.funcPrev)[p?'removeClass':'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled',p?false:true);if(this.buttonNext.length>0&&(this.buttonNext[0].jcarouselstate==undefined||this.buttonNext[0].jcarouselstate!=n)&&this.options.buttonNextCallback!=null){this.buttonNext.each(function(){self.options.buttonNextCallback(self,this,n);});this.buttonNext[0].jcarouselstate=n;}if(this.buttonPrev.length>0&&(this.buttonPrev[0].jcarouselstate==undefined||this.buttonPrev[0].jcarouselstate!=p)&&this.options.buttonPrevCallback!=null){this.buttonPrev.each(function(){self.options.buttonPrevCallback(self,this,p);});this.buttonPrev[0].jcarouselstate=p;}},notify:function(evt){var state=this.prevFirst==null?'init':(this.prevFirst<this.first?'next':'prev');this.callback('itemLoadCallback',evt,state);if(this.prevFirst!==this.first){this.callback('itemFirstInCallback',evt,state,this.first);this.callback('itemFirstOutCallback',evt,state,this.prevFirst);}if(this.prevLast!==this.last){this.callback('itemLastInCallback',evt,state,this.last);this.callback('itemLastOutCallback',evt,state,this.prevLast);}this.callback('itemVisibleInCallback',evt,state,this.first,this.last,this.prevFirst,this.prevLast);this.callback('itemVisibleOutCallback',evt,state,this.prevFirst,this.prevLast,this.first,this.last);},callback:function(cb,evt,state,i1,i2,i3,i4){if(this.options[cb]==undefined||(typeof this.options[cb]!='object'&&evt!='onAfterAnimation'))return;var callback=typeof this.options[cb]=='object'?this.options[cb][evt]:this.options[cb];if(!$.isFunction(callback))return;var self=this;if(i1===undefined)callback(self,state,evt);else if(i2===undefined)this.get(i1).each(function(){callback(self,this,i1,state,evt);});else{for(var i=i1;i<=i2;i++)if(i!==null&&!(i>=i3&&i<=i4))this.get(i).each(function(){callback(self,this,i,state,evt);});}},create:function(i){return this.format('<li></li>',i);},format:function(e,i){var $e=$(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-'+i)).css({'float':'left','list-style':'none'});$e.attr('jcarouselindex',i);return $e;},className:function(c){return c+' '+c+(!this.options.vertical?'-horizontal':'-vertical');},dimension:function(e,d){var el=e.jquery!=undefined?e[0]:e;var old=!this.options.vertical?el.offsetWidth+$jc.margin(el,'marginLeft')+$jc.margin(el,'marginRight'):el.offsetHeight+$jc.margin(el,'marginTop')+$jc.margin(el,'marginBottom');if(d==undefined||old==d)return old;var w=!this.options.vertical?d-$jc.margin(el,'marginLeft')-$jc.margin(el,'marginRight'):d-$jc.margin(el,'marginTop')-$jc.margin(el,'marginBottom');$(el).css(this.wh,w+'px');return this.dimension(el);},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-$jc.intval(this.clip.css('borderLeftWidth'))-$jc.intval(this.clip.css('borderRightWidth')):this.clip[0].offsetHeight-$jc.intval(this.clip.css('borderTopWidth'))-$jc.intval(this.clip.css('borderBottomWidth'));},index:function(i,s){if(s==undefined)s=this.options.size;return Math.round((((i-1)/s)-Math.floor((i-1)/s))*s)+1;}});$jc.extend({defaults:function(d){return $.extend(defaults,d||{});},margin:function(e,p){if(!e)return 0;var el=e.jquery!=undefined?e[0]:e;if(p=='marginRight'&&$.browser.safari){var old={'display':'block','float':'none','width':'auto'},oWidth,oWidth2;$.swap(el,old,function(){oWidth=el.offsetWidth;});old['marginRight']=0;$.swap(el,old,function(){oWidth2=el.offsetWidth;});return oWidth2-oWidth;}return $jc.intval($.css(el,p));},intval:function(v){v=parseInt(v);return isNaN(v)?0:v;}});})(jQuery);
jQuery.dpl={init:function(type,config){return this.each(function(i){if(this.id){}
else{this.id=type+"-"+new Date().getTime();}
try{document.execCommand('BackgroundImageCache',false,true);}catch(e){}
var init=$.dpl[type];if($.isFunction(init)){init(this,config);}});},carousel:function(ele,config){config=$.extend({pause:null,scroll:1,animation:"slow",auto:0,wrap:null,pagelink:null,pagetext:null,start:1},config);var crsl_itemFirstInCallback=function(carousel,item,idx,state){if(config["pagelink"]=="text"){var tmpText=config["pagetext"];tmpText=tmpText.replace(/_current/ig,idx);tmpText=tmpText.replace(/_total/ig,carousel["options"]["size"]);carousel.container.find(".jcarousel-pagetext").html(tmpText);}else if(config["pagelink"]=="image"){jQuery(ele).find('.jcarousel-pageimg a.current').removeClass("current");link=jQuery(ele).find('.jcarousel-pageimg a')[idx-1];jQuery(link).addClass("current");}};var crsl_initCallback=function(carousel,state){if((config["pagelink"]=="text")||(config["pagelink"]=="both")){carousel.container.append('<div class="jcarousel-pagetext"></div>');}else if((config["pagelink"]=="image")||(config["pagelink"]=="both")){var imgLinks="";for(var i=1;i<=carousel["options"]["size"];i++){imgLinks+='<a href="#'+i+'">'+i+'</a>';}
carousel.container.append('<div class="jcarousel-pageimg"></div>');jQuery(ele).find(".jcarousel-pageimg").append(imgLinks);jQuery(ele).find(".jcarousel-pageimg").css("left",parseInt($(ele).width())/2-parseInt($(ele).find(".jcarousel-pageimg").width())/2);jQuery(ele).find('.jcarousel-pageimg a').bind('click',function(){carousel.scroll(jQuery.jcarousel.intval(jQuery(this).html()));return false;});}};$(ele).find('.crsl').jcarousel({scroll:config["scroll"],animation:config["slow"],auto:config["auto"],wrap:config["wrap"],itemFirstInCallback:crsl_itemFirstInCallback,initCallback:crsl_initCallback,start:config["start"]});},dynlead:function(ele,config){config=$.extend({delay:15000,loops:0,showThumbnails:false,widthThumbails:110,pause:null},config);var _timeout;var currentSlide=0;var slides=$(ele).find(".dl-content li");var pageLinks=$(ele).find(".dl-menu");var maxSlides=slides.length;var countLoop=0;$(".video-cn").hide();$(ele).find(".videolink").click(function(){clearTimeout(_timeout);$(this).hide();$(this).parent().find(".video-cn").show();});var play=true;if(config["pause"]!=null){$(ele).find("."+config["pause"]).click(function(){txt=($(this).html()=="PAUSE")?"PLAY":"PAUSE";$(this).html(txt);if(play){clearTimeout(_timeout);play=false;}
else{nextSlide(ele,config);play=true;}});}
slides.not(":first").hide();pageLinks.find("ul > li:first-child").addClass("active");pageLinks.find("ul > li").each(function(i){var $this=$(this);if(config["showThumbnails"]){var thPreviewID=ele.id+"-cn-th-"+i;$this.attr({"rel":"#"+thPreviewID});$this.next(".content-th").attr({"id":thPreviewID});$this.cluetip({width:config["widthThumbails"],cluezIndex:6,cluetipClass:'content-th',local:true,showTitle:false,sticky:true,mouseOutClose:true,closePosition:'title',closeText:'',topOffset:6,leftOffset:-($this.parent().width()),positionBy:'fixed',dropShadow:false,cursor:'hand',titleAttribute:'',waitImage:false});$this.hover(function(e){height=$("#cluetip-inner").outerHeight();$('#cluetip').hide();opt={margin:true,padding:true,border:true,scroll:true};anchorPos=$(this).offset({scroll:true,margin:true,padding:true,border:true});_top=parseInt(anchorPos["top"])-parseInt(height);$('#cluetip').css('top',_top);$('#cluetip').show();},function(){if($('#cluetip').is(':visible')){$('#cluetip').hover(function(){$('#cluetip').show();},function(){$('#cluetip').hide();});$('#cluetip').hide();}});}
$this.click(function(){clearTimeout(_timeout);currentSlide=i;nextSlide(ele,config);});});var nextSlide=function(ele,config){clearTimeout(_timeout);var currentID=ele.id;var currentPage=slides[currentSlide];$(ele).find("li.active").removeClass("active");pageLinks.find("ul > li:eq("+currentSlide+")").addClass("active");$(currentPage).fadeIn('slow').siblings().not(":hidden").fadeOut('slow');if(currentSlide==(maxSlides-1)){currentSlide=0;countLoop++;}
else{currentSlide++;}
if((countLoop<config["loops"])&&(config["loops"]>0)){_timeout=setTimeout(function(){nextSlide(ele,config);},config["delay"]);}};if((config["loops"]>0)){_timeout=setTimeout(function(){nextSlide(ele,config);},config["delay"]);}},accordion:function(el,config){config=$.extend({autoheight:true,header:'.acco-link',animated:($.browser.msie?false:'easeOutSine')},config);jQuery(el).accordion(config);},tabs:function(el,config){jQuery(el).tabs(config);},collapser:function(el,config){config=$.extend({programguide:false,videochannels:false},config);if(config["programguide"]==true){var today=new Date();var current_time=today.getHours();var current_minutes=today.getMinutes();var dayofweek=today.getDay();var weekend=false;if(dayofweek==0||dayofweek==6){weekend=true;}
if(weekend==true&&current_time>=7&&current_time<12){$("#prog-guide .morning").addClass("active");}
else if(current_time>=9&&current_time<12){$("#prog-guide .morning").addClass("active");}
else if(current_time>=12&&current_time<16){$("#prog-guide .daytime").addClass("active");}
else if(current_time>=16&&current_time<19){$("#prog-guide .evening").addClass("active");}
else if(current_time>=19&&current_time<23){$("#prog-guide .primetime").addClass("active");}
else{$("#prog-guide .latenight").addClass("active");};};if(config["videochannels"]==true){togglelist=$(el).find('li.switch');togglelist.each(function(){var $this=$(this);var target=$this.find("h4");if(!$this.hasClass("active")){$this.find(".crsl-w").hide();};target.click(function(){if($this.hasClass("active")){$this.removeClass("active");$this.find(".crsl-w").hide(250);}else{$this.addClass("active");$this.find(".crsl-w").show(250);}});});};if(config["videochannels"]!=true){$(el).children(":first").each(function(){var $this=$(this);$this.click(function(){$this.parent().toggleClass("active");});});};}};jQuery.fn.dpl=jQuery.dpl.init;
$.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();}};$.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(){select=this.element.get(0);option=select.selectedIndex>-1?select[select.selectedIndex]:false;if(option){this.list.find('dt a').html(option.text+'<em></em>');}},activate:function(event){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){select=element.get(0);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-hd"></div>';ddList+='<div class="dd-bd">';if(options.title){ddList+='<h3>'+options.title+'<a class="close"></a></h3>';}
ddList+='</div>';ddList+='<div class="dd-ft"></div>';ddList+='</dd>';ddList+='</dl>';ddList=$(ddList);ddList.find('.close').click(function(){hideDropDowns();return false;});var list=$('<ul class="dd-ul"></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('.dd-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;}};
(function($){var GlobalHeader=function(){var GlobalHeader=this;var globalNav=function(){var globalNav=this;globalNav.MENU_DELAY=500;if(typeof SNI.Config.navHoverDelay=='number'){globalNav.MENU_DELAY=SNI.Config.navHoverDelay;}
globalNav.oSiteNav={};globalNav.init=function($nav){initTopNav($nav);initSubNavs($nav.find(".subnav"));globalNav.setSelectedTabs($nav,globalNav.getTabsToSelect(mdManager));globalNav.loadDropsDta();return;};function initTopNav($nav){var navTimer=null;var navDelay=globalNav.MENU_DELAY;var $topNav=$nav.find(".topnav");var $subNav=$nav.find(".subnav");$topNav.children("li").data("drops",false).filter(".sel").addClass("savesel");$subNav.filter(".sel").addClass("savesel");$topNav.children("li").hover(function(e){var $this=$(this);clearTimeout(navTimer);navTimer=null;if($this.hasClass("sel")){return;}
navTimer=setTimeout(function(){if(!$this.data("drops")){if(fillDrops((/tab-([\S]+)/.exec($this.attr("class")))[1])){$this.data("drops",true);}}
$topNav.children("li.sel").removeClass("sel").find(".subnav > li.dd-on").removeClass("dd-on");$this.addClass("sel");},navDelay);},function(e){var $this=$(this);clearTimeout(navTimer);navTimer=null;navTimer=setTimeout(function(){$topNav.children("li.sel").removeClass("sel").find(".subnav > li.dd-on").removeClass("dd-on");$topNav.children("li.savesel").addClass("sel");},navDelay);});return;}
function initSubNavs($subnavs){function initOneSubNav($subnav){var navTimer=null;var navDelay=globalNav.MENU_DELAY;$subnav.children("li.nav").hover(function(e){var $this=$(this);clearTimeout(navTimer);navTimer=null;if($this.hasClass("dd-on")){return;}
$this.siblings("li.nav").removeClass("dd-on");$this.addClass("dd-on");},function(e){var $this=$(this);clearTimeout(navTimer);navTimer=null;navTimer=setTimeout(function(){$this.removeClass("dd-on");},navDelay);});return;}
$subnavs.each(function(i){initOneSubNav($(this));});return;}
globalNav.getTabsToSelect=function(md){var o={tTab:"xyz",sTab:"abc"};if(((typeof md.getParameter("SctnNameLineage"))!="undefined")&&(md.getParameter("SctnNameLineage")!="")){var aLin=md.getParameter("SctnNameLineage").split(',');if(typeof aLin[0]!="undefined"){aLin.pop();}
if(typeof aLin[0]!="undefined"){o.tTab=aLin.pop().toLowerCase().replace(' ','-');}
if(typeof aLin[0]!="undefined"){o.sTab=aLin.pop().toLowerCase().replace(' ','-');}}else{if(((typeof md.getParameter("CategoryDspName"))!="undefined")&&(md.getParameter("CategoryDspName")!="")){o.tTab=md.getParameter("CategoryDspName").toLowerCase();}
if(((typeof md.getParameter("SctnDspName"))!="undefined")&&(md.getParameter("SctnDspName")!="")){o.sTab=md.getParameter("SctnDspName").toLowerCase();}}
return o;};globalNav.setSelectedTabs=function($nav,oTabs){var $tTabs=$nav.find(".topnav > li");$tTabs.removeClass("sel savesel");var $tTab=$tTabs.filter(".tab-"+oTabs.tTab);if($tTab.length>0){$tTab.addClass("sel savesel");var $sTab=$tTab.find(".tab-"+oTabs.sTab);if($sTab.length>0){$sTab.addClass("sel");}}else{$tTabs.eq(0).addClass("sel savesel");}
return;};globalNav.loadDropsDta=function(){$.ajax({url:SNI.Config.navDropJsonPath+"&callback=SNI.HGTV.GlobalHeader.globalNav.processNavLoad",dataType:'script',cache:true,timeout:5000,error:SNI.HGTV.GlobalHeader.globalNav.errorNavLoad});};globalNav.processNavLoad=function(jsondta){globalNav.oSiteNav=jsondta;$tTab=$("#hg-sitenav .topnav > li.sel");if($tTab.length>0){fillDrops((/tab-([\S]+)/.exec($tTab.attr("class")))[1]);$tTab.data("drops",true);}
return;};globalNav.errorNavLoad=function(oXHR,sError){return;}
function fillDrops(topTab){if(typeof globalNav.oSiteNav!="object")return false;if(!$.isArray(globalNav.oSiteNav.topTabs))return false;var o=globalNav.oSiteNav.topTabs;for(var i=0;i<o.length;i++){if((typeof o[i].keyName!="undefined")&&(o[i].keyName==topTab)){with(o[i]){if($.isArray(subTabs)){for(var j=0;j<subTabs.length;j++){$subTab=$("#hg-sitenav .topnav").find("> li.tab-"+topTab+" li.tab-"+subTabs[j].keyName);var myHtml=fmtOneDropHtml(subTabs[j],"gh-t"+(i+1)+"s"+(j+1));if(myHtml!=""){$subTab.append(myHtml);$subTab.find("span.r").addClass("on");}}}}
break;}}
return true;}
function fmtOneDropHtml(oSubTab,relVal){function fmtLinkGrp(oLG,bLast){var retHtml="";var extraClass="";if((typeof bLast!=undefined)&&bLast){extraClass=" last";}
if((typeof oLG.dspName)=="string"){retHtml+='\t\t\t<h3>'+oLG.dspName+'</h3>\n';}
if($.isArray(oLG.links)){retHtml+='\t\t\t<ul class="first">\n';var mhalf=Math.round(oLG.links.length/2,0);for(var m=0;m<oLG.links.length;m++){if(m==mhalf){retHtml+="\t\t\t</ul>\n";retHtml+="\t\t\t<ul>\n";}
if((aHtml=fmtALink(oLG.links[m]))!=""){retHtml+='\t\t\t\t<li>'+aHtml+'</li>\n';}}
retHtml+="\t\t\t</ul>\n";}
if((aHtml=fmtALink(oLG.cta))!=""){retHtml+='\t\t\t<p class="cta">'+aHtml+'</p>\n';}
if((aHtml=fmtALink(oLG.oneLink))!=""){retHtml+='\t\t\t<p>'+aHtml+'</p>\n';}
if(retHtml!=""){retHtml="\t\t<div class=\"grp clrfix"+extraClass+"\">\n"+retHtml+"\t\t</div>\n";}
return retHtml;}
function fmtALink(oLnk){retHtml="";if(typeof oLnk!="object"){return retHtml;}
if(((typeof oLnk.text)!="string")||((typeof oLnk.url)!=="string")){return retHtml;}
var url=oLnk.url;if(url.indexOf("http://")==-1){url="http://"+SNI.Config.domain+url;}
retHtml='<a href="'+url+'"';retHtml+=' rel='+relVal+"-"+(++linkCt);if(((typeof oLnk.rel)=="string")){retHtml+=' rel="'+oLnk.rel+'"';}
if(((typeof oLnk.newWin)=="string")&&oLnk.newWin=="true"){retHtml+=' target=\"_blank\"';}
retHtml+='>'+oLnk.text+'</a>';return retHtml;}
var retHtml="";var linkCt=0;if($.isArray(oSubTab.linkGrps)){for(var i=0;i<oSubTab.linkGrps.length;i++){retHtml+=fmtLinkGrp(oSubTab.linkGrps[i],(i==(oSubTab.linkGrps.length-1)));}}
if(retHtml!=""){var tmp=retHtml;retHtml="<div class=\"dd20\">\n";retHtml+="\t<div class=\"dd20-hd\"><span class=\"l\"></span><span class=\"c\"></span><span class=\"r\"></span></div>\n";retHtml+="\t<div class=\"dd20-bd-outer clrfix\">";retHtml+="\t\t<div class=\"dd20-bd\">\n";retHtml+="\t\t\t<div class=\"content clrfix\">\n";retHtml+=tmp;retHtml+="\t\t\t</div>\n";retHtml+="\t\t</div>\n";retHtml+="\t</div>\n";retHtml+="\t<div class=\"dd20-ft\"><span class=\"l\"></span><span class=\"c\"></span><span class=\"r\"></span></div>\n";retHtml+="</div>\n";}
return retHtml;}};GlobalHeader.globalNav=new globalNav;GlobalHeader.globalSearch=function(element,autosuggest){SNI.Util.inputField(element+' input','Search');if(autosuggest===true){function findValue(li){if(li==null){return alert("No match!");}else{return li.selectValue;}}
function selectItem(li){findValue(li);}
function formatItem(row){return row[0];}
if(document.domain=="www.hgtv.com"){$(element+" input").autocomplete(SNI.Config.autoSuggestService,{delay:10,width:345,minChars:3,matchSubset:1,matchContains:0,cacheLength:10,onItemSelect:selectItem,onFindValue:findValue,formatItem:formatItem,autoFill:true});}}
$(element+" select").dropdown({title:'Search In:'});$(element+' form').submit(function(){var $form=$(this);var $searchInput=$form.find('input');var searchText=$.trim($searchInput.val());var searchIn=$form.find('option:selected').attr('id');if((aSearch=/[^_]{2}_([\S]+)/.exec(searchIn))!=null){searchIn=aSearch[1];}
var searchAction=$form.find('select').val();if(searchText==''||searchText.toLowerCase()=='search'){$searchInput.get(0).focus();return false;}else if(searchIn=='tv-shows'){$form.attr('action',searchAction);}else if(searchIn=='rate-my-space'){window.location.href=searchAction.replace(/(.*)(SEARCH_STRING)(.*)/,"$1"+escape(searchText)+"$3");return false;}else if(searchIn=='designers-portfolio'){$form.attr('action',searchAction);}else if(searchIn=='products'){searchText=searchText.replace(/\s+/,'%20').toLowerCase();window.location.href=searchAction+searchText+'_keyword';return false;}else if(searchIn=='services'){searchText=encodeURIComponent(searchText);window.location.href=searchAction+"&searchVal="+searchText;return false;}
return true;});};GlobalHeader.myHGTV=function(){if((SNI.Community.UR.logged_in!=null)&&(SNI.Community.UR.logged_in=="true")){var $dd=$('#my-hgtv .signed-in .dd20');$('#my-hgtv .signed-in .dd20-cntnr').hover(function(){$dd.show();},function(){var timer=setTimeout(function(){$dd.hide();clearTimeout(timer);timer=null;},100);});$('#my-hgtv .signed-in .hello a').text(SNI.Community.UR.ViewingUserDisplayName);$('#my-hgtv .not-signed-in').hide();$('#my-hgtv .signed-in').show();}};GlobalHeader.init=function(){GlobalHeader.globalNav.init($("#hg-sitenav"));GlobalHeader.globalSearch('#hg-hd .search',true);GlobalHeader.myHGTV();};};SNI.HGTV.GlobalHeader=new GlobalHeader;})(jQuery);
SNI.HGTV.GlobalFooter={init:function(){SNI.HGTV.GlobalHeader.globalSearch('#hg-ft .search');}};
SNI.HGTV.Photogallery={gallery:function(){$("#pgallery .prev a.desc").hover(function(){$(".prev a.btn").addClass("hover");},function(){$('.prev a.btn').removeClass("hover");});$("#pgallery .next a.desc").hover(function(){$(".next a.btn").addClass("hover");},function(){$('.next a.btn').removeClass("hover");});var topmargin=13;var panelheight=$('#pgallery .imgpanel').height();var shrinkheight=panelheight-topmargin;$("#pgallery .close-btn").click(function(){$(".imgpanel").animate({bottom:-shrinkheight+"px"},500);$("#pgallery .imgpanel span.close-btn").css("display","none");$("#pgallery .imgpanel span.open-btn").css("display","block");});$("#pgallery .open-btn").click(function(){$(".imgpanel").animate({bottom:"1px"},500);$("#pgallery .imgpanel span.open-btn").css("display","none");$("#pgallery .imgpanel span.close-btn").css("display","block");});$(window).load(function(){$("#pgallery .largeImage .imgpanel").css("left","1px");$("#pgallery .largeImage .imgpanel").css("bottom","1px");});}};
SNI.HGTV.Photogallery3={cbackHotSpotJSON:function(){if(SNI.HGTV.Photogallery3.ImageData[ITMCUR].bhs){SNI.HGTV.Photogallery3.doHotSpots(ITMCUR);}
SNI.HGTV.Photogallery3.insertProdsTab();return;},doHotSpots:function(itmSel){if(typeof SNI.HGTV.Photogallery3.Hotspots=="undefined"){return;}
imgId=$("#pgallery3 .pglnks li").eq(itmSel).find("a").attr("rel");for(i=0;i<SNI.HGTV.Photogallery3.Hotspots.images.length;++i){if(imgId==SNI.HGTV.Photogallery3.Hotspots.images[i].id){SNI.HGTV.Photogallery3.applyHotSpots(SNI.HGTV.Photogallery3.Hotspots.images[i],itmSel);break;}}
return;},applyHotSpots:function(oHS,itmSel){$imgCont=$("#pgallery3 #img-"+(itmSel));vi='';vc='';if($imgCont.hasClass("vert-enl")){vi="-v";vc=" v";}
$imgCont=$imgCont.find(".imgwrap");wImg=parseInt($imgCont.css("width"));hImg=parseInt($imgCont.css("height"));for(i=0;i<oHS.hotspots.length;++i){hsID="hs-"+itmSel+'-'+i+vi;hsRel="hs-"+oHS.id+'-'+oHS.hotspots[i].id;sHS='<span class="hs'+vc+'" id="'+hsID+'"><a href="'+oHS.hotspots[i].url+'" rel="'+hsRel+'">click</a><span>'+oHS.hotspots[i].name+'</span></span>';$imgCont.append(sHS);$jBtn=$imgCont.find("#"+hsID+" a");if(typeof wBtn=="undefined"){wBtn=parseInt($jBtn.css("width"));hBtn=parseInt($jBtn.css("height"));}
xBtn=Math.round(wImg*oHS.hotspots[i].hotspotXPercent/100-wBtn/2,0);yBtn=Math.round(hImg*oHS.hotspots[i].hotspotYPercent/100-hBtn/2,0);$ePop=$jBtn.next();wPop=$ePop.width()+parseInt($ePop.css("padding-left"))+parseInt($ePop.css("padding-right"));hPop=$ePop.height()+parseInt($ePop.css("padding-top"))+parseInt($ePop.css("padding-bottom"));yPop=yBtn-4-hPop;if(yPop<7){yPop=Math.max(yBtn+(hBtn-hPop)/2,7);if(xBtn+wBtn/2>wImg/2){xPop=xBtn-4-wPop;}else{xPop=xBtn+wBtn+4;}}else{xPop=xBtn+(wBtn-wPop)/2;xPop=Math.min(Math.max(7,xPop),wImg-7-wPop);}
$jBtn.css({"left":xBtn,"top":yBtn}).hover(function(){$(this).parent().find("span").addClass("on");},function(){$(this).parent().find("span").removeClass("on");}).bind("click",{oHSthis:oHS.hotspots[i]},function(e){SNI.HGTV.Omniture.HotSpotClick(e.data.oHSthis,"c");return SNI.HGTV.Photogallery3.showProd($(this))}).parent().find("span").css({"left":xPop,"top":yPop});}
return;},showProd:function($hsLink){aID=$hsLink.parent().attr("id").split("-");imgNum=parseInt(aID[1]);hsNum=parseInt(aID[2]);aRel=$hsLink.attr("rel").split("-");imgCMA=aRel[1];hsCMA=aRel[2];imgSel="#pgallery3 #img-"+imgNum;prodSel="#pgallery3 #prod-"+imgNum;bNew=false;if($(prodSel).length==0){for(i=0;i<SNI.HGTV.Photogallery3.Hotspots.images.length;++i){if(imgCMA==SNI.HGTV.Photogallery3.Hotspots.images[i].id){oHS=SNI.HGTV.Photogallery3.Hotspots.images[i].hotspots;hTabs='<h4>Products From this Photo:</h4>\n<div class="tab-wrap">\n<ul class="tabs">\n';hCont='<ul class="cont">';bMkt=true;for(j=0;j<oHS.length;++j){hTabs+='<li><a href="'+oHS[j].url+'">'+oHS[j].name+'</a></li>\n';hCont+='<li>\n<h4><a target="_blank" href="'+oHS[j].url+'">'+SNI.Util.strTrimEllips(oHS[j].name,42)+'</a></h4>\n';hCont+='<a class="pframe" target="_blank" href="'+oHS[j].url+'"><img width="266" height="200" src="'+oHS[j].imageURL+'"><span>More Info</span></a>';hCont+='<p>'+SNI.Util.strTrimEllips(oHS[j].description,180)+'</p>\n</li>';bMkt=bMkt&&(oHS[j].marketplaceId!="");}
hTabs+="</ul>\n</div>\n";hCont+="</ul>\n";break;}}
hOut='<div class="prod clrfix" id="prod-'+imgNum+'">\n';hOut+='<div class="l clrfix">';hOut+='<a class="close" href="#"><img width="160" src="'+$(imgSel).find("img").attr("src")+'"></a>\n';hOut+='<p><a class="close" href="#">Back to Photo</a></p>'
hOut+=hTabs;hOut+='</div>\n';hOut+='<div class="r">';hOut+='<a href="#" class="close">Close</a>\n';hOut+=hCont;if(bMkt){hOut+=SNI.HGTV.Photogallery3.getProdYMAL();}
hOut+='</div>\n';$("#pgallery3 .pglnkmask").before(hOut);bNew=true;$(prodSel+" .r ul.cont li").each(function(i){$(this).find("a").bind("click",{oHSthis:oHS[i]},function(e){SNI.HGTV.Omniture.HotSpotClick(e.data.oHSthis,"l");return true;});});$(prodSel+" .l .tabs li a").click(function(){if($(this).parent().hasClass("sel")){return false;};$(prodSel).find(".l .tabs li").removeClass("sel");$(prodSel).find(".r .cont li").removeClass("sel");$(this).parent().addClass("sel");$(prodSel).find(".r .cont li").eq($(prodSel).find(".l .tabs li").index($(prodSel).find(".l .tabs li.sel"))).addClass("sel");if($(prodSel).find(".r .relProd").length>0){$(prodSel).find(".r .relProd").replaceWith(SNI.HGTV.Photogallery3.getProdYMAL());}
return false;});$(prodSel+" a.close").click(function(){var $prodCont=$(this).parents(".prod");var aID=$prodCont.attr("id").split("-");var imgNum=parseInt(aID[1]);var imgSel="#pgallery3 #img-"+imgNum;$prodCont.hide();$(imgSel).show();return false;});}
$(prodSel+" .l .tabs li").removeClass("sel").eq(hsNum).addClass("sel");$(prodSel+" .r .cont li").removeClass("sel").eq(hsNum).addClass("sel");$(imgSel).hide();$(prodSel).show();if(bNew){$(prodSel+" .tab-wrap").height($(prodSel).offset().top+$(prodSel).innerHeight()-parseInt($(prodSel).css("padding-bottom"))-$(prodSel+" .tab-wrap").offset().top);}
return false;},getProdYMAL:function(){hRet='';if(typeof SNI.HGTV.ProductIdeas=="undefined"){return hRet;}
iSrcLen=SNI.HGTV.ProductIdeas.length;if(iSrcLen==0){return hRet;}
aSrc=new Array(iSrcLen);for(i=0;i<iSrcLen;++i){aSrc[i]=i;}
iDrawnLen=Math.min(iSrcLen,3);aDrawn=new Array(iDrawnLen);for(i=0;i<iDrawnLen;++i){j=Math.floor(Math.random()*aSrc.length);aDrawn[i]=aSrc[j];aSrc.splice(j,1);}
hRet='<div class="relProd clrfix">\n';hRet+='<a class="more" href="http://marketplace.hgtv.com/">More Products</a><h4>You Might Also Like:</h4>\n';hRet+='<ul class="clrfix">\n';itmClass='';for(i=0;i<iDrawnLen;++i){with(SNI.HGTV.ProductIdeas[aDrawn[i]]){if(i==iDrawnLen-1){itmClass=' class="last"';}
hRet+='<li'+itmClass+'><a target="_blank" href="'+pURL+'"><img width="92" height="69" src="'+iURL+'" alt="'+iAlt+'" /><span>'+pName+'</span></a></li>\n';}}
hRet+='</ul>\n';hRet+='</div>\n';return hRet;},insertProdsTab:function(){if(typeof SNI.HGTV.Photogallery3.Hotspots=="undefined"){return;}
hRet="<ul>\n<h4>Products From This Gallery</h4>";for(i=0;i<SNI.HGTV.Photogallery3.Hotspots.images.length;++i){oHS=SNI.HGTV.Photogallery3.Hotspots.images[i].hotspots;;for(j=0;j<oHS.length;++j){hRet+='<li><a target="_blank" href="'+oHS[j].url+'"><img src="'+oHS[j].imageURL+'" alt="'+oHS[j].name+'" />';hRet+='<p class="first"><a target="_blank" href="'+oHS[j].url+'">'+oHS[j].name+'</a></p></li>\n';}}
hRet+="</ul>\n";$("#pgallery3 .endframe .tab.shop").append(hRet);$("#pgallery3 .endframe .nav .shop").show();},init:function(){EF_IMG_HTML='<img width="92" height="69" src="http://web.hgtv.com/webhgtv/hg20/imgs/email-share_sm.jpg" alt="Share or Email this Photo Gallery" />';ITMCUR=$("#pgallery3 .pglnks li").index($("#pgallery3 .pglnks li.sel"));BYLINE="";if($("#hg-w > .intro p.byline").length>0){BYLINE=$("#hg-w > .intro p.byline").text();}
ITMPERPANEL=9;XBASE=$("#pgallery3 .pglnks").position().left;ITMLAST=$("#pgallery3 .pglnks li").length-1;ITMWIDTH=$("#pgallery3 .pglnks li").innerWidth()+parseInt($("#pgallery3 .pglnks li").css("margin-left"))+parseInt($("#pgallery3 .pglnks li").css("margin-right"));newwidth=(ITMLAST+1)*ITMWIDTH;if(ITMLAST>ITMPERPANEL){++newwidth;}
$("#pgallery3 .pglnks").css("width",newwidth);$("#pgallery3 .pglnkmask .leftctrl a").click(function(){if($(this).hasClass("dis")){return false;}
itmBaseCur=Math.round((XBASE-$("#pgallery3 .pglnks").position().left)/ITMWIDTH);itmBaseNew=Math.max(0,itmBaseCur-ITMPERPANEL);if(itmBaseCur==ITMLAST-ITMPERPANEL){$("#pgallery3 .pglnkmask .rightctrl a").removeClass("dis");}
$("#pgallery3 .pglnks").animate({left:(XBASE-itmBaseNew*ITMWIDTH)+"px"},SNI.HGTV.ANIMATION_SPEED);if(itmBaseNew==0){$("#pgallery3 .pglnkmask .leftctrl a").addClass("dis");}
return false;});$("#pgallery3 .pglnkmask .rightctrl a").click(function(){if($(this).hasClass("dis")){return false;}
itmBaseCur=Math.round((XBASE-$("#pgallery3 .pglnks").position().left)/ITMWIDTH);itmBaseNew=Math.min(ITMLAST-ITMPERPANEL,itmBaseCur+ITMPERPANEL);if(itmBaseCur==0){$("#pgallery3 .pglnkmask .leftctrl a").removeClass("dis");}
$("#pgallery3 .pglnks").animate({left:(XBASE-itmBaseNew*ITMWIDTH)+"px"},SNI.HGTV.ANIMATION_SPEED);if(itmBaseNew==ITMLAST-ITMPERPANEL){$("#pgallery3 .pglnkmask .rightctrl a").addClass("dis");}
return false;});$("#pgallery3 .pglnks li a").bind("mouseenter",function(){if($(this).parent().hasClass("sel")){return false;}
$(this).parent().find(".tnframe").show();$(this).parents(".pglnkmask").addClass("popactive");}).bind("mouseleave",function(){$(this).parent().find(".tnframe").hide();$(this).parents(".pglnkmask").removeClass("popactive");});$("#pgallery3 .photonav .prevlnk a").click(function(){setImg((ITMCUR+ITMLAST)%(ITMLAST+1));return false;});$("#pgallery3 .photonav .nextlnk a, #pgallery3 .largeImage a.bigimg").click(function(){setImg((ITMCUR+1)%(ITMLAST+1));return false;});$("#pgallery3 .pglnks a").click(function(){if(!$(this).parent().hasClass("sel")){$(this).parent().find(".tnframe").hide();setImg($(this).text()-1);}
return false;});$("#pgallery3 .largeImage a.vtoggle.enl").click(function(){$myImgCont=$(this).parents(".largeImage");$myImgCont.removeClass("vert-shr").addClass("vert-enl");if($myImgCont.find(" .hs.v").length==0){SNI.HGTV.Photogallery3.doHotSpots(parseInt($(this).parents(".largeImage").attr("id").split("-")[1]))}
return false;});$("#pgallery3 .largeImage a.vtoggle.shr").click(function(){$myImgCont=$(this).parents(".largeImage");$myImgCont.removeClass("vert-enl").addClass("vert-shr");return false;});$("#pgallery3 .largeImage .imgpanel a.open").click(function(){$myPanel=$(this).parent();$myPanel.find("a.open").hide();$myPanel.animate({bottom:"0"});$myPanel.find("a.close").show();return false;});$("#pgallery3 .largeImage .imgpanel a.close").click(function(){$myPanel=$(this).parent();myCollapseHt=parseInt(Math.max($myPanel.find("h2").outerHeight(),$myPanel.find("a.cap-lnk.close").outerHeight())+parseInt($myPanel.css("padding-top"))-$myPanel.innerHeight())+"px";$myPanel.find("a.close").hide();$myPanel.animate({bottom:myCollapseHt});$myPanel.find("a.open").show();return false;});function setImg(itmSel){if(itmSel==ITMCUR){return;}
doDynOmni(itmSel);newImgCont="#pgallery3 #img-"+itmSel;if($(newImgCont).length>0){$("#pgallery3 .largeImage, #pgallery3 .prod").hide();$(newImgCont).show();}else{$("#pgallery3 .largeImage").eq(0).clone(true).attr("id","img-"+itmSel).insertAfter("#pgallery3 .largeImage:last");$(newImgCont).hide();$("#pgallery3 .largeImage.loading").show();$(newImgCont).find(".hs").remove();$(newImgCont+" img").remove();myImg=new Image();if($(newImgCont+" a.bigimg").length>0){$(myImg).appendTo(newImgCont+" a.bigimg");}else{$(myImg).appendTo(newImgCont+" .imgwrap");}
$(myImg).load(function(){$("#pgallery3 .largeImage, #pgallery3 .prod").hide();$(newImgCont).show();if(SNI.HGTV.Photogallery3.ImageData[itmSel].bhs){SNI.HGTV.Photogallery3.doHotSpots(itmSel);}
$("#pgallery3 .largeImage.loading").hide();});setImgData(SNI.HGTV.Photogallery3.ImageData[itmSel],$(newImgCont));}
fixByLine(itmSel);if(itmSel==0){$("#pgallery3 .photonav .prevlnk").css("visibility","hidden");}
else if(ITMCUR==0){$("#pgallery3 .photonav .prevlnk").css("visibility","visible");}
$("#pgallery3 .photonav .pagen span").text(itmSel+1);topPrev="#pgallery3 .photonav .prevlnk";$(topPrev+" img").remove();$pgItmPrev=$("#pgallery3 .pglnks li").eq((itmSel+ITMLAST)%(ITMLAST+1));if($pgItmPrev.find("img").length>0){$pgItmPrev.find("img").clone().prependTo(topPrev+" a");}
$(topPrev+" a").attr("href",$pgItmPrev.find("a").attr("href"));topNext="#pgallery3 .photonav .nextlnk";$(topNext+" img").remove();$pgItmNext=$("#pgallery3 .pglnks li").eq((itmSel+1)%(ITMLAST+1));if($pgItmNext.find("img").length>0){$pgItmNext.find("img").clone().prependTo(topNext+" a");}
$(topNext+" a").attr("href",$pgItmNext.find("a").attr("href"));if($(newImgCont+" a.bigimg").length>0){$(newImgCont+" a.bigimg").attr("href",$pgItmNext.find("a").attr("href"));}
$("#pgallery3 .pglnks li").eq(ITMCUR).removeClass("sel");$("#pgallery3 .pglnks li").eq(itmSel).addClass("sel");ITMCUR=itmSel;SNI.HGTV.DynAds.refresh();if($("#print-select a.this").length>0){plink=$("#print-select a.this").attr("href");i=itmSel+1;if(i<10){i='0'+parseInt(itmSel+1);}
plink=$("#print-select a.this").attr("href");plink=plink.replace(/(.*ARTICLE-PRINT-PHOTO-GALLERY-CURRENT).*?(,00.html)$/,"$1_"+i+"$2");$("#print-select a.this").attr("href",plink);}
setPanel();SNI.Util.hitCount();return;}
function doDynOmni(i){++i;if(mdManager.getParameterString("oUrl")==""){mdManager.setParameter("oUrl",mdManager.getParameterString("Url"))}
mdManager.setParameter("Url",mdManager.getParameter("oUrl")+"?i="+parseInt(i));if(i<10){i='0'+parseInt(i);}
mdManager.setParameter("UniqueId",mdManager.getParameterString("UniqueId").replace(/(.*?)-([0-9]{1,2})$/,"$1-"+i));if(typeof s=="object"){s.t();}
return;}
function setImgData(imgData,$inImgCont){if(imgData.bvert){$inImgCont.removeClass("vert-enl").addClass("vert-shr");}else{$inImgCont.removeClass("vert-shr vert-enl");}
$inImgCont.find("img").attr("src",imgData.iurl).attr("alt",imgData.ialt);$myPanel=$inImgCont.find(".imgpanel");$myPanel.find("h2").html(imgData.ititle);$myPanel.find("cite").html(imgData.icap);if((imgData.rurl!="")&&(imgData.rtxt!="")){$myPanel.find(".lgbtn a").attr("href",imgData.rurl);$myPanel.find(".lgbtn .lgbtn-text").text(imgData.rtxt);$myPanel.find(".lgbtn").removeClass("hide");}else{$myPanel.find(".lgbtn").addClass("hide");}
if((imgData.ititle=="")&&(imgData.icap=="")&&(imgData.rurl=="")&&(imgData.rtxt=="")){$myPanel.addClass("hide");}else{$myPanel.find("a.open").hide();$myPanel.find("a.close").show();$myPanel.css({bottom:"0"});$myPanel.removeClass("hide");}
return;}
function fixByLine(itmSel){iCreator="";if(itmSel<SNI.HGTV.Photogallery3.ImageData.length){iCreator=SNI.HGTV.Photogallery3.ImageData[itmSel].creator;}
if(iCreator!=""){if($("#hg-w > .intro p.byline").length==0){$("#hg-w > .intro").append("<p class=\"byline\"></p>");}
$("#hg-w > .intro p.byline").addClass("pic").text("By "+iCreator);}else if($("#hg-w > .intro p.byline.pic").length>0){if(BYLINE!=""){$("#hg-w > .intro p.byline").removeClass("pic").text(BYLINE);}else{$("#hg-w > .intro p.byline").remove();}}
return;}
$("#pgallery3 .endframe .nav a").click(function(){$("#pgallery3 .endframe .nav li.sel").removeClass("sel");$(".endframe .tab").hide();$(".endframe .tab."+$(this).parent().parent().attr("class")).show();$(this).parent().parent().addClass("sel");return false;});$("#pgallery3 .endframe div.share p#copylink a").click(function(){$("#embed_code").select();return false;});$("#pgallery3 .endframe .share .digg a").click(function(){window.open('http://digg.com/submit?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(mdManager.getParameter('Title')));return false;});$("#pgallery3 .endframe .share .fb a").click(function(){window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(mdManager.getParameter('Title')),'sharer','toolbar=0,status=0,width=626,height=436,resizable=yes');return false;});$("#pgallery3 .endframe .share .mysp a").click(function(){window.open('http://www.myspace.com/index.cfm?fuseaction=postto&'+'t='+encodeURIComponent(mdManager.getParameter('Title'))+'&u='+encodeURIComponent(location.href));return false;});$("#pgallery3 .endframe .share .deli a").click(function(){window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(mdManager.getParameter('Title')),'delicious','toolbar=no,width=550,height=550,resizable=yes');return false;});function loadHotSpotJSON(){if(typeof SNI.HGTV.Photogallery3.hsJSON=="undefined"){return;}
myJSONurl="http://"+location.hostname+SNI.HGTV.Photogallery3.hsJSON;$.ajax({url:myJSONurl,dataType:"script",cache:true,timeout:10000,success:successHotSpotJSON,error:errorHotSpotJSON,complete:completeHotSpotJSON});return;}
function errorHotSpotJSON(oXHTTP,stat,oExc){return;}
function successHotSpotJSON(dta,stat){$("#pgallery3").append('<script type="text/javascript">'+dta+'\n SNI.HGTV.Photogallery3.cbackHotSpotJSON();</script>');return;}
function completeHotSpotJSON(oXHTTP,stat){if(stat=="success"){}
return;}
function setPanel(){itmBaseCur=Math.round((XBASE-$("#pgallery3 .pglnks").position().left)/ITMWIDTH);itmBaseNew=Math.max(0,Math.min(ITMLAST-ITMPERPANEL,Math.floor((ITMCUR-1)/ITMPERPANEL)*ITMPERPANEL));if(itmBaseCur!=itmBaseNew)
{itmBaseNew=Math.max(0,Math.min(ITMLAST-ITMPERPANEL,Math.floor((ITMCUR-1)/ITMPERPANEL)*ITMPERPANEL));$("#pgallery3 .pglnks").css("left",(XBASE-itmBaseNew*ITMWIDTH)+"px");if(itmBaseCur==0){$("#pgallery3 .pglnkmask .leftctrl a").removeClass("dis");}
if(itmBaseNew==0){$("#pgallery3 .pglnkmask .leftctrl a").addClass("dis");}
if(itmBaseCur==ITMLAST-ITMPERPANEL){$("#pgallery3 .pglnkmask .rightctrl a").removeClass("dis");}
if(itmBaseNew==ITMLAST-ITMPERPANEL){$("#pgallery3 .pglnkmask .rightctrl a").addClass("dis");}}}
function fixEndFrame(){if($("#pgallery3 .endframe .tab.shop img").length==0){$("#pgallery3 .endframe .nav .shop").hide();}
if($("#pgallery3 .endframe .tab.ymal img").length==0){$("#pgallery3 .endframe .nav .ymal").hide();$("#pgallery3 .endframe .nav .email").addClass("sel");$("#pgallery3 .endframe .tab.email").show();}
if($("#pgallery3 .pglnks li:last img").length==0){$("#pgallery3 .pglnks li:last .tnframe").append(EF_IMG_HTML);if((ITMCUR==ITMLAST)&&($("#pgallery3 .photonav .nextlnk img").length==0)){$("#pgallery3 .photonav .nextlnk").prepend(EF_IMG_HTML);}}
return;}
bHS=false;for(i=0;i<SNI.HGTV.Photogallery3.ImageData.length;i++){bHS=bHS||SNI.HGTV.Photogallery3.ImageData[i].bhs;}
if(bHS){if(typeof SNI.HGTV.Photogallery3.hsJSON!="undefined"){loadHotSpotJSON()}};if(ITMCUR<SNI.HGTV.Photogallery3.ImageData.length){if(typeof SNI.HGTV.Photogallery3.hsJSON=="undefined"){if(SNI.HGTV.Photogallery3.ImageData[ITMCUR].bhs){SNI.HGTV.Photogallery3.doHotSpots(ITMCUR);}
if(bHS){SNI.HGTV.Photogallery3.insertProdsTab();}}
fixByLine(ITMCUR);}
$("#pgallery3 .photowrap").append('<div class="largeImage loading"><span></span><p>loading</p></div>');SNI.HGTV.DynAds.init();var itmSel=ITMCUR;if($.query.has('i')){itmSel=parseInt($.query.get('i'));if(isNaN(itmSel)||(itmSel<1)||(itmSel>ITMLAST+1)){itmSel=ITMCUR;}else{--itmSel;}}
if(itmSel!=ITMCUR){setImg(itmSel);}
setPanel();fixEndFrame();return;}};SNI.HGTV.DynAds={descr:{active:true,refreshRate:3,interstitial:false},iparm:{iURL:"",iFmt:"",iHREF:"",iHeight:"",iWidth:"",iTrackURL:"",bURL:""},impressionCt:1,init:function(){myJSON=getDartEnterpriseUrl("PHOTO_DESCRIPTOR",1);myJSON+="&params.styles=photoGallery&callback=?";$.getJSON(myJSON,SNI.HGTV.DynAds.cback_descrJSON);return;},cback_descrJSON:function(oJSON){if(typeof oJSON!="object"){return false;}
if(oJSON.photo_descriptor==undefined){return false;}
oJSON=oJSON.photo_descriptor;if(oJSON.active==undefined){return false;}
if(oJSON.refreshRate==undefined){return false;}
if(oJSON.active!="true"){return false;}
tmp=parseInt(oJSON.refreshRate);if(isNaN(tmp)){return false;}
if(tmp<1||tmp>100){return false;}
SNI.HGTV.DynAds.descr.active=true;SNI.HGTV.DynAds.descr.refreshRate=tmp;if(oJSON.interstitial==undefined){return false;}
if(oJSON.interstitial=="true"){SNI.HGTV.DynAds.descr.interstitial=true;}
return true;},refresh:function(){if(!this.descr.active){return;}
$("#pgallery3 .interwrap").remove();this.impressionCt++;if(this.impressionCt==this.descr.refreshRate){this.impressionCt=0;if(this.descr.interstitial){myJSON=getDartEnterpriseUrl("PHOTO_INTERSTITIAL",1);myJSON+="&params.styles=photoGallery&callback=?";$.getJSON(myJSON,SNI.HGTV.DynAds.cback_interJSON);return;}else{setDartEnterpriseBanner("BIGBOX",getDartEnterpriseUrl("BIGBOX",5));}}
return;},cback_interJSON:function(oJSON){$.each(SNI.HGTV.DynAds.iparm,function(key,val){SNI.HGTV.DynAds.iparm[key]="";});if(typeof oJSON!="object"){return false;}
if(typeof oJSON.scrippsads!="object"){return false;}
if(typeof oJSON.scrippsads.ad!="object"){return false;}
for(i=0;i<oJSON.scrippsads.ad.length;++i){if(typeof oJSON.scrippsads.ad[i].position!="object"){return false;}
with(oJSON.scrippsads.ad[i].position){with(SNI.HGTV.DynAds){if((iparm.iURL=="")&&(id=="interstitial")){iparm.iURL=media.src;iparm.iFmt=media.format;iparm.iHREF=media.href;iparm.iHeight=media.height;iparm.iWidth=media.width;if(typeof media.tracking.audit=="object"){iparm.iTrackURL=media.tracking.audit.src;}}
if((iparm.bURL=="")&&(id=="300syncBanner")){iparm.bURL=media.src;}}}}
with(SNI.HGTV.DynAds){if(iparm.iURL==""||iparm.iFmt==""||iparm.bURL==""){return false;}}
SNI.HGTV.DynAds.gen_interstitial();return true;},gen_interstitial:function(){hRet="";with(SNI.HGTV.DynAds){hRet+='<div class="interwrap">';hRet+='<a href="#" class="close"><span></span>Next Photo</a>';hRet+='<h6>Advertisement</h6>';if(iparm.iFmt.toLowerCase()=="swf"){hRet+='<div id="interad"></div>';}else{if(iHREF!=""){hRet+='<a href="'+iparm.iHREF+'">';}
hRet+='<img src ="'+iparm.iURL+'" />';if(iHREF!=""){hRet+='</a>';}}
hRet+='<iframe class="tracker" width="0" height="0" frameborder="0"></iframe>';hRet+='</div>';$myImgCont=$("#pgallery3 #img-"+ITMCUR);if($myImgCont.hasClass("vert-enl")){$myImgCont.removeClass("vert-enl").addClass("vert-shr");}
$("#pgallery3 .photowrap").append(hRet);$("#pgallery3 .interwrap .close").click(function(){$("#pgallery3 .interwrap").remove();return false;});if(iparm.iFmt.toLowerCase()=="swf"){swfobject.embedSWF(iparm.iURL,"interad",iparm.iWidth,iparm.iHeight,"9","http://common.scrippsnetworks.com/common/flash-express-install/expressInstall.swf","",{wmode:"opaque",allowScriptAccess:"always",quality:"high"});}
setDartEnterpriseBanner("BIGBOX",iparm.bURL);$("#pgallery3 .interwrap .tracker").attr("src",iparm.iTrackURL);}
return;}};
SNI.HGTV.GetInspired={colorPicker:function(colorList,typeList,hrefList){var swfUrl='http://web.hgtv.com/webhgtv/hg20/swf/color-picker/color-picker.swf';var elementId='color-picker';var width=160;var height=160;var flashvars={colorList:colorList,typeList:typeList,hrefList:hrefList};var params={wmode:"transparent",allowScriptAccess:"always",quality:"high"};swfobject.embedSWF(swfUrl,elementId,width,height,"9","http://common.scrippsnetworks.com/common/flash-express-install/expressInstall.swf",flashvars,params,{});}};SNI.HGTV.ZoneFinder={init:function(){$("#zone-finder form").submit(function(){zip=$.trim($("#zone-zip").val());if(zip==''){return false;}
var url="/cf/com/hgtv/zonefinder/ZipCodeSearch.cfc?method=findZone&zipCode="+zip;try{$.ajax({dataType:"text",url:url,success:function(zone){$('#zone-finder .message').hide();zone=$.trim(zone);if(zone=='-1'||zone=='-2'||zone==''){$('#zone-finder .error').show();}else{$('#zone-finder form').hide();success=$('#zone-finder .success');success.find('.zone').text('Zone '+zone.toUpperCase());success.find('.details').attr('href','/topics/garden-zone-'+parseInt(zone)+'/index.html');success.show();}}});}catch(e){}
return false;});}};
if(typeof(SNI.HGTV.Util)=="undefined"){SNI.HGTV.Util={};}
SNI.HGTV.Util.liHover=function(el){if($.browser.msie&&parseInt($.browser.version)==6){$(el).find('li').hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');});}};$.extend($.ui.accordion.animations,{easeOutSine:function(options){this.slide(options,{easing:'easeOutSine',duration:600});}});jQuery.fn.sort=Array.prototype.sort;SNI.HGTV.Util.flyOuts={getScrollXY:function(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}
return[scrOfX,scrOfY];},moveToView:function(settings){settings=jQuery.extend({object:null,anchorObj:null,yAlign:"left",useLftOffset:0,useTopOffset:0,overRideDflt:false},settings);settings.object.css({left:'',top:''});var p=SNI.HGTV.Util.flyOuts.getPosition(settings.object,true);var pc=SNI.HGTV.Util.flyOuts.getPosition(settings.anchorObj,true);var viewportHeight=$(window).height();var scrollTop=SNI.HGTV.Util.flyOuts.getScrollXY()[1];var viewportBottomY=scrollTop+viewportHeight;var containerMaxTopY=(viewportBottomY-(settings.object[0].offsetHeight+10));if((settings.anchorObj[0].offsetTop-4>containerMaxTopY)&&(165<=viewportHeight)){var top=containerMaxTopY;var left=(pc.width+pc.left)+(settings.useLftOffset);if(settings.pAlign=="left"){left=(pc.left-p.width)+(settings.useLftOffset);}
settings.object.css({left:left+'px',top:top+'px'});}else{var top='';var left='';if(settings.overRideDflt){top=pc.top+settings.useTopOffset;left=(pc.width+pc.left)+(settings.useLftOffset);}
if((jQuery.browser.msie)&&(!settings.overRideDflt)){left=pc.left;top=pc.top+15;}
settings.object.css({left:left+'px',top:top+'px'});}},getPosition:function(obj){var $el=obj;var bHidden=false;var bUseOffset=true;if($el.is(":hidden")){bHidden=!!$el.css("visibility","hidden").show();}
var pos=$.extend($el[bUseOffset===true?"offset":"position"](),{width:$el.outerWidth(),height:$el.outerHeight(),marginLeft:parseInt($.curCSS($el[0],"marginLeft",true),10)||0,marginRight:parseInt($.curCSS($el[0],"marginRight",true),10)||0,marginTop:parseInt($.curCSS($el[0],"marginTop",true),10)||0,marginBottom:parseInt($.curCSS($el[0],"marginBottom",true),10)||0});if(pos.marginTop<0)pos.top+=pos.marginTop;if(pos.marginLeft<0)pos.left+=pos.marginLeft;pos["bottom"]=pos.top+pos.height;pos["right"]=pos.left+pos.width;if(bHidden)$el.hide().css("visibility","visible");return pos;},alphaCompare:function(a,b){a=a.toLowerCase();b=b.toLowerCase();return a<b?-1:a>b?1:0;}};SNI.Util.hitCount=function(){var myURL;if(location.host=="www.hgtv.com"){myURL="http://img.hgtv.com/webhgtv/hg20/html/fixHits.html";}else{myURL="http://frontend.scrippsnetworks.com/hgtv/fixHits.html";}
if($("#hitCounter").length>0){$("#hitCounter").remove();}
$("head").append('<iframe id="hitCounter" src="'+myURL+'" width="0" height="0" frameborder="0" style="height:0; width:0; display:none;"></iframe>')
return;};SNI.Util.Flyout={create:function(settings){var flyout={draw_list:function(items){var flyout=this;items=items||flyout.select.children('option').not('.excluded');var flyout_list=jQuery('<ul class="flyout-list"></ul>');items.each(function(i){var $this=jQuery(this);var list_item=jQuery('<li><span>'+jQuery.trim($this.text())+'</span></li>');if($this.attr('selected')){list_item.addClass('selected');}
if($this.attr('disabled')){list_item.addClass('disabled');}
list_item.not('.disabled').click(function(event){flyout.anchor.children('.'+flyout.settings.trigger_class[0]).children('span').text(jQuery.trim($this.text()))
$this.siblings().removeAttr('selected');$this.attr('selected','selected');flyout.hide();flyout.select.change();});flyout_list.append(list_item);});return flyout_list;},show:function(speed){var flyout=this;flyout.element.fadeIn(speed||100);flyout.anchor.addClass('flyout-is-open');},hide:function(speed){var flyout=this;flyout.element.fadeOut(speed||100);flyout.anchor.removeClass('flyout-is-open');},create_flyout:function(){var flyout=this;var html=jQuery('<div></div>');var id=flyout.flyout_id();var settings=flyout.settings;jQuery.each(settings.wrapper_classes,function(){html.addClass(this.toString());});if(id){html.attr('id',id);}
var head=flyout._flyout_hd();head.children('.close').click(function(e){flyout.hide();});html.append(head);html.append(flyout._flyout_bd());html.append(flyout._flyout_ft());return html;},_flyout_hd:function(){var html=jQuery('<div></div>')
jQuery.each(settings.header_wrap,function(){html.addClass(this.toString());});if(settings.close_button){html.prepend('<span class="close">Close</span>')}
if(settings.title){html.prepend('<'+settings.title_element+' class="'+settings.title_class+'">'+settings.title+'</'+settings.title_element+'>');}
return html;},_flyout_bd:function(){var html=jQuery('<div></div>')
jQuery.each(settings.body_wrap,function(){html.addClass(this.toString());});html.append(flyout.list);return html;},_flyout_ft:function(){var html=jQuery('<div></div>')
jQuery.each(settings.footer_wrap,function(){html.addClass(this.toString());});return html;},flyout_id:function(){var flyout=this;var id;if(flyout.select&&flyout.select.attr('id')){id="flyout-for-"+flyout.select.attr('id');}
return id;},build_options:function(settings){settings.title_element=settings.title_element||'h4';settings.title_class=settings.title_class||'flyout-title';settings.close_button=settings.close_button?true:false;settings.wrapper_classes=settings.wrapper_classes||['flyout'];settings.header_wrap=settings.header_wrap||['flyout-hd'];settings.body_wrap=settings.body_wrap||['flyout-bd'];settings.footer_wrap=settings.footer_wrap||['flyout-ft'];this.settings=settings;return settings;}};flyout.build_options(settings);return flyout;},createFor:function(select_element,settings){settings.wrapper_classes=['flyout','flyout-med','flyout-for-select']
settings.attach_to=settings.attach_to||select_element.parent();settings.anchor_class=settings.anchor_class||['select-flyout'];settings.trigger_class=settings.trigger_class||['select-flyout-selector'];settings.flyout_css=(settings.flyout_css===false)?false:true;var flyout=this.create(settings);flyout.anchor=jQuery('<div><div><span>'+jQuery.trim(select_element.children(':selected').text())+'</span></div></div>');flyout.select=select_element;flyout.list=flyout.draw_list(flyout.sele);flyout.element=flyout.create_flyout();if(flyout.select.attr('id')){flyout.anchor.attr('id',"selector-for-"+flyout.select.attr('id'));}
jQuery.each(settings.anchor_class,function(){flyout.anchor.addClass(this.toString());});jQuery.each(settings.trigger_class,function(){flyout.anchor.children('div').addClass(this.toString());});flyout.select.change(function(event){flyout.anchor.children('span').html(jQuery.trim(flyout.select.children(':selected').text()));flyout.select.children('option').not('.excluded').each(function(i){if(jQuery(this).is(':selected')){var selected_list_item=flyout.element.find('.flyout-list > li').eq(i);if(!selected_list_item.hasClass('selected')){selected_list_item.siblings().removeClass('selected');selected_list_item.addClass('selected');}
return false;}});});if(settings.flyout_css===true){flyout.element.css({'position':'absolute','top':0,'left':0,'display':'none'});}
flyout.anchor.append(flyout.element);var body_click=function(event){var fly=flyout;var element=$(event.target);if(fly.element.is(':visible')){if(element.parents().is('#'+fly.anchor.attr('id'))){event.stopPropagation();}else{fly.hide();jQuery('body').unbind('click',body_click);}}else{event.stopPropagation();}};flyout.anchor.children('.'+settings.trigger_class[0]).bind('click focus',function(e){flyout.show();jQuery('body').bind('click',body_click);});select_element.hide();flyout.settings.attach_to.append(flyout.anchor);return flyout;}};
if($.browser.msie){$(function(){$('button.button').mousedown(function(){$(this).addClass('active');}).mouseup(function(){$(this).removeClass('active');});$('a.button, .button-nav a, a.button-sm, .button-nav-sm a').mouseup(function(){$(this).blur();});});}
SNI.HGTV.BrowserCheck={init:function(){if($.browser.msie&&parseInt($.browser.version)<7&&!window.XMLHttpRequest&&($("body#print").length==0)){var bc=this;if(SNI.Util.Cookie.get('upgradeReminderSet')==null){var html='<div id="ie6-msg" class="clrfix"><a href="#" class="close">Close</a><div id="ie6-txt"><h3>We Noticed You Are Using Internet Explorer 6.</h3><p>We detected your browser is out of date. For the best possible experience, upgrade to the latest version of <a href="http://www.browserforthebetter.com/download.html" target="_blank">Internet Explorer</a>, or try one of these fine browsers: <a href="http://www.firefox.com" target="_blank">Firefox</a> or <a href="http://www.apple.com/safari/download/" target="_blank">Safari</a>.</p>';if(SNI.Util.Cookie.get('upgradePreviouslyReminded')=='1'){html+='<p class="remind"><a href="#" class="yes">Remind Me in 30 Days</a> or <a href="#" class="no">Don\'t Remind Me</a></p>';}
html+='</div><ul><li><a id="icn-ie" href="http://www.browserforthebetter.com/download.html" target="_blank">Get Internet Explorer</a></li><li><a id="icn-ff" href="http://www.firefox.com" target="_blank">Get Firefox</a></li><li><a id="icn-sf" href="http://www.apple.com/safari/download/" target="_blank">Get Safari</a></li></ul></div>';html=$(html);$('a.close, .remind a.yes',html).click(function(){bc.setReminder(30);$(html).slideUp();SNI.HGTV.Omniture.ClickTrackSingle(this,"UpgradeIE6 ","HGTV");return false;});$('.remind a.no',html).click(function(){bc.setReminder(365);$(html).slideUp();SNI.HGTV.Omniture.ClickTrackSingle(this,"UpgradeIE6 ","HGTV");return false;});if($('#hg-bd').length){$('#hg-bd').prepend(html);}
else{$('#site-wrapper').prepend(html);}
html.show();SNI.HGTV.Omniture.ClickTrackSingle("#ie6-msg #ie6-txt","UpgradeIE6 ","Food");SNI.HGTV.Omniture.ClickTrackSingle("#ie6-msg ul li","UpgradeIE6 ","Food");SNI.HGTV.Omniture.ClickTrackSingle("#ie6-msg .remind","UpgradeIE6 ","Food");}}},setReminder:function(days){SNI.Util.Cookie.set('upgradeReminderSet','1',days);SNI.Util.Cookie.set('upgradePreviouslyReminded','1',365*2);}};$(document).ready(function(){SNI.HGTV.BrowserCheck.init();});
if(typeof(SNI.HGTV.Player)=='undefined'){SNI.HGTV.Player={};}
SNI.HGTV.Player.Configs={FullSize:{enableSyncAdFix:1,dimensions:{width:'576',height:'688'},flashvars:{config:SNI.Config.snapConfigs+"/snap-style-playlist-w-title.xml,"+SNI.Config.snapConfigs+"/snap-config-std.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent",bgcolor:"#ffffff"}},FullSizeNoPlaylist:{enableSyncAdFix:1,dimensions:{width:'576',height:'460'},flashvars:{showCarousel:"false",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"}},RightRail:{enableSyncAdFix:0,dimensions:{width:'320',height:'360'},flashvars:{config:SNI.Config.snapConfigs+"/snap-style-rr.xml,"+SNI.Config.snapConfigs+"/snap-config-rr.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},Blog:{enableSyncAdFix:1,dimensions:{width:'320',height:'263'},flashvars:{config:SNI.Config.snapConfigs+"/snap-style-rr.xml,"+SNI.Config.snapConfigs+"/snap-config-std-no-autoplay.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},Lead:{enableSyncAdFix:1,dimensions:{width:'400',height:'300'},flashvars:{autoPlay:"false",showPlaylistTitle:"false",showCarousel:"false",config:SNI.Config.snapConfigs+"/snap-style-v4.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.HGTV.Player.Configs);SNI.HGTV.Player.FullSize=SNI.Player.FullSize;SNI.HGTV.Player.Big=SNI.HGTV.Player.FullSize;SNI.HGTV.Player.VideoLibrary=SNI.HGTV.Player.FullSize;SNI.HGTV.Player.FullSizeNoPlaylist=SNI.Player.FullSizeNoPlaylist;SNI.HGTV.Player.VideoAsset=SNI.HGTV.Player.FullSizeNoPlaylist;SNI.HGTV.Player.RightRail=SNI.Player.RightRail;SNI.HGTV.Player.RightRailMyHGTV=function(divId,channelId,videoId,ui_config){var buildChannelFeed=function(chId){return'http://www.hgtv.com/hgtv/channel/xml/0,,'+chId+',00.xml';};return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.HGTV.Player.Configs.RightRail,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_build_playlist_url":buildChannelFeed});};SNI.HGTV.Player.Blog=function(divId,channelId,videoId,ui_config){var buildChannelFeed=function(chId){return'http://www.hgtv.com/hgtv/channel/xml/0,,'+chId+',00.xml';};return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.HGTV.Player.Configs.Blog,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_build_playlist_url":buildChannelFeed});};SNI.HGTV.Player.BigBlog=function(divId,channelId,videoId,ui_config){var buildChannelFeed=function(chId){return'http://www.hgtv.com/hgtv/channel/xml/0,,'+chId+',00.xml';};var bigBlogConfig=SNI.Util.mergeObjects(SNI.HGTV.Player.Configs.FullSizeNoPlaylist,{flashvars:{config:SNI.Config.snapConfigs+"/snap-style.xml,"+SNI.Config.snapConfigs+"/snap-config-std-no-autoplay.xml"}},true);return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(bigBlogConfig,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_build_playlist_url":buildChannelFeed});};SNI.HGTV.Player.Lead=function(divId,channelId,videoId,ui_config){return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.HGTV.Player.Configs.Lead,ui_config,true),"channel_id":channelId,"video_id":videoId});};
SNI.HGTV.EpisodeFinder={init:function(){$('#episode-finder .acco-round').dpl('accordion');$("#episode-finder .button-nav").dpl('tabs');$("#episode-finder .date-box input").attr('readonly','readonly');$("#episode-finder-w .date-box input").attr('readonly','readonly');SNI.Util.inputField('#ef-topic','Topic');$(document).ready(function(){$("#episode-finder .date").attachDatepicker();$("#episode-finder-w .date").attachDatepicker();});}};
function HgtvAd(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;}
HgtvAd('LEADERBOARD','468x60',pos);}
function PushdownAd(pos){if(pos<0||pos==undefined){pos=1;}
HgtvAd('PUSHDOWN','',pos);}
function GoogleBigboxAd(pos){if(pos<0||pos==undefined){pos=1;}
HgtvAd('GOOGLE_BIGBOX','',pos);}
function GoogleLeaderboardAd(pos){if(pos<0||pos==undefined){pos=1;}
HgtvAd('GOOGLE_LEADERBOARD','',pos);}
function BigboxAd(pos,keywords){if(typeof(mdManager)!=undefined&&mdManager.getParameterString("VideoPlayer")==""){if(pos<0||pos==undefined){pos=1;}
HgtvAd('BIGBOX','',pos,keywords);}}
function BigboxAd300x150(pos,keywords){if(pos<0||pos==undefined){pos=1;}
HgtvAd('SPONSORSHIP_CONTENT','',pos,keywords);}
function SuperstitialAd(pos){if(pos<0||pos==undefined){pos=1;}
HgtvAd('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);}
if(typeof(SNI.HGTV.Search)=="undefined"){SNI.HGTV.Search={};}
SNI.HGTV.Search={statusMessage:function(){$(".status-message .close a").each(function(e){$(this).bind("click",function(){var obj=$(this).parents(".status-message");obj.css("height",obj.height());obj.find(".wrap").fadeOut("slow",function(){obj.slideUp("slow");});return false;});});}};
if(typeof(SNI.HGTV.Toolbar)=="undefined"){SNI.HGTV.Toolbar={};}
SNI.HGTV.Toolbar={toolbar:"#toolbar",toolbarElement:$(SNI.HGTV.Toolbar.toolbar),revealModule:function(trigger,module){$(SNI.HGTV.Toolbar.toolbar).find(trigger).click(function(){module.fadeIn(SNI.HGTV.ANIMATION_SPEED);$(this).addClass("active");return false;})},closeModule:function(trigger,module,speed){if(speed==null){speed=SNI.HGTV.ANIMATION_SPEED;};module.fadeOut(speed);if($(trigger).hasClass("active")){$(trigger).removeClass("active");};},fontResize:function(element){$(element).find("li").click(function(){var defaultSize="100%";$(element).find("li").removeClass("active");$(this).addClass("active");if($(this).hasClass("med")){$("#hg-art-we").css("font-size",defaultSize);}else if($(this).hasClass("sm")){$("#hg-art-we").css("font-size","85%");}else{$("#hg-art-we").css("font-size","116%");}});},printPage:function(){var module=$("#print-select");SNI.HGTV.Toolbar.revealModule(".print",module);$("em.close").click(function(){SNI.HGTV.Toolbar.closeModule(".print",module);});$(".email").click(function(){SNI.HGTV.Toolbar.closeModule(".print",module);});},emailAFriend:function(inMod){if(inMod==undefined){SNI.HGTV.Toolbar.emailAFriend1($("#email-a-friend"));}else{SNI.HGTV.Toolbar.emailAFriend2($(inMod));}},emailAFriend2:function(module){var form=module.find("form");initMessage=form.find("textarea").val();clear_form=function(){form.find("input:text").each(function(){$(this).val("");});form.find("textarea").val(initMessage);form.find("label").removeClass("error");module.find(".message").removeClass("alert").text("All fields are required.");return;};clear_form();$("#pgallery3 .email form .form-submit a").click(function(){clear_form();return false;});if(mdManager.getPageTitle){var page_title=mdManager.getPageTitle();success_message=module.find('.success strong');success_message.text(page_title);}else{success_message.text('this page');}
form.validate({errorLabelContainer:false,rules:{from_name:{required:true},from_email:{required:true,email:true},to_emails:{required:true,multipleEmails: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. joe@hgtv.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. joe@hgtv.com)."}},showErrors:function(errorMap,errorList){if(errorList.length){module.find('.message').addClass('alert').html(errorList[0].message);element=$(errorList[0].element);if(element.hasClass('isemail')){element.select();}
this.errorList=[this.errorList[0]];this.defaultShowErrors();}},submitHandler:function(){var txtarea=form.find('textarea[name="body"]');var txtarea_comment=txtarea.val();var page_title=mdManager.getPageTitle();var msg_body=form.find('input[name="from_name"]').val()+" thought you would be interested in this link to \""+page_title+"\" on the  HGTV Web site:\n\n";msg_body+="http://"+location.hostname;msg_body+=mdManager.getParameter("Url")+"\n\n";if(txtarea.val()!=""){msg_body+="Comments from "+form.find('input[name="from_name"]').val()+":\n";msg_body+=txtarea.val();};module.find('.message').hide().removeClass("alert");form.find('fieldset').hide();form.find("label").removeClass("error");form.find('button').addClass('disabled').attr('disabled','disabled');form.find('.cancel').addClass("disabled");form.find('.loading').show();txtarea.val(msg_body);var form_data="";form.find(":input:not('button')").each(function(){var input_name=$(this).attr("name");var input_value=$(this).val();form_data+=input_name+"="+input_value+"&";});$.ajax({type:"POST",url:form.attr("action"),data:form_data.slice(0,-1),cache:false,success:function(data){form.find('.loading').hide();var response=$(data);var emailSent=response.eq(7).text();if(emailSent=="false"){txtarea.val(txtarea_comment);form.find('fieldset').show();form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find("label[for='friends-email']").addClass("error");$("#friends-email").select();module.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@HGTV.com).").show();}else{var success=module.find('.success');var page_title="this page"
form.hide();success.show();var timeout=setTimeout(function(){success.hide();txtarea.val(txtarea_comment);module.find('.message').text("All fields are required.").show();form.find("input:text").each(function(){$(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();form.find('fieldset').show();},3000);$(".close").click(function(){clearTimeout(timeout);close_module();module.hide();success.hide();txtarea.val(txtarea_comment);module.find('.message').text("All fields are required.").show();form.find("input:text").each(function(){$(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();});}},error:function(){form.find('.loading').hide();txtarea.val(txtarea_comment);form.find('fieldset').show();form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");module.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();}});}});},emailAFriend1:function(module){var form=module.find("form");var null_value="";var initMessage=form.find("textarea").val();$(".print").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);});SNI.HGTV.Toolbar.revealModule(".email",module);$(".close").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);});$(".form-submit a").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);return false;});if(mdManager.getPageTitle){var page_title=mdManager.getPageTitle();var success_message=module.find('.success strong');success_message.text(page_title);}else{success_message.text('this page');};form.validate({errorLabelContainer:false,rules:{from_name:{required:true},from_email:{required:true,email:true},to_emails:{required:true,multipleEmails: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. joe@hgtv.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. joe@hgtv.com)."}},showErrors:function(errorMap,errorList){if(errorList.length){module.find('.message').addClass('alert').html(errorList[0].message);element=$(errorList[0].element);if(element.hasClass('isemail')){element.select();}
this.errorList=[this.errorList[0]];this.defaultShowErrors();}},submitHandler:function(){var txtarea=form.find('textarea[name="body"]');var txtarea_comment=txtarea.val();var page_title=mdManager.getPageTitle();var msg_body=form.find('input[name="from_name"]').val()+" thought you would be interested in this link to \""+page_title+"\" on the  HGTV Web site:\n\n";msg_body+="http://"+location.hostname;msg_body+=mdManager.getParameter("Url")+"\n\n";if(txtarea.val()!=null_value){msg_body+="Comments from "+form.find('input[name="from_name"]').val()+":\n";msg_body+=txtarea.val();};module.find('.message').hide().removeClass("alert");form.find('fieldset').hide();form.find("label").removeClass("error");form.find('button').addClass('disabled').attr('disabled','disabled');form.find('.cancel').addClass("disabled");form.find('.loading').show();txtarea.val(msg_body);var form_data="";form.find(":input:not('button')").each(function(){var input_name=$(this).attr("name");var input_value=$(this).val();form_data+=input_name+"="+input_value+"&";});$.ajax({type:"POST",url:form.attr("action"),data:form_data.slice(0,-1),cache:false,success:function(data){form.find('.loading').hide();var response=$(data);var emailSent=response.eq(7).text();if(emailSent=="false"){txtarea.val(txtarea_comment);form.find('fieldset').show();form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find("label[for='friends-email']").addClass("error");$("#friends-email").select();module.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@HGTV.com).").show();}else{var success=module.find('.success');var page_title="this page"
form.hide();success.show();var timeout=setTimeout(function(){SNI.HGTV.Toolbar.closeModule(".email",module,300);module.hide();success.hide();txtarea.val(txtarea_comment);module.find('.message').text("All fields are required.").show();form.find("input:text").each(function(){$(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();},3000);$(".close").click(function(){clearTimeout(timeout);SNI.HGTV.Toolbar.closeModule(".email",module);module.hide();success.hide();txtarea.val(txtarea_comment);module.find('.message').text("All fields are required.").show();form.find("input:text").each(function(){$(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();});}},error:function(){form.find('.loading').hide();txtarea.val(txtarea_comment);form.find('fieldset').show();form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");module.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();}});}});},emailAFriendCaptcha:function(module){var module=$("#email-a-friend");var form=module.find("form");var null_value="";var initMessage=form.find("textarea").val();form.submit(function(e){e.preventDefault();return false;});function newCaptchaImg(){addtime=new Date().getTime();};$(".email").click(function(){form.find('#captcha-img').html('<img src="/app/emailservice2/captchaImg" height="30" width="93" />');});$("#captcha-request a, .email").click(function(){newCaptchaImg();form.find('#captcha-img').html('<img src="/app/emailservice2/captchaImg?generateNew=true&t='+addtime+'" height="30" width="93" />');return false;});$(".print").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);});SNI.HGTV.Toolbar.revealModule(".email",module);$(".close").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);});$(".form-submit a").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);return false;});if(mdManager.getPageTitle){var page_title=mdManager.getPageTitle();var success_message=module.find('.success strong');success_message.text(page_title);}else{success_message.text('this page');};var captcha_msg="Whoops. Please enter the characters in the image to verify you are human."
form.validate({errorLabelContainer:form.find("p.message"),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. joe@hgtv.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. joe@hgtv.com)."},captcha_answer:{required:captcha_msg}},showErrors:function(errorMap,errorList){if(errorList.length){module.find('.message').addClass('alert').html(errorList[0].message);element=$(errorList[0].element);if(element.hasClass('isemail')){element.select();}
this.errorList=[this.errorList[0]];this.defaultShowErrors();}},submitHandler:function(){var txtarea=form.find('textarea[name="body"]');var txtarea_comment=txtarea.val();var page_title=mdManager.getPageTitle();var msg_body=form.find('input[name="from_name"]').val()+" thought you would be interested in this link to \""+page_title+"\" on the  HGTV Web site:\n\n";msg_body+="http://"+location.hostname;msg_body+=mdManager.getParameter("Url")+"\n\n";if(txtarea.val()!=null_value){msg_body+="Comments from "+form.find('input[name="from_name"]').val()+":\n";msg_body+=txtarea.val();};module.find('.message').hide().removeClass("alert");form.find('fieldset').hide();form.find("label").removeClass("error");form.find('button').addClass('disabled').attr('disabled','disabled');form.find('.cancel').addClass("disabled");form.find('.loading').show();txtarea.val(msg_body);var form_data="";form.find(":input:not('button')").each(function(){var input_name=$(this).attr("name");var input_value=$(this).val();form_data+=input_name+"="+input_value+"&";});$.ajax({type:"POST",url:form.attr("action"),dataType:'json',data:form_data.slice(0,-1),cache:false,success:function(data){form.find('.loading').hide();var response=$(data);var emailSent=data.emailSent;var captchaCorrect=data.captchaAnswerValid;if(!emailSent){txtarea.val(txtarea_comment);form.find('fieldset').show();form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");if(!captchaCorrect){form.find("label[for='captcha_answer']").addClass("error");$("#captcha_answer").select();module.find('.message').addClass("alert").text(captcha_msg).show();}else{form.find("label[for='friends-email']").addClass("error");$("#friends-email").select();module.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@HGTV.com).").show();}}else{var success=module.find('.success');var page_title="this page"
form.hide();success.show();var timeout=setTimeout(function(){SNI.HGTV.Toolbar.closeModule(".email",module,300);module.hide();success.hide();txtarea.val(txtarea_comment);module.find('.message').text("All fields are required.").show();form.find("input:text").each(function(){$(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();},3000);$(".close").click(function(){clearTimeout(timeout);SNI.HGTV.Toolbar.closeModule(".email",module);module.hide();success.hide();txtarea.val(txtarea_comment);module.find('.message').text("All fields are required.").show();form.find("input:text").each(function(){$(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();});}},error:function(){form.find('.loading').hide();txtarea.val(txtarea_comment);form.find('fieldset').show();form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");module.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();}});}});},shareThis:function(){var share_url=SNI.Util.Url.setParameter(document.location.href,"soc","share");var page_title=jQuery("<div>"+mdManager.getPageTitle()+"</div>").text();var twitter_shared_object=SHARETHIS.addEntry({title:page_title+" #HGTV ",url:share_url});var facebook_shared_object=SHARETHIS.addEntry({title:page_title,url:share_url});twitter_shared_object.attachChicklet("twitter",SNI.HGTV.Toolbar.toolbarElement.find(".sharing .twitter a.chicklet")[0]);facebook_shared_object.attachChicklet("facebook",SNI.HGTV.Toolbar.toolbarElement.find(".sharing .facebook a.chicklet")[0]);},init:function(){if(!SNI.HGTV.Toolbar.toolbarElement||SNI.HGTV.Toolbar.toolbarElement.length==0){SNI.HGTV.Toolbar.toolbarElement=jQuery(SNI.HGTV.Toolbar.toolbar);}
SNI.HGTV.Toolbar.fontResize(".font-resize");SNI.HGTV.Toolbar.printPage();if(SNI.HGTV.Toolbar.toolbarElement.find(".sharing .facebook a.chicklet").length>0){SNI.HGTV.Toolbar.shareThis();}
if(jQuery("#email-a-friend form").attr("name")){SNI.HGTV.Toolbar.emailAFriendCaptcha();}
else{SNI.HGTV.Toolbar.emailAFriend();}}};
(function($){if(typeof(SNI.HGTV.ArticleInfo)=="undefined"){SNI.HGTV.ArticleInfo={};}
SNI.HGTV.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);
(function(){_egg=function(){return;if($("#fn-ft div.brand").length==0){return;}
var o=$("#fn-ft .brand").get(0);if(o!==null){var ee=document.createElement("div");ee.className="_egg";o.appendChild(ee);$(ee).click(function(){if(document.getElementById('_egg-yolk')===null){var bd=document.getElementById('fn-bd');if(bd!=null){var img_w=620;var img_h=465;var x=($(window).width()-img_w)/2;var y=($(window).height()-img_h)/2;y+=window.scrollY;var yolk=document.createElement("div");yolk.setAttribute('id','_egg-yolk');yolk.style.left=Math.ceil(x)+'px';yolk.style.top=Math.ceil(y)+'px';bd.appendChild(yolk);$(yolk).click(function(){yolk.parentNode.removeChild(yolk);});$(yolk).animate({width:img_w+'px',height:img_h+'px'},700);}}});}};$(document).ready(_egg);})();
SNI.HGTV.Newsletters={subscribe:function(){this.setupAccordion();$(".nl-bd .check-all a").click(function(){link=$(this);if(link.text()=='Check All'){checked="checked";link.html('<span>Uncheck All</span>');}else{checked='';link.html('<span>Check All</span>');}
$('.nl-choose :checkbox').attr('checked',checked);return false;});$('.nl-bd form').validate({errorContainer:'.nl-bd .form-errors',errorLabelContainer:'.nl-bd .form-errors ul',wrapper:"li",rules:{newsletter:{required:true},fname:{required:true},lname:{required:true},email:{required:true,email:true},email2:{required:true,equalTo:"#email"},zip:"required"},messages:{newsletter:"Please choose at least one HGTV newsletter",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@hgtv.com)"},email2:{required:"Please confirm your e-mail address",equalTo:"Please make sure your e-mail and confirmation e-mail match"},zip:"Please enter your zip code"},showErrors:function(errorMap,errorList){if(errorList.length){this.defaultShowErrors();element=errorList[0].element;if(element.type=='checkbox'){form=$(element.form);form.find("label[for="+element.id+"]").removeClass('error');form.find("label[for='newsletter']").addClass('error');}else{form.find("label[for='newsletter']").removeClass('error');}
$('html, body').animate({scrollTop:$('.nl-bd .form-errors').offset().top-10},'slow');$('.nl-bd .form-errors').fadeIn();}}});},changeEmail:function(){$('.nl-bd form').validate({errorContainer:'.nl-bd .form-errors',errorLabelContainer:'.nl-bd .form-errors ul',wrapper:"li",rules:{oldemail:{required:true,email:true},newemail:{required:true,email:true},newemail2:{required:true,equalTo:"#new-email"}},messages:{oldemail:{required:"Please enter your old e-mail address",email:"Please check the format of your old e-mail address and re-enter (i.e. joe@hgtv.com)"},newemail:{required:"Please enter your new e-mail address",email:"Please check the format of your new e-mail address and re-enter (i.e. joe@hgtv.com)"},newemail2:{required:"Please confirm your new e-mail address",equalTo:"Please make sure your new e-mail and confirmation e-mail match"}},showErrors:function(errorMap,errorList){if(errorList.length){this.defaultShowErrors();$('.nl-bd .form-errors').fadeIn();}}});},unsubscribe:function(){this.setupAccordion();$('.nl-bd form').validate({errorContainer:'.nl-bd .form-errors',errorLabelContainer:'.nl-bd .form-errors ul',wrapper:"li",rules:{newsletter:{required:true},email:{required:true,email:true},email2:{required:true,equalTo:"#email"}},messages:{newsletter:"Please choose at least one HGTV newsletter",email:{required:"Please enter your e-mail address",email:"Please check the format of your e-mail address and re-enter (i.e. joe@hgtv.com)"},email2:{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.defaultShowErrors();element=errorList[0].element;if(element.type=='checkbox'){form=$(element.form);form.find("label[for="+element.id+"]").removeClass('error');form.find("label[for='newsletter']").addClass('error');}else{form.find("label[for='newsletter']").removeClass('error');}
$('html, body').animate({scrollTop:$('.nl-bd .form-errors').offset().top-10},'slow');$('.nl-bd .form-errors').fadeIn();}}});},setupAccordion:function(){$(".nl-bd .acco-res li.selected").each(function(){$(this).find(".acco-bd").show();});$(".nl-bd .acco-res .acco-link").click(function(){acco_link=$(this);acco_bd=acco_link.next();acco_li=acco_link.parent();if(acco_li.hasClass("selected")){acco_bd.slideUp("slow");acco_li.removeClass("selected");}else{acco_bd.slideDown("slow");acco_li.addClass("selected");}});}};(function($){var NewsLetterAjax=function(form){var $nl_form,submit_url,$nl_error_list;$nl_form=$(form);$nl_error_list=$nl_form.find(".nl-errors")
submit_url=$nl_form.attr("action");$nl_form.submit(function(e){$nl_form.find(".nl-loading").show();$nl_error_list.find("li").hide();var privacy=$nl_form.find("#nl-agree").attr("checked")?1:"";var ajax_url=submit_url
+'?&list[]='+$nl_form.find("#nl-list").val()
+'&email='+$nl_form.find("#nl-emailaddress").val()
+'&privacy='+privacy;$.ajax({url:ajax_url,timeout:10000,dataType:"json",success:function(response){$nl_form.find(".highlight").removeClass("highlight");$nl_form.find("p.nl-intro").hide();if(response.success===true){$nl_form.find("fieldset").hide();$nl_form.find(".nl-thank-you").show();}else if(response.error&&response.error.code){var error=response.error;$nl_error_list.find(".error-"+error.code).show();$nl_form.find(".highlight-"+error.code).addClass("highlight");}
$nl_form.find(".nl-loading").fadeOut("fast");}});e.preventDefault();return false;});return $nl_form;}
SNI.HGTV.Newsletters.ajaxHandler=NewsLetterAjax;})(jQuery);
SNI.HGTV.Contact={init:function(){$('.contact-bd select').dropdown();$('.contact-bd form').validate({errorContainer:'.contact-bd .form-errors',errorLabelContainer:'.contact-bd .form-errors 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@hgtv.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:$('.contact-bd .form-errors').offset().top-10},'slow');$('.contact-bd .form-errors').fadeIn();}}});},liveChat:function(){$('form').validate({errorContainer:'.form-errors',errorLabelContainer:'.form-errors ul',wrapper:"li",rules:{fname:"required",lname:"required",email:{required:true,email:true},email2:{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@hgtv.com)"},email2:{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){$('.form-errors').fadeIn();this.defaultShowErrors();}}});}};
SNI.HGTV.SearchFilter={srchLeftNavFilter:function(){var flyout_container=$("<div id='search-flyouts'></div>");$("body").prepend(flyout_container);$("#hg-filters .bd ul").not('.dp-color-srf').each(function(i){var count=$(this).children().size();var title=$(this).prev().text();var count_diff=parseInt(count-4);if(count>5){$(this).attr("id","srf-list"+i);var results=document.createElement("div");var $results=$(results);$results.addClass("drops").addClass("small").attr("id","flyout"+i);$results.html('<div class="hd"> </div><div class="bd"><h3>More '+title+' <a class="close">Close</a></h3><ul id="alpha'+i+'"></ul></div><div class="ft"> </div>');$(this).children("li").each(function(i){$(this).find("a").click(function(){$(this).parents().filter(".drops").hide();return true;});if(i<=3){$(this).clone(true).appendTo($results.find(".bd ul"));}else{$results.find(".bd ul").append($(this));}});$("#srf-list"+i).after('<div id="srf-drop'+i+'"><a class="cta" href="#flyout'+i+'">More '+title+'</a> <span>('+count+')</span></div>');flyout_container.append(results);function alphaList($it){$('#alpha'+i).html(($it.map(function(){return'<li><a href="'+this.href+'">'+this.innerHTML+'</a><span>'+$(this).parent().children("span")[0].innerHTML+'</span></li>';}).get().join('\n')));}
alphaList($('#alpha'+i+' li a').sort(function(a,b){return SNI.HGTV.Util.flyOuts.alphaCompare(a.innerHTML,b.innerHTML);}));$("#srf-drop"+i).find(".cta").click(function(e){var $fDiv=$("#search-flyouts").find("#flyout"+i);var $aDiv=$("#srf-drop"+i).find("a");hideAll();if(jQuery.browser.msie){$fDiv.css({background:""});}
SNI.HGTV.Util.flyOuts.moveToView({object:$fDiv,anchorObj:$aDiv,pAlign:"right",useLftOffset:32,useTopOffset:-13,overRideDflt:true});$fDiv.fadeIn("fast");$('body').bind("click",function(e){bodyClick(e);});return false;}).css({cursor:"pointer"});$("#search-flyouts .drops").find('.close').click(function(){hideAll();}).css({cursor:"pointer"});}});function bodyClick(e){var $clicked=$(e.target);if($clicked.is('.cta')||$clicked.parents().is('.drops')){return false;}else{hideAll();$('body').unbind();}}
function hideAll(){$("#search-flyouts .drops").each(function(){if(jQuery.browser.msie){$(this).css({background:"B1B1B1"});}
$(this).fadeOut("fast");});}},init:function(){SNI.HGTV.SearchFilter.srchLeftNavFilter();}};
SNI.HGTV.Hosts={init:function(){$('#hgtv-hosts select').dropdown();$('#hgtv-hosts select').change(function(){location.href=$(this).val();});}};
SNI.HGTV.Topics={topicNav:function(){$("#topicNav .nav li").each(function(i){$(this).click(function(){$("#topicNav .active").removeClass("active");$(this).addClass("active");$("#topicNav .bbsctnt:eq("+i+")").addClass("active");});if($(this).hasClass("active")){$("#topicNav .bbsctnt:eq("+i+")").addClass("active");}});$("#topicNav .nav li a").click(function(){return false;});}};
if(typeof(SNI.HGTV.DesignPortfolio)=="undefined"){SNI.HGTV.DesignPortfolio={};}
SNI.HGTV.DesignPortfolio={spacesNav:function(){var expanded_nav=$('#dp-expanded-nav');expanded_nav.find('.close').click(function(e){expanded_nav.hide();return false;});$('#dp-nav-spaces').click(function(e){if(expanded_nav.is(':visible')){expanded_nav.hide();}else{expanded_nav.show();}
return false;});},browseByStyle:function(){var styles_list=jQuery("#browse-by-style .nav ul li");$("#browse-by-style .active").removeClass("active");var random_pick=Math.floor(Math.random()*styles_list.length);jQuery(styles_list[random_pick]).addClass("active");jQuery(jQuery("#browse-by-style .ctnt .bbsctnt")[random_pick]).addClass("active");styles_list.each(function(i){$(this).click(function(){$("#browse-by-style .active").removeClass("active");$(this).addClass("active");$("#browse-by-style .bbsctnt:eq("+i+")").addClass("active");});});},gridHeight:function(){var itemHeight=0;$(".grid li").each(function(e){var thisHeight=$(this).height();if(thisHeight>itemHeight){itemHeight=thisHeight;}});$(".grid li").css("height",itemHeight);},browseByStylePods:{node:function(id,length){this.id=id;this.lock=false;this.length=length;this.current=-1;this.duration=400;this.easing="easeOutQuad";},advance:function(id,direction){var n=SNI.HGTV.DesignPortfolio.browseByStylePods[id];var next=n.current+direction;if(next<0){next=0;}
if(next>=n.length){next=n.length-1;}
return next;},set:function(id,next){var n=SNI.HGTV.DesignPortfolio.browseByStylePods[id];if(n.current!=next&!n.lock){n.lock=true;n.current=next;var obj=$("#"+id);var newx=-1*next*obj.find(".bd li:first").width();obj.find(".bd ul").animate({left:newx},n.duration,n.easing,function(){n.lock=false;});if(n.current<1){obj.find(".previous a").addClass("disabled");}
else{obj.find(".previous a").removeClass("disabled");}
if(n.current>=n.length-1){obj.find(".next a").addClass("disabled");}
else{obj.find(".next a").removeClass("disabled");}}},init:function(){$('#dp-space-more select').dropdown({title:"Browse More Spaces"});$('#dp-designer-more select').dropdown({title:"Browse More Designers"});$('#dp-sponsor-more select').dropdown({title:"Browse More Showrooms"});$('#dp-style-more select').dropdown({title:"Browse More Styles"});$('#dp-browse .more-pod').each(function(){var select=$(this);select.change(function(){window.location.href=$(this).val();return false;});});$("#dp-browse-designer .bd ul").each(function(i){var list=$(this);var length=list.find("li").length;if(length>1){list.width(list.find("li:first").width()*length);var obj=list.parents("li");var id=obj.attr('id');SNI.HGTV.DesignPortfolio.browseByStylePods[id]=new SNI.HGTV.DesignPortfolio.browseByStylePods.node(id,length);obj.find(".pod").addClass("multiple");obj.find(".wrap").before('<p class="previous"><a href="#">Previous</a></p>\n');obj.find(".wrap").before('<p class="next"><a href="#">Next</a></p>\n');obj.find(".previous a").bind("click",function(){var n=SNI.HGTV.DesignPortfolio.browseByStylePods.advance(id,-1);SNI.HGTV.DesignPortfolio.browseByStylePods.set(id,n);return false;});obj.find(".next a").bind("click",function(){var n=SNI.HGTV.DesignPortfolio.browseByStylePods.advance(id,1);SNI.HGTV.DesignPortfolio.browseByStylePods.set(id,n);return false;});SNI.HGTV.DesignPortfolio.browseByStylePods.set(id,0);}});}},RoomBrowser:{inter_refreshed:true,google_leaderboard_html:"",getRooms:function(data,count){var browser=this;var next_button=browser.element.find('.navigate .next');var previous_button=browser.element.find('.navigate .previous');var room_count=count||data.length;var first_room=data[0];var this_room=parseInt(browser.portfolioId);browser.rooms=data;if(window.location.hash){var id_in_hash=window.location.hash.split('/')[1];if(id_in_hash){var id_value=id_in_hash.split('-');id_value.shift();var hash_id=parseInt(id_value.join('-'));if(hash_id&&(jQuery.inArray(hash_id,data)>=0)){first_room=data[jQuery.inArray(hash_id,data)];if(first_room!=this_room){this_room=null;}}}}
if(this_room&&(jQuery.inArray(this_room,data)>=0)){first_room=data[jQuery.inArray(this_room,data)];browser.portfolioId=null;}
browser.setRoomCount(room_count);if((first_room!=this_room)&&(!browser.previewFlg)){browser.loadRoom(first_room);}else{browser.hideLoadingFilters();}
if(!(data.length<=1)){browser.navigateRooms(first_room);if(next_button.hasClass('disabled')){next_button.removeClass('disabled');}
if(previous_button.hasClass('disabled')){previous_button.removeClass('disabled');}}else{next_button.addClass('disabled');previous_button.addClass('disabled');}
return data;},navigateRooms:function(current_room){var browser=this;var rooms=browser.rooms;var current_room_index=jQuery.inArray(current_room,rooms);if(current_room_index===0){browser.previous_room=rooms[rooms.length-1];browser.next_room=rooms[current_room_index+1];}else if(current_room_index===(rooms.length-1)){browser.previous_room=rooms[current_room_index-1];browser.next_room=rooms[0];}else{browser.previous_room=rooms[current_room_index-1];browser.next_room=rooms[current_room_index+1];}
return rooms;},goNextRoom:function(){var browser=this;if(SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed===true&&SNI.HGTV.DynamicAds.refresh('#room-viewer .interwrap')){SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed=false;setTimeout(function(){SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed=true;},5000);return false;}
var current_room=browser.loadRoom(browser.next_room);if(current_room){browser.navigateRooms(current_room);}
return browser.current_room;},goPreviousRoom:function(){var browser=this;if(SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed===true&&SNI.HGTV.DynamicAds.refresh('#room-viewer .interwrap')){SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed=false;setTimeout(function(){SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed=true;},5000);return false;}
var current_room=browser.loadRoom(browser.previous_room);if(current_room){browser.navigateRooms(current_room);}
return browser.current_room;},loadRoom:function(room_id){var browser=this;browser.imageContainer.attr("style","");browser.imageContainer.find("img").attr("style","");var applied_filters=(window.location.hash||"#").split('/');var url=browser.serviceUrl+'PortfolioService/index.json?portfolio='+room_id+'&site=HGTV';if(browser.previewFlg){url+='&preview=true'}
var room_type=browser.portfolioRoomName;var room_type_filter=browser.element.find('#select-filter-room :selected');if(browser.google_leaderboard_html==""){browser.google_leaderboard_html=$("<div />").append($("#hg-w").find(".google-leaderboard").clone().find("script").remove().end()).html();}
browser.displayLoadingMessage(room_id);browser.current_room=room_id;jQuery.ajax({url:url,dataType:'script',success:function(result,textStatus){if(typeof dpCurrentRoom=="undefined"){eval(result);}
applied_filters[1]=("id-"+dpCurrentRoom.portfolioId);window.location.hash=applied_filters.join('/');if(!browser.sponsorFlg&&(dpCurrentRoom.sponsorFlag.length>0)){browser.refreshPage();return dpCurrentRoom;}
if(browser.sponsorFlg&&(dpCurrentRoom.sponsorFlag.length<=0)){browser.sponsorFlg=false;browser.refreshPage();return dpCurrentRoom;}
if(browser.sponsorFlg&&(dpCurrentRoom.sponsorshipValue!=mdManager.getSponsorship())){browser.refreshPage();return dpCurrentRoom;}
jQuery.each(dpCurrentRoom.metadata,function(key,val){mdManager.setParameter(key,val);});if(typeof s=="object"){s.t();}
SNI.Util.hitCount();browser.constructRoom(dpCurrentRoom);browser.hideLoadingFilters();browser.hideLoadingMessage();}});return browser.current_room;},displayLoadingMessage:function(room_id){var browser=this;var room_viewer=browser.viewer;var content_well=jQuery('#hg-w');var designers_notes=room_viewer.find('.dp-notes');var loader=jQuery('<div id="room-loading"></div>');var message=jQuery('<div class="flyout flyout-for-select"><div class="flyout-hd"></div><div class="flyout-bd"></div><div class="flyout-ft"></div></div>');message.children('.flyout-bd').append('<p><img src="http://web.hgtv.com/webhgtv/hg20/imgs/hg-loader.gif" alt="Sending E-mail" width="30" height="30"> <span>Loading...</span></p>')
loader.append(message);content_well.empty();designers_notes.empty();room_viewer.append(loader);},hideLoadingMessage:function(){var browser=this;browser.viewer.find('#room-loading').hide().remove();},setRoomCount:function(count){var browser=this;var criteria=browser.element.find('.navigate > .room-count .criteria');var room_count_html=browser.element.find('.navigate > .room-count strong');var room_text=' Rooms';if(count===1){room_text=' Room';}
room_count_html.html('<span class="count">'+count+'</span>'+room_text);if(browser.filterIsApplied()){criteria.text('Based on the above criteria');}else{criteria.text('Set your criteria above to narrow your results');}
return room_count_html;},filterIsApplied:function(){var browser=this;var filters=browser.element.find('.filter-select :selected').not('.excluded')
return!(filters.length<=0);},generateFilters:function(filters){var browser=this;var select_lists=browser.element.find('.filter');var flyouts=[];jQuery.each(filters,function(i,filter){if(browser.sponsorFlg){if(filter.name=="designer"){return true;}}else{if(filter.name=="sponsor"){return true;}}
var $select_list=select_lists.eq(i);if(filter.name=="sponsor"){$select_list=select_lists.eq(3);}
var label=jQuery('<label class="filter-title"></label>');var select=jQuery('<select class="filter-select"></select>');var option="<option></option>";label.attr('for',filter.id);label.text(filter.label+":");select.attr('id',filter.id);select.attr('name',filter.name);select.append('<option class="excluded">Any '+filter.label+'</option>');jQuery.each(filter.options,function(j,option){var $option=jQuery('<option value="'+option.v+'">'+option.t+'</option>');if(option.s){$option.attr('selected','selected');}
if(option.d){$option.attr('disabled','disabled');}
select.append($option);});$select_list.empty();$select_list.append(label);$select_list.append(select);flyouts.push(browser.generateFlyout(select).flyout);});browser.checkSelectedFilters(flyouts);jQuery.each(flyouts,function(index,flyout){if(flyout.select.attr('id')==='select-filter-room'){browser.changeRoomType(flyout.select.find(':selected'));}
flyout.resetLink.click(function(e){jQuery.each(flyouts,function(index,flyout){flyout.hide();flyout.flyout_reset.attr('selected','selected');browser.element.removeClass("filtered");if(index+1>=flyouts.length){flyout.select.change();}});});});browser.filterClickTracking();return select_lists;},checkSelectedFilters:function(flyouts){var browser=this;var reset_all=true;if(!browser.element.hasClass("filtered")){browser.element.addClass("filtered");}
jQuery.each(flyouts,function(index,flyout){if(flyout.select[0].selectedIndex>0){reset_all=false;return false;}});if(reset_all){browser.element.removeClass("filtered");}},changeRoomType:function(option){var browser=this;var navigation=$('#dp-nav-menu');var right_rail=$('#hg-e');function menuReset(selector){navigation.children('li').removeClass('selected active');navigation.children(selector).addClass('selected active');}
switch(option.val()){case'bathrooms':menuReset('#dp-nav-bathrooms');break;case'bedrooms':menuReset('#dp-nav-bedrooms');break;case'dining-rooms':menuReset('#dp-nav-diningroom');break;case'entryways':menuReset('#dp-nav-entryways');break;case'home-offices':menuReset('#dp-nav-homeoffices');break;case'kids-rooms':menuReset('#dp-nav-kidsrooms');break;case'kitchens':menuReset('#dp-nav-kitchens');break;case'living-rooms':menuReset('#dp-nav-livingroom');break;default:menuReset('#dp-nav-main');}},loadRightRail:function(room_type){var browser=this;var right_rail=$('#hg-e');jQuery.ajax({url:browser.rightRailService(room_type),dataType:'script',success:function(result,textStatus){if(typeof roomTypeRightRail=="undefined"){eval(result);}}});},generateFlyout:function(select){var browser=this;var config={};config.flyout_css=false;config.close_button=true;if(select.attr('id')){var label=jQuery("label[for='"+select.attr('id')+"']");if(label.size()>0){config['title']='Select a '+jQuery.trim(label.text());}}
select.change(function(e){var $this=$(this);var select_lists=browser.element.find('select');var applied_filters=("#").split('/');applied_filters[1]=window.location.hash.split('/')[1];var filter=$this.attr('name')
var option=$this.children(':selected').val();var url=browser.browserService();var selected_hash=[];var room_type=browser.portfolioRoomName;jQuery.each(select_lists,function(i,list){var $list=jQuery(list);var $selected=$list.children(':selected');if($selected.hasClass('excluded')){return true;}
url+=$list.attr('name')+"/"+$selected.val()+"/";selected_hash.push($list.attr('name')+'-'+$selected.val());});jQuery.merge(applied_filters,selected_hash);window.location.hash=applied_filters.join('/');url+='roomfilter.js';browser.generateBrowser(url);});var flyout=SNI.Util.Flyout.createFor(select,config);var flyout_body=flyout.element.children('.flyout-bd');var flyout_reset=flyout.select.children('.excluded');var select_name=select.attr('name').charAt(0).toUpperCase()+select.attr('name').substr(1).toLowerCase();var reset_button=jQuery('<button class="button"><span><em>See Any Available '+select_name+'</em></span></button>');reset_button.click(function(e){flyout.hide();flyout_reset.attr('selected','selected');flyout.select.change();e.preventDefault();});flyout_body.append(reset_button);var reset_container=jQuery('<div class="reset">Or </div>');var reset_link=jQuery('<a href="javascript: void(0);">Start a New Search</a>');reset_container.append(reset_link)
flyout_body.append(reset_container);flyout.resetLink=reset_link;flyout.flyout_reset=flyout_reset;select.flyout=flyout;return select;},generateBrowser:function(service_url){var browser=this;browser.showLoadingFilters();jQuery.ajax({url:service_url,dataType:'script',success:function(result,textStatus){if(typeof dpRoomBrowser=="undefined"){eval(result);}
browser.generateFilters(dpRoomBrowser.filters);browser.getRooms(dpRoomBrowser.rooms,dpRoomBrowser.count);}});return browser;},browserService:function(){var url;switch(window.location.host){case'www.dev-hgtv.com':url='http://10.64.36.113:18080/HGTVSearchServiceCXF/browseByRoom/'
break;case'www.staging-hgtv.com':url='http://search1.staging-hgtv.com/hgtv/cxfservice/browseByRoom/';break;default:url='http://www.hgtv.com/hgtv/cxfservice/browseByRoom/';}
return url;},rightRailService:function(room_type){room_type=room_type||'';return'http://'+window.location.host+'/hgtv/feeds/portfolio-right-rail/0,,HGTV_'+room_type+',00.html'},showLoadingFilters:function(){var browser=this;if(browser.element.find('.loading').length<=0){browser.element.append('<div class="loading">Loading Filters</div>');}},hideLoadingFilters:function(){var browser=this;browser.element.children('.loading').remove();},constructRoom:function(data){var browser=this;var room_viewer=browser.viewer;var content_well=jQuery('#hg-w');var designers_notes=room_viewer.find('.dp-notes');var toggler=browser.imageContainer.find(".dp-toggler").detach();var enlarge=browser.toggler.find(".dp-enlarge");var shrink=browser.toggler.find(".dp-shrink");designers_notes.empty();content_well.empty();browser.imageContainer.empty();browser.imageContainer.append(toggler);enlarge.show();shrink.hide();if(data.images[0].bvert&&data.images[0].bvert=="true"){browser.imageContainer.addClass("dp-fitted");}else{browser.imageContainer.removeClass("dp-fitted");}
var designer_info=jQuery('<div id="dp-about-designers" class="dp-acco"><div class="hd"><h4>About the Designer(s)</h4></div>');var more_from_sponsor=jQuery('<div id="dp-more-sponsor" class="dp-notes"><h4>More From This Sponsor</h4></div>');if(data.multimedia&&data.multimedia.length>0){browser.imageContainer.append(data.multimedia);}else if(data.images&&data.images.length>0){var new_img=$('<img src="'+data.images[0].lgUrl+'" alt="'+data.images[0].img_alt+'" />');new_img.click(function(e){if(!browser.element.find('.navigate .next').hasClass("disabled")){browser.goNextRoom();}
return false;});browser.imageContainer.append(new_img);}
if(data.designerNotes.length>=1){if(data.sponsorFlag.length>=1){designers_notes.append('<h4>About This Room</h4>');}else{designers_notes.append("<h4>Designer's Notes</h4>");}
designers_notes.append(browser.truncateNotes(data.designerNotes));}
content_well.append(data.toolbar);if(data.sponsorFlag.length<=0){designer_info.append(data.designerList);designer_info.append('<div class="ft"></div>');content_well.append(designer_info);content_well.find('#dp-about-designers .acco-dp').dpl('accordion');}
content_well.append(data.otherRoomsEndeca);content_well.append(browser.google_leaderboard_html);return data;},truncateNotes:function(notes){var browser=this
var $notes=$(notes);var text=$notes.text();var cut_off=333;if(text.length>cut_off){var new_notes=text.slice(0,cut_off)+"... ";var more_link=jQuery('<a href="#">more</a>').click(function(e){$(this).parent().text(text);return false;});$notes.text(new_notes);$notes.append(more_link);}
return $notes;},refreshPage:function(url){var path;try{path=dpCurrentRoom.metadata.Url;}catch(err){path=url||window.location.pathname}
var new_location='http://'+window.location.host+path+window.location.search+window.location.hash;window.location=new_location;return new_location;},filterClickTracking:function(){var browser=this;var filters=browser.element.find('.filters .flyout-for-select .flyout-bd');if(filters.length<=0){return;}
filters.bind('click',function(e){var $clicked=$(e.target);var filter=$clicked.parents('#room-browser li.filter').children('.filter-title').text().split(':')[0];var option=$clicked.text();var s=s_gi(s_account);s.linkTrackVars='prop50,eVar8';s.linkTrackEvents='None';s.prop50=filter+': '+option;s.eVar8=s.prop50;s.tl(this,'o','DP Room Filter');s.linkTrackVars='';s.linkTrackEvents='';s.prop50='';s.eVar8='';});},init:function(){var browser=this;browser.element=jQuery('#room-browser');browser.viewer=jQuery('#room-viewer');browser.setupToggler();var next_button=browser.element.find('.navigate .next');var previous_button=browser.element.find('.navigate .previous');var service_url=browser.browserService();if(window.location.hash){var filters=window.location.hash.split('/');var url='';jQuery.each(filters,function(i,val){if(i==0||!val){return true;}
var filter=val.split('-');var name=filter.shift();var value=filter.join('-');if(name=='id'){return true;}
url+=name+'/'+value+'/';});if(url){service_url+=url;}}
browser.generateBrowser(service_url+'roomfilter.js');previous_button.click(function(e){if($(this).hasClass('disabled')){return false;}
browser.goPreviousRoom();return false;});next_button.click(function(e){if($(this).hasClass('disabled')){return false;}
browser.goNextRoom();return false;});browser.viewer.find('.large-image img').click(function(e){if(!next_button.hasClass("disabled")){browser.goNextRoom();}
return false;});SNI.HGTV.DynamicAds.init();SNI.HGTV.Omniture.ClickTrack("#room-browser .navigate","Designer's Portfolio Room Gallery");return browser;},setupToggler:function(){var browser=this;browser.toggler=browser.viewer.find(".dp-toggler");var enlarge=browser.toggler.find(".dp-enlarge");var shrink=browser.toggler.find(".dp-shrink");var imageContainer=browser.viewer.find(".large-image");browser.imageContainer=imageContainer;enlarge.click(function(){browser.imageContainer.animate({width:"616px"},200);browser.imageContainer.find("img").animate({width:"616px"},200);enlarge.hide();shrink.show();});enlarge.children(".dp-toggler-button").hover(function(){enlarge.children(".dp-toggler-label").show();},function(){enlarge.children(".dp-toggler-label").hide();});enlarge.children(".dp-toggler-label").hover(function(){enlarge.children(".dp-toggler-label").show();},function(){enlarge.children(".dp-toggler-label").hide();});shrink.click(function(){browser.imageContainer.animate({width:"346px"},250);browser.imageContainer.find("img").animate({width:"346px"},250);shrink.hide();enlarge.show();});shrink.children(".dp-toggler-button").hover(function(){shrink.children(".dp-toggler-label").show();},function(){shrink.children(".dp-toggler-label").hide();});shrink.children(".dp-toggler-label").hover(function(){shrink.children(".dp-toggler-label").show();},function(){shrink.children(".dp-toggler-label").hide();});}},searchFieldHandler:function(){var searchField=jQuery("#hg-w-search-input");var label="Search Over 2000 Spaces";if(searchField.val()!=label){searchField.removeClass("grayedout");}
searchField.focus(function(e){var field=jQuery(this);field.removeClass("grayedout");if(field.val()==label){field.val("");}});searchField.blur(function(e){var field=jQuery(this);if(field.val()==""){field.addClass("grayedout");field.val(label);}});jQuery("#dp-search .search .input").click(function(){searchField.focus();});jQuery("#dp-search-form").submit(function(e){if(searchField.val()==label){searchField.val("");}});}};
SNI.HGTV.MessageBoard={init:function(url){messageList=$('#messageboard .mb-bd ul');$.ajax({type:"GET",url:url,dataType:"xml",success:function(xml){var data=$(SNI.HGTV.MessageBoard.parseData(xml,'item'));data.each(function(){var item='<li><div class="bubble">';item+='<q><a href="'+this.link+'">'+this.title+'</a></q>';item+='<cite><span>'+this.author+'</span></cite>';item+='</div></li>';messageList.append(item);});},error:function(data,status,e){messageList.append("<li>Sorry, we're having trouble loading the message board information...</li>");}});},parseData:function(xml,nodeName){var data=[];$(nodeName,xml).each(function(){var item={};$(this).children().each(function(){item[this.nodeName]=$(this).text();});data.push(item);});return data;}};
if(typeof(SNI.HGTV.ImageEnlarge)=="undefined"){SNI.HGTV.ImageEnlarge={};}
SNI.HGTV.ImageEnlarge={clickCtrl:".img-enlarge",insertPoint:"#hg-art-we",imgFrame:"#blow-up",closeCtrl:"#blow-up a.close",init:function(){$(SNI.HGTV.ImageEnlarge.clickCtrl).bind("click",SNI.HGTV.ImageEnlarge.clickExpand);},clickExpand:function(e){$(this).parents().filter(".thumb-wrap").before(SNI.HGTV.ImageEnlarge.htmlImage(this.href));$(SNI.HGTV.ImageEnlarge.closeCtrl).bind("click",SNI.HGTV.ImageEnlarge.closeImg);return false;},htmlImage:function(imgURL){retHTML="<div id='blow-up' class='clrfix'><div class='bu-hd'></div><div class='bu-bd'><div class='bu-bd-hd'><a class='close' href='#'>Close</a></div><img width='616' src='"+imgURL+"'><div class='bu-bd-ft clrfix'><!--[if IE]><center><![endif]-->";retHTML+="<p class='clrfix'><a class='close button' href='#'><span>Close</span></a>";if((typeof pgalurl)!="undefined")
{retHTML+="<span class='pgal-link'>or <a href='"+pgalurl+"'>Go to Photo Gallery</a></span>";}
retHTML+="</p><!--[if IE]></center><![endif]--></div></div><div class='bu-ft'></div>";return retHTML;},closeImg:function(e){$(SNI.HGTV.ImageEnlarge.imgFrame).remove();return false;}};
if(typeof(SNI.HGTV.QuickVote)=="undefined"){SNI.HGTV.QuickVote={};}
SNI.HGTV.QuickVote={inputLink:"#poll-input-link",resultLink:"#poll-result-link",submitLink:"#poll-submit-link",inputPanel:"#inputPanel",inputForm:"#quick-vote-poll",resultsPanel:"#resultsPanel",submittingPanel:".qv-ww .submitting",loadingPanel:".qv-ww .loading",validateOptions:{errorElement:"",highlight:"",rules:{Rating:"required"},messages:{Rating:""},errorContainer:"#quick-vote-poll .errormsg"},voteURL:'',resURL:'',POLL_Cookie:'',oValidator:'',init:function(pollnum,voteURL,resURL){SNI.HGTV.QuickVote.voteURL=voteURL;SNI.HGTV.QuickVote.resURL=resURL;SNI.HGTV.QuickVote.POLL_Cookie="HGTV_poll_"+pollnum;SNI.HGTV.QuickVote.oValidator=$(SNI.HGTV.QuickVote.inputForm).validate(SNI.HGTV.QuickVote.validateOptions);SNI.HGTV.QuickVote.oValidator.resetForm();$(SNI.HGTV.QuickVote.inputForm).get(0).reset();$(SNI.HGTV.QuickVote.resultLink).click(function(){$(SNI.HGTV.QuickVote.inputPanel).hide();SNI.HGTV.QuickVote.showResults(resURL);return false;});$(SNI.HGTV.QuickVote.inputPanel).submit(SNI.HGTV.QuickVote.submitVote);if(SNI.Util.Cookie.get(SNI.HGTV.QuickVote.POLL_Cookie)=="yes"){$(SNI.HGTV.QuickVote.inputPanel).hide();SNI.HGTV.QuickVote.showResults(resURL);}
else
{$(SNI.HGTV.QuickVote.inputPanel).show();}},submitVote:function(){$(SNI.HGTV.QuickVote.inputPanel).hide();$(SNI.HGTV.QuickVote.submittingPanel).show();$.post(SNI.HGTV.QuickVote.voteURL,$(SNI.HGTV.QuickVote.inputForm).serialize(),SNI.HGTV.QuickVote.afterSubmit);return false;},afterSubmit:function(){SNI.Util.Cookie.set(SNI.HGTV.QuickVote.POLL_Cookie,"yes");$(SNI.HGTV.QuickVote.submittingPanel).hide();SNI.HGTV.QuickVote.showResults();},showResults:function(){$(SNI.HGTV.QuickVote.loadingPanel).show();$(SNI.HGTV.QuickVote.resultsPanel).load(SNI.HGTV.QuickVote.resURL,'',SNI.HGTV.QuickVote.resInit);return false;},resInit:function(){$(SNI.HGTV.QuickVote.loadingPanel).hide();$(SNI.HGTV.QuickVote.resultsPanel).show();$(SNI.HGTV.QuickVote.inputLink).click(function(){SNI.HGTV.QuickVote.showInputForm();return false;});return;},showInputForm:function(){$(SNI.HGTV.QuickVote.resultsPanel).empty();$(SNI.HGTV.QuickVote.resultsPanel).hide();SNI.HGTV.QuickVote.oValidator.resetForm();$(SNI.HGTV.QuickVote.inputForm).get(0).reset();$(SNI.HGTV.QuickVote.inputPanel).show();return false;}};;SNI.HGTV.LazyImage={load:function(img_element,src){var image_src=src||img_element.attr('data-src');img_element.attr('src',image_src);return img_element;}};SNI.HGTV.ViewSlider=(function(){function ViewSlider(){this.updateImageList=function(){this.images=this.images.not('[src]');return this.images;},this.monitorScroll=function(){var sliding_window=this;var slider=sliding_window.slider;sliding_window.images=slider.find('img').not('[src]');if(sliding_window.images.length>0){slider.scroll(function(e){sliding_window.images.each(function(i){var $this=jQuery(this);if(($this.offset().left-slider.offset().left)<=slider.width()){SNI.HGTV.LazyImage.load($this);sliding_window.updateImageList();}});});}},this.calculateBodyWidth=function(slider_body){slider_body=slider_body||sliding_window.slider.children('ul');var total_body_width=0;slider_body.children('li').each(function(i){var $this=$(this);var list_item_width=$this.outerWidth()+parseInt($this.css('margin-left'))+parseInt($this.css('margin-right'));total_body_width=total_body_width+list_item_width;});return total_body_width;},this.init=function(element){var sliding_window=this;var slider=element||jQuery('.view-slider');sliding_window.slider=slider;slider.addClass("view-slider-setup")
sliding_window.images=slider.find('img').not('[src]');var slider_body=slider.children('ul');var slider_body_width=sliding_window.calculateBodyWidth(slider_body);if(slider_body.width()!==slider_body_width){slider_body.width(slider_body_width);}
sliding_window.images.each(function(i){var $this=jQuery(this);if($this.position().left<=sliding_window.slider.width()){SNI.HGTV.LazyImage.load($this);}});sliding_window.updateImageList();sliding_window.monitorScroll();}}
return{init:function(element){var view_slider=new ViewSlider();view_slider.init(element);return view_slider;}};})();
SNI.HGTV.BestOf={init:function(){SNI.HGTV.Drops.init($(".best-of-full .drops"),$(".best-of-full .more-lnk"));SNI.HGTV.ViewSlider.init();return;}}
SNI.HGTV.Drops={init:function($eDrop,$eLnk){$eLnk.click(function(){if($eLnk.hasClass("sel")){$eDrop.find(".close").trigger("click");}
else{$eLnk.addClass("sel");$("body").bind("click.drops_out",function(ev){if($(ev.target).parents(".drops").length==0){$eDrop.find(".close").trigger("click");}
return true;});$eDrop.show();}
return false;});$eDrop.find(".close").click(function(){$eDrop.hide();$eLnk.removeClass("sel");$("body").unbind("click.drops_out");return false;});return;}}
SNI.HGTV.DynamicAds={descr:{active:true,refreshRate:4,interstitial:false},iparm:{iURL:"",iFmt:"",iHREF:"",iHeight:"",iWidth:"",iTrackURL:"",bURL:""},impressionCt:1,init:function(descriptor,param_styles,gen_inter_func){descriptor=descriptor||"PHOTO_DESCRIPTOR";param_styles=param_styles||'photoGallery';SNI.HGTV.DynamicAds.gen_interstitial=gen_inter_func||SNI.HGTV.DynamicAds.gen_interstitial;myJSON=getDartEnterpriseUrl(descriptor,1);myJSON+="&params.styles="+param_styles+"&callback=?";$.getJSON(myJSON,SNI.HGTV.DynamicAds.cback_descrJSON);return;},cback_descrJSON:function(oJSON){if(typeof oJSON!="object"){return false;}
if(oJSON.photo_descriptor==undefined){return false;}
oJSON=oJSON.photo_descriptor;if(oJSON.active==undefined){return false;}
if(oJSON.refreshRate==undefined){return false;}
if(oJSON.active!="true"){return false;}
tmp=parseInt(oJSON.refreshRate);if(isNaN(tmp)){return false;}
if(tmp<1||tmp>100){return false;}
SNI.HGTV.DynamicAds.descr.active=true;SNI.HGTV.DynamicAds.descr.refreshRate=tmp;if(oJSON.interstitial==undefined){return false;}
if(oJSON.interstitial=="true"){SNI.HGTV.DynamicAds.descr.interstitial=true;}
return true;},refresh:function(interstitial_selector){if(!this.descr.active){return;}
var interstitial_element=interstitial_selector||'#pgallery3 .interwrap';$(interstitial_element).remove();this.impressionCt++;if(this.impressionCt==this.descr.refreshRate){this.impressionCt=0;if(this.descr.interstitial){myJSON=getDartEnterpriseUrl("PHOTO_INTERSTITIAL",1);myJSON+="&params.styles=photoGallery&callback=?";$.getJSON(myJSON,SNI.HGTV.DynamicAds.cback_interJSON);return true;}else{setDartEnterpriseBanner("BIGBOX",getDartEnterpriseUrl("BIGBOX",5));}}
return;},cback_interJSON:function(oJSON){$.each(SNI.HGTV.DynamicAds.iparm,function(key,val){SNI.HGTV.DynamicAds.iparm[key]="";});if(typeof oJSON!="object"){return false;}
if(typeof oJSON.scrippsads!="object"){return false;}
if(typeof oJSON.scrippsads.ad!="object"){return false;}
for(i=0;i<oJSON.scrippsads.ad.length;++i){if(typeof oJSON.scrippsads.ad[i].position!="object"){return false;}
with(oJSON.scrippsads.ad[i].position){with(SNI.HGTV.DynamicAds){if((iparm.iURL=="")&&(id=="interstitial")){iparm.iURL=media.src;iparm.iFmt=media.format;iparm.iHREF=media.href;iparm.iHeight=media.height;iparm.iWidth=media.width;if(typeof media.tracking.audit=="object"){iparm.iTrackURL=media.tracking.audit.src;}}
if((iparm.bURL=="")&&(id=="300syncBanner")){iparm.bURL=media.src;}}}}
with(SNI.HGTV.DynamicAds){if(iparm.iURL==""||iparm.iFmt==""||iparm.bURL==""){return false;}}
SNI.HGTV.DynamicAds.gen_interstitial();return true;},gen_interstitial:function(){var hRet="";with(SNI.HGTV.DynamicAds){hRet+='<div class="interwrap">';hRet+='<a href="#" class="close"><span></span>Continue to Next Room</a>';hRet+='<h6>Advertisement</h6>';if(iparm.iFmt.toLowerCase()=="swf"){hRet+='<div id="interad"></div>';}else{if(iparm.iHREF!=""){hRet+='<a href="'+iparm.iHREF+'">';}
hRet+='<img src ="'+iparm.iURL+'" />';if(iparm.iHREF!=""){hRet+='</a>';}}
hRet+='<iframe class="tracker" width="0" height="0" frameborder="0"></iframe>';hRet+='</div>';$("#room-viewer").append(hRet);$("#room-viewer .interwrap .close").click(function(){SNI.HGTV.DesignPortfolio.RoomBrowser.goNextRoom()
return false;});if(iparm.iFmt.toLowerCase()=="swf"){swfobject.embedSWF(iparm.iURL,"interad",iparm.iWidth,iparm.iHeight,"9","http://common.scrippsnetworks.com/common/flash-express-install/expressInstall.swf","",{wmode:"opaque",allowScriptAccess:"always",quality:"high"});}
setDartEnterpriseBanner("BIGBOX",iparm.bURL);$("#room-viewer .interwrap .tracker").attr("src",iparm.iTrackURL);}
return;}};
SNI.SimpleTabs={init:function($elt,nInit){$elt.find(".tab-nav li a").click(function(){if($(this).parent().hasClass("sel")){return false;}
$elt.find(".tab-nav li.sel").removeClass("sel");$(this).parent().addClass("sel");idx=$elt.find(".tab-nav li").index($(this).parent());$elt.find(".tab-cont > li.sel").removeClass("sel");$elt.find(".tab-cont > li").eq(idx).addClass("sel");return false;});if((typeof nInit!="undefined")&&(nInit!=0)){idx=0;if(nInit<0){idx=Math.floor(Math.random()*$elt.find(".tab-nav li").length);}
else if(nInit<$elt.find(".tab-nav li").length){idx=nInit;}
if(idx!=0){$elt.find(".tab-nav li").removeClass("sel").eq(idx).addClass("sel");$elt.find(".tab-cont > li").removeClass("sel").eq(idx).addClass("sel");}}
return;}};(function($){var oTabs=function(){oTabs=this;oTabs.$wrap={}
oTabs.$Nav={};oTabs.$Cont={};oTabs.init=function($modWrap,nInit){oTabs.$Wrap=$modWrap;oTabs.$Nav=$modWrap.find(".tab-nav");oTabs.$Cont=$modWrap.find(".tab-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.fTransOut(oTabs.$Wrap.find(".tab-cont > li#"+$(this).attr("rel")));return false;});oTabs.$Cont.append('<li class="loader"><p>loading...</p></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.$Nav.find("li a").not("li.sel a").animate({color:"#dae7e3",backgroundColor:"transparent"},{duration:500,complete:function(){$(this).attr("style","");}});oTabs.$Nav.find("li.sel a").animate({color:"#fff",backgroundColor:"#fbcfcf"},{duration:500,complete:function(){$(this).attr("style","");}});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));});oTabs.$Nav.find("li a").not("li.sel a").animate({color:"#386cb4",backgroundColor:"transparent"},{duration:500,complete:function(){$(this).attr("style","");}});oTabs.$Nav.find("li.sel a").animate({color:"#fff",backgroundColor:"#ef4141"},{duration:500,complete:function(){$(this).attr("style","");}});$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.NotSoSimpleTabs=new oTabs;})(jQuery);
if(typeof(SNI.Common)=='undefined'){SNI.Common={};}
SNI.Common.Carousel=function(element,config){config=$.extend({btnNext:element+" .next-btn",btnPrev:element+" .prev-btn",visible:1,circular:false,displayPage:false,miniNav:false},config);return $(element+' .crsl-wrap').jCarouselLite({btnNext:config.btnNext,btnPrev:config.btnPrev,visible:config.visible,circular:config.circular,scroll:config.visible,displayPage:(config.displayPage),btnNavigation:(config.displayPage)?false:true,miniNav:config.miniNav,container:element,mouseWheel:true});};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(element==="#on-hgtv .acco"){$('.tvschedule .acco-link a').click(function(){window.location.href=this.href;return true;});}
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){var tabs=$(element).tabs(config);};SNI.HGTV.Medialibrary=function(element,o){o=$.extend({crslLoad:null,crslAttr:"data-crsl-loaded",crslClass:".crsl",crslVisible:null},o);if(o.crslLoad){$(o.crslLoad).show();SNI.Common.Carousel(o.crslLoad,{visible:o.crslVisible});$(o.crslLoad).closest('h4').attr(o.crslAttr,'true');}
togglelist=$(element).find('li.switch');togglelist.each(function(){var $this=$(this);var crsl=$this.find('.crsl').attr('id');var target=$this.find("h4");if(!$this.hasClass("active")){$this.find(o.crslClass).slideUp();target.attr(o.crslAttr,'false');}else{target.attr(o.crslAttr,'true');}
target.click(function(){if($this.hasClass("active")){$this.removeClass("active");$this.find(o.crslClass).slideUp(250);}else{$this.addClass("active");$this.find(o.crslClass).slideDown(250);var load=$(this).attr(o.crslAttr);if(load=='false'){SNI.Common.Carousel('#'+crsl,{visible:o.crslVisible});target.attr(o.crslAttr,'true');}}});});};
/* jQuery UI Date Picker v3.3 - previously jQuery Calendar
   Written by Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood@virginbroadband.com.au).

   Copyright (c) 2007 Marc Grabanski (http://marcgrabanski.com/code/ui-datepicker)
   Dual licensed under the MIT (MIT-LICENSE.txt)
   and GPL (GPL-LICENSE.txt) licenses.
   Date: 09-03-2007  */


if(typeof(SNI.HGTV.Quiz)=='undefined'){SNI.HGTV.Quiz={};}
var total_a;var total_b;var total_c;var total_d;var aQuizAnswers;SNI.HGTV.Quiz.popupQuiz=function(url){total_a=0;total_b=0;total_c=0;total_d=0;aQuizAnswers=[];SNI.Util.popup(url,775,525);return false;};
if(typeof(SNI.HGTV.Omniture)=='undefined'){SNI.HGTV.Omniture={};}
SNI.Omniture.getLinkText=function($elt){var linkText="";linkText=$.trim($elt.closest("a").text());if(linkText==''&&$elt.is("img")){linkText='Photo : '+$elt.attr("alt");}else if($elt.closest("#hg-sitenav .subnav").length>0){$thislink=$elt.closest("a");if(!$thislink.is("#hg-sitenav .subnav li.nav > a")){linkText=$elt.closest("#hg-sitenav .subnav > li.nav").children("a").text()+'-'+linkText;}
linkText=$elt.closest("#hg-sitenav .topnav > li").children("a.toplink").text()+'-'+linkText;}
return linkText;}
SNI.HGTV.Omniture.ClickTrack=SNI.Omniture.MultiVar;SNI.HGTV.Omniture.ClickTrackSingle=SNI.Omniture.SingleVar;SNI.HGTV.Omniture.ClickTrackSingleCustom=function(jsel,module,propVal,trackEvent){var $el=$(jsel);if($el.length==0||$el.data('events.click.omniture')){return;}
$el.bind('click.omniture',function(e){var $clicked=$(e.target);var s=s_gi(s_account);s.linkTrackVars=propVal;if(trackEvent!=""){s.linkTrackEvents=trackEvent;}else{s.linkTrackEvents="None";}
s[propVal]=module;s.tl(this,'o',propVal);e.stopPropagation();});};SNI.HGTV.Omniture.HotSpotClick=function(oHS,mode){var s=s_gi('scrippshgtvnew');s.linkTrackVars='eVar46,eVar47,eVar48,events';if(mode=='c'){s.linkTrackEvents='event47';s.events='event47';}else{s.linkTrackEvents='event48';s.events='event48';}
if((oHS.marketplaceId=="")||(oHS.marketplaceId=="0")){s.eVar46="Non-Marketplace";}else{s.eVar46=oHS.marketplaceId;}
s.eVar47=oHS.name;s.eVar48=oHS.description;if(mode=='c'){s.tl(this,'o','Hotspot Click');}else{s.tl(this,'o','Hotspot Learn More');}
s.linkTrackVars='';s.linkTrackEvents='';s.events='';s.eVar46='';s.eVar47='';s.eVar48='';return;};

(function($){var DEFAULT_CONFIG={current_index:0,thumbnail_loader:"http://web.hgtv.com/webhgtv/hg20/imgs/hg-loader.gif",default_product_image_sm:"../img/product_unavailable_sm.jpg",default_product_image_lg:"../img/product_unavailable_al.jpg",images:null,interstitial_refresh_rate:5000};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,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_wrap,inter_next=false,print_link,inter_refreshed=true;loader_img.src=config.thumbnail_loader;function doDynOmni(i){++i;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"){s.t();}
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);}
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("pg-loading");clone.hide();clone.fadeIn("fast");}).error(function(){gallery_element.removeClass("pg-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:"602px"},200);current_data.image_wrapper.find("a.photo img").animate({width:"602px"},200);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(){current_data.image_wrapper.animate({width:"339px"},250);current_data.image_wrapper.find("a.photo img").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 loadPhotoInfo(index){var current_data=config.images[index];var caption_length=207;var cap_start,cap_end='';var next_index=(index+1)%config.images.length;doDynOmni(index);SNI.Util.hitCount();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("pg-loading");count_label.html(index+1);if(current_data.iid!="endframe"){photo_description.show();endframe_info.hide();if(current_data.ititle.length>41){caption_length=157;}
cap_start=current_data.icap_txt.substring(0,caption_length);if(cap_start.length<current_data.icap_txt.length){cap_end='<span class="pg-cap-elipse">&#8230; <span class="pg-show-caption">more</span></span><span class="pg-full-caption">'
+current_data.icap_txt.substring(caption_length,current_data.icap_txt.length)
+'</span>';photo_description.addClass("pg-short-caption");}else{photo_description.removeClass("pg-short-caption");}
var rendered_content=cap_start+cap_end;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();caption.find(".pg-full-caption").css({display:"inline"});caption.slideDown(175,function(){photo_description.removeClass("pg-short-caption");caption.html(current_data.icap)});});if(current_data.rtitle&&current_data.rtitle!=""){ymal.show();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();}
else{photo_author.hide();}}else{photo_description.hide();photo_author.hide();endframe_info.show();ymal.hide();}
$(thumbnails_frame.find(".pg-thumbnails li")[index]).addClass("pg-selected-thumbnail");if(!current_data.image_wrapper){createImageWrapper(current_data);}else{gallery_element.removeClass("pg-loading");current_data.image_wrapper.fadeIn("fast");}}
function applyHotspots(current_data){if(SNI.HGTV.Photogallery3.Hotspots){$(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+'" /><span><a href="javascript: void(0);">Back to this Photo</a></span></div>');var showProducts=function(e){SNI.HGTV.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">'
+'<h4><a class="hotspot_readmore_'+index+'" href="'+hotspot.url+'" target="_blank">'+hotspot.name+'</a></h4>'
+' <div class="pg-hsproduct-img"><a class="hotspot_readmore_'+index+'" href="'+hotspot.url+'" target="_blank"><img src="'+product_image_url+'" alt="'+hotspot.name+'" /></a></div>'
+' <p>'+product_description+'</p>'
+' <a class="pg-hsproduct-moreinfo 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},showProducts);hotspot_element.hover(hoverIn,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.HGTV.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").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.HGTV.Omniture.HotSpotClick(hotspotImage.hotspots[index],"1");e.stopPropagation();return true;});});}});}}
gallery.previousPhoto=function(e){e.preventDefault();if(!previous_button.hasClass("pg-disabled")){if(gallery_element.hasClass("pg-errored")){gallery_element.removeClass("pg-errored");}
inter_next=false;gallery.goToPhoto((current_index-1));}
e.preventDefault();};gallery.nextPhoto=function(e){if(!next_button.hasClass("pg-disabled")){if(gallery_element.hasClass("pg-errored")){gallery_element.removeClass("pg-errored");}
inter_next=true;gallery.goToPhoto(((current_index+1)%config.images.length));}
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");});_load_once=function(){return;};};gallery.showThumbnails=function(e){if(!gallery_element.hasClass("pg-loading")){_load_once();thumbnails_button.addClass("selected");thumbnails_frame.fadeIn("fast");}
e.stopPropagation();};gallery.hideThumbnails=function(e){thumbnails_button.removeClass("selected");thumbnails_frame.fadeOut("fast");e.stopPropagation();};gallery.toggleThumbnails=function(e){if(!gallery_element.hasClass("pg-loading")){_load_once();if(thumbnails_button.hasClass("selected")){thumbnails_button.removeClass("selected");}else{thumbnails_button.addClass("selected");}
thumbnails_frame.animate({opacity:'toggle'});}
e.stopPropagation();};gallery.goToPhoto=function(index,skip_interstitial){if(gallery_element.hasClass("pg-errored")){gallery_element.removeClass("pg-errored");}
if(!gallery_element.hasClass("pg-loading")){gallery_element.addClass("pg-loading");gallery_element.removeClass("interstitial-show");if(inter_refreshed===true&&!skip_interstitial&&SNI.HGTV.DynamicAds.refresh(inter_wrap)){gallery_element.removeClass("pg-loading");gallery_element.addClass("interstitial-show");inter_refreshed=false;setTimeout(function(){inter_refreshed=true;},config.interstitial_refresh_rate);return;}
hsproduct_wrapper.hide();if(current_index>=0){var previous_data=config.images[current_index];if(previous_data.image_wrapper){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=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.pg-thumbnails-button");thumbnails_frame=gallery_element.find(".pg-navigation .pg-thumbnails-frame");next_button=gallery_element.find(".pg-navigation .pg-next");previous_button=gallery_element.find(".pg-navigation .pg-previous");template_element=photo_display.children(".pg-photo-wrapper");photo_description=$(".pg-viewport .pg-photo-description");photo_author=$(".pg-author");caption_head=photo_description.children("h2");caption=photo_description.children("p");endframe_info=$(".pg-viewport .pg-endframe-info");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");inter_wrap=$('<div class="interwrap"></div>').appendTo(photo_display);print_link=$("#print-select a.this");current_index=config.current_index;config.images.push({iid:"endframe",image_wrapper:$(photo_display).children(".pg-endframe")});if(!config.images[current_index]){current_index=0;}
template_element.hide();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{toggler.hide();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);}
return false;});}
var applyHotspotImg=config.images[current_index];$.ajax({url:config.hotspotURL,dataType:"script",timeout:10000,success:function(data){SNI.HGTV.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(){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"><img src="'+product_image_url+'" /></div><p><a href="'+this.url+'">'+this.name+'</a></p></li>');});}});}});if(endframe_products.length>0){var endframe_products_list=$('<ul class="pg-endframe-products clrfix">'+endframe_products.join("\n")+'</ul>').appendTo(".pg-endframe .pg-endframe-content");var $endframe_products=endframe_products_list.find("li.hs-product");$($endframe_products[$endframe_products.length-1]).addClass("last");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 .pg-endframe-ymal-btn").click(function(){$(".pg-endframe .tabs .pg-endframe-products-btn").removeClass("selected");$(this).addClass("selected");$(".pg-endframe-content .pg-endframe-products").hide();$(".pg-endframe-content .recommend").fadeIn("fast");});$(".pg-endframe .tabs .pg-endframe-products-btn").click(function(){$(".pg-endframe .tabs .pg-endframe-ymal-btn").removeClass("selected");$(this).addClass("selected");$(".pg-endframe-content .recommend").hide();$(".pg-endframe-content .pg-endframe-products").fadeIn("fast");});$(".pg-endframe-products-btn").show();$(".pg-endframe .tabs .pg-endframe-products-btn").click();}};$("head").append('<script type="text/javascript">'+data+' \n SNI.HGTV.buildProductsTab(); </script>');},complete:function(){loadPhotoInfo(current_index);applyHotspots(config.images[current_index]);}});thumbnails_button.click(gallery.toggleThumbnails);thumbnails_frame.find(".pg-thumbnails li").each(function(index){jQuery(this).click(function(e){gallery.goToPhoto(index,false,true);gallery.hideThumbnails(e);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 button").click(function(e){gallery.goToPhoto(current_index);e.preventDefault();});next_button.click(gallery.nextPhoto);$("#toolbar .font-resize").find("li").click(function(){var defaultSize="100%";$(element).find("li.active").removeClass("active");$(this).addClass("active");if($(this).hasClass("med")){photo_description.css("font-size",defaultSize);}else if($(this).hasClass("sm")){photo_description.css("font-size","85%");}else{photo_description.css("font-size","116%");}});var share_url=SNI.Util.Url.setParameter(document.location.href,"soc","share");var page_title=jQuery("<div>"+mdManager.getPageTitle()+"</div>").text();var facebook_shared_object=SHARETHIS.addEntry({title:page_title,url:share_url});var twitter_shared_object=SHARETHIS.addEntry({title:page_title+" #HGTV ",url:share_url});facebook_shared_object.attachChicklet("facebook",endframe_info.find(".pg-share .facebook a")[0]);twitter_shared_object.attachChicklet("twitter",endframe_info.find(".pg-share .twitter a")[0]);endframe_info.find(".pg-share li a").click(function(){return false;});SNI.HGTV.DynamicAds.init(null,null,function(){var hRet="";with(SNI.HGTV.DynamicAds){hRet+='<div class="pg-inter-wrap">';hRet+='<a href="#" class="close"><span></span>Continue to Next Photo</a>';hRet+='<h6 class="mrec">Advertisement</h6>';hRet+='<div class="pg-inter-container">';if(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(iparm.iHREF!=""){hRet+='<a href="'+iparm.iHREF+'">';}
hRet+='<img src ="'+iparm.iURL+'" />';if(iparm.iHREF!=""){hRet+='</a>';}}
hRet+='<iframe class="tracker" width="0" height="0" frameborder="0"></iframe>';hRet+='</div>';hRet+='</div>';inter_wrap=$(hRet).appendTo(photo_display);$(inter_wrap).find(".close").click(function(e){gallery_element.removeClass("interstitial-show");if(inter_next){gallery.nextPhoto(e);}
else{gallery.previousPhoto(e);}
return false;});if(iparm.iFmt.toLowerCase()=="swf"){swfobject.embedSWF(iparm.iURL,"interad",iparm.iWidth,iparm.iHeight,"9","http://common.scrippsnetworks.com/common/flash-express-install/expressInstall.swf",null,{wmode:"transparent",allowScriptAccess:"always",quality:"high"});}
setDartEnterpriseBanner("BIGBOX",iparm.bURL);$(inter_wrap).find(".tracker").attr("src",iparm.iTrackURL);}
return;});return gallery;}
SNI.HGTV.PhotoGallery4=PhotoGallery;})(jQuery);