/* sni-hgtv - Thu, 19 Nov 2009 10:51:05 -0500 */

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

SNI.HGTV.ANIMATION_SPEED = 150;


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;}}
if(typeof SNI.Community=='undefined'){SNI.Community={};}
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);}};
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){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;}};
$.validator.setDefaults({errorElement:'span',onfocusout:false,onkeyup:false,onclick:false,highlight:function(element,errorClass){$(element).addClass(errorClass);$(element.form).find("label[for="+element.id+"]").addClass(errorClass);},unhighlight:function(element,errorClass){$(element).removeClass(errorClass);$(element.form).find("label[for="+element.id+"]").removeClass(errorClass);}});$.validator.addMethod("spaces",function(value,element){return this.optional(element)||value.indexOf(' ')==-1;},"Spaces are not allowed");$.validator.addMethod("multipleEmails",function(value,element){if(this.optional(element)){return true;}
var friendsEmails=value.split(",");var isEmail=true;$.each(friendsEmails,function(){var patternTest=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test($.trim(this));if(patternTest==false){isEmail=false;};});return isEmail;},"One of these is not a valid e-mail address");
SNI.HGTV.GlobalHeader={globalNav:function(){var navTimer=null;var initializeMenu="#hd-sub-nav li";hideAll();initMenu(initializeMenu);function initMenu(initializeMenu){var menu=initializeMenu;$(menu).find('h3:first span').click(function(){hideAll();});$(menu+"[@class ^= 'nav-']").each(function(i){menuItem=$(this);var leftOffset=menuItem.offset().left;var dropdownWidth=345;if(menuItem.hasClass("nav-e")){offsetVal=leftOffset-dropdownWidth+menuItem.outerWidth()+3;}else{offsetVal=leftOffset-1;}
menuItem.find('div.drop').css({left:offsetVal});menuItem.hover(function(e){hideAll();var $this=$(this);$this.addClass("dd-on");$this.find('div.drop').show();},function(e){clearTimeout(navTimer);navTimer=null;var closeDiv=$(this);navTimer=setTimeout(function(){closeDiv.removeClass("dd-on");closeDiv.find('div.drop').hide();navTimer=null;},100);});});if($.browser.msie&&(parseInt($.browser.version)<7)){var win=$(window);win.resize(function(){$('#hg-hd').width(($(this).width()<1002?1002:'auto'));});$('#hg-hd').width((win.width()<1002?1002:'auto'));}}
function hideAll(){clearTimeout(navTimer);navTimer=null;$("#hd-sub-nav li[@class ^= 'nav-']").each(function(){var navItem=$(this);navItem.removeClass("dd-on");navItem.find('div.drop').hide();});}},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("/search/autosuggest.do",{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 searchText=$.trim(form.find('input').val());var searchIn=$(form).find('option[@selected]').attr('id');var searchAction=$(form).find('select').val();if(searchText==''||searchText.toLowerCase()=='search'){return false;}else if(searchIn=='tv-shows'){$(this).attr('action',searchAction);}else if(searchIn=='rate-my-space'){window.location.href=searchAction+searchText;return false;}else if(searchIn=='designers-portfolio'){$(this).attr('action',searchAction);}else if(searchIn=='products'){searchText=searchText.replace(/\s+/,'+').toLowerCase();window.location.href=searchAction+searchText+'_keyword';return false;}
return true;});},myHGTV:function(){if((SNI.Community.UR.logged_in!=null)&&(SNI.Community.UR.logged_in=="true")){var dd=$('#my-hgtv .dd-list dd');$('#my-hgtv .dd-list').hover(function(){dd.show();},function(){var timer=setTimeout(function(){dd.hide();clearTimeout(timer);timer=null;},100);});dd.find('.dd-bd h3 a').click(function(){dd.hide();return false;});$('#my-hgtv .signed-in .hello a').text(SNI.Community.UR.ViewingUserDisplayName);$('#my-hgtv .not-signed-in').hide();$('#my-hgtv .signed-in').show();}},init:function(){SNI.HGTV.GlobalHeader.globalNav();SNI.HGTV.GlobalHeader.globalSearch('#hg-hd .search',true);SNI.HGTV.GlobalHeader.myHGTV();}};
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");});}};
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">';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>';}
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;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");$(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(Math.min($(prodSel).offset().top+$(prodSel).innerHeight()-parseInt($(prodSel).css("padding-bottom"))-$(prodSel+" .tab-wrap").offset().top,$(prodSel+" .tab-wrap ul").innerHeight()));}
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").outerWidth();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(SNI.HGTV.ANIMATION_SPEED);}).bind("mouseleave",function(){$(this).parent().find(".tnframe").hide(SNI.HGTV.ANIMATION_SPEED);});$("#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);SNI.HGTV.DynAds.refresh();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;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));$("#dynOmni").remove();$("body").append('<script id="#dynOmni" type="text/javascript">s.t();</script>');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:"",iTrackURL:"",bURL:""},impressionCt:1,init:function(){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;},cback_descrXML:function(myXML){if(typeof myXML!="object"){return false;}
if(myXML.documentElement.tagName==undefined){return false;}
if(myXML.documentElement.tagName!="photo_descriptor"){return false;}
tmp=$(myXML).find("active").attr("value");if(tmp!="true"){return false;}
tmp=parseInt($(myXML).find("refreshRate").attr("value"));if(isNaN(tmp)){return false;}
if(tmp<1||tmp>100){return false;}
SNI.HGTV.DynAds.descr.active=true;SNI.HGTV.DynAds.descr.refreshRate=tmp;tmp=$(myXML).find("interstitial").attr("value");if(tmp=="true"){SNI.HGTV.DynAds.descr.interstitial=true;}
return true;},refresh:function(){this.impressionCt++;if(this.impressionCt==this.descr.refreshRate){this.impressionCt=0;if(this.descr.interstitial){$.each(SNI.HGTV.DynAds.iparm,function(i,v){SNI.HGTV.DynAds.iparm[i]="";});myXML=getDartEnterpriseUrl("PHOTO_INTERSTITIAL",1);$.get(myXML,{},this.cback_inter,"xml");}else{setDartEnterpriseBanner("BIGBOX",getDartEnterpriseUrl("BIGBOX",5));}}
return;},cback_inter:function(myXML){if(typeof myXML!="object"){return false;}
if(myXML.documentElement.tagName==undefined){return false;}
if(myXML.documentElement.tagName!="scrippsads"){return false;}
$ad=$(myXML).find("ad:has(\"position[id='interstitial']\")");if(typeof $ad!="object"){return false;}
$tmp=$ad.find("media");if(typeof $tmp!="object"){return false;}
with(SNI.HGTV.DynAds){with(iparm){iURL=$tmp.attr("src");iFmt=$tmp.attr("format");iHREF=$tmp.attr("href");$tmp=$ad.find("tracking audit");iTrackURL=$tmp.attr("src");$ad=$(myXML).find("ad:has(\"position[id='300syncBanner']\")");bURL=$ad.find("media").attr("src");if(iURL==""||iFmt==""||bURL==""){return false;}}
gen_interstitial();}
return true;},gen_interstitial:function(){hRet="";with(SNI.HGTV.DynAds.iparm){hRet+='<div class="interwrap">';hRet+='<h6>Advertisement</h6>';hRet+='<a href="#" class="close">Close Ad</a>';if(iFmt.toLowerCase()=="swf"){hRet+='<div id="interad"></div>';}else{if(iHREF!=""){hRet+='<a href="'+iHREF+'">';}
hRet+='<img src ="'+iURL+'" />';if(iHREF!=""){hRet+='</a>';}}
hRet+='<iframe class="tracker" width="0" height="0" frameborder="0"></iframe>';hRet+='</div>';$("#pgallery3 .photowrap").append(hRet);$("#pgallery3 .interwrap .close").click(function(){$("#pgallery3 .interwrap").remove();return false;});if(iFmt.toLowerCase()=="swf"){swfobject.embedSWF(iURL,"interad","585","400","9","http://common.scrippsnetworks.com/common/flash-express-install/expressInstall.swf");}
setDartEnterpriseBanner("BIGBOX",bURL);$("#pgallery3 .interwrap .tracker").attr("src",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;}};
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();});});}
(function($){$.fn.countDown=function(options){var options=$.extend({date:'January 1, 2099 00:00:00',updateInterval:1,wraps:null,onExpire:function(){}},options);return this.each(function(i){var obj=this;var today=new Date();var endDate=new Date(options.date);var ms=Math.floor(endDate.getTime()-today.getTime())
function two(x){return((x>9)?"":"0")+x}
function three(x){return((x>99)?"":"0")+((x>9)?"":"0")+x}
function MS2DHMSMS(ms){var nt={};var sec=Math.floor(ms/1000);ms=ms%1000;nt.ms=three(ms).toString();var min=Math.floor(sec/60);sec=sec%60;nt.ss=two(sec).toString();var hr=Math.floor(min/60);min=min%60;nt.mm=two(min).toString();var day=Math.floor(hr/24);hr=hr%24;nt.hh=two(hr).toString();nt.dd=day.toString();return nt;}
function getTimeLeft(){var today=new Date();var ms=Math.floor(endDate.getTime()-today.getTime())
sLeft=MS2DHMSMS(ms).ss;mLeft=MS2DHMSMS(ms).mm;hLeft=MS2DHMSMS(ms).hh;dLeft=MS2DHMSMS(ms).dd;if(options.wraps==null)
$(obj).html('<span class="jcdDays">'+dLeft+'</span>&nbsp;<span class="jcdDaysText">day'+s+'</span>&nbsp;<span class="jcdHours">'+hLeft+'</span>:<span class="jcdMinutes">'+mLeft+'</span>:<span class="jcdSeconds">'+sLeft+'</span>');else{for(x in options.wraps){if(x=='days')$(options.wraps[x]).html(dLeft);if(x=='hours')$(options.wraps[x]).html(hLeft);if(x=='minutes')$(options.wraps[x]).html(mLeft);if(x=='seconds')$(options.wraps[x]).html(sLeft);}}};if(parseInt(MS2DHMSMS(ms).dd)<0)
options.onExpire.call(this,obj);else
if(options.updateInterval)setInterval(function(){getTimeLeft();},options.updateInterval*500);else getTimeLeft();});};})(jQuery);
if(typeof(SNI.HGTV.Player)=='undefined'){SNI.HGTV.Player={};}
SNI.HGTV.Player.Configs={FullSize:{enableSyncAdFix:1,dimensions:{width:'576',height:'645'},flashvars:{config:"http://web.hgtv.com/webhgtv/hg20/snap-configs/hgtv-player-fullsize-playlist-title.xml",channel:'',channelurl:'',videoid:''},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},FullSizeNoPlaylist:{enableSyncAdFix:1,dimensions:{width:'576',height:'460'},flashvars:{config:"http://web.hgtv.com/webhgtv/hg20/snap-configs/hgtv-player-fullsize-noplaylist.xml",channel:'',channelurl:'',videoid:''},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},RightRail:{enableSyncAdFix:0,dimensions:{width:'320',height:'360'},flashvars:{config:"http://web.hgtv.com/webhgtv/hg20/snap-configs/hgtv-player-rightrail.xml",channel:'',channelurl:'',videoid:''},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},Blog:{enableSyncAdFix:1,dimensions:{width:'320',height:'263'},flashvars:{config:"http://web.hgtv.com/webhgtv/hg20/snap-configs/hgtv-player-blog.xml",channel:'',channelurl:'',videoid:''},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},Lead:{enableSyncAdFix:1,dimensions:{width:'400',height:'300'},flashvars:{config:"http://web.hgtv.com/webhgtv/hg20/snap-configs/hgtv-player-lead.xml",channel:'',channelurl:'',videoid:''},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}}};SNI.HGTV.Player.FullSize=function(divId,channelId,videoId,playlistTitle){return new SNI.Player.SNAP(divId,SNI.HGTV.Player.Configs.FullSize,channelId,videoId,playlistTitle);};SNI.HGTV.Player.Big=SNI.HGTV.Player.FullSize;SNI.HGTV.Player.VideoLibrary=SNI.HGTV.Player.FullSize;SNI.HGTV.Player.FullSizeNoPlaylist=function(divId,channelId,videoId){return new SNI.Player.SNAP(divId,SNI.HGTV.Player.Configs.FullSizeNoPlaylist,channelId,videoId);};SNI.HGTV.Player.VideoAsset=SNI.HGTV.Player.FullSizeNoPlaylist;SNI.HGTV.Player.RightRail=function(divId,channelId,videoId){return new SNI.Player.SNAP(divId,SNI.HGTV.Player.Configs.RightRail,channelId,videoId);};SNI.HGTV.Player.RightRailMyHGTV=function(divId,channelId,videoId){buildChannelFeedUrlForPickle=function(chId){return'http://www.hgtv.com/hgtv/channel/xml/0,,'+chId+',00.xml';};return new SNI.Player.SNAP(divId,SNI.HGTV.Player.Configs.RightRail,channelId,videoId,'',buildChannelFeedUrlForPickle);};SNI.HGTV.Player.Blog=function(divId,channelId,videoId){buildChannelFeedUrlForBlogs=function(chId){return'http://www.hgtv.com/hgtv/channel/xml/0,,'+chId+',00.xml';};return new SNI.Player.SNAP(divId,SNI.HGTV.Player.Configs.Blog,channelId,videoId,'',buildChannelFeedUrlForBlogs);};SNI.HGTV.Player.BigBlog=function(divId,channelId,videoId){buildChannelFeedUrlForBlogs=function(chId){return'http://www.hgtv.com/hgtv/channel/xml/0,,'+chId+',00.xml';};return new SNI.Player.SNAP(divId,SNI.HGTV.Player.Configs.FullSizeNoPlaylist,channelId,videoId,'',buildChannelFeedUrlForBlogs);};SNI.HGTV.Player.Lead=function(divId,channelId,videoId){return new SNI.Player.SNAP(divId,SNI.HGTV.Player.Configs.Lead,channelId,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){case"GOOGLE_BIGBOX":case"GOOGLE_LEADERBOARD":if(mdManager.getParameterString("Sponsorship")==""){writeAd(ad);}else{$(".google-text-ads").hide();}
break;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",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(){var module=$("#email-a-friend");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();}});}});},init:function(){SNI.HGTV.Toolbar.fontResize(".font-resize");SNI.HGTV.Toolbar.printPage();SNI.HGTV.Toolbar.emailAFriend();}};
(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");}});}};
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").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></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(){$("#dp-expanded-nav .wrap").dpl('carousel',{pagelink:"image"});$("#dp-nav-spaces, #dp-expanded-nav .hd span").click(function(){$("#dp-nav-spaces").toggleClass("open");if($("#dp-nav-spaces").hasClass("open")){var h=$("#dp-expanded-nav .wrap").outerHeight()+"px";$("#dp-expanded-nav").animate({height:h},800,"easeOutBack",function(){});$("#dp-nav-rule").css({marginLeft:0,marginRight:0});}else{$("#dp-expanded-nav").animate({height:0},500,"easeOutCubic",function(){$("#dp-nav-rule").animate({marginLeft:"14px",marginRight:"14px"},300,"easeOutSine",function(){});});}});},browseByStyle:function(){$("#browse-by-style .nav li").each(function(i){$(this).click(function(){$("#browse-by-style .active").removeClass("active");$(this).addClass("active");$("#browse-by-style .bbsctnt:eq("+i+")").addClass("active");});if($(this).hasClass("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);}});}}};
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.Sweepstakes)==="undefined"){SNI.HGTV.Sweepstakes={};}
SNI.HGTV.Sweepstakes={init:function(){var validator=$("#sweepsEntryForm").validate({debug:false,rules:{fvFirst:"required",fvLast:"required",fvAddress1:"required",fvCity:"required",fvState:"required",fvZip:{required:true,digits:true},fvEvePhone:{required:true,phoneUS:true},fvEmail:"email",fvEmail:{required:true,email:true},fvEmailConfirm:{required:true,equalTo:"#fvEmail"},fvGender:"required"},messages:{fvFirst:"Please enter your first name",fvLast:"Please enter your last name",fvAddress1:"Please enter your address",fvCity:"Please enter your city",fvState:"Please select your state",fvZip:"Please enter your 5 digit ZIP code",fvEvePhone:"Please enter a valid phone number",fvEmail:"Please enter an e-mail address",fvEmailConfirm:"Please make sure your e-mails match",fvGender:"Please select your gender"},errorContainer:".form-errors",errorLabelContainer:$(".list-alt",".form-errors"),wrapper:"li",showErrors:function(errorMap,errorList){if(errorList.length){$('html, body').fadeIn().animate({scrollTop:0},'slow');this.defaultShowErrors();}else{if(window.onbeforeunload!="undefined"){window.onbeforeunload=null;}}}});$.validator.addMethod("phoneUS",function(phone_number,element){phone_number=phone_number.replace(/\s+/g,"");return this.optional(element)||phone_number.length>9&&phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);},"Please specify a valid phone number");$(".hgtv-nl").find("#optionalall").click(function(){var $this=$(this);var checkValue=$this.find('span').html();if(checkValue==='Check All'){$(".hgtv-nl input[@type=checkbox],.sponsor-offer input[@type=checkbox]").each(function(){$(".hgtv-nl input[@type='checkbox'],.sponsor-offer input[@type=checkbox]").attr('checked',true);});$this.find('span').html('Uncheck All');}else{$(".hgtv-nl input[@type=checkbox],.sponsor-offer input[@type=checkbox]").each(function(){$(".hgtv-nl input[@type='checkbox'],.sponsor-offer input[@type=checkbox]").attr('checked',false);});$this.find('span').html('Check All');}
return false;});$(".acco-content").find("#optionalall").click(function(){var $this=$(this);var checkValue=$this.find('span').html();if(checkValue==='Check All'){$(".acco-content input[@type=checkbox]").each(function(){$(".acco-content input[@type='checkbox']").attr('checked',true);});$this.find('span').html('Uncheck All');}else{$(".acco-content input[@type=checkbox]").each(function(){$(".acco-content input[@type='checkbox']").attr('checked',false);});$this.find('span').html('Check All');}
return false;});}};function confirmExit(e){if(!e)e=window.event;e.cancelBubble=true;return"It appears you have not entered the sweepstakes.\nDon't miss a chance to win the Design Star Sweepstakes.";if(e.stopPropagation){e.stopPropagation();e.preventDefault();}}
SNI.HGTV.Sweepstakes.Thanks={stf:function(){var validator=$("#sweepsStfForm").validate({debug:false,rules:{senderName:"required",senderEmail:"email",senderEmail:{required:true,email:true},recipientemail1:"email",recipientemail1:{required:true,email:true}},messages:{senderName:"Please enter your name",senderEmail:"Please enter an e-mail address",recipientemail1:"Please enter at least one Friend's e-mail address"},errorContainer:".form-errors",errorLabelContainer:$(".list-alt",".form-errors"),wrapper:"li",showErrors:function(errorMap,errorList){if(errorList.length){$('html, body').fadeIn().animate({scrollTop:0},'slow');this.defaultShowErrors();}}});}};
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.OnHGTV={init:function(){$(".tvschedule").dpl("accordion");$('.tvschedule .acco-link a').click(function(){if($(this).parents().is('li.selected')){window.location.href=this.href;return true;}});}};
if(typeof(SNI.HGTV.SweepsInvite)=="undefined"){SNI.HGTV.SweepsInvite={};}
SNI.HGTV.SweepsInvite={invite:"#sweeps-invite",revealModule:function(trigger,module){$(SNI.HGTV.SweepsInvite.invite).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");};},inviteAFriend:function(){var module=$("#invite-a-friend");var form=module.find("form");var null_value="";SNI.HGTV.Omniture.ClickTrackSingleCustom("#invite-button","GH09:InviteFriends","prop2","")
SNI.HGTV.SweepsInvite.revealModule(".email",module);$(".close").click(function(){SNI.HGTV.SweepsInvite.closeModule(".email",module);});$(".form-submit a").click(function(){SNI.HGTV.SweepsInvite.closeModule(".email",module);return false;});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"]');msg_body_full=form.find('input[name="from_name"]').val()+msg_body;txtarea.val(msg_body_full);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();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"){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');form.hide();success.show();var timeout=setTimeout(function(){SNI.HGTV.SweepsInvite.closeModule(".email",module,300);module.hide();success.hide();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.SweepsInvite.closeModule(".email",module);module.hide();success.hide();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();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();}});}});}};
if(typeof(SNI.HGTV.DesignStar)=='undefined'){SNI.HGTV.DesignStar={};}
SNI.HGTV.DesignStar.dsTabs=function(jsel){$('.ds-tabs .ui-tabs-nav li').each(function(i){$(this).addClass("tab-num-"+i);});$('.ds-tabs .tab-well').each(function(i){$(this).addClass("tab-num-"+i);});$('.ds-tabs .tab-well').not(".tab-num-0").hide();$('.ds-tabs .ui-tabs-nav li').click(function(){if($(this).hasClass('ui-tabs-selected')){return false;}else{$(this).siblings().removeClass('ui-tabs-selected');var selectedClass=$(this).attr("class");$('.ds-tabs .tab-well').each(function(){if($(this).hasClass(selectedClass)){$(this).show();$(this).siblings().hide();}});$(this).addClass('ui-tabs-selected');return false;}});};SNI.HGTV.DesignStar.bodyHook=function(){var bodyClass=$('#body-hook').attr('rel');$('body').addClass(bodyClass);};SNI.HGTV.DesignStar.Medialibrary=function(element,config){togglelist=$(element).find('li.switch');carouselCount=0;togglelist.each(function(){var $this=$(this);var target=$this.find("h4");if(carouselCount<4){$this.addClass("selected");}
if(!$this.hasClass("selected")){$this.find(".channel-bd").hide();}
target.click(function(){if($this.hasClass("selected")){$this.removeClass("selected");$this.find(".channel-bd").hide();}else{$this.addClass("selected");$this.find(".channel-bd").show();}
carouselCount++;});});};SNI.HGTV.DesignStar.ThankYouToggle=function(element,config){var submitStatus='';if($.query.has('fvEmail')){submitStatus=$.query.get('fvEmail');}
if(submitStatus!=''){$("#thank-you-message").show();}
$("#ty-close").click(function(){$("#thank-you-message").hide();});};SNI.HGTV.DesignStar.ReminderSignUp={remind:"#reminders",revealModule:function(trigger,module){$(SNI.HGTV.DesignStar.ReminderSignUp.remind).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");}},signUp:function(){var module=$("#reminder-signup");var form=module.find("form");var null_value="";SNI.HGTV.DesignStar.ReminderSignUp.revealModule(".reminder",module);$(".close").click(function(){SNI.HGTV.DesignStar.ReminderSignUp.closeModule(".reminder",module);});$(".form-submit a").click(function(){SNI.HGTV.DesignStar.ReminderSignUp.closeModule(".reminder",module);return false;});form.validate({debug:false,rules:{FIRST_NAME_:"required",LAST_NAME_:"required",email:"email",email:{required:true,email:true},email_confirm:{required:true,equalTo:"#email"}},messages:{FIRST_NAME_:"Please enter your first name",LAST_NAME_:"Please enter your last name",email:"Please enter an e-mail address",email_confirm:"Please make sure your e-mails match"},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]];}}});}};(function($){$.fn.countDown2=function(options){var options=$.extend({container:null,date:'January 1, 2099 00:00:00',updateInterval:.5,wraps:null,onExpire:function(){}},options);return this.each(function(i){var obj=this;var today=new Date();var endDate=new Date(options.date);var ms=Math.floor(endDate.getTime()-today.getTime());function two(x){return((x>9)?"":"0")+x};function three(x){return((x>99)?"":"0")+((x>9)?"":"0")+x};function MS2DHMSMS(ms){var nt={};var sec=Math.floor(ms/1000);ms=ms%1000;nt.ms=three(ms).toString();var min=Math.floor(sec/60);sec=sec%60;nt.ss=two(sec).toString();var hr=Math.floor(min/60);min=min%60;nt.mm=two(min).toString();var day=Math.floor(hr/24);hr=hr%24;nt.hh=two(hr).toString();nt.dd=day.toString();return nt;}
function getTimeLeft(){var today=new Date();var ms=Math.floor(endDate.getTime()-today.getTime());sLeft=MS2DHMSMS(ms).ss;mLeft=MS2DHMSMS(ms).mm;hLeft=MS2DHMSMS(ms).hh;dLeft=MS2DHMSMS(ms).dd;if(dLeft<=0){if(hLeft<=0){if(mLeft<=0){if(sLeft<=0){options.onExpire.call(this,obj);}}}}
if(options.wraps==null){$(obj).html('<span class="jcdDays">'+dLeft+'</span>&nbsp;<span class="jcdDaysText">day'+s+'</span>&nbsp;<span class="jcdHours">'+hLeft+'</span>:<span class="jcdMinutes">'+mLeft+'</span>:<span class="jcdSeconds">'+sLeft+'</span>');}else{for(x in options.wraps){if(x=='days'){$(options.wraps[x]).html(dLeft);}
if(x=='hours'){$(options.wraps[x]).html(hLeft);}
if(x=='minutes'){$(options.wraps[x]).html(mLeft);}
if(x=='seconds'){$(options.wraps[x]).html(sLeft);}}}};if(options.container){$(options.container).css('display','block');obj.container=options.container;}
if(parseInt(MS2DHMSMS(ms).dd)<0){options.onExpire.call(this,obj);}else{if(options.updateInterval){setInterval(function(){getTimeLeft();},options.updateInterval*1000);}else{getTimeLeft();}}});};})(jQuery);
/* 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  */

/* Date picker manager.
   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
   Settings for (groups of) date pickers are maintained in an instance object
   (DatepickerInstance), allowing multiple different settings on the same page. */

function Datepicker(){this.debug=false;this._nextId=0;this._inst=[];this._curInst=null;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this.regional=[];this.regional['']={clearText:'Clear',clearStatus:'Erase the current date',closeText:'Close',closeStatus:'Close without change',prevText:'&#x3c;Prev',prevStatus:'Show the previous month',nextText:'Next&#x3e;',nextStatus:'Show the next month',currentText:'Today',currentStatus:'Show the current month',monthNames:['January','February','March','April','May','June','July','August','September','October','November','December'],monthNamesShort:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],monthStatus:'Show a different month',yearStatus:'Show a different year',weekHeader:'Wk',weekStatus:'Week of the year',dayNames:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],dayNamesShort:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],dayNamesMin:['Su','M','Tu','W','Th','F','Sa'],dayStatus:'Set DD as first week day',dateStatus:'Select DD, M d',dateFormat:'mm/dd/y',firstDay:0,initStatus:'Select a date',isRTL:false};this._defaults={showOn:'focus',showAnim:'',hideAnim:'',defaultDate:null,appendText:'',buttonText:'...',buttonImage:'',buttonImageOnly:false,closeAtTop:true,mandatory:true,hideIfNoPrevNext:false,changeMonth:true,changeYear:true,yearRange:'-10:+10',changeFirstDay:false,showOtherMonths:false,showWeeks:false,calculateWeek:this.iso8601Week,shortYearCutoff:'+10',showStatus:false,statusForDate:this.dateStatus,minDate:null,maxDate:null,speed:'medium',beforeShowDay:null,beforeShow:null,onSelect:null,numberOfMonths:1,stepMonths:1,stepYears:1,rangeSelect:false,rangeSeparator:' - ',title:'Select a Day',selectionType:'day',highlightWeek:false,otherMonthsActive:false,printRange:false};$.extend(this._defaults,this.regional['']);this._datepickerDiv=$('<div id="datepicker"><div class="hd"></div><div class="bd"></div><div class="ft"></div></div>');}
$.extend(Datepicker.prototype,{markerClassName:'hasDatepicker',log:function(){if(this.debug){console.log.apply('',arguments);}},_register:function(inst){var id=this._nextId++;this._inst[id]=inst;return id;},_getInst:function(id){return this._inst[id]||id;},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this;},_doKeyDown:function(e){var inst=$.datepicker._getInst(this._calId);if($.datepicker._datepickerShowing){switch(e.keyCode){case 9:$.datepicker.hideDatepicker('');break;case 13:$.datepicker._selectDay(inst,inst._selectedMonth,inst._selectedYear,$('td.datepicker_daysCellOver',inst._datepickerDiv)[0]);return false;case 27:$.datepicker.hideDatepicker(inst._get('speed'));break;case 33:$.datepicker._adjustDate(inst,(e.ctrlKey?-1:-inst._get('stepMonths')),(e.ctrlKey?'Y':'M'));break;case 34:$.datepicker._adjustDate(inst,(e.ctrlKey?+1:+inst._get('stepMonths')),(e.ctrlKey?'Y':'M'));break;case 35:if(e.ctrlKey){$.datepicker._clearDate(inst);}
break;case 36:if(e.ctrlKey){$.datepicker._gotoToday(inst);}
break;case 37:if(e.ctrlKey){$.datepicker._adjustDate(inst,-1,'D');}
break;case 38:if(e.ctrlKey){$.datepicker._adjustDate(inst,-7,'D');}
break;case 39:if(e.ctrlKey){$.datepicker._adjustDate(inst,+1,'D');}
break;case 40:if(e.ctrlKey){$.datepicker._adjustDate(inst,+7,'D');}
break;}}
else if(e.keyCode==36&&e.ctrlKey){$.datepicker.showFor(this);}},_doKeyPress:function(e){var inst=$.datepicker._getInst(this._calId);var chars=$.datepicker._possibleChars(inst._get('dateFormat'));var chr=String.fromCharCode(e.charCode==undefined?e.keyCode:e.charCode);return(chr<' '||!chars||chars.indexOf(chr)>-1);},_connectDatepicker:function(target,inst){var input=$(target);if(this._hasClass(input,this.markerClassName)){return;}
var appendText=inst._get('appendText');var isRTL=inst._get('isRTL');if(appendText){if(isRTL){input.before('<span class="datepicker_append">'+appendText+'</span>');}
else{input.after('<span class="datepicker_append">'+appendText+'</span>');}}
var showOn=inst._get('showOn');if(showOn=='focus'||showOn=='both'){input.focus(this.showFor);}
if(showOn=='button'||showOn=='both'){var buttonText=inst._get('buttonText');var buttonImage=inst._get('buttonImage');var buttonImageOnly=inst._get('buttonImageOnly');var trigger=$(buttonImageOnly?'<img class="datepicker_trigger" src="'+
buttonImage+'" alt="'+buttonText+'" title="'+buttonText+'"/>':'<button type="button" class="datepicker_trigger">'+(buttonImage!=''?'<img src="'+buttonImage+'" alt="'+buttonText+'" title="'+buttonText+'"/>':buttonText)+'</button>');input.wrap('<span class="datepicker_wrap"></span>');if(isRTL){input.before(trigger);}
else{input.after(trigger);}
trigger.click(this.showFor);}
input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress);input[0]._calId=inst._id;},_inlineDatepicker:function(target,inst){var input=$(target);if(this._hasClass(input,this.markerClassName)){return;}
input.addClass(this.markerClassName).append(inst._datepickerDiv);input[0]._calId=inst._id;this._updateDatepicker(inst);},_inlineShow:function(inst){var numMonths=inst._getNumberOfMonths();inst._datepickerDiv.width(numMonths[1]*$('.datepicker',inst._datepickerDiv[0]).width());},_hasClass:function(element,className){var classes=element.attr('class');return(classes&&classes.indexOf(className)>-1);},dialogDatepicker:function(dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){inst=this._dialogInst=new DatepickerInstance({},false);this._dialogInput=$('<input type="text" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$('body').append(this._dialogInput);this._dialogInput[0]._calId=inst._id;}
extendRemove(inst._settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY];}
this._dialogInput.css('left',this._pos[0]+'px').css('top',this._pos[1]+'px');inst._settings.onSelect=onSelect;this._inDialog=true;this._datepickerDiv.addClass('datepicker_dialog');this.showFor(this._dialogInput[0]);if($.blockUI){$.blockUI(this._datepickerDiv);}
return this;},showFor:function(control){control=(control.jquery?control[0]:(typeof control=='string'?$(control)[0]:control));var input=(control.nodeName&&control.nodeName.toLowerCase()=='input'?control:this);if(input.nodeName.toLowerCase()!='input'){input=$('input',input.parentNode)[0];}
if($.datepicker._lastInput==input){return;}
if($(input).isDisabledDatepicker()){return;}
var inst=$.datepicker._getInst(input._calId);var beforeShow=inst._get('beforeShow');extendRemove(inst._settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker.hideDatepicker('');$.datepicker._lastInput=input;inst._setDateFromField(input);if($.datepicker._inDialog){input.value='';}
if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight;}
var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css('position')=='fixed';});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop;}
if(!$.datepicker._inDialog){var iconOffset=7;var horizontalOffset=$(inst._input).outerWidth()-$.datepicker._datepickerDiv.outerWidth()-iconOffset;$.datepicker._pos[0]=$.datepicker._pos[0]+horizontalOffset;}
inst._datepickerDiv.css('position',($.datepicker._inDialog&&$.blockUI?'static':(isFixed?'fixed':'absolute'))).css('left',$.datepicker._pos[0]+'px').css('top',$.datepicker._pos[1]+'px');$.datepicker._pos=null;$.datepicker._showDatepicker(inst);return this;},_showDatepicker:function(id){var inst=this._getInst(id);inst._rangeStart=null;this._updateDatepicker(inst);if(!inst._inline){var speed=inst._get('speed');var postProcess=function(){$.datepicker._datepickerShowing=true;$.datepicker._afterShow(inst);};inst._input.addClass('datepicker_open');var showAnim=inst._get('showAnim');if(showAnim){inst._datepickerDiv[showAnim](speed,postProcess);}else{inst._datepickerDiv.show();speed='';}
if(speed==''){postProcess();}
if(inst._input[0].type!='hidden'){inst._input[0].focus();}
this._curInst=inst;}},_updateDatepicker:function(inst){inst._datepickerBody.empty().append(inst._generateDatepicker());var numMonths=inst._getNumberOfMonths();if(numMonths[0]!=1||numMonths[1]!=1){inst._datepickerBody.addClass('datepicker_multi');}
else{inst._datepickerBody.removeClass('datepicker_multi');}
if(inst._get('isRTL')){inst._datepickerBody.addClass('datepicker_rtl');}
else{inst._datepickerBody.removeClass('datepicker_rtl');}
if(inst._input&&inst._input[0].type!='hidden'){inst._input[0].focus();}},_afterShow:function(inst){var numMonths=inst._getNumberOfMonths();var isFixed=inst._datepickerDiv.css('position')=='fixed';var pos=inst._input?$.datepicker._findPos(inst._input[0]):null;var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=(isFixed?0:document.documentElement.scrollLeft||document.body.scrollLeft);var scrollY=(isFixed?0:document.documentElement.scrollTop||document.body.scrollTop);if(inst._datepickerDiv.offset().left<0){inst._datepickerDiv.css('left','5px');}
if((inst._datepickerDiv.offset().top+inst._datepickerDiv.height()-
(isFixed&&$.browser.msie?document.documentElement.scrollTop:0))>(browserHeight+scrollY)){inst._datepickerDiv.css('top',Math.max(scrollY,pos[1]-(this._inDialog?0:inst._datepickerDiv.height())-
(isFixed&&$.browser.opera?document.documentElement.scrollTop:0))+'px');}},_findPos:function(obj){while(obj&&(obj.type=='hidden'||obj.nodeType!=1)){obj=obj.nextSibling;}
var curleft=0;var curtop=0;if(obj&&obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){var origcurleft=curleft;curleft+=obj.offsetLeft;if(curleft<0){curleft=origcurleft;}
curtop+=obj.offsetTop;}}
return[curleft,curtop];},hideDatepicker:function(speed){var inst=this._curInst;if(!inst){return;}
var rangeSelect=inst._get('rangeSelect');if(rangeSelect&&this._stayOpen){this._selectDate(inst,inst._formatDate(inst._currentDay,inst._currentMonth,inst._currentYear));}
this._stayOpen=false;if(this._datepickerShowing){speed=(speed!=null?speed:inst._get('speed'));inst._input.removeClass('datepicker_open');hideAnim=inst._get('hideAnim');if(hideAnim){inst._datepickerDiv[hideAnim](speed,function(){$.datepicker._tidyDialog(inst);});}else{inst._datepickerDiv.hide();speed='';}
if(speed===''){this._tidyDialog(inst);}
this._datepickerShowing=false;this._lastInput=null;inst._settings.prompt=null;if(this._inDialog){this._dialogInput.css('position','absolute').css('left','0px').css('top','-100px');if($.blockUI){$.unblockUI();$('body').append(this._datepickerDiv);}}
this._inDialog=false;}
this._curInst=null;},_tidyDialog:function(inst){inst._datepickerDiv.removeClass('datepicker_dialog');$('.datepicker_prompt',inst._datepickerDiv).remove();},_checkExternalClick:function(event){if(!$.datepicker._curInst){return;}
var target=$(event.target);if((target.parents("#datepicker").length==0)&&(target.attr('class')!='datepicker_trigger')&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker.hideDatepicker('');}},_adjustDate:function(id,offset,period){var inst=this._getInst(id);inst._adjustDate(offset,period);this._updateDatepicker(inst);},_gotoToday:function(id){var date=new Date();var inst=this._getInst(id);inst._selectedDay=date.getDate();inst._selectedMonth=date.getMonth();inst._selectedYear=date.getFullYear();this._adjustDate(inst);},_selectMonthYear:function(id,select,period){var inst=this._getInst(id);inst._selectingMonthYear=false;inst[period=='M'?'_selectedMonth':'_selectedYear']=select.options[select.selectedIndex].value-0;this._adjustDate(inst);},_clickMonthYear:function(id){var inst=this._getInst(id);if(inst._input&&inst._selectingMonthYear&&!$.browser.msie){inst._input[0].focus();}
inst._selectingMonthYear=!inst._selectingMonthYear;},_changeFirstDay:function(id,day){var inst=this._getInst(id);inst._settings.firstDay=day;this._updateDatepicker(inst);},_selectDay:function(id,month,year,td){if(this._hasClass($(td),'datepicker_unselectable')){return;}
var inst=this._getInst(id);var weekSelect=inst._get('selectionType')=='week';var rangeSelect=inst._get('rangeSelect');var printRange=inst._get('printRange');if(rangeSelect){if(!this._stayOpen){$('.datepicker_table td').removeClass('datepicker_currentDay');$(td).addClass('datepicker_currentDay');}
this._stayOpen=!this._stayOpen;}
inst._currentDay=$('a',td).html();inst._currentMonth=month;inst._currentYear=year;this._selectDate(id,inst._formatDate(inst._currentDay,inst._currentMonth,inst._currentYear));if(printRange){selectedDate=$.datepicker.parseDate(inst._get('dateFormat'),inst._formatDate(inst._currentDay,inst._currentMonth,inst._currentYear));selectedDate.setDate(selectedDate.getDate()-selectedDate.getDay());inst._currentDay=selectedDate.getDate();inst._currentMonth=selectedDate.getMonth();inst._currentYear=selectedDate.getFullYear();inst._rangeStart=new Date(inst._currentYear,inst._currentMonth,inst._currentDay);endDate=new Date(inst._currentYear,inst._currentMonth,inst._currentDay);endDate.setDate(endDate.getDate()+6);this._selectDate(id,inst._formatDate(endDate.getDate(),endDate.getMonth(),endDate.getFullYear()));inst._rangeStart=null;}
else if(this._stayOpen){inst._endDay=inst._endMonth=inst._endYear=null;inst._rangeStart=new Date(inst._currentYear,inst._currentMonth,inst._currentDay);this._updateDatepicker(inst);}
else if(rangeSelect){inst._endDay=inst._currentDay;inst._endMonth=inst._currentMonth;inst._endYear=inst._currentYear;inst._selectedDay=inst._currentDay=inst._rangeStart.getDate();inst._selectedMonth=inst._currentMonth=inst._rangeStart.getMonth();inst._selectedYear=inst._currentYear=inst._rangeStart.getFullYear();inst._rangeStart=null;if(inst._inline){this._updateDatepicker(inst);}}},_clearDate:function(id){var inst=this._getInst(id);this._stayOpen=false;inst._endDay=inst._endMonth=inst._endYear=inst._rangeStart=null;this._selectDate(inst,'');},_selectDate:function(id,dateStr){var inst=this._getInst(id);dateStr=(dateStr!=null?dateStr:inst._formatDate());if(inst._rangeStart){dateStr=inst._formatDate(inst._rangeStart)+inst._get('rangeSeparator')+dateStr;}
if(inst._input){inst._input.val(dateStr);}
var onSelect=inst._get('onSelect');if(onSelect){onSelect.apply((inst._input?inst._input[0]:null),[dateStr,inst]);}
else{if(inst._input){inst._input.trigger('change');}}
if(inst._inline){this._updateDatepicker(inst);}
else{if(!this._stayOpen){this.hideDatepicker(inst._get('speed'));this._lastInput=inst._input[0];if(typeof(inst._input[0])!='object'){inst._input[0].focus();}
this._lastInput=null;}}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),''];},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate);}
else if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){checkDate.setDate(checkDate.getDate()+3);return $.datepicker.iso8601Week(checkDate);}}
return Math.floor(((checkDate-firstMon)/86400000)/7)+1;},dateStatus:function(date,inst){return $.datepicker.formatDate(inst._get('dateStatus'),date,inst._getFormatConfig());},parseDate:function(format,value,settings){if(format==null||value==null){throw'Invalid arguments';}
value=(typeof value=='object'?value.toString():value+'');if(value==''){return null;}
var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++;}
return matches;};var getNumber=function(match){lookAhead(match);var size=(match=='y'?4:2);var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>='0'&&value.charAt(iValue)<='9'){num=num*10+(value.charAt(iValue++)-0);size--;}
if(size==(match=='y'?4:2)){throw'Missing number at position '+iValue;}
return num;};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length);}
var name='';var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1;}}
size--;}
throw'Unknown name at position '+iInit;};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw'Unexpected literal at position '+iValue;}
iValue++;};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=='\''&&!lookAhead('\'')){literal=false;}
else{checkLiteral();}}
else{switch(format.charAt(iFormat)){case'd':day=getNumber('d');break;case'D':getName('D',dayNamesShort,dayNames);break;case'm':month=getNumber('m');break;case'M':month=getName('M',monthNamesShort,monthNames);break;case'y':year=getNumber('y');break;case'\'':if(lookAhead('\'')){checkLiteral();}
else{literal=true;}
break;default:checkLiteral();}}}
if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+
(year<=shortYearCutoff?0:-100);}
var date=new Date(year,month-1,day);if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw'Invalid date';}
return date;},formatDate:function(format,date,settings){if(!date){return'';}
var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++;}
return matches;};var formatNumber=function(match,value){return(lookAhead(match)&&value<10?'0':'')+value;};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value]);};var output='';var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=='\''&&!lookAhead('\'')){literal=false;}
else{output+=format.charAt(iFormat);}}
else{switch(format.charAt(iFormat)){case'd':output+=formatNumber('d',date.getDate());break;case'D':output+=formatName('D',date.getDay(),dayNamesShort,dayNames);break;case'm':output+=formatNumber('m',date.getMonth()+1);break;case'M':output+=formatName('M',date.getMonth(),monthNamesShort,monthNames);break;case'y':output+=(lookAhead('y')?date.getFullYear():(date.getYear()%100<10?'0':'')+date.getYear()%100);break;case'\'':if(lookAhead('\'')){output+='\'';}
else{literal=true;}
break;default:output+=format.charAt(iFormat);}}}}
return output;},_possibleChars:function(format){var chars='';var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=='\''&&!lookAhead('\'')){literal=false;}
else{chars+=format.charAt(iFormat);}}
else{switch(format.charAt(iFormat)){case'd':case'm':case'y':chars+='0123456789';break;case'D':case'M':return null;case'\'':if(lookAhead('\'')){chars+='\'';}
else{literal=true;}
break;default:chars+=format.charAt(iFormat);}}}
return chars;}});function DatepickerInstance(settings,inline){this._id=$.datepicker._register(this);this._selectedDay=0;this._selectedMonth=0;this._selectedYear=0;this._input=null;this._inline=inline;this._datepickerDiv=(!inline?$.datepicker._datepickerDiv:$('<div id="datepicker_'+this._id+'" class="datepicker_inline"></div>'));this._datepickerBody=this._datepickerDiv.find('.bd:first');this._settings=extendRemove({},settings||{});if(inline){this._setDate(this._getDefaultDate());}}
$.extend(DatepickerInstance.prototype,{_get:function(name){return(this._settings[name]!=null?this._settings[name]:$.datepicker._defaults[name]);},_setDateFromField:function(input){this._input=$(input);var dateFormat=this._get('dateFormat');var dates=this._input?this._input.val().split(this._get('rangeSeparator')):null;this._endDay=this._endMonth=this._endYear=null;var date=defaultDate=this._getDefaultDate();if(dates.length>0){var settings=this._getFormatConfig();if(dates.length>1){date=$.datepicker.parseDate(dateFormat,dates[1],settings)||defaultDate;this._endDay=date.getDate();this._endMonth=date.getMonth();this._endYear=date.getFullYear();}
try{date=$.datepicker.parseDate(dateFormat,dates[0],settings)||defaultDate;}
catch(e){$.datepicker.log(e);date=defaultDate;}}
this._selectedDay=this._currentDay=date.getDate();this._selectedMonth=this._currentMonth=date.getMonth();this._selectedYear=this._currentYear=date.getFullYear();this._adjustDate();},_getDefaultDate:function(){return this._determineDate('defaultDate',new Date());},_determineDate:function(name,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date;};var offsetString=function(offset,getDaysInMonth){var date=new Date();var matches=/^([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?$/.exec(offset);if(matches){var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();switch(matches[2]||'d'){case'd':case'D':day+=(matches[1]-0);break;case'w':case'W':day+=(matches[1]*7);break;case'm':case'M':month+=(matches[1]-0);day=Math.min(day,getDaysInMonth(year,month));break;case'y':case'Y':year+=(matches[1]-0);day=Math.min(day,getDaysInMonth(year,month));break;}
date=new Date(year,month,day);}
return date;};var date=this._get(name);return(date==null?defaultDate:(typeof date=='string'?offsetString(date,this._getDaysInMonth):(typeof date=='number'?offsetNumeric(date):date)));},_setDate:function(date,endDate){this._selectedDay=this._currentDay=date.getDate();this._selectedMonth=this._currentMonth=date.getMonth();this._selectedYear=this._currentYear=date.getFullYear();if(this._get('rangeSelect')||this._get('selectionType')=='week'){if(endDate){this._endDay=endDate.getDate();this._endMonth=endDate.getMonth();this._endYear=endDate.getFullYear();}
else{this._endDay=this._currentDay;this._endMonth=this._currentMonth;this._endYear=this._currentYear;}}
this._adjustDate();},_getDate:function(){var startDate=(!this._currentYear||(this._input&&this._input.val()=='')?null:new Date(this._currentYear,this._currentMonth,this._currentDay));if(this._get('rangeSelect')||this._get('selectionType')=='week'){return[startDate,(!this._endYear?null:new Date(this._endYear,this._endMonth,this._endDay))];}
else{return startDate;}},_generateDatepicker:function(){var today=new Date();today=new Date(today.getFullYear(),today.getMonth(),today.getDate());var showStatus=this._get('showStatus');var isRTL=this._get('isRTL');var clear=(this._get('mandatory')?'':'<div class="datepicker_clear"><a href="javascript:void(0);" onclick="jQuery.datepicker._clearDate('+this._id+');"'+
(showStatus?this._addStatus(this._get('clearStatus')||'&#xa0;'):'')+'>'+
this._get('clearText')+'</a></div>');var title=this._get('title');var controls='<div class="datepicker_control">'+(isRTL?'':clear)+
(title?'<div class="datepicker_title">'+title+'</div>':'')+'<div class="datepicker_close"><a href="javascript:void(0);" onclick="jQuery.datepicker.hideDatepicker();"'+
(showStatus?this._addStatus(this._get('closeStatus')||'&#xa0;'):'')+'>'+
this._get('closeText')+'</a></div>'+(isRTL?clear:'')+'</div>';var prompt=this._get('prompt');var closeAtTop=this._get('closeAtTop');var hideIfNoPrevNext=this._get('hideIfNoPrevNext');var numMonths=this._getNumberOfMonths();var stepMonths=this._get('stepMonths');var stepYears=this._get('stepYears');var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var minDate=this._getMinMaxDate('min',true);var maxDate=this._getMinMaxDate('max');var drawMonth=this._selectedMonth;var drawYear=this._selectedYear;if(maxDate){var maxDraw=new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate());maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(new Date(drawYear,drawMonth,1)>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--;}}}
var html=(closeAtTop&&!this._inline?controls:'');var showWeeks=this._get('showWeeks');var highlightWeek=this._get('highlightWeek');for(var row=0;row<numMonths[0];row++){for(var col=0;col<numMonths[1];col++){var selectedDate=new Date(drawYear,drawMonth,this._selectedDay);html+='<div class="datepicker_oneMonth'+(col==0?' datepicker_newRow':'')+'">'+
this._generateMonthYearHeader(drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0)+'<table class="datepicker_table" cellpadding="0" cellspacing="0"><thead>'+'<tr class="datepicker_titleRow">'+
(showWeeks?'<td>'+this._get('weekHeader')+'</td>':'');var firstDay=this._get('firstDay');var changeFirstDay=this._get('changeFirstDay');var dayNames=this._get('dayNames');var dayNamesShort=this._get('dayNamesShort');var dayNamesMin=this._get('dayNamesMin');for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;var status=this._get('dayStatus')||'&#xa0;';status=(status.indexOf('DD')>-1?status.replace(/DD/,dayNames[day]):status.replace(/D/,dayNamesShort[day]));html+='<td'+((dow+firstDay+6)%7>=5?' class="datepicker_weekEndCell"':'')+'>'+
(!changeFirstDay?'<span':'<a onclick="jQuery.datepicker._changeFirstDay('+this._id+', '+day+');"')+
(showStatus?this._addStatus(status):'')+' title="'+dayNames[day]+'">'+
dayNamesMin[day]+(changeFirstDay?'</a>':'</span>')+'</td>';}
html+='</tr></thead><tbody>';var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==this._selectedYear&&drawMonth==this._selectedMonth){this._selectedDay=Math.min(this._selectedDay,daysInMonth);}
var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var currentDate=new Date(this._currentYear,this._currentMonth,this._currentDay);var endDate=this._endDay?new Date(this._endYear,this._endMonth,this._endDay):currentDate;var defaultDate=this._get('defaultDate');if(currentDate!=endDate&&defaultDate){currentDate=defaultDate;}
if(!highlightWeek){endDate=currentDate;}
var printDate=new Date(drawYear,drawMonth,1-leadDays);var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var beforeShowDay=this._get('beforeShowDay');var showOtherMonths=this._get('showOtherMonths');var calculateWeek=this._get('calculateWeek')||$.datepicker.iso8601Week;var dateStatus=this._get('statusForDate')||$.datepicker.dateStatus;var weekSelect=this._get('selectionType')=='week';var otherMonthsActive=this._get('otherMonthsActive');for(var dRow=0;dRow<numRows;dRow++){html+='<tr class="datepicker_daysRow"';if(weekSelect){html+=' onmouseover="jQuery(this).addClass(\'datepicker_daysRowOver\');" '+'onmouseout="jQuery(this).removeClass(\'datepicker_daysRowOver\');" ';}
html+='>'+
(showWeeks?'<td class="datepicker_weekCol">'+calculateWeek(printDate)+'</td>':'');for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((this._input?this._input[0]:null),[printDate]):[true,'']);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonthsActive?false:(otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate));html+='<td class="datepicker_daysCell'+
((dow+firstDay+6)%7>=5?' datepicker_weekEndCell':'')+
(otherMonth?' datepicker_otherMonth':'')+
(unselectable?' datepicker_unselectable':'')+
(otherMonth&&!showOtherMonths?'':' '+daySettings[1]+
(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?' datepicker_currentDay':'')+
(printDate.getTime()==today.getTime()?' datepicker_today':''))+'"'+
(unselectable?'':' onmouseover="jQuery(this).addClass(\'datepicker_daysCellOver\');'+
(!showStatus||(otherMonth&&!showOtherMonths)?'':'jQuery(\'#datepicker_status_'+
this._id+'\').html(\''+(dateStatus.apply((this._input?this._input[0]:null),[printDate,this])||'&#xa0;')+'\');')+'"'+' onmouseout="jQuery(this).removeClass(\'datepicker_daysCellOver\');'+
(!showStatus||(otherMonth&&!showOtherMonths)?'':'jQuery(\'#datepicker_status_'+
this._id+'\').html(\'&#xa0;\');')+'" onclick="jQuery.datepicker._selectDay('+
this._id+','+printDate.getMonth()+','+printDate.getFullYear()+', this);"')+'>'+
(otherMonth&&!otherMonthsActive?(showOtherMonths?printDate.getDate():'&#xa0;'):(unselectable?printDate.getDate():'<a href="javascript:void(0);">'+printDate.getDate()+'</a>'))+'</td>';printDate.setDate(printDate.getDate()+1);}
html+='</tr>';}
drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++;}
html+='</tbody></table></div>';}}
html+=(showStatus?'<div id="datepicker_status_'+this._id+'" class="datepicker_status">'+(this._get('initStatus')||'&#xa0;')+'</div>':'')+
(!closeAtTop&&!this._inline?controls:'')
return html;},_generateMonthYearHeader:function(drawMonth,drawYear,minDate,maxDate,selectedDate,secondary){minDate=(this._rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var showStatus=this._get('showStatus');var hideIfNoPrevNext=this._get('hideIfNoPrevNext');var html='<div class="datepicker_header">';var monthNames=this._get('monthNames');if(secondary||!this._get('changeMonth')){html+=monthNames[drawMonth]+'&#xa0;';}
else{var monthName=monthNames[drawMonth];var stepMonths=this._get('stepMonths');var prevMonth='<div class="datepicker_newMonth_prev">'+
(this._canAdjustMonth(-1,drawYear,drawMonth)?'<a href="javascript:void(0);" onclick="jQuery.datepicker._adjustDate('+this._id+', -'+stepMonths+', \'M\');"'+
(showStatus?this._addStatus(this._get('prevStatus')||'&#xa0;'):'')+'>'+
this._get('prevText')+'</a>':(hideIfNoPrevNext?'':'<a href="javascript:void(0);" onclick="void(0);" class="disabled">'+this._get('prevText')+'</a>'))+'</div>';var nextMonth='<div class="datepicker_newMonth_next">'+(this._canAdjustMonth(+1,drawYear,drawMonth)?'<a href="javascript:void(0);" onclick="jQuery.datepicker._adjustDate('+this._id+', +'+stepMonths+', \'M\');"'+
(showStatus?this._addStatus(this._get('nextStatus')||'&#xa0;'):'')+'>'+
this._get('nextText')+'</a>':(hideIfNoPrevNext?'>':'<a href="javascript:void(0);" onclick="void(0);" class="disabled">'+this._get('nextText')+'</a>'))+'</div>';html+='<div class="datepicker_newMonth">'+
prevMonth+'<span class="datepicker_month_title">'+monthName+'</span>'+
nextMonth+'</div>';}
if(secondary||!this._get('changeYear')){html+=drawYear;}
else{var stepYears=this._get('stepYears');var prevYear='<div class="datepicker_newYear_prev">'+(this._canAdjustMonth(-1,drawYear,drawMonth)?'<a href="javascript:void(0);" onclick="jQuery.datepicker._adjustDate('+this._id+', -'+stepYears+', \'Y\');"'+
(showStatus?this._addStatus(this._get('prevStatus')||'&#xa0;'):'')+'>'+
this._get('prevText')+'</a>':(hideIfNoPrevNext?'':'<a href="javascript:void(0);" onclick="void(0);" class="disabled">'+this._get('prevText')+'</a>'))+'</div>';var nextYear='<div class="datepicker_newYear_next">'+(this._canAdjustMonth(+1,drawYear,drawMonth)?'<a href="javascript:void(0);" onclick="jQuery.datepicker._adjustDate('+this._id+', +'+stepYears+', \'Y\');"'+
(showStatus?this._addStatus(this._get('nextStatus')||'&#xa0;'):'')+'>'+
this._get('nextText')+'</a>':(hideIfNoPrevNext?'>':'<a href="javascript:void(0);" onclick="void(0);" class="disabled">'+this._get('nextText')+'</a>'))+'</div>';html+='<div class="datepicker_newYear">'+
prevYear+'<span class="datepicker_year_title">'+drawYear+'</span>'+
nextYear+'</div>';}
html+='</div>';return html;},_addStatus:function(text){return' onmouseover="jQuery(\'#datepicker_status_'+this._id+'\').html(\''+text+'\');" '+'onmouseout="jQuery(\'#datepicker_status_'+this._id+'\').html(\'&#xa0;\');"';},_adjustDate:function(offset,period){var year=this._selectedYear+(period=='Y'?offset:0);var month=this._selectedMonth+(period=='M'?offset:0);var day=Math.min(this._selectedDay,this._getDaysInMonth(year,month))+
(period=='D'?offset:0);var date=new Date(year,month,day);var minDate=this._getMinMaxDate('min',true);var maxDate=this._getMinMaxDate('max');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);this._selectedDay=date.getDate();this._selectedMonth=date.getMonth();this._selectedYear=date.getFullYear();},_getNumberOfMonths:function(){var numMonths=this._get('numberOfMonths');return(numMonths==null?[1,1]:(typeof numMonths=='number'?[1,numMonths]:numMonths));},_getMinMaxDate:function(minMax,checkRange){var date=this._determineDate(minMax+'Date',null);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0);}
return date||(checkRange?this._rangeStart:null);},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate();},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay();},_canAdjustMonth:function(offset,curYear,curMonth){var numMonths=this._getNumberOfMonths();var date=new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1);if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()));}
return this._isInRange(date);},_isInRange:function(date){var newMinDate=(!this._rangeStart?null:new Date(this._selectedYear,this._selectedMonth,this._selectedDay));newMinDate=(newMinDate&&this._rangeStart<newMinDate?this._rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate('min');var maxDate=this._getMinMaxDate('max');return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate));},_getFormatConfig:function(){var shortYearCutoff=this._get('shortYearCutoff');shortYearCutoff=(typeof shortYearCutoff!='string'?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get('dayNamesShort'),dayNames:this._get('dayNames'),monthNamesShort:this._get('monthNamesShort'),monthNames:this._get('monthNames')};},_formatDate:function(day,month,year){if(!day){this._currentDay=this._selectedDay;this._currentMonth=this._selectedMonth;this._currentYear=this._selectedYear;}
var date=(day?(typeof day=='object'?day:new Date(year,month,day)):new Date(this._currentYear,this._currentMonth,this._currentDay));return $.datepicker.formatDate(this._get('dateFormat'),date,this._getFormatConfig());}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null){target[name]=null;}}
return target;};$.fn.attachDatepicker=function(settings){return this.each(function(){var inlineSettings=null;for(attrName in $.datepicker._defaults){var attrValue=this.getAttribute('date:'+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue);}
catch(err){inlineSettings[attrName]=attrValue;}}}
var nodeName=this.nodeName.toLowerCase();if(nodeName=='input'){var instSettings=(inlineSettings?$.extend($.extend({},settings||{}),inlineSettings||{}):settings);var inst=(inst&&!inlineSettings?inst:new DatepickerInstance(instSettings,false));$.datepicker._connectDatepicker(this,inst);}
else if(nodeName=='div'||nodeName=='span'){var instSettings=$.extend($.extend({},settings||{}),inlineSettings||{});var inst=new DatepickerInstance(instSettings,true);$.datepicker._inlineDatepicker(this,inst);}});};$.fn.removeDatepicker=function(){var jq=this.each(function(){var $this=$(this);var nodeName=this.nodeName.toLowerCase();var calId=this._calId;this._calId=null;if(nodeName=='input'){$this.siblings('.datepicker_append').replaceWith('');$this.siblings('.datepicker_trigger').replaceWith('');$this.removeClass($.datepicker.markerClassName).unbind('focus',$.datepicker.showFor).unbind('keydown',$.datepicker._doKeyDown).unbind('keypress',$.datepicker._doKeyPress);var wrapper=$this.parents('.datepicker_wrap');if(wrapper){wrapper.replaceWith(wrapper.html());}}
else if(nodeName=='div'||nodeName=='span'){$this.removeClass($.datepicker.markerClassName).empty();}
if($('input[_calId='+calId+']').length==0){$.datepicker._inst[calId]=null;}});if($('input.hasDatepicker').length==0){$.datepicker._datepickerDiv.replaceWith('');}
return jq;};$.fn.enableDatepicker=function(){return this.each(function(){this.disabled=false;$(this).siblings('button.datepicker_trigger').each(function(){this.disabled=false;});$(this).siblings('img.datepicker_trigger').css({opacity:'1.0',cursor:''});var $this=this;$.datepicker._disabledInputs=$.map($.datepicker._disabledInputs,function(value){return(value==$this?null:value);});});};$.fn.disableDatepicker=function(){return this.each(function(){this.disabled=true;$(this).siblings('button.datepicker_trigger').each(function(){this.disabled=true;});$(this).siblings('img.datepicker_trigger').css({opacity:'0.5',cursor:'default'});var $this=this;$.datepicker._disabledInputs=$.map($.datepicker._disabledInputs,function(value){return(value==$this?null:value);});$.datepicker._disabledInputs[$.datepicker._disabledInputs.length]=this;});};$.fn.isDisabledDatepicker=function(){if(this.length==0){return false;}
for(var i=0;i<$.datepicker._disabledInputs.length;i++){if($.datepicker._disabledInputs[i]==this[0]){return true;}}
return false;};$.fn.changeDatepicker=function(name,value){var settings=name||{};if(typeof name=='string'){settings={};settings[name]=value;}
return this.each(function(){var inst=$.datepicker._getInst(this._calId);if(inst){extendRemove(inst._settings,settings);$.datepicker._updateDatepicker(inst);}});};$.fn.showDatepicker=function(){$.datepicker.showFor(this);return this;};$.fn.setDatepickerDate=function(date,endDate){return this.each(function(){var inst=$.datepicker._getInst(this._calId);if(inst){inst._setDate(date,endDate);$.datepicker._updateDatepicker(inst);}});};$.fn.getDatepickerDate=function(){var inst=(this.length>0?$.datepicker._getInst(this[0]._calId):null);return(inst?inst._getDate():null);};$(document).ready(function(){$.datepicker=new Datepicker();$(document.body).append($.datepicker._datepickerDiv).mousedown($.datepicker._checkExternalClick);});

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.HGTV.Omniture.ClickTrack=function(jsel,module,searchKey){var $el=$(jsel);if($el.length==0){return;}
$el.click(function(e){var $clicked=$(e.target);if($clicked.is("a")&&(($clicked.parents().filter('form').attr("id")=="hgSearchForm")||($clicked.parents().filter('form').attr("id")=="hgFtSearchForm"))){return;}
if($clicked.is("a")||$clicked.parent().is("a")||($clicked.attr("type")=="submit")){if($clicked.attr("type")=="submit"){site="HGTV: "+$clicked.parents().filter('form').attr("name")+" ";}else{site="HGTV: "+module+" ";}
var s=s_gi(s_account);s.linkTrackVars='prop14,eVar16,prop15,eVar18,prop16,eVar17,prop17,eVar19,prop18,prop19,eVar20,prop20';s.prop14=site;s.eVar16=s.prop14;var linkText=$clicked.html();var thumbnail=false;if((linkText=="")&&($clicked.is("img"))){linkText=$clicked.attr("alt");thumbnail=true;}
s.prop15=site+linkText;s.eVar18=s.prop15;relid="relid?";var linkUrl=$clicked.attr("href");if($clicked.is("a")){relid=$clicked.attr("rel");}
else if($clicked.parent().is("a")){relid=$clicked.parent().attr("rel");linkUrl=$clicked.parent().attr("href");}
s.prop16=site+relid;s.eVar17=s.prop16;s.prop17=site+linkUrl;s.eVar19=s.prop17;s.prop18=site+mdManager.getParameter("Url");if(typeof(searchKey)!=='undefined'){s.prop19="endeca: "+mdManager.getParameter(searchKey+"_name"," ");s.eVar20=s.prop19;s.prop20="endeca: "+mdManager.getParameter(searchKey+"_style"," ");}
s.tl(this,'o','Link Name');e.stopPropagation();}});};SNI.HGTV.Omniture.ClickTrackSingle=function(jsel,module,section){var $el=$(jsel);if($el.length==0){return;}
$el.click(function(e){var $clicked=$(e.target);if($clicked.is("a")||$clicked.parent().is("a")){var linkText=$clicked.html();if((linkText=="")&&($clicked.is("img"))){linkText=$clicked.attr("alt");}
var s=s_gi(s_account);s.linkTrackVars='prop26';s.prop26=section+": "+module+": "+linkText;s.tl(this,'o','Link Name');e.stopPropagation();}});};SNI.HGTV.Omniture.ClickTrackSingleCustom=function(jsel,module,propVal,trackEvent){var $el=$(jsel);if($el.length==0){return;}
$el.click(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;};