
/*
 * custom HGTV JS Library created for Kudzu as workaround for prototype/jquery $ namespace conflict.
 * This file includes library js for sni-config.js, sni-core.js, and sni-hgtv.js
 * jQuery no conflict has been run and $ namespace freed up, jQuery obj represented by $k instead. -kw
 * This static file created on Mon, 26 Jul 2010 16:00:03 -0400 
 */



if(typeof SNI=="undefined"||!SNI){var SNI={};}
SNI.Config={env:"prod",site:"HGTV",domain:"www.hgtv.com",adServerUrl:"adsremote.scrippsnetworks.com",snapPlayListUrl:"http://www.hgtv.com/",snapBinary:"http://www.sndimg.com/common/snap/snap-2.1.13.swf",snapConfigs:"http://hgtv.sndimg.com/webhgtv/hg20/snap-configs/v4/",autoSuggestContainer:"#sni-hd .search",autoSuggestService:"/search/autosuggest",omnitureMultiVariable:"prop14,eVar16,prop15,eVar18,prop16,eVar17,prop17,eVar19,prop18,prop19,eVar20,prop20",omnitureSingleVariable:"prop26",rsiKeyWord:"searchTerm",UR3:true,animationSpeed:250,navDropJsonPath:"http://www.hgtv.com/app/fetchElement/text.json?site=HGTV&type=TEXT&id=99096&preview=no"};
/*
 * sni-core-library
 * version 2.0
 *
 */


(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b==="find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" "," ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case"only":case"first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case"last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case"nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m==="="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j={},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration==="number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
var $k = jQuery.noConflict();


jQuery.ui||(function(b){var a=b.browser.mozilla&&(parseFloat(b.browser.version)<1.9);b.ui={version:"1.8rc3",plugin:{add:function(d,e,g){var f=b.ui[d].prototype;for(var c in g){f.plugins[c]=f.plugins[c]||[];f.plugins[c].push([e,g[c]])}},call:function(c,e,d){var g=c.plugins[e];if(!g||!c.element[0].parentNode){return}for(var f=0;f<g.length;f++){if(c.options[g[f][0]]){g[f][1].apply(c.element,d)}}}},contains:function(d,c){return document.compareDocumentPosition?d.compareDocumentPosition(c)&16:d!==c&&d.contains(c)},hasScroll:function(f,d){if(b(f).css("overflow")=="hidden"){return false}var c=(d&&d=="left")?"scrollLeft":"scrollTop",e=false;if(f[c]>0){return true}f[c]=1;e=(f[c]>0);f[c]=0;return e},isOverAxis:function(d,c,e){return(d>c)&&(d<(c+e))},isOver:function(h,d,g,f,c,e){return b.ui.isOverAxis(h,g,c)&&b.ui.isOverAxis(d,f,e)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};b.fn.extend({_focus:b.fn.focus,focus:function(c,d){return typeof c==="number"?this.each(function(){var e=this;setTimeout(function(){b(e).focus();(d&&d.call(e))},c)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var c;if((b.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){c=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(b.curCSS(this,"position",1))&&(/(auto|scroll)/).test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0)}else{c=this.parents().filter(function(){return(/(auto|scroll)/).test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!c.length?b(document):c},zIndex:function(f){if(f!==undefined){return this.css("zIndex",f)}if(this.length){var d=b(this[0]),c,e;while(d.length&&d[0]!==document){c=d.css("position");if(c=="absolute"||c=="relative"||c=="fixed"){e=parseInt(d.css("zIndex"));if(!isNaN(e)&&e!=0){return e}}d=d.parent()}}return 0}});b.extend(b.expr[":"],{data:function(e,d,c){return!!b.data(e,c[3])},focusable:function(d){var e=d.nodeName.toLowerCase(),c=b.attr(d,"tabindex");return(/input|select|textarea|button|object/.test(e)?!d.disabled:"a"==e||"area"==e?d.href||!isNaN(c):!isNaN(c))&&!b(d)["area"==e?"parents":"closest"](":hidden").length},tabbable:function(d){var c=b.attr(d,"tabindex");return(isNaN(c)||c>=0)&&b(d).is(":focusable")}})})(jQuery);;(function(b){var a=b.fn.remove;b.fn.remove=function(c,d){return this.each(function(){if(!d){if(!c||b.filter(c,[this]).length){b("*",this).add(this).each(function(){b(this).triggerHandler("remove")})}}return a.call(b(this),c,d)})};b.widget=function(d,f,c){var e=d.split(".")[0],h;d=d.split(".")[1];h=e+"-"+d;if(!c){c=f;f=b.Widget}b.expr[":"][h]=function(i){return!!b.data(i,d)};b[e]=b[e]||{};b[e][d]=function(i,j){if(arguments.length){this._createWidget(i,j)}};var g=new f();g.options=b.extend({},g.options);b[e][d].prototype=b.extend(true,g,{namespace:e,widgetName:d,widgetEventPrefix:b[e][d].prototype.widgetEventPrefix||d,widgetBaseClass:h},c);b.widget.bridge(d,b[e][d])};b.widget.bridge=function(d,c){b.fn[d]=function(g){var e=typeof g==="string",f=Array.prototype.slice.call(arguments,1),h=this;g=!e&&f.length?b.extend.apply(null,[true,g].concat(f)):g;if(e&&g.substring(0,1)==="_"){return h}if(e){this.each(function(){var i=b.data(this,d),j=i&&b.isFunction(i[g])?i[g].apply(i,f):i;if(j!==i&&j!==undefined){h=j;return false}})}else{this.each(function(){var i=b.data(this,d);if(i){if(g){i.option(g)}i._init()}else{b.data(this,d,new c(g,this))}})}return h}};b.Widget=function(c,d){if(arguments.length){this._createWidget(c,d)}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(d,e){this.element=b(e).data(this.widgetName,this);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(e)[this.widgetName],d);var c=this;this.element.bind("remove."+this.widgetName,function(){c.destroy()});this._create();this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled")},widget:function(){return this.element},option:function(e,f){var d=e,c=this;if(arguments.length===0){return b.extend({},c.options)}if(typeof e==="string"){if(f===undefined){return this.options[e]}d={};d[e]=f}b.each(d,function(g,h){c._setOption(g,h)});return c},_setOption:function(c,d){this.options[c]=d;if(c==="disabled"){this.widget()[d?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",d)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(d,e,f){var h=this.options[d];e=b.Event(e);e.type=(d===this.widgetEventPrefix?d:this.widgetEventPrefix+d).toLowerCase();f=f||{};if(e.originalEvent){for(var c=b.event.props.length,g;c;){g=b.event.props[--c];e[g]=e.originalEvent[g]}}this.element.trigger(e,f);return!(b.isFunction(h)&&h.call(this.element[0],e,f)===false||e.isDefaultPrevented())}}})(jQuery);;(function(a){a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(c){return b._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(b._preventClickEvent){b._preventClickEvent=false;c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(d){d.originalEvent=d.originalEvent||{};if(d.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(d));this._mouseDownEvent=d;var c=this,e=(d.which==1),b=(typeof this.options.cancel=="string"?a(d.target).parents().add(d.target).filter(this.options.cancel).length:false);if(!e||b||!this._mouseCapture(d)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(d)!==false);if(!this._mouseStarted){d.preventDefault();return true}}this._mouseMoveDelegate=function(f){return c._mouseMove(f)};this._mouseUpDelegate=function(f){return c._mouseUp(f)};a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(a.browser.safari||d.preventDefault());d.originalEvent.mouseHandled=true;return true},_mouseMove:function(b){if(a.browser.msie&&!b.button){return this._mouseUp(b)}if(this._mouseStarted){this._mouseDrag(b);return b.preventDefault()}if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,b)!==false);(this._mouseStarted?this._mouseDrag(b):this._mouseUp(b))}return!this._mouseStarted},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(b.target==this._mouseDownEvent.target);this._mouseStop(b)}return false},_mouseDistanceMet:function(b){return(Math.max(Math.abs(this._mouseDownEvent.pageX-b.pageX),Math.abs(this._mouseDownEvent.pageY-b.pageY))>=this.options.distance)},_mouseDelayMet:function(b){return this.mouseDelayMet},_mouseStart:function(b){},_mouseDrag:function(b){},_mouseStop:function(b){},_mouseCapture:function(b){return true}})})(jQuery);;(function(f){f.ui=f.ui||{};var c=/left|center|right/,e="center",d=/top|center|bottom/,g="center",a=f.fn.position;f.fn.position=function(i){if(!i||!i.of){return a.apply(this,arguments)}i=f.extend({},i);var l=f(i.of),n=(i.collision||"flip").split(" "),m=i.offset?i.offset.split(" "):[0,0],k,h,j;if(i.of.nodeType===9){k=l.width();h=l.height();j={top:0,left:0}}else{if(i.of.scrollTo&&i.of.document){k=l.width();h=l.height();j={top:l.scrollTop(),left:l.scrollLeft()}}else{if(i.of.preventDefault){i.at="left top";k=h=0;j={top:i.of.pageY,left:i.of.pageX}}else{k=l.outerWidth();h=l.outerHeight();j=l.offset()}}}f.each(["my","at"],function(){var o=(i[this]||"").split(" ");if(o.length===1){o=c.test(o[0])?o.concat([g]):d.test(o[0])?[e].concat(o):[e,g]}o[0]=c.test(o[0])?o[0]:e;o[1]=d.test(o[1])?o[1]:g;i[this]=o});if(n.length===1){n[1]=n[0]}m[0]=parseInt(m[0],10)||0;if(m.length===1){m[1]=m[0]}m[1]=parseInt(m[1],10)||0;if(i.at[0]==="right"){j.left+=k}else{if(i.at[0]===e){j.left+=k/2}}if(i.at[1]==="bottom"){j.top+=h}else{if(i.at[1]===g){j.top+=h/2}}j.left+=m[0];j.top+=m[1];return this.each(function(){var t=f(this),s=t.outerWidth(),r=t.outerHeight(),p=f.extend({},j),u,o,q;if(i.my[0]==="right"){p.left-=s}else{if(i.my[0]===e){p.left-=s/2}}if(i.my[1]==="bottom"){p.top-=r}else{if(i.my[1]===g){p.top-=r/2}}f.each(["left","top"],function(w,v){if(f.ui.position[n[w]]){f.ui.position[n[w]][v](p,{targetWidth:k,targetHeight:h,elemWidth:s,elemHeight:r,offset:m,my:i.my,at:i.at})}});if(f.fn.bgiframe){t.bgiframe()}t.offset(f.extend(p,{using:i.using}))})};f.ui.position={fit:{left:function(h,i){var k=f(window),j=h.left+i.elemWidth-k.width()-k.scrollLeft();h.left=j>0?h.left-j:Math.max(0,h.left)},top:function(h,i){var k=f(window),j=h.top+i.elemHeight-k.height()-k.scrollTop();h.top=j>0?h.top-j:Math.max(0,h.top)}},flip:{left:function(i,j){if(j.at[0]==="center"){return}var l=f(window),k=i.left+j.elemWidth-l.width()-l.scrollLeft(),h=j.my[0]==="left"?-j.elemWidth:j.my[0]==="right"?j.elemWidth:0,m=-2*j.offset[0];i.left+=i.left<0?h+j.targetWidth+m:k>0?h-j.targetWidth+m:0},top:function(i,k){if(k.at[1]==="center"){return}var m=f(window),l=i.top+k.elemHeight-m.height()-m.scrollTop(),h=k.my[1]==="top"?-k.elemHeight:k.my[1]==="bottom"?k.elemHeight:0,j=k.at[1]==="top"?k.targetHeight:-k.targetHeight,n=-2*k.offset[1];i.top+=i.top<0?h+k.targetHeight+n:l>0?h+j+n:0}}};if(!f.offset.setOffset){f.offset.setOffset=function(l,i){if(/static/.test(jQuery.curCSS(l,"position"))){l.style.position="relative"}var k=jQuery(l),n=k.offset(),h=parseInt(jQuery.curCSS(l,"top",true),10)||0,m=parseInt(jQuery.curCSS(l,"left",true),10)||0,j={top:(i.top-n.top)+h,left:(i.left-n.left)+m};if("using"in i){i.using.call(l,j)}else{k.css(j)}};var b=f.fn.offset;f.fn.offset=function(h){var i=this[0];if(!i||!i.ownerDocument){return null}if(h){return this.each(function(){f.offset.setOffset(this,h)})}return b.call(this)}}})(jQuery);;(function(a){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},_create:function(){var d=this.options,b=this;this.running=0;this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){var e=c.closest(".ui-accordion-header");if(e.length){this.active=e}else{this.active=c.closest(".ui-accordion-content").prev()}}}this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");this._createIcons();if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(f){return b._keydown(f)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.headers.bind((d.event)+".accordion",function(f){b._clickHandler.call(b,f,this);f.preventDefault()})}},_createIcons:function(){var b=this.options;if(b.icons){a("<span/>").addClass("ui-icon "+b.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}return this},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);if(b=="active"){this.activate(c)}if(b=="icons"){this._destroyIcons();if(c){this._createIcons()}}},_keydown:function(e){var g=this.options,f=a.ui.keyCode;if(g.disabled||e.altKey||e.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(e.target);var c=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];break;case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];break;case f.SPACE:case f.ENTER:this._clickHandler({target:e.target},e.target);e.preventDefault()}if(c){a(e.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var d=this.options,c;if(d.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){c-=a(this).outerHeight(true)});this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else{if(d.autoHeight){c=0;this.headers.next().each(function(){c=Math.max(c,a(this).height())}).height(c)}}return this},activate:function(b){this.options.active=b;var c=this._findActive(b)[0];this._clickHandler({target:c},c);return this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,f){var d=this.options;if(d.disabled){return}if(!b.target){if(!d.collapsible){return}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));this._toggle(c,h,e);return}var g=a(b.currentTarget||f);var i=g[0]==this.active[0];d.active=d.collapsible&&i?false:a(".ui-accordion-header",this.element).index(g);if(this.running||(!d.collapsible&&i)){return}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);g.next().addClass("ui-accordion-content-active")}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c,oldContent:h},j=this.headers.index(this.active[0])>this.headers.index(g[0]);this.active=i?a([]):g;this._toggle(c,h,e,i,j);return},_toggle:function(b,i,g,j,k){var d=this.options,m=this;this.toShow=b;this.toHide=i;this.data=g;var c=function(){if(!m){return}return m._completed.apply(m,arguments)};this._trigger("changestart",null,this.data);this.running=i.size()===0?b.size():i.size();if(d.animated){var f={};if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;var l=a.ui.accordion.animations,e=d.duration,h=d.animated;if(h&&!l[h]&&!a.easing[h]){h="slide"}if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})}}l[h](f)}else{if(d.collapsible&&j){b.toggle()}else{i.hide();b.show()}c(true)}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this.toHide.removeClass("ui-accordion-content-active");this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.8rc3",animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);if(!j.toHide.size()){j.toShow.animate({height:"show"},j);return}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);return}var c=j.toShow.css("overflow"),g=0,d={},f={},e=["height","paddingTop","paddingBottom"],b;var i=j.toShow;b=i[0].style.width;i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-(parseInt(i.css("borderLeftWidth"),10)||0)-(parseInt(i.css("borderRightWidth"),10)||0));a.each(e,function(k,m){f[m]="hide";var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});j.toShow.css({height:0,overflow:"hidden"}).show();j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.end-l.start===0)?0:(l.now-l.start)/(l.end-l.start)}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")}j.toShow.css("width",b);j.toShow.css({overflow:c});j.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})}}})})(jQuery);;(function(b){var a=0;b.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'},_create:function(){this._tabify(true)},_setOption:function(c,d){if(c=="selected"){if(this.options.collapsible&&d==this.options.selected){return}this.select(d)}else{this.options[c]=d;this._tabify()}},_tabId:function(c){return c.title&&c.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+(++a)},_sanitizeSelector:function(c){return c.replace(/:/g,"\\:")},_cookie:function(){var c=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+b.data(this.list[0]));return b.cookie.apply(null,[c].concat(b.makeArray(arguments)))},_ui:function(d,c){return{tab:d,panel:c,index:this.anchors.index(d)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var c=b(this);c.html(c.data("label.tabs")).removeData("label.tabs")})},_tabify:function(p){this.list=this.element.find("ol,ul").eq(0);this.lis=b("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return b("a",this)[0]});this.panels=b([]);var q=this,e=this.options;var d=/^#.+/;this.anchors.each(function(s,o){var r=b(o).attr("href");var u=r.split("#")[0],v;if(u&&(u===location.toString().split("#")[0]||(v=b("base")[0])&&u===v.href)){r=o.hash;o.href=r}if(d.test(r)){q.panels=q.panels.add(q._sanitizeSelector(r))}else{if(r!="#"){b.data(o,"href.tabs",r);b.data(o,"load.tabs",r.replace(/#.*$/,""));var x=q._tabId(o);o.href="#"+x;var w=b("#"+x);if(!w.length){w=b(e.panelTemplate).attr("id",x).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(q.panels[s-1]||q.list);w.data("destroy.tabs",true)}q.panels=q.panels.add(w)}else{e.disabled.push(s)}}});if(p){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(e.selected===undefined){if(location.hash){this.anchors.each(function(r,o){if(o.hash==location.hash){e.selected=r;return false}})}if(typeof e.selected!="number"&&e.cookie){e.selected=parseInt(q._cookie(),10)}if(typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}e.selected=e.selected||(this.lis.length?0:-1)}else{if(e.selected===null){e.selected=-1}}e.selected=((e.selected>=0&&this.anchors[e.selected])||e.selected<0)?e.selected:0;e.disabled=b.unique(e.disabled.concat(b.map(this.lis.filter(".ui-state-disabled"),function(r,o){return q.lis.index(r)}))).sort();if(b.inArray(e.selected,e.disabled)!=-1){e.disabled.splice(b.inArray(e.selected,e.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(e.selected>=0&&this.anchors.length){this.panels.eq(e.selected).removeClass("ui-tabs-hide");this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active");q.element.queue("tabs",function(){q._trigger("show",null,q._ui(q.anchors[e.selected],q.panels[e.selected]))});this.load(e.selected)}b(window).bind("unload",function(){q.lis.add(q.anchors).unbind(".tabs");q.lis=q.anchors=q.panels=null})}else{e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(e.cookie){this._cookie(e.selected,e.cookie)}for(var h=0,n;(n=this.lis[h]);h++){b(n)[b.inArray(h,e.disabled)!=-1&&!b(n).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(e.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(e.event!="mouseover"){var g=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var k=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){g("hover",b(this))});this.lis.bind("mouseout.tabs",function(){k("hover",b(this))});this.anchors.bind("focus.tabs",function(){g("focus",b(this).closest("li"))});this.anchors.bind("blur.tabs",function(){k("focus",b(this).closest("li"))})}var c,j;if(e.fx){if(b.isArray(e.fx)){c=e.fx[0];j=e.fx[1]}else{c=j=e.fx}}function f(i,o){i.css({display:""});if(!b.support.opacity&&o.opacity){i[0].style.removeAttribute("filter")}}var l=j?function(i,o){b(i).closest("li").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(j,j.duration||"normal",function(){f(o,j);q._trigger("show",null,q._ui(i,o[0]))})}:function(i,o){b(i).closest("li").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");q._trigger("show",null,q._ui(i,o[0]))};var m=c?function(o,i){i.animate(c,c.duration||"normal",function(){q.lis.removeClass("ui-tabs-selected ui-state-active");i.addClass("ui-tabs-hide");f(i,c);q.element.dequeue("tabs")})}:function(o,i,r){q.lis.removeClass("ui-tabs-selected ui-state-active");i.addClass("ui-tabs-hide");q.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var o=this,s=b(this).closest("li"),i=q.panels.filter(":not(.ui-tabs-hide)"),r=b(q._sanitizeSelector(this.hash));if((s.hasClass("ui-tabs-selected")&&!e.collapsible)||s.hasClass("ui-state-disabled")||s.hasClass("ui-state-processing")||q._trigger("select",null,q._ui(this,r[0]))===false){this.blur();return false}e.selected=q.anchors.index(this);q.abort();if(e.collapsible){if(s.hasClass("ui-tabs-selected")){e.selected=-1;if(e.cookie){q._cookie(e.selected,e.cookie)}q.element.queue("tabs",function(){m(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(e.cookie){q._cookie(e.selected,e.cookie)}q.element.queue("tabs",function(){l(o,r)});q.load(q.anchors.index(this));this.blur();return false}}}if(e.cookie){q._cookie(e.selected,e.cookie)}if(r.length){if(i.length){q.element.queue("tabs",function(){m(o,i)})}q.element.queue("tabs",function(){l(o,r)});q.load(q.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(b.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var c=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var d=b.data(this,"href.tabs");if(d){this.href=d}var e=b(this).unbind(".tabs");b.each(["href","load","cache"],function(f,g){e.removeData(g+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(b.data(this,"destroy.tabs")){b(this).remove()}else{b(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(c.cookie){this._cookie(null,c.cookie)}return this},add:function(f,e,d){if(d===undefined){d=this.anchors.length}var c=this,h=this.options,j=b(h.tabTemplate.replace(/#\{href\}/g,f).replace(/#\{label\}/g,e)),i=!f.indexOf("#")?f.replace("#",""):this._tabId(b("a",j)[0]);j.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var g=b("#"+i);if(!g.length){g=b(h.panelTemplate).attr("id",i).data("destroy.tabs",true)}g.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(d>=this.lis.length){j.appendTo(this.list);g.appendTo(this.list[0].parentNode)}else{j.insertBefore(this.lis[d]);g.insertBefore(this.panels[d])}h.disabled=b.map(h.disabled,function(l,k){return l>=d?++l:l});this._tabify();if(this.anchors.length==1){h.selected=0;j.addClass("ui-tabs-selected ui-state-active");g.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[d],this.panels[d]));return this},remove:function(c){var e=this.options,f=this.lis.eq(c).remove(),d=this.panels.eq(c).remove();if(f.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(c+(c+1<this.anchors.length?1:-1))}e.disabled=b.map(b.grep(e.disabled,function(h,g){return h!=c}),function(h,g){return h>=c?--h:h});this._tabify();this._trigger("remove",null,this._ui(f.find("a")[0],d[0]));return this},enable:function(c){var d=this.options;if(b.inArray(c,d.disabled)==-1){return}this.lis.eq(c).removeClass("ui-state-disabled");d.disabled=b.grep(d.disabled,function(f,e){return f!=c});this._trigger("enable",null,this._ui(this.anchors[c],this.panels[c]));return this},disable:function(d){var c=this,e=this.options;if(d!=e.selected){this.lis.eq(d).addClass("ui-state-disabled");e.disabled.push(d);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[d],this.panels[d]))}return this},select:function(c){if(typeof c=="string"){c=this.anchors.index(this.anchors.filter("[href$="+c+"]"))}else{if(c===null){c=-1}}if(c==-1&&this.options.collapsible){c=this.options.selected}this.anchors.eq(c).trigger(this.options.event+".tabs");return this},load:function(f){var d=this,h=this.options,c=this.anchors.eq(f)[0],e=b.data(c,"load.tabs");this.abort();if(!e||this.element.queue("tabs").length!==0&&b.data(c,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(f).addClass("ui-state-processing");if(h.spinner){var g=b("span",c);g.data("label.tabs",g.html()).html(h.spinner)}this.xhr=b.ajax(b.extend({},h.ajaxOptions,{url:e,success:function(j,i){b(d._sanitizeSelector(c.hash)).html(j);d._cleanup();if(h.cache){b.data(c,"cache.tabs",true)}d._trigger("load",null,d._ui(d.anchors[f],d.panels[f]));try{h.ajaxOptions.success(j,i)}catch(k){}},error:function(k,i,j){d._cleanup();d._trigger("load",null,d._ui(d.anchors[f],d.panels[f]));try{h.ajaxOptions.error(k,i,f,c)}catch(j){}}}));d.element.dequeue("tabs");return this},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},url:function(d,c){this.anchors.eq(d).removeData("cache.tabs").data("load.tabs",c);return this},length:function(){return this.anchors.length}});b.extend(b.ui.tabs,{version:"1.8rc3"});b.extend(b.ui.tabs.prototype,{rotation:null,rotate:function(e,g){var c=this,h=this.options;var d=c._rotate||(c._rotate=function(i){clearTimeout(c.rotation);c.rotation=setTimeout(function(){var j=h.selected;c.select(++j<c.anchors.length?j:0)},e);if(i){i.stopPropagation()}});var f=c._unrotate||(c._unrotate=!g?function(i){if(i.clientX){c.rotate(null)}}:function(i){t=h.selected;d()});if(e){this.element.bind("tabsshow",d);this.anchors.bind(h.event+".tabs",f);d()}else{clearTimeout(c.rotation);this.element.unbind("tabsshow",d);this.anchors.unbind(h.event+".tabs",f);delete this._rotate;delete this._unrotate}return this}})})(jQuery);;jQuery.effects||(function(g){g.effects={};g.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(l,k){g.fx.step[k]=function(m){if(!m.colorInit){m.start=j(m.elem,k);m.end=i(m.end);m.colorInit=true}m.elem.style[k]="rgb("+Math.max(Math.min(parseInt((m.pos*(m.end[0]-m.start[0]))+m.start[0],10),255),0)+","+Math.max(Math.min(parseInt((m.pos*(m.end[1]-m.start[1]))+m.start[1],10),255),0)+","+Math.max(Math.min(parseInt((m.pos*(m.end[2]-m.start[2]))+m.start[2],10),255),0)+")"}});function i(l){var k;if(l&&l.constructor==Array&&l.length==3){return l}if(k=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(l)){return[parseInt(k[1],10),parseInt(k[2],10),parseInt(k[3],10)]}if(k=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(l)){return[parseFloat(k[1])*2.55,parseFloat(k[2])*2.55,parseFloat(k[3])*2.55]}if(k=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(l)){return[parseInt(k[1],16),parseInt(k[2],16),parseInt(k[3],16)]}if(k=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(l)){return[parseInt(k[1]+k[1],16),parseInt(k[2]+k[2],16),parseInt(k[3]+k[3],16)]}if(k=/rgba\(0, 0, 0, 0\)/.exec(l)){return a.transparent}return a[g.trim(l).toLowerCase()]}function j(m,k){var l;do{l=g.curCSS(m,k);if(l!=""&&l!="transparent"||g.nodeName(m,"body")){break}k="backgroundColor"}while(m=m.parentNode);return i(l)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};var e=["add","remove","toggle"],c={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};function f(){var n=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,o={},l,m;if(n&&n.length&&n[0]&&n[n[0]]){var k=n.length;while(k--){l=n[k];if(typeof n[l]=="string"){m=l.replace(/\-(\w)/g,function(p,q){return q.toUpperCase()});o[m]=n[l]}}}else{for(l in n){if(typeof n[l]==="string"){o[l]=n[l]}}}return o}function b(l){var k,m;for(k in l){m=l[k];if(m==null||g.isFunction(m)||k in c||(/scrollbar/).test(k)||(!(/color/i).test(k)&&isNaN(parseFloat(m)))){delete l[k]}}return l}function h(k,m){var n={_:0},l;for(l in m){if(k[l]!=m[l]){n[l]=m[l]}}return n}g.effects.animateClass=function(k,l,n,m){if(g.isFunction(n)){m=n;n=null}return this.each(function(){var r=g(this),o=r.attr("style")||" ",s=b(f.call(this)),q,p=r.attr("className");g.each(e,function(t,u){if(k[u]){r[u+"Class"](k[u])}});q=b(f.call(this));r.attr("className",p);r.animate(h(s,q),l,n,function(){g.each(e,function(t,u){if(k[u]){r[u+"Class"](k[u])}});if(typeof r.attr("style")=="object"){r.attr("style").cssText="";r.attr("style").cssText=o}else{r.attr("style",o)}if(m){m.apply(this,arguments)}})})};g.fn.extend({_addClass:g.fn.addClass,addClass:function(l,k,n,m){return k?g.effects.animateClass.apply(this,[{add:l},k,n,m]):this._addClass(l)},_removeClass:g.fn.removeClass,removeClass:function(l,k,n,m){return k?g.effects.animateClass.apply(this,[{remove:l},k,n,m]):this._removeClass(l)},_toggleClass:g.fn.toggleClass,toggleClass:function(m,l,k,o,n){if(typeof l=="boolean"||l===undefined){if(!k){return this._toggleClass(m,l)}else{return g.effects.animateClass.apply(this,[(l?{add:m}:{remove:m}),k,o,n])}}else{return g.effects.animateClass.apply(this,[{toggle:m},l,k,o])}},switchClass:function(k,m,l,o,n){return g.effects.animateClass.apply(this,[{add:m,remove:k},l,o,n])}});g.extend(g.effects,{version:"1.8rc3",save:function(l,m){for(var k=0;k<m.length;k++){if(m[k]!==null){l.data("ec.storage."+m[k],l[0].style[m[k]])}}},restore:function(l,m){for(var k=0;k<m.length;k++){if(m[k]!==null){l.css(m[k],l.data("ec.storage."+m[k]))}}},setMode:function(k,l){if(l=="toggle"){l=k.is(":hidden")?"show":"hide"}return l},getBaseline:function(l,m){var n,k;switch(l[0]){case"top":n=0;break;case"middle":n=0.5;break;case"bottom":n=1;break;default:n=l[0]/m.height}switch(l[1]){case"left":k=0;break;case"center":k=0.5;break;case"right":k=1;break;default:k=l[1]/m.width}return{x:k,y:n}},createWrapper:function(k){if(k.parent().is(".ui-effects-wrapper")){return k.parent()}var l={width:k.outerWidth(true),height:k.outerHeight(true),"float":k.css("float")},m=g("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});k.wrap(m);m=k.parent();if(k.css("position")=="static"){m.css({position:"relative"});k.css({position:"relative"})}else{g.extend(l,{position:k.css("position"),zIndex:k.css("z-index")});g.each(["top","left","bottom","right"],function(n,o){l[o]=k.css(o);if(isNaN(parseInt(l[o],10))){l[o]="auto"}});k.css({position:"relative",top:0,left:0})}return m.css(l).show()},removeWrapper:function(k){if(k.parent().is(".ui-effects-wrapper")){return k.parent().replaceWith(k)}return k},setTransition:function(l,n,k,m){m=m||{};g.each(n,function(p,o){unit=l.cssUnit(o);if(unit[0]>0){m[o]=unit[0]*k+unit[1]}});return m}});function d(l,k,m,n){if(typeof l=="object"){n=k;m=null;k=l;l=k.effect}if(g.isFunction(k)){n=k;m=null;k={}}if(typeof k=="number"||g.fx.speeds[k]){n=m;m=k;k={}}k=k||{};m=m||k.duration;m=g.fx.off?0:typeof m=="number"?m:g.fx.speeds[m]||g.fx.speeds._default;n=n||k.complete;return[l,k,m,n]}g.fn.extend({effect:function(n,m,p,q){var l=d.apply(this,arguments),o={options:l[1],duration:l[2],callback:l[3]},k=g.effects[n];return k&&!g.fx.off?k.call(this,o):this},_show:g.fn.show,show:function(l){if(!l||typeof l=="number"||g.fx.speeds[l]){return this._show.apply(this,arguments)}else{var k=d.apply(this,arguments);k[1].mode="show";return this.effect.apply(this,k)}},_hide:g.fn.hide,hide:function(l){if(!l||typeof l=="number"||g.fx.speeds[l]){return this._hide.apply(this,arguments)}else{var k=d.apply(this,arguments);k[1].mode="hide";return this.effect.apply(this,k)}},__toggle:g.fn.toggle,toggle:function(l){if(!l||typeof l=="number"||g.fx.speeds[l]||typeof l=="boolean"||g.isFunction(l)){return this.__toggle.apply(this,arguments)}else{var k=d.apply(this,arguments);k[1].mode="toggle";return this.effect.apply(this,k)}},cssUnit:function(k){var l=this.css(k),m=[];g.each(["em","px","%","pt"],function(n,o){if(l.indexOf(o)>0){m=[parseFloat(l),o]}});return m}});g.easing.jswing=g.easing.swing;g.extend(g.easing,{def:"easeOutQuad",swing:function(l,m,k,o,n){return g.easing[g.easing.def](l,m,k,o,n)},easeInQuad:function(l,m,k,o,n){return o*(m/=n)*m+k},easeOutQuad:function(l,m,k,o,n){return-o*(m/=n)*(m-2)+k},easeInOutQuad:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m+k}return-o/2*((--m)*(m-2)-1)+k},easeInCubic:function(l,m,k,o,n){return o*(m/=n)*m*m+k},easeOutCubic:function(l,m,k,o,n){return o*((m=m/n-1)*m*m+1)+k},easeInOutCubic:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m*m+k}return o/2*((m-=2)*m*m+2)+k},easeInQuart:function(l,m,k,o,n){return o*(m/=n)*m*m*m+k},easeOutQuart:function(l,m,k,o,n){return-o*((m=m/n-1)*m*m*m-1)+k},easeInOutQuart:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m*m*m+k}return-o/2*((m-=2)*m*m*m-2)+k},easeInQuint:function(l,m,k,o,n){return o*(m/=n)*m*m*m*m+k},easeOutQuint:function(l,m,k,o,n){return o*((m=m/n-1)*m*m*m*m+1)+k},easeInOutQuint:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m*m*m*m+k}return o/2*((m-=2)*m*m*m*m+2)+k},easeInSine:function(l,m,k,o,n){return-o*Math.cos(m/n*(Math.PI/2))+o+k},easeOutSine:function(l,m,k,o,n){return o*Math.sin(m/n*(Math.PI/2))+k},easeInOutSine:function(l,m,k,o,n){return-o/2*(Math.cos(Math.PI*m/n)-1)+k},easeInExpo:function(l,m,k,o,n){return(m==0)?k:o*Math.pow(2,10*(m/n-1))+k},easeOutExpo:function(l,m,k,o,n){return(m==n)?k+o:o*(-Math.pow(2,-10*m/n)+1)+k},easeInOutExpo:function(l,m,k,o,n){if(m==0){return k}if(m==n){return k+o}if((m/=n/2)<1){return o/2*Math.pow(2,10*(m-1))+k}return o/2*(-Math.pow(2,-10*--m)+2)+k},easeInCirc:function(l,m,k,o,n){return-o*(Math.sqrt(1-(m/=n)*m)-1)+k},easeOutCirc:function(l,m,k,o,n){return o*Math.sqrt(1-(m=m/n-1)*m)+k},easeInOutCirc:function(l,m,k,o,n){if((m/=n/2)<1){return-o/2*(Math.sqrt(1-m*m)-1)+k}return o/2*(Math.sqrt(1-(m-=2)*m)+1)+k},easeInElastic:function(l,n,k,u,r){var o=1.70158;var q=0;var m=u;if(n==0){return k}if((n/=r)==1){return k+u}if(!q){q=r*0.3}if(m<Math.abs(u)){m=u;var o=q/4}else{var o=q/(2*Math.PI)*Math.asin(u/m)}return-(m*Math.pow(2,10*(n-=1))*Math.sin((n*r-o)*(2*Math.PI)/q))+k},easeOutElastic:function(l,n,k,u,r){var o=1.70158;var q=0;var m=u;if(n==0){return k}if((n/=r)==1){return k+u}if(!q){q=r*0.3}if(m<Math.abs(u)){m=u;var o=q/4}else{var o=q/(2*Math.PI)*Math.asin(u/m)}return m*Math.pow(2,-10*n)*Math.sin((n*r-o)*(2*Math.PI)/q)+u+k},easeInOutElastic:function(l,n,k,u,r){var o=1.70158;var q=0;var m=u;if(n==0){return k}if((n/=r/2)==2){return k+u}if(!q){q=r*(0.3*1.5)}if(m<Math.abs(u)){m=u;var o=q/4}else{var o=q/(2*Math.PI)*Math.asin(u/m)}if(n<1){return-0.5*(m*Math.pow(2,10*(n-=1))*Math.sin((n*r-o)*(2*Math.PI)/q))+k}return m*Math.pow(2,-10*(n-=1))*Math.sin((n*r-o)*(2*Math.PI)/q)*0.5+u+k},easeInBack:function(l,m,k,p,o,n){if(n==undefined){n=1.70158}return p*(m/=o)*m*((n+1)*m-n)+k},easeOutBack:function(l,m,k,p,o,n){if(n==undefined){n=1.70158}return p*((m=m/o-1)*m*((n+1)*m+n)+1)+k},easeInOutBack:function(l,m,k,p,o,n){if(n==undefined){n=1.70158}if((m/=o/2)<1){return p/2*(m*m*(((n*=(1.525))+1)*m-n))+k}return p/2*((m-=2)*m*(((n*=(1.525))+1)*m+n)+2)+k},easeInBounce:function(l,m,k,o,n){return o-g.easing.easeOutBounce(l,n-m,0,o,n)+k},easeOutBounce:function(l,m,k,o,n){if((m/=n)<(1/2.75)){return o*(7.5625*m*m)+k}else{if(m<(2/2.75)){return o*(7.5625*(m-=(1.5/2.75))*m+0.75)+k}else{if(m<(2.5/2.75)){return o*(7.5625*(m-=(2.25/2.75))*m+0.9375)+k}else{return o*(7.5625*(m-=(2.625/2.75))*m+0.984375)+k}}}},easeInOutBounce:function(l,m,k,o,n){if(m<n/2){return g.easing.easeInBounce(l,m*2,0,o,n)*0.5+k}return g.easing.easeOutBounce(l,m*2-n,0,o,n)*0.5+o*0.5+k}})})(jQuery);;
var swfobject=function(){var UNDEF="undefined",OBJECT="object",SHOCKWAVE_FLASH="Shockwave Flash",SHOCKWAVE_FLASH_AX="ShockwaveFlash.ShockwaveFlash",FLASH_MIME_TYPE="application/x-shockwave-flash",EXPRESS_INSTALL_ID="SWFObjectExprInst",ON_READY_STATE_CHANGE="onreadystatechange",win=window,doc=document,nav=navigator,plugin=false,domLoadFnArr=[main],regObjArr=[],objIdArr=[],listenersArr=[],storedAltContent,storedAltContentId,storedCallbackFn,storedCallbackObj,isDomLoaded=false,isExpressInstallActive=false,dynamicStylesheet,dynamicStylesheetMedia,autoHideShow=true,ua=function(){var w3cdom=typeof doc.getElementById!=UNDEF&&typeof doc.getElementsByTagName!=UNDEF&&typeof doc.createElement!=UNDEF,u=nav.userAgent.toLowerCase(),p=nav.platform.toLowerCase(),windows=p?/win/.test(p):/win/.test(u),mac=p?/mac/.test(p):/mac/.test(u),webkit=/webkit/.test(u)?parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,ie=!+"\v1",playerVersion=[0,0,0],d=null;if(typeof nav.plugins!=UNDEF&&typeof nav.plugins[SHOCKWAVE_FLASH]==OBJECT){d=nav.plugins[SHOCKWAVE_FLASH].description;if(d&&!(typeof nav.mimeTypes!=UNDEF&&nav.mimeTypes[FLASH_MIME_TYPE]&&!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)){plugin=true;ie=false;d=d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");playerVersion[0]=parseInt(d.replace(/^(.*)\..*$/,"$1"),10);playerVersion[1]=parseInt(d.replace(/^.*\.(.*)\s.*$/,"$1"),10);playerVersion[2]=/[a-zA-Z]/.test(d)?parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0;}}
else if(typeof win.ActiveXObject!=UNDEF){try{var a=new ActiveXObject(SHOCKWAVE_FLASH_AX);if(a){d=a.GetVariable("$version");if(d){ie=true;d=d.split(" ")[1].split(",");playerVersion=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)];}}}
catch(e){}}
return{w3:w3cdom,pv:playerVersion,wk:webkit,ie:ie,win:windows,mac:mac};}(),onDomLoad=function(){if(!ua.w3){return;}
if((typeof doc.readyState!=UNDEF&&doc.readyState=="complete")||(typeof doc.readyState==UNDEF&&(doc.getElementsByTagName("body")[0]||doc.body))){callDomLoadFunctions();}
if(!isDomLoaded){if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("DOMContentLoaded",callDomLoadFunctions,false);}
if(ua.ie&&ua.win){doc.attachEvent(ON_READY_STATE_CHANGE,function(){if(doc.readyState=="complete"){doc.detachEvent(ON_READY_STATE_CHANGE,arguments.callee);callDomLoadFunctions();}});if(win==top){(function(){if(isDomLoaded){return;}
try{doc.documentElement.doScroll("left");}
catch(e){setTimeout(arguments.callee,0);return;}
callDomLoadFunctions();})();}}
if(ua.wk){(function(){if(isDomLoaded){return;}
if(!/loaded|complete/.test(doc.readyState)){setTimeout(arguments.callee,0);return;}
callDomLoadFunctions();})();}
addLoadEvent(callDomLoadFunctions);}}();function callDomLoadFunctions(){if(isDomLoaded){return;}
try{var t=doc.getElementsByTagName("body")[0].appendChild(createElement("span"));t.parentNode.removeChild(t);}
catch(e){return;}
isDomLoaded=true;var dl=domLoadFnArr.length;for(var i=0;i<dl;i++){domLoadFnArr[i]();}}
function addDomLoadEvent(fn){if(isDomLoaded){fn();}
else{domLoadFnArr[domLoadFnArr.length]=fn;}}
function addLoadEvent(fn){if(typeof win.addEventListener!=UNDEF){win.addEventListener("load",fn,false);}
else if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("load",fn,false);}
else if(typeof win.attachEvent!=UNDEF){addListener(win,"onload",fn);}
else if(typeof win.onload=="function"){var fnOld=win.onload;win.onload=function(){fnOld();fn();};}
else{win.onload=fn;}}
function main(){if(plugin){testPlayerVersion();}
else{matchVersions();}}
function testPlayerVersion(){var b=doc.getElementsByTagName("body")[0];var o=createElement(OBJECT);o.setAttribute("type",FLASH_MIME_TYPE);var t=b.appendChild(o);if(t){var counter=0;(function(){if(typeof t.GetVariable!=UNDEF){var d=t.GetVariable("$version");if(d){d=d.split(" ")[1].split(",");ua.pv=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)];}}
else if(counter<10){counter++;setTimeout(arguments.callee,10);return;}
b.removeChild(o);t=null;matchVersions();})();}
else{matchVersions();}}
function matchVersions(){var rl=regObjArr.length;if(rl>0){for(var i=0;i<rl;i++){var id=regObjArr[i].id;var cb=regObjArr[i].callbackFn;var cbObj={success:false,id:id};if(ua.pv[0]>0){var obj=getElementById(id);if(obj){if(hasPlayerVersion(regObjArr[i].swfVersion)&&!(ua.wk&&ua.wk<312)){setVisibility(id,true);if(cb){cbObj.success=true;cbObj.ref=getObjectById(id);cb(cbObj);}}
else if(regObjArr[i].expressInstall&&canExpressInstall()){var att={};att.data=regObjArr[i].expressInstall;att.width=obj.getAttribute("width")||"0";att.height=obj.getAttribute("height")||"0";if(obj.getAttribute("class")){att.styleclass=obj.getAttribute("class");}
if(obj.getAttribute("align")){att.align=obj.getAttribute("align");}
var par={};var p=obj.getElementsByTagName("param");var pl=p.length;for(var j=0;j<pl;j++){if(p[j].getAttribute("name").toLowerCase()!="movie"){par[p[j].getAttribute("name")]=p[j].getAttribute("value");}}
showExpressInstall(att,par,id,cb);}
else{displayAltContent(obj);if(cb){cb(cbObj);}}}}
else{setVisibility(id,true);if(cb){var o=getObjectById(id);if(o&&typeof o.SetVariable!=UNDEF){cbObj.success=true;cbObj.ref=o;}
cb(cbObj);}}}}}
function getObjectById(objectIdStr){var r=null;var o=getElementById(objectIdStr);if(o&&o.nodeName=="OBJECT"){if(typeof o.SetVariable!=UNDEF){r=o;}
else{var n=o.getElementsByTagName(OBJECT)[0];if(n){r=n;}}}
return r;}
function canExpressInstall(){return!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)&&!(ua.wk&&ua.wk<312);}
function showExpressInstall(att,par,replaceElemIdStr,callbackFn){isExpressInstallActive=true;storedCallbackFn=callbackFn||null;storedCallbackObj={success:false,id:replaceElemIdStr};var obj=getElementById(replaceElemIdStr);if(obj){if(obj.nodeName=="OBJECT"){storedAltContent=abstractAltContent(obj);storedAltContentId=null;}
else{storedAltContent=obj;storedAltContentId=replaceElemIdStr;}
att.id=EXPRESS_INSTALL_ID;if(typeof att.width==UNDEF||(!/%$/.test(att.width)&&parseInt(att.width,10)<310)){att.width="310";}
if(typeof att.height==UNDEF||(!/%$/.test(att.height)&&parseInt(att.height,10)<137)){att.height="137";}
doc.title=doc.title.slice(0,47)+" - Flash Player Installation";var pt=ua.ie&&ua.win?"ActiveX":"PlugIn",fv="MMredirectURL="+win.location.toString().replace(/&/g,"%26")+"&MMplayerType="+pt+"&MMdoctitle="+doc.title;if(typeof par.flashvars!=UNDEF){par.flashvars+="&"+fv;}
else{par.flashvars=fv;}
if(ua.ie&&ua.win&&obj.readyState!=4){var newObj=createElement("div");replaceElemIdStr+="SWFObjectNew";newObj.setAttribute("id",replaceElemIdStr);obj.parentNode.insertBefore(newObj,obj);obj.style.display="none";(function(){if(obj.readyState==4){obj.parentNode.removeChild(obj);}
else{setTimeout(arguments.callee,10);}})();}
createSWF(att,par,replaceElemIdStr);}}
function displayAltContent(obj){if(ua.ie&&ua.win&&obj.readyState!=4){var el=createElement("div");obj.parentNode.insertBefore(el,obj);el.parentNode.replaceChild(abstractAltContent(obj),el);obj.style.display="none";(function(){if(obj.readyState==4){obj.parentNode.removeChild(obj);}
else{setTimeout(arguments.callee,10);}})();}
else{obj.parentNode.replaceChild(abstractAltContent(obj),obj);}}
function abstractAltContent(obj){var ac=createElement("div");if(ua.win&&ua.ie){ac.innerHTML=obj.innerHTML;}
else{var nestedObj=obj.getElementsByTagName(OBJECT)[0];if(nestedObj){var c=nestedObj.childNodes;if(c){var cl=c.length;for(var i=0;i<cl;i++){if(!(c[i].nodeType==1&&c[i].nodeName=="PARAM")&&!(c[i].nodeType==8)){ac.appendChild(c[i].cloneNode(true));}}}}}
return ac;}
function createSWF(attObj,parObj,id){var r,el=getElementById(id);if(ua.wk&&ua.wk<312){return r;}
if(el){if(typeof attObj.id==UNDEF){attObj.id=id;}
if(ua.ie&&ua.win){var att="";for(var i in attObj){if(attObj[i]!=Object.prototype[i]){if(i.toLowerCase()=="data"){parObj.movie=attObj[i];}
else if(i.toLowerCase()=="styleclass"){att+=' class="'+attObj[i]+'"';}
else if(i.toLowerCase()!="classid"){att+=' '+i+'="'+attObj[i]+'"';}}}
var par="";for(var j in parObj){if(parObj[j]!=Object.prototype[j]){par+='<param name="'+j+'" value="'+parObj[j]+'" />';}}
el.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+att+'>'+par+'</object>';objIdArr[objIdArr.length]=attObj.id;r=getElementById(attObj.id);}
else{var o=createElement(OBJECT);o.setAttribute("type",FLASH_MIME_TYPE);for(var m in attObj){if(attObj[m]!=Object.prototype[m]){if(m.toLowerCase()=="styleclass"){o.setAttribute("class",attObj[m]);}
else if(m.toLowerCase()!="classid"){o.setAttribute(m,attObj[m]);}}}
for(var n in parObj){if(parObj[n]!=Object.prototype[n]&&n.toLowerCase()!="movie"){createObjParam(o,n,parObj[n]);}}
el.parentNode.replaceChild(o,el);r=o;}}
return r;}
function createObjParam(el,pName,pValue){var p=createElement("param");p.setAttribute("name",pName);p.setAttribute("value",pValue);el.appendChild(p);}
function removeSWF(id){var obj=getElementById(id);if(obj&&obj.nodeName=="OBJECT"){if(ua.ie&&ua.win){obj.style.display="none";(function(){if(obj.readyState==4){removeObjectInIE(id);}
else{setTimeout(arguments.callee,10);}})();}
else{obj.parentNode.removeChild(obj);}}}
function removeObjectInIE(id){var obj=getElementById(id);if(obj){for(var i in obj){if(typeof obj[i]=="function"){obj[i]=null;}}
obj.parentNode.removeChild(obj);}}
function getElementById(id){var el=null;try{el=doc.getElementById(id);}
catch(e){}
return el;}
function createElement(el){return doc.createElement(el);}
function addListener(target,eventType,fn){target.attachEvent(eventType,fn);listenersArr[listenersArr.length]=[target,eventType,fn];}
function hasPlayerVersion(rv){var pv=ua.pv,v=rv.split(".");v[0]=parseInt(v[0],10);v[1]=parseInt(v[1],10)||0;v[2]=parseInt(v[2],10)||0;return(pv[0]>v[0]||(pv[0]==v[0]&&pv[1]>v[1])||(pv[0]==v[0]&&pv[1]==v[1]&&pv[2]>=v[2]))?true:false;}
function createCSS(sel,decl,media,newStyle){if(ua.ie&&ua.mac){return;}
var h=doc.getElementsByTagName("head")[0];if(!h){return;}
var m=(media&&typeof media=="string")?media:"screen";if(newStyle){dynamicStylesheet=null;dynamicStylesheetMedia=null;}
if(!dynamicStylesheet||dynamicStylesheetMedia!=m){var s=createElement("style");s.setAttribute("type","text/css");s.setAttribute("media",m);dynamicStylesheet=h.appendChild(s);if(ua.ie&&ua.win&&typeof doc.styleSheets!=UNDEF&&doc.styleSheets.length>0){dynamicStylesheet=doc.styleSheets[doc.styleSheets.length-1];}
dynamicStylesheetMedia=m;}
if(ua.ie&&ua.win){if(dynamicStylesheet&&typeof dynamicStylesheet.addRule==OBJECT){dynamicStylesheet.addRule(sel,decl);}}
else{if(dynamicStylesheet&&typeof doc.createTextNode!=UNDEF){dynamicStylesheet.appendChild(doc.createTextNode(sel+" {"+decl+"}"));}}}
function setVisibility(id,isVisible){if(!autoHideShow){return;}
var v=isVisible?"visible":"hidden";if(isDomLoaded&&getElementById(id)){getElementById(id).style.visibility=v;}
else{createCSS("#"+id,"visibility:"+v);}}
function urlEncodeIfNecessary(s){var regex=/[\\\"<>\.;]/;var hasBadChars=regex.exec(s)!=null;return hasBadChars&&typeof encodeURIComponent!=UNDEF?encodeURIComponent(s):s;}
var cleanup=function(){if(ua.ie&&ua.win){window.attachEvent("onunload",function(){var ll=listenersArr.length;for(var i=0;i<ll;i++){listenersArr[i][0].detachEvent(listenersArr[i][1],listenersArr[i][2]);}
var il=objIdArr.length;for(var j=0;j<il;j++){removeSWF(objIdArr[j]);}
for(var k in ua){ua[k]=null;}
ua=null;for(var l in swfobject){swfobject[l]=null;}
swfobject=null;});}}();return{registerObject:function(objectIdStr,swfVersionStr,xiSwfUrlStr,callbackFn){if(ua.w3&&objectIdStr&&swfVersionStr){var regObj={};regObj.id=objectIdStr;regObj.swfVersion=swfVersionStr;regObj.expressInstall=xiSwfUrlStr;regObj.callbackFn=callbackFn;regObjArr[regObjArr.length]=regObj;setVisibility(objectIdStr,false);}
else if(callbackFn){callbackFn({success:false,id:objectIdStr});}},getObjectById:function(objectIdStr){if(ua.w3){return getObjectById(objectIdStr);}},embedSWF:function(swfUrlStr,replaceElemIdStr,widthStr,heightStr,swfVersionStr,xiSwfUrlStr,flashvarsObj,parObj,attObj,callbackFn){var callbackObj={success:false,id:replaceElemIdStr};if(ua.w3&&!(ua.wk&&ua.wk<312)&&swfUrlStr&&replaceElemIdStr&&widthStr&&heightStr&&swfVersionStr){setVisibility(replaceElemIdStr,false);addDomLoadEvent(function(){widthStr+="";heightStr+="";var att={};if(attObj&&typeof attObj===OBJECT){for(var i in attObj){att[i]=attObj[i];}}
att.data=swfUrlStr;att.width=widthStr;att.height=heightStr;var par={};if(parObj&&typeof parObj===OBJECT){for(var j in parObj){par[j]=parObj[j];}}
if(flashvarsObj&&typeof flashvarsObj===OBJECT){for(var k in flashvarsObj){if(typeof par.flashvars!=UNDEF){par.flashvars+="&"+k+"="+flashvarsObj[k];}
else{par.flashvars=k+"="+flashvarsObj[k];}}}
if(hasPlayerVersion(swfVersionStr)){var obj=createSWF(att,par,replaceElemIdStr);if(att.id==replaceElemIdStr){setVisibility(replaceElemIdStr,true);}
callbackObj.success=true;callbackObj.ref=obj;}
else if(xiSwfUrlStr&&canExpressInstall()){att.data=xiSwfUrlStr;showExpressInstall(att,par,replaceElemIdStr,callbackFn);return;}
else{setVisibility(replaceElemIdStr,true);}
if(callbackFn){callbackFn(callbackObj);}});}
else if(callbackFn){callbackFn(callbackObj);}},switchOffAutoHideShow:function(){autoHideShow=false;},ua:ua,getFlashPlayerVersion:function(){return{major:ua.pv[0],minor:ua.pv[1],release:ua.pv[2]};},hasFlashPlayerVersion:hasPlayerVersion,createSWF:function(attObj,parObj,replaceElemIdStr){if(ua.w3){return createSWF(attObj,parObj,replaceElemIdStr);}
else{return undefined;}},showExpressInstall:function(att,par,replaceElemIdStr,callbackFn){if(ua.w3&&canExpressInstall()){showExpressInstall(att,par,replaceElemIdStr,callbackFn);}},removeSWF:function(objElemIdStr){if(ua.w3){removeSWF(objElemIdStr);}},createCSS:function(selStr,declStr,mediaStr,newStyleBoolean){if(ua.w3){createCSS(selStr,declStr,mediaStr,newStyleBoolean);}},addDomLoadEvent:addDomLoadEvent,addLoadEvent:addLoadEvent,getQueryParamValue:function(param){var q=doc.location.search||doc.location.hash;if(q){if(/\?/.test(q)){q=q.split("?")[1];}
if(param==null){return urlEncodeIfNecessary(q);}
var pairs=q.split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=")+1)));}}}
return"";},expressInstallCallback:function(){if(isExpressInstallActive){var obj=getElementById(EXPRESS_INSTALL_ID);if(obj&&storedAltContent){obj.parentNode.replaceChild(storedAltContent,obj);if(storedAltContentId){setVisibility(storedAltContentId,true);if(ua.ie&&ua.win){storedAltContent.style.display="block";}}
if(storedCallbackFn){storedCallbackFn(storedCallbackObj);}}
isExpressInstallActive=false;}}};}();
/*** sni-core ***/

  
if(typeof(SNI.Util)=="undefined"){SNI.Util={};}
SNI.Util.inputField=function(elem,defaultText,preventDefault){var elem=$k(elem);var preventDefault=preventDefault==null?'blank':preventDefault;var hintClass='input-hint';if(elem.length>0){var input=elem.get(0);if($k(input).is('input[type=text]')){if($k.trim(elem.val())===''){elem.val(defaultText);elem.addClass(hintClass);}
elem.blur(function(){if($k.trim(this.value)===''){this.value=defaultText;elem.addClass(hintClass);}});elem.focus(function(){if(this.value==defaultText){this.value='';}
elem.removeClass(hintClass);});if(preventDefault===true||preventDefault=='blank'){form=$k(elem.get(0).form);if(form){form.submit(function(event){if($k.trim(elem.val())==defaultText||$k.trim(elem.val())==""){if(preventDefault===true){event.preventDefault();elem.focus();}else{elem.val('');}}
return true;});}}}}};SNI.Util.popup=function(url,w,h,menu){x=Math.floor((screen.width-w)/2);y=Math.floor((screen.height-h)/2);now=new Date();features="screenx="+x+",screeny="+y+",left="+x+",top="+y+",width="+w+",height="+h+",location=no,resizable=yes"+",directories=no,status=no,scrollbars=yes";if(menu!=null){features+=",menubar=yes,toolbar=yes";}else{features+=",menubar=no,toolbar=no";}
window.open(url,"newwin",features);};SNI.Util.getUrlParam=function(name){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null){return"";}else{return results[1];}};SNI.Util.truncate=function(str,length,truncation){length=length||30;truncation=truncation==undefined?'...':truncation;return str.length>length?str.slice(0,length-truncation.length)+truncation:str;};SNI.Util.ImageEnlarge={init:function(element,config){config=$k.extend({clickCtrl:"a.img-enlarge",insertPoint:element,imgFrame:"#blow-up",closeCtrl:"#blow-up a.close",closeCtrlBtn:"#blow-up a.close-btn"},config);$k(config.clickCtrl).click(function(){$k(config.insertPoint).prepend(SNI.Util.ImageEnlarge.htmlImage(this.href));$k(config.closeCtrl).click(SNI.Util.ImageEnlarge.closeImg);$k(config.closeCtrlBtn).click(SNI.Util.ImageEnlarge.closeImg);return false;});},htmlImage:function(imgURL){retHTML="<div id='blow-up' class='clrfix'><div class=\"flyout fxlg\"><div class=\"fly-hd\"></div>";retHTML+="<div class=\"fly-bd\"><a class=\"close\" href=\"#\"></a><img width='616' src='"+imgURL+"'>";retHTML+="<p class=\"blow-up-btn clrfix\"><a href=\"#\" class=\"button close-btn\"><span>Close</span></a></p>";if((typeof pgalurl)!="undefined"){retHTML+="<span class='pgal-link'>or <a href='"+pgalurl+"'>Go to Photo Gallery</a></span>";}
retHTML+="</div><div class=\"fly-ft\"></div></div></div>";return retHTML;},closeImg:function(e){$k(this).parents().find("#blow-up").remove();return false;}};SNI.Util.cloneObject=function(obj){var newObj=(obj instanceof Array)?[]:{};for(var i in obj){if(obj[i]&&typeof obj[i]=="object"){newObj[i]=SNI.Util.cloneObject(obj[i]);}else
newObj[i]=obj[i];}
return newObj;};SNI.Util.mergeObjects=function(trg,src){var lastArg=arguments[arguments.length-1];var deep=arguments.length>2&&typeof(lastArg)=='boolean'?lastArg:false;var result=SNI.Util.cloneObject(trg);if(typeof(src)!='object'||src==null)return result;for(prop in src){if(typeof(trg[prop])=='undefined'||trg[prop].constructor==Array||typeof(trg[prop])!='object'||!deep){result[prop]=src[prop];continue;}
result[prop]=SNI.Util.mergeObjects(trg[prop],src[prop],deep);}
return result;};SNI.Util.Cookie={SEARCH:'S',UI:'U',get:function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length);}
if(c.indexOf(nameEQ)===0){return c.substring(nameEQ.length,c.length);}}
return null;},set:function(name,value,days,path){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}
if(!path){path='/';}
document.cookie=name+"="+value+expires+"; path="+path;},remove:function(name){this.set(name,"",-1);},persist:function(cookieName,key,value,days){var cookie=this.get(cookieName);days=days||30;if(typeof value=='undefined'){if(cookie==null){return null;}else{var values=this.getPersistValues(cookie);return values[key];}}else{if(cookie==null){var values={};values[key]=value;}else{var values=this.getPersistValues(cookie);values[key]=value;}
this.set(cookieName,this.buildPersistString(values),days);}},getPersistValues:function(cookie){var values={};var temp='';$k.each(cookie.split('&'),function(k,v){temp=v.split('=');if(temp[0]){values[temp[0]]=unescape(temp[1]);}});return values;},buildPersistString:function(values){var result=[];$k.each(values,function(k,v){if(v!=null){result.push(k+'='+escape(v));}});return result.join('&');}};SNI.Util.LazyLoad=function(img_element,src){if(img_element.attr('src')){return;}
var image_src=src||img_element.attr('data-src');img_element.attr('src',image_src);return img_element;}
SNI.Util.Url={setParameter:function(url,param,val){var curPairs;var paramPair;var hashString="";if(url.indexOf("#")>-1){hashString=url.substr(url.indexOf("#")+1);url=url.substring(0,url.indexOf("#"));}
var allPairs=[];var urlParts=url.split('?');if(urlParts.length>1){curPairs=urlParts[1].split('&');jQuery(curPairs).each(function(index){var paramPair=this;var paramParts=paramPair.split('=');if(paramParts[0]!=param){allPairs.push(paramParts[0]+'='+(typeof paramParts[1]!="undefined"?paramParts[1]:''));}});}
if(val!==null&&typeof val!=='undefined'){allPairs.push(param+'='+val);}
return urlParts[0]+'?'+allPairs.join('&')+(hashString?"#"+hashString:"");},getParameter:function(url,param){var i,urlParts,curPairs,paramParts;if(url.indexOf("#")>-1){url=url.substring(0,url.indexOf("#"));}
urlParts=url.split('?');if(urlParts.length>1){curPairs=urlParts[1].split('&');for(i=0;i<curPairs.length;i++){var paramPair=curPairs[i];paramParts=paramPair.split('=');if(paramParts[0]===param){return paramParts[1];}}}
return null;},getHash:function(url){if(url.indexOf("#")>-1){return url.substring(url.indexOf("#")+1);}
return"";}};
SNI.MetaData={};SNI.MetaData.Parameter=function(){var parameters={};this.addParameter=function(key,value){key=key.toUpperCase();if(!parameters[key]){parameters[key]=[];}
parameters[key].push(value);};this.getParameter=function(key,separator){key=key.toUpperCase();if(!parameters[key]){return;}
return parameters[key].join(separator);};this.getKeys=function(){return parameters;};this.setParameter=function(key,value){key=key.toUpperCase();parameters[key]=[];parameters[key].push(value);};};SNI.MetaData.Manager=function(){var m=new SNI.MetaData.Parameter();this.addParameter=m.addParameter;this.getParameter=m.getParameter;this.getKeys=m.getKeys;this.setParameter=m.setParameter;this.getParameterString=function(key){var s=this.getParameter(key," ");if(s==null){s="";}
return s;};this.getPageType=function(){return this.getParameterString("Type");};this.getPageTitle=function(){return this.getParameterString("Title");};this.getSite=function(){return this.getParameterString("Site");};this.getSctnId=function(){return this.getParameterString("SctnId");};this.getSctnName=function(){return this.getParameterString("SctnName");};this.getSponsorship=function(){return this.getParameterString("Sponsorship");};this.getAbstract=function(){return this.getParameterString("Abstract");};this.getKeywords=function(){return this.getParameterString("Keywords");};this.getClassification=function(){return this.getParameterString("Classification");};this.getSctnDspName=function(){return this.getParameterString("SctnDspName");};this.getCategoryDspName=function(){return this.getParameterString("CategoryDspName");};this.getShowAbbr=function(){return this.getParameterString("Show_Abbr");};this.getRole=function(){return this.getParameterString("Role");};this.getDetailId=function(){return this.getParameterString("DetailId");};this.getPageNumber=function(){return this.getParameterString("PageNumber");};this.getUniqueId=function(){return this.getParameterString("UniqueId");};this.getUserId=function(){return this.getParameterString("UserId");};this.getUserIdEmail=function(){return this.getParameterString("UserIdEmail");};this.getUserIdCreateDt=function(){return this.getParameterString("UserIdCreateDt");};this.getUserIdVersion=function(){return this.getParameterString("UserIdVersion");};this.getFilters=function(){return this.getParameterString("Filters");};this.getMultimediaFlag=function(){return this.getParameterString("MultimediaFlag");};this.getChefName=function(){return this.getParameterString("ChefName");};this.getMealPart=function(){return this.getParameterString("MealPart");};this.getCuisine=function(){return this.getParameterString("Cuisine");};this.getOccasion=function(){return this.getParameterString("Occasion"," ");};this.getMainIngredient=function(){return this.getParameterString("MainIngredient");};this.getTechnique=function(){return this.getParameterString("Technique"," ");};this.getDish=function(){return this.getParameterString("Dish"," ");};this.getMealType=function(){return this.getParameterString("MealType"," ");};this.getNutrition=function(){return this.getParameterString("Nutrition"," ");};this.getDifficulty=function(){return this.getParameterString("Difficulty"," ");};this.getSearchTerm=function(){var args=parseQueryString();for(var arg in args){var s=arg.toUpperCase();if(s=='SEARCHSTRING'){return args[arg];}}
return"";};this.setMultimediaFlag=function(flag){if(flag!=null){this.addParameter("MultimediaFlag",flag);}else{this.addParameter("MultimediaFlag","");}};this.parseQueryString=function(str){str=str?str:document.location.search;var query=str.charAt(0)=='?'?str.substring(1):str;var args={};if(query){var fields=query.split('&');for(var f=0;f<fields.length;f++){var field=fields[f].split('=');args[unescape(field[0].replace(/\+/g,' '))]=unescape(field[1].replace(/\+/g,' '));}}
return args;};};var MetaDataManager=SNI.MetaData.Manager;
if(typeof(SNI.Ads)=='undefined'){SNI.Ads={_adServerHostname:SNI.Config.adServerUrl};}
SNI.Ads.Url=function(){var p=new SNI.MetaData.Parameter();this.addParameter=p.addParameter;this.getParameter=p.getParameter;this.getKeys=p.getKeys;this.url='';this.buildUrl=buildUrl;this.buildExpandedUrl=buildExpandedUrl;this.setUrl=setUrl;this.getUrl=getUrl;this.buildQueryStringValuePairs=buildQueryStringValuePairs;this.buildExpandedQueryStringValuePairs=buildExpandedQueryStringValuePairs;function setUrl(u){this.url=u;}
function getUrl(){return this.url;}
function buildQueryStringValuePairs(){var queryString="";for(key in this.getKeys()){if(queryString!==""){queryString+='&';}
queryString+=key+'='+this.getParameter(key,',');}
return queryString;}
function buildUrl(){return this.getUrl()+this.buildQueryStringValuePairs();}
function buildExpandedQueryStringValuePairs(){var queryString="";for(key in this.getKeys()){var item=this.getParameter(key,",");var iArray=item.split(",");for(i=0;i<iArray.length;i++){if(queryString!==""&&iArray[i]!==""&&iArray[i]!==undefined){queryString+='&';}
if(iArray[i]!==""&&iArray[i]!==undefined){queryString+=key+'='+iArray[i];}}}
return queryString;}
function buildExpandedUrl(){var sJitterbug="";if(window.location.hostname.indexOf("jitterbug")!=(-1)){sJitterbug="&domain=jitterbug";}
var sRSI="";if((SNI.Ads.UseRSI)&&(segQS.length>0)){sRSI=segQS;}
return this.getUrl()+this.buildExpandedQueryStringValuePairs()+sJitterbug+sRSI;}};Ad.prototype=new SNI.Ads.Url();function Ad()
{var url=new SNI.Ads.Url();this.addParameter=url.addParameter;this.getParameter=url.getParameter;this.getKeys=url.getKeys;this.buildUrl=url.buildUrl;this.buildExpandedUrl=url.buildExpandedUrl;var feature=new SNI.MetaData.Parameter();this.useFeature=useFeature;this.getFeature=getFeature;this.debug=debug;this.write=write;this.deferrable=1;function useFeature(key){feature.addParameter(key,"T");}
function getFeature(key){return feature.getParameter(key,",");}
function debug(){document.write('<div style="background:red;color:white;">'+this.buildExpandedUrl()+'</div>');}
function write(){}}
DartAd.prototype=new Ad();function DartAd()
{DartAd.prototype=new Ad();this.write=write;this.useFeature("site");this.useFeature("category");this.useFeature("vgncontent");this.useFeature("ord");this.useFeature("topic");this.useFeature("tile");this.useFeature("pagetype");this.useFeature("SECTION_ID");this.useFeature("SUBSECTION");this.useFeature("page");this.useFeature("uniqueid");this.useFeature("adkey1");this.useFeature("adkey2");this.useFeature("chef");this.useFeature("show");this.useFeature("delvfrmt");this.useFeature("source");this.useFeature("filter");this.useFeature("difficulty");this.useFeature("cuisine");this.useFeature("ingredient");this.useFeature("occasion");this.useFeature("mealpart");this.useFeature("technique");this.adClass="AD_CLASS";function write(){if(navigator.userAgent.indexOf("#sni-loadtest#")!==-1){return;}
document.write('<script type="text/javascript" src="'+this.buildExpandedUrl()+'"></script>');}}
AdUrl.prototype=new Ad();function AdUrl()
{AdUrl.prototype=new Ad();this.write=write;this.useFeature("site");this.useFeature("category");this.useFeature("vgncontent");this.useFeature("ord");this.useFeature("topic");this.useFeature("tile");this.useFeature("pagetype");this.useFeature("SECTION_ID");this.useFeature("SUBSECTION");this.useFeature("page");this.useFeature("uniqueid");this.useFeature("SearchKeywords");this.useFeature("SearchFilters");this.useFeature("adkey1");this.useFeature("adkey2");this.useFeature("chef");this.useFeature("show");this.useFeature("delvfrmt");this.useFeature("source");this.useFeature("filter");this.useFeature("difficulty");this.useFeature("cuisine");this.useFeature("ingredient");this.useFeature("occasion");this.useFeature("mealpart");this.useFeature("technique");function write(){}}
DartAdvanceAd.prototype=new DartAd();function DartAdvanceAd()
{DartAdvanceAd.prototype=new DartAd();this.write=write;this.align='';this.frameborder=0;this.height='';this.longdesc='';this.marginheight=0;this.marginwidth=0;this.name='';this.scrolling='no';this.width='100%';this.useIframe=false;function write(){if(navigator.userAgent.indexOf("#sni-loadtest#")!==-1){return;}
if(this.useIframe==false){this.setUrl("http://"+SNI.Ads._adServerHostname+"/js.ng/");document.write('<script type="text/javascript" src="'+this.buildExpandedUrl()+'"></script>');}else{this.setUrl("http://"+SNI.Ads._adServerHostname+"/html.ng/");document.write('<iframe src ="'+this.buildExpandedUrl()+'" align ="'+this.align+'" frameborder ="'+this.frameborder+'" height ="'+this.height+'" longdesc ="'+this.longdesc+'" marginheight ="'+this.marginheight+'" marginwidth ="'+this.marginwidth+'" name ="'+this.name+'" scrolling ="'+this.scrolling+'" width ="'+this.width+'"></iframe>');}}}
function AdManager()
{var p=new SNI.MetaData.Parameter();this.addParameter=p.addParameter;this.getParameter=p.getParameter;this.getKeys=p.getKeys;this.createAd=createAd;this.createDeferredAd=createDeferredAd;this.moveAds=moveAds;this.ads=[];this.defer=false;if(document.deferAds!==null&&document.deferAds==1&&document.deferEnabled!==null&&document.deferEnabled==1){this.defer=true;}
function createAd(ad){for(key in this.getKeys()){if(ad.getFeature(key)!==undefined){ad.addParameter(key,this.getParameter(key,','));}}
if(document.debug==1){ad.debug();}
ad.write();}
function createDeferredAd(i){}
function moveAds(){}}
function AdRestriction()
{var p=new SNI.MetaData.Parameter();this.addParameter=p.addParameter;this.getParameter=p.getParameter;this.getKeys=p.getKeys;this.isActive=true;this.isIframe=false;}
function AdDefault()
{var p=new SNI.MetaData.Parameter();this.addParameter=p.addParameter;this.getParameter=p.getParameter;this.getKeys=p.getKeys;this.display=false;}
function AdRestrictionManager(){this.restriction=[];this.adDefaults=[];this.isActive=isActive;this.isIframe=isIframe;this.isMatch=isMatch;this.startMatch=startMatch;function isActive(ad,mdm){var value=false;var adDefaultMatch=false;var defaultReturnValue=true;for(var i=0;i<this.adDefaults.length;i++){adDefaultMatch=this.startMatch(ad,mdm,this.adDefaults[i]);if(adDefaultMatch==true){defaultReturnValue=this.adDefaults[i].display;break;}}
for(var i=0;i<this.restriction.length;i++){adRestriction=this.restriction[i];if(!adRestriction.isActive){value=this.startMatch(ad,mdm,adRestriction);}
if(value==true){return!defaultReturnValue;}}
return defaultReturnValue;}
function isIframe(ad,mdm){var value=false;for(var i=0;i<this.restriction.length;i++){adRestriction=this.restriction[i];if(adRestriction.isIframe){value=this.startMatch(ad,mdm,adRestriction);}}
return value;}
function startMatch(ad,mdm,adRestriction){var match=true;for(var key in adRestriction.getKeys()){var restrictions=adRestriction.getParameter(key,',');var value=mdm.getParameter(key,'----');match=this.isMatch(value,restrictions);if(!match){value=ad.getParameter(key,'----');match=this.isMatch(value,restrictions);}
if(!match){return false;}}
return match;}
function isMatch(value,restrictions){var match=false;if(value){splitValue=value.split('----');for(var x=0;x<splitValue.length;x++){if(restrictions==splitValue[x]){match=true;}
for(var a;a<restrictions.length;a++){if(splitValue[x]==restrictions[a]){return true;}}}}
return match;}}
function initAdManager(adm,mdm){function admAppendParam(key,val){if(val!=""){val=val.replace(/-/g,"_");val=val.replace(/ /g,"_");s=val.split(',',1);adm.addParameter(key,s);}}
var ranNum=String(Math.round(Math.random()*10000000000));var now=new Date();var ad_ord=now.getTime()%10000000000;var amPageType=mdm.getPageType();var amSponsorship=mdm.getSponsorship();var amKeywords=mdm.getKeywords();amPageType=amPageType.replace(/-/g,"_");var amUniqueId=mdm.getUniqueId();amUniqueId=amUniqueId.replace(/-/g,"_");if(amSponsorship!==""&&amSponsorship!==undefined){amSponsorship=amSponsorship.replace(/-/g,"_");amSponsorship=amSponsorship.replace(/ /g,"_");}
if(amKeywords!==""&&amKeywords!==undefined){amKeywords=amKeywords.replace(/,/g,"_");}
amSctns=mdm.getClassification();amSctns=amSctns.split(",");if(amSctns.length>1){for(var i=0;i<amSctns.length;i++){if(i==(amSctns.length-1)){adm.addParameter("sitesection",amSctns[i]);}else if(i==(amSctns.length-2)){adm.addParameter("category",amSctns[i]);}else if(i==(amSctns.length-3)){adm.addParameter("vgncontent",amSctns[i]);}else{adm.addParameter("SUBSECTION",amSctns[i]);}}}else{var c=mdm.getClassification();adm.addParameter("category",c);}
if(amPageType=='SECTION'){if(!adm.getParameter("vgncontent"," ")){adm.addParameter("page","MAIN");}}
var s=mdm.getSite();adm.addParameter("site",s);var gsId=mdm.getSctnId();adm.addParameter("tile",ranNum+gsId);adm.addParameter("ord",ad_ord);adm.addParameter("topic",amSponsorship);adm.addParameter("keywords",amKeywords);adm.addParameter("pagetype",amPageType);adm.addParameter("uniqueid",amUniqueId);var sId=mdm.getSctnId();adm.addParameter("SECTION_ID",sId);admAppendParam("adkey1",mdm.getParameterString("AdKey1").toUpperCase());admAppendParam("adkey2",mdm.getParameterString("AdKey2").toUpperCase());admAppendParam("delvfrmt",mdm.getParameterString("DelvFrmt"));admAppendParam("source",mdm.getParameterString("Source"));admAppendParam("filter",mdm.getParameterString("filter"));admAppendParam("chef",mdm.getParameterString("ChefName"));admAppendParam("show",mdm.getParameterString("Show_Abbr"));admAppendParam("difficulty",mdm.getParameterString("Difficulty"));admAppendParam("cuisine",mdm.getParameterString("Cuisine"));admAppendParam("ingredient",mdm.getParameterString("MainIngredient"));admAppendParam("occasion",mdm.getParameterString("Occasion"));admAppendParam("mealpart",mdm.getParameterString("MealPart"));admAppendParam("technique",mdm.getParameterString("Technique"));}
function SNIAd(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");}
if(adtype=='LEADERBOARD'||adtype=='PUSHDOWN'){ad.addParameter("Role",mdManager.getParameter("Role"));}
ad.addParameter("adsize",adsize);ad.addParameter("PagePos",pos);ad.useFeature("tile");if(keywords!=""){var words=keywords.split(" ");for(i=0;i<words.length;i++){ad.addParameter("keyword",words[i]);}}
switch(adtype){default:writeAd(ad);break;}}
function writeAd(ad){if(typeof adRestrictionManager!='undefined'){ad.useIframe=adRestrictionManager.isIframe(ad,mdManager);if(adRestrictionManager.isActive(ad,mdManager)!=false){adManager.createAd(ad);}}else{adManager.createAd(ad);}}
function LeaderboardAd(pos){if(pos<0||pos==undefined||pos==''){pos=1;}
SNIAd('LEADERBOARD','468x60',pos);}
function PushdownAd(pos){if(pos<0||pos==undefined){pos=1;}
SNIAd('PUSHDOWN','',pos);}
function GoogleBigboxAd(pos){if(pos<0||pos==undefined){pos=1;}
SNIAd('GOOGLE_BIGBOX','',pos);}
function GoogleLeaderboardAd(pos){if(pos<0||pos==undefined){pos=1;}
SNIAd('GOOGLE_LEADERBOARD','',pos);}
function BigboxAd(pos,keywords){if(typeof(mdManager)!=undefined&&mdManager.getParameterString("VideoPlayer")==""){if(pos<0||pos==undefined){pos=1;}
SNIAd('BIGBOX','',pos,keywords);}}
function BigboxAd300x150(pos,keywords){if(pos<0||pos==undefined){pos=1;}
SNIAd('SPONSORSHIP_CONTENT','',pos,keywords);}
function SuperstitialAd(pos){if(pos<0||pos==undefined){pos=1;}
SNIAd('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.addParameter("Role",mdManager.getParameter("Role"));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($k("#leaderboard").length>0){boxW=728;boxH=90;$k("#leaderboard").html("<iframe src='"+sync_banner+"\' width=\'"+boxW+"\' height=\'"+boxH+"\'"+"frameborder='0' scrolling='no' marginheight='0' marginwidth='0'></iframe>");}}else{if($k("#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;}
$k("#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($k("#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;}
$k("#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);$k(document).ready(function(){var sponsor=$k('.sponsor-multi-logo');if($k('a img',sponsor).length>0){if(sponsor.parents("div").hasClass("generic-lead")){$k(".generic-lead .hd").css({"border-bottom":"1px solid #e3e3e3","padding":"5px"});}
if(($k('em:first-child',sponsor).length<=0)&&(!(sponsor.parents("div").hasClass("section-title")))){if(sponsor.is(':only-child')||sponsor.siblings().is(':empty')){sponsor.prepend('<em class="solo">Sponsored by:</em>');}else{sponsor.prepend("<em>Sponsored by:</em>");}}}});}}
function sponsorTextLinks(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+"/[NEW_SERVER_SIDE_FILENAME] "+linkNum+".html?");ad.addParameter("adtype",adtype);ad.addParameter("PagePos",1);if(linkNum>0){writeAd(ad);}}
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+"/snd_dp_links"+linkNum+".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)=="undefined"){SNI={};}
if(typeof(SNI.RSI)=="undefined"){SNI.RSI={};}
var segQS="";SNI.RSI.rdcookie=function(){var rsi_segs=[];var segs_beg=document.cookie.indexOf('rsi_segs=');if(segs_beg>=0){segs_beg=document.cookie.indexOf('=',segs_beg)+1;if(segs_beg>0){var segs_end=document.cookie.indexOf(';',segs_beg);if(segs_end==-1)segs_end=document.cookie.length;rsi_segs=document.cookie.substring(segs_beg,segs_end).split('|');}}
var segLen=20;if(rsi_segs.length<segLen){segLen=rsi_segs.length}
for(var i=0;i<segLen;i++){segQS+=("&rsi"+"="+rsi_segs[i])}
SNI.Ads.UseRSI=true;return;}
SNI.RSI.rdcookie();SNI.RSI.setvars=function(){A09802.DM_cat(mdManager.getParameter("Classification").split(',').reverse().join(' > '));A09802.DM_addEncToLoc("keyword",mdManager.getParameter(SNI.Config.rsiKeyWord));A09802.DM_tag();}
/*** sni-UR ***/


String.prototype.trim=function(){return this.replace(/^\s+|\s+$/,'');};if(typeof(SNI.UR)=='undefined'){SNI.UR={};}
var userIdCookieUserId;var userIdEmail;var userIdCookieCreateDt;var userIdCookieVersion;SNI.UR.IdCookie=function(){this.id="";this.email="";this.createDate=new Date();this.version="2.0";this.domain=getPrimaryDomain();this.secure="";this.path="/";this.cookieName='userIdCookie';this.expirationDate=new Date(new Date().getTime()+(10000*1000*60*60*24));function getCookieKeyValue(cookie_value,key,delimeter){if(cookie_value!=null){var keystring=key+delimeter;var thiscookie_start=cookie_value.indexOf(keystring)+keystring.length;var thiscookie_end=cookie_value.indexOf(delimeter,thiscookie_start);var keyvalue=cookie_value.substring(thiscookie_start,thiscookie_end);return keyvalue;}
return null;}
function getPrimaryDomain(){var theUrl=document.domain;var urlLength=theUrl.length;var firstDot=theUrl.lastIndexOf(".");var secondDot=theUrl.lastIndexOf(".",firstDot-1);var primaryDomain=theUrl.substr(secondDot);return primaryDomain;}
function getRandNumber(numDigits){var randNum="";var thisDigit="";for(var i=0;i<numDigits;i++){thisDigit=Math.floor(Math.random()*10);randNum=randNum+thisDigit;}
return randNum;}
function setGlobalValues(){userIdCookieUserId=this.id;userIdEmail=this.email;userIdCookieCreateDt=this.createDate;userIdCookieVersion=this.version;}
this.createCookie=function(cookies,user){var updtCookie=false;if(cookies['userIdCookie']!=undefined){this.id=getCookieKeyValue(cookies['userIdCookie'],'userId','ZZ');this.email=getCookieKeyValue(cookies['userIdCookie'],'email','ZZ');this.createDate=getCookieKeyValue(cookies['userIdCookie'],'createDate','ZZ');this.version=getCookieKeyValue(cookies['userIdCookie'],'cookieVersion','ZZ');}
if(user.isLoggedIn){if(this.id!=user.getUserId()){this.id=user.getUserId();updtCookie=true;}
if(this.email!=user.getEmail()){this.email=user.getEmail();updtCookie=true;}}
if(this.id==""){this.id=getRandNumber(10);updtCookie=true;}
setGlobalValues();if(updtCookie){this.writeCookie();}};this.writeCookie=function(){var cookieValue='userIdZZ'+this.id+'ZZemailZZ'+this.email+'ZZcreateDateZZ'+this.createDate+'ZZcookieVersionZZ'+this.version+'ZZ';document.cookie=this.cookieName+"="+escape(cookieValue)+
((this.expirationDate)?";expires="+this.expirationDate.toGMTString():"")+
((this.path)?";path="+this.path:"")+
((this.domain)?";domain="+this.domain:"")+
((this.secure)?";secure=":"");};};SNI.UR.ApplicationConfig=function(){this.applicationName="";this.applicationCode="";this.applicationEntryPage="";this.applicationPath="";this.loginServer={"DEV":"","STAGE":"","PROD":""};this.requiredRoles=[];this.requiresLogin=false;this.getLoginServer=function(env){if(this.loginServer[env]){return this.loginServer[env];}
return null;};this.addRole=function(role){this.requiredRoles.push(role);};this.urVersion=function(){return 1;};};SNI.UR.ApplicationRole=function(name,date){this.name=name;this.date=date;};UrCookie=SNI.UR.UrCookie=function(){this.info=[];this.clear=this.clearInfo=function(){for(var i=0;i<this.info.length;i++){delete this.info[i];}
this.info=[];};this.parse=this.parseCookie=function(cookie){var cookieArray=cookie.split("|");for(var i=0;i<cookieArray.length;i++){var chips=cookieArray[i].split(":");this.info[chips[0]]=chips[1];}};};SNI.UR.ValueCookie=function(){this.info=new SNI.UR.UrCookie();this.clear=this.clearInfo=this.info.clear;this.parse=this.parseCookie=this.info.parse;this.getEmail=function(){return this.info['email'];};this.getBirthYear=function(){return this.info['birth_year'];};this.getCity=function(){return this.info['city'];};this.getConfirm=function(){return this.info['confirm'];};this.getFirstName=function(){return this.info['first_name'];};this.getGender=function(){return this.info['gender'];};this.getLastName=function(){return this.info['last_name'];};this.getParentEmail=function(){return this.info['parent_email'];};this.getPersist=function(){return this.info['persist'];};this.getPhone=function(){return this.info['phone'];};this.getPostalCode=function(){return this.info['postal_code'];};this.getStatus=function(){return this.info['status'];};this.getTransComplete=function(){return this.info['transcomplete'];};this.getUserId=function(){return this.info['user_id'];};this.getUserName=function(){return this.info['user_name'];};this.getUserType=function(){return this.info['usertype'];};};SNI.UR.RoleCookie=function(){this.info=new SNI.UR.UrCookie();this.clear=this.clearInfo=this.info.clear;this.parse=this.parseCookie=this.info.parse;this.getRoleByName=function(name){return this.info[name];};};SNI.UR.UrLite=function(){function getPrimaryDomain(){var theUrl=document.domain;var urlLength=theUrl.length;var firstDot=theUrl.lastIndexOf(".");var secondDot=theUrl.lastIndexOf(".",firstDot-1);var primaryDomain=theUrl.substr(secondDot);return primaryDomain;}
this.login=function(urUser,applicationConfig){var cookies=this.loadCookies();if(cookies['value']){urUser.vignetteValueCookie.parse(cookies['value']);}
if(cookies['UserLoginCookie']){urUser.valueCookie.parse(cookies['UserLoginCookie']);}
if(urUser.getUserId()==null||urUser.getUserId()<0){if(applicationConfig.requiresLogin==true){writeIdCookie(cookies,urUser);this.redirectToUr(urUser,applicationConfig);}}else{urUser.isLoggedIn=true;}
this.writeIdCookie(cookies,urUser);if(cookies['UserRoleCookie']){urUser.roleCookie.parse(cookies['UserRoleCookie']);}
if(cookies['role']){urUser.vignetteRoleCookie.parse(cookies['role']);}
if(applicationConfig.requiredRoles!=null&&applicationConfig.requiredRoles.length>0&&applicationConfig.requiresLogin==true){for(var i=0;i<applicationConfig.requiredRoles.length;i++){if(urUser.hasRoleByName(applicationConfig.requiredRoles[i])==false){this.redirectToUr(urUser,applicationConfig);}}}};this.logout=function(urUser,applicationConfig){var domain=getPrimaryDomain();this.deleteLoginCookie("value","/",domain);this.deleteLoginCookie("role","/",domain);this.deleteLoginCookie("userLoginCookie","/",domain);this.deleteLoginCookie("userRoleCookie","/",domain);urUser.valueCookie.clear();urUser.roleCookie.clear();urUser.vignetteValueCookie.clear();urUser.vignetteRoleCookie.clear();urUser.isLoggedIn=false;};this.deleteLoginCookie=function(name,path,domain){document.cookie=name+"="+"; path="+path+"; domain="+domain+"; expires=Thu, 01-Jan-70 00:00:01 GMT";};this.getEnvironment=function(){switch(document.location.hostname){case"localhost":case"127.0.0.1":case"vdev2.scrippsnetworks.com":return"DEV";case"staging.scrippsweb.com":return"STAGE";default:return"PROD";}};this.redirectToUr=function(urUser,applicationConfig){window.location=this.getLoginPath(applicationConfig);};this.getLoginPath=function(applicationConfig){var loginPath;if(applicationConfig.urVersion()=="1"){loginPath=applicationConfig.loginServer[this.getEnvironment()]+applicationConfig.applicationPath+'?a=fflogin&url='+escape(applicationConfig.applicationEntryPage)+'&an='+escape(applicationConfig.applicationName)+'&ac='+escape(applicationConfig.applicationCode);}else{loginPath=applicationConfig.loginServer[this.getEnvironment()]+applicationConfig.applicationPath+'urValidation.html?applicationId='+applicationConfig.applicationCode;}
return loginPath;};this.loadCookies=function(){var cookies=[];if(document.cookie!=''){var cookieArray=document.cookie.split(';');for(var i=0;i<cookieArray.length;i++){var cookiesValues=cookieArray[i].split('=');cookies[cookiesValues[0].trim()]=cookiesValues[1];}}
return cookies;};this.writeIdCookie=function(cookies,user){var id=new SNI.UR.IdCookie();id.createCookie(cookies,user);};};SNI.UR.UrUser=function(appConfig){this.valueCookie=new SNI.UR.ValueCookie();this.roleCookie=new SNI.UR.RoleCookie();this.vignetteValueCookie=new VignetteValueCookie();this.vignetteRoleCookie=new VignetteRoleCookie();this.applicationConfig=appConfig;this.urLite=new SNI.UR.UrLite();this.isLoggedIn=false;this.getBirthYear=function(){if(this.valueCookie.getBirthYear()!=null){return this.valueCookie.getBirthYear();}
if(this.vignetteValueCookie.getBirthYear()!=null){return this.vignetteValueCookie.getBirthYear();}};this.getCity=function(){if(this.valueCookie.getCity()!=null){return this.valueCookie.getCity();}
if(this.vignetteValueCookie.getCity()!=null){return this.vignetteValueCookie.getCity();}};this.getConfirm=function(){if(this.valueCookie.getConfirm()!=null){return this.valueCookie.getConfirm();}
if(this.vignetteValueCookie.getConfirm()!=null){return this.vignetteValueCookie.getConfirm();}};this.getEmail=function(){if(this.valueCookie.getEmail()!=null){return this.valueCookie.getEmail();}
if(this.vignetteValueCookie.getEmail()!=null){return this.vignetteValueCookie.getEmail();}};this.getFirstName=function(){if(this.valueCookie.getFirstName()!=null){return this.valueCookie.getFirstName();}
if(this.vignetteValueCookie.getFirstName()!=null){return this.vignetteValueCookie.getFirstName();}};this.getFullName=function(){return this.getFirstName()+' '+this.getLastName();};this.getGender=function(){if(this.valueCookie.getGender()!=null){return this.valueCookie.getGender();}
if(this.vignetteValueCookie.getGender()!=null){return this.vignetteValueCookie.getGender();}};this.getLastName=function(){if(this.valueCookie.getLastName()!=null){return this.valueCookie.getLastName();}
if(this.vignetteValueCookie.getLastName()!=null){return this.vignetteValueCookie.getLastName();}};this.getParentEmail=function(){if(this.valueCookie.getParentEmail()!=null){return this.valueCookie.getParentEmail();}
if(this.vignetteValueCookie.getParentEmail()!=null){return this.vignetteValueCookie.getParentEmail();}};this.getPersist=function(){if(this.valueCookie.getPersist()!=null){return this.valueCookie.getPersist();}
if(this.vignetteValueCookie.getPersist()!=null){return this.vignetteValueCookie.getPersist();}};this.getPhone=function(){if(this.valueCookie.getPhone()!=null){return this.valueCookie.getPhone();}
if(this.vignetteValueCookie.getPhone()!=null){return this.vignetteValueCookie.getPhone();}};this.getPostalCode=function(){if(this.valueCookie.getPostalCode()!=null){return this.valueCookie.getPostalCode();}
if(this.vignetteValueCookie.getPostalCode()!=null){return this.vignetteValueCookie.getPostalCode();}};this.getStatus=function(){if(this.valueCookie.getStatus()!=null){return this.valueCookie.getStatus();}
if(this.vignetteValueCookie.getStatus()!=null){return this.vignetteValueCookie.getStatus();}};this.getTransComplete=function(){if(this.valueCookie.getTransComplete()!=null){return this.valueCookie.getTransComplete();}
if(this.vignetteValueCookie.getTransComplete()!=null){return this.vignetteValueCookie.getTransComplete();}};this.getUserId=function(){if(this.valueCookie.getUserId()!=null){return this.valueCookie.getUserId();}
if(this.vignetteValueCookie.getUserId()!=null){return this.vignetteValueCookie.getUserId();}};this.getUserName=function(){if(this.valueCookie.getUserName()!=null){return this.valueCookie.getUserName();}
if(this.vignetteValueCookie.getUserName()!=null){return this.vignetteValueCookie.getUserName();}};this.getUserType=function(){if(this.valueCookie.getUserId()!=null){return this.valueCookie.getUserId();}
if(this.vignetteValueCookie.getUserType()!=null){return this.vignetteValueCookie.getUserType();}};this.hasRole=function(role){if(this.roleCookie.getRoleByName(role.name)!=null){if(this.roleCookie.getRoleByName(role.name)>=role.date){return true;}
return false;}
if(this.vignetteRoleCookie.getRoleByName(role.name)!=null){return true;}
return false;};this.hasRoleById=function(roleId){if(this.vignetteRoleCookie.getRoleById(roleId)!=null){return true;}
return false;};this.logout=function(){if(this.isLoggedIn){this.urLite.logout(this,this.applicationConfig);}};this.urLite.login(this,appConfig);};SNI.UR.VignetteCookie=function(){this.info=[];this.parse=parseCookie;this.parseCookie=parseCookie;this.parseSingleValueChip=parseSingleValueChip;this.parseMultiValueChip=parseMultiValueChip;this.cookieName="";this.cookiePath="/";this.cookieDomain="";this.clear=clearInfo;function clearInfo(){for(var i=0;i<this.info.length;i++){delete this.info[i];}
this.info=[];}
function stripHeader(string){return string.substring(23);}
function stripTrailer(string){return string.substring(0,string.length-3);}
function parseCookie(cookie){cookie=stripHeader(cookie);cookie=stripTrailer(cookie);var cookieArray=cookie.split("ZZ%");for(var i=0;i<cookieArray.length;++i){chip=cookieArray[i];chip=chip.substring(6);if(chip.substring(0,1)=="s"){chip=chip.substring(1);}else{chip=chip.substring(3);}
if(chip.match("\\+")=='+'){this.parseMultiValueChip(chip);}else{this.parseSingleValueChip(chip);}}}
function parseSingleValueChip(chip){chip=URLDecode(chip);var values=chip.split("ZZ");if(values.length<2){this.info[values[0]]="";}else{this.info[values[0]]=values[1];}}
function parseMultiValueChip(chip){var multivalue=[];chip=URLDecode(chip);var key=chip.split("ZZ")[0];chip=chip.substring(key.length);chip=chip.replace(/ZZZZ/g,"ZZ");var chips=chip.split("+");for(var i=0;i<chips.length;++i){part=chips[i];var parts=part.split("ZZ");multivalue[parts[1]]=parts[2];}
this.info[key]=multivalue;}
function URLDecode(encodedString){var output=encodedString;var binVal,thisString;var myregexp=/(%.{2})/;while((match=myregexp.exec(output))!=null&&match.length>1&&match[1]!=''){binVal=parseInt(match[1].substr(1),16);thisString=String.fromCharCode(binVal);output=output.replace(match[1],thisString);}
return output;}};VignetteValueCookie.prototype=new SNI.UR.VignetteCookie();function VignetteValueCookie(){VignetteValueCookie.prototype=new SNI.UR.VignetteCookie();this.getEmail=function(){return this.info['email'];};this.getBirthYear=function(){return this.info['birth_year'];};this.getCity=function(){return this.info['city'];};this.getConfirm=function(){return this.info['confirm'];};this.getFirstName=function(){return this.info['first_name'];};this.getGender=function(){return this.info['gender'];};this.getLastName=function(){return this.info['last_name'];};this.getParentEmail=function(){return this.info['parent_email'];};this.getPersist=function(){return this.info['persist'];};this.getPhone=function(){return this.info['phone'];};this.getPostalCode=function(){return this.info['postal_code'];};this.getStatus=function(){return this.info['status'];};this.getTransComplete=function(){return this.info['transcomplete'];};this.getUserId=function(){return this.info['user_id'];};this.getUserName=function(){return this.info['user_name'];};this.getUserType=function(){return this.info['usertype'];};}
VignetteRoleCookie.prototype=new SNI.UR.VignetteCookie();function VignetteRoleCookie(){VignetteRoleCookie.prototype=new SNI.UR.VignetteCookie();this.getPersist=function(){return this.info['persist'];};this.getUserId=function(){return this.info['user_id'];};this.getRoleByName=function(name){if(this.info['roles']!=undefined){for(var i=0;i<this.info['roles'].length;i++){if(this.info['roles'][i]!=undefined&&this.info['roles'][i]==name){return this.info['roles'][i];}}}};this.getRoleById=function(id){if(this.info['roles']!=undefined)return this.info['roles'][id];};}
if(typeof(SNI)=='undefined'){SNI={};}
if(typeof(SNI.Community)=='undefined'){SNI.Community={};}
if(typeof(SNI.Community.UR)=='undefined'){SNI.Community.UR={};}
SNI.Community.UR.getCookie=function(name){var cookies=document.cookie;if(cookies.indexOf(name)!=-1){var startpos=cookies.indexOf(name)+name.length+1;var endpos=cookies.indexOf(';',startpos)-1;if(endpos==-2){endpos=cookies.length;}
return unescape(cookies.substring(startpos,endpos));}
else{return false;}};SNI.Community.UR.init=function(){SNI.Community.xUrlPre='';if(location.hostname.toLowerCase().indexOf("dev")>-1){SNI.Community.xUrlPre="test1-";}
else if(location.hostname.toLowerCase().indexOf("staging")>-1){SNI.Community.xUrlPre="test2-";}
if((SNI.Community.UR.getCookie('SMSESSION')==null)||(SNI.Community.UR.getCookie('SMSESSION')=='')){var orig_domain=document.location.href.substring(0,document.location.href.indexOf(location.hostname)+location.hostname.length);var x=document.createElement('script');x.src='http://'+SNI.Community.xUrlPre+'www.scrippscontroller.com/sso/checkcontrollercookie.html?DEST_URL='+document.location.href+'&orig_domain='+orig_domain;document.getElementsByTagName('head')[0].appendChild(x);}};if(SNI.Config.UR3){SNI.Community.UR.init();}

/*** sni-core-plugins ***/
/* 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
 */

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};$k.extend(this._defaults,this.regional['']);this._datepickerDiv=$k('<div id="datepicker"><div class="hd"></div><div class="bd"></div><div class="ft"></div></div>');}
$k.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=$k.datepicker._getInst(this._calId);if($k.datepicker._datepickerShowing){switch(e.keyCode){case 9:$k.datepicker.hideDatepicker('');break;case 13:$k.datepicker._selectDay(inst,inst._selectedMonth,inst._selectedYear,$k('td.datepicker_daysCellOver',inst._datepickerDiv)[0]);return false;case 27:$k.datepicker.hideDatepicker(inst._get('speed'));break;case 33:$k.datepicker._adjustDate(inst,(e.ctrlKey?-1:-inst._get('stepMonths')),(e.ctrlKey?'Y':'M'));break;case 34:$k.datepicker._adjustDate(inst,(e.ctrlKey?+1:+inst._get('stepMonths')),(e.ctrlKey?'Y':'M'));break;case 35:if(e.ctrlKey){$k.datepicker._clearDate(inst);}
break;case 36:if(e.ctrlKey){$k.datepicker._gotoToday(inst);}
break;case 37:if(e.ctrlKey){$k.datepicker._adjustDate(inst,-1,'D');}
break;case 38:if(e.ctrlKey){$k.datepicker._adjustDate(inst,-7,'D');}
break;case 39:if(e.ctrlKey){$k.datepicker._adjustDate(inst,+1,'D');}
break;case 40:if(e.ctrlKey){$k.datepicker._adjustDate(inst,+7,'D');}
break;}}
else if(e.keyCode==36&&e.ctrlKey){$k.datepicker.showFor(this);}},_doKeyPress:function(e){var inst=$k.datepicker._getInst(this._calId);var chars=$k.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=$k(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=$k(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=$k(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]*$k('.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=$k('<input type="text" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$k('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($k.blockUI){$k.blockUI(this._datepickerDiv);}
return this;},showFor:function(control){control=(control.jquery?control[0]:(typeof control=='string'?$k(control)[0]:control));var input=(control.nodeName&&control.nodeName.toLowerCase()=='input'?control:this);if(input.nodeName.toLowerCase()!='input'){input=$k('input',input.parentNode)[0];}
if($k.datepicker._lastInput==input){return;}
if($k(input).isDisabledDatepicker()){return;}
var inst=$k.datepicker._getInst(input._calId);var beforeShow=inst._get('beforeShow');extendRemove(inst._settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$k.datepicker.hideDatepicker('');$k.datepicker._lastInput=input;inst._setDateFromField(input);if($k.datepicker._inDialog){input.value='';}
if(!$k.datepicker._pos){$k.datepicker._pos=$k.datepicker._findPos(input);$k.datepicker._pos[1]+=input.offsetHeight;}
var isFixed=false;$k(input).parents().each(function(){isFixed|=$k(this).css('position')=='fixed';});if(isFixed&&$k.browser.opera){$k.datepicker._pos[0]-=document.documentElement.scrollLeft;$k.datepicker._pos[1]-=document.documentElement.scrollTop;}
if(!$k.datepicker._inDialog){var iconOffset=7;var horizontalOffset=$k(inst._input).outerWidth()-$k.datepicker._datepickerDiv.outerWidth()-iconOffset;$k.datepicker._pos[0]=$k.datepicker._pos[0]+horizontalOffset;}
inst._datepickerDiv.css('position',($k.datepicker._inDialog&&$k.blockUI?'static':(isFixed?'fixed':'absolute'))).css('left',$k.datepicker._pos[0]+'px').css('top',$k.datepicker._pos[1]+'px');$k.datepicker._pos=null;$k.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(){$k.datepicker._datepickerShowing=true;$k.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?$k.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&&$k.browser.msie?document.documentElement.scrollTop:0))>(browserHeight+scrollY)){inst._datepickerDiv.css('top',Math.max(scrollY,pos[1]-(this._inDialog?0:inst._datepickerDiv.height())-
(isFixed&&$k.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(){$k.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($k.blockUI){$k.unblockUI();$k('body').append(this._datepickerDiv);}}
this._inDialog=false;}
this._curInst=null;},_tidyDialog:function(inst){inst._datepickerDiv.removeClass('datepicker_dialog');$k('.datepicker_prompt',inst._datepickerDiv).remove();},_checkExternalClick:function(event){if(!$k.datepicker._curInst){return;}
var target=$k(event.target);if((target.parents("#datepicker").length==0)&&(target.attr('class')!='datepicker_trigger')&&$k.datepicker._datepickerShowing&&!($k.datepicker._inDialog&&$k.blockUI)){$k.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&&!$k.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($k(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){$k('.datepicker_table td').removeClass('datepicker_currentDay');$k(td).addClass('datepicker_currentDay');}
this._stayOpen=!this._stayOpen;}
inst._currentDay=$k('a',td).html();inst._currentMonth=month;inst._currentYear=year;this._selectDate(id,inst._formatDate(inst._currentDay,inst._currentMonth,inst._currentYear));if(printRange){selectedDate=$k.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 $k.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 $k.datepicker.iso8601Week(checkDate);}}
return Math.floor(((checkDate-firstMon)/86400000)/7)+1;},dateStatus:function(date,inst){return $k.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=$k.datepicker._register(this);this._selectedDay=0;this._selectedMonth=0;this._selectedYear=0;this._input=null;this._inline=inline;this._datepickerDiv=(!inline?$k.datepicker._datepickerDiv:$k('<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());}}
$k.extend(DatepickerInstance.prototype,{_get:function(name){return(this._settings[name]!=null?this._settings[name]:$k.datepicker._defaults[name]);},_setDateFromField:function(input){this._input=$k(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=$k.datepicker.parseDate(dateFormat,dates[1],settings)||defaultDate;this._endDay=date.getDate();this._endMonth=date.getMonth();this._endYear=date.getFullYear();}
try{date=$k.datepicker.parseDate(dateFormat,dates[0],settings)||defaultDate;}
catch(e){$k.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')||$k.datepicker.iso8601Week;var dateStatus=this._get('statusForDate')||$k.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 $k.datepicker.formatDate(this._get('dateFormat'),date,this._getFormatConfig());}});function extendRemove(target,props){$k.extend(target,props);for(var name in props){if(props[name]==null){target[name]=null;}}
return target;};$k.fn.attachDatepicker=function(settings){return this.each(function(){var inlineSettings=null;for(attrName in $k.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?$k.extend($k.extend({},settings||{}),inlineSettings||{}):settings);var inst=(inst&&!inlineSettings?inst:new DatepickerInstance(instSettings,false));$k.datepicker._connectDatepicker(this,inst);}
else if(nodeName=='div'||nodeName=='span'){var instSettings=$k.extend($k.extend({},settings||{}),inlineSettings||{});var inst=new DatepickerInstance(instSettings,true);$k.datepicker._inlineDatepicker(this,inst);}});};$k.fn.removeDatepicker=function(){var jq=this.each(function(){var $this=$k(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($k.datepicker.markerClassName).unbind('focus',$k.datepicker.showFor).unbind('keydown',$k.datepicker._doKeyDown).unbind('keypress',$k.datepicker._doKeyPress);var wrapper=$this.parents('.datepicker_wrap');if(wrapper){wrapper.replaceWith(wrapper.html());}}
else if(nodeName=='div'||nodeName=='span'){$this.removeClass($k.datepicker.markerClassName).empty();}
if($k('input[_calId='+calId+']').length==0){$k.datepicker._inst[calId]=null;}});if($k('input.hasDatepicker').length==0){$k.datepicker._datepickerDiv.replaceWith('');}
return jq;};$k.fn.enableDatepicker=function(){return this.each(function(){this.disabled=false;$k(this).siblings('button.datepicker_trigger').each(function(){this.disabled=false;});$k(this).siblings('img.datepicker_trigger').css({opacity:'1.0',cursor:''});var $this=this;$k.datepicker._disabledInputs=$k.map($k.datepicker._disabledInputs,function(value){return(value==$this?null:value);});});};$k.fn.disableDatepicker=function(){return this.each(function(){this.disabled=true;$k(this).siblings('button.datepicker_trigger').each(function(){this.disabled=true;});$k(this).siblings('img.datepicker_trigger').css({opacity:'0.5',cursor:'default'});var $this=this;$k.datepicker._disabledInputs=$k.map($k.datepicker._disabledInputs,function(value){return(value==$this?null:value);});$k.datepicker._disabledInputs[$k.datepicker._disabledInputs.length]=this;});};$k.fn.isDisabledDatepicker=function(){if(this.length==0){return false;}
for(var i=0;i<$k.datepicker._disabledInputs.length;i++){if($k.datepicker._disabledInputs[i]==this[0]){return true;}}
return false;};$k.fn.changeDatepicker=function(name,value){var settings=name||{};if(typeof name=='string'){settings={};settings[name]=value;}
return this.each(function(){var inst=$k.datepicker._getInst(this._calId);if(inst){extendRemove(inst._settings,settings);$k.datepicker._updateDatepicker(inst);}});};$k.fn.showDatepicker=function(){$k.datepicker.showFor(this);return this;};$k.fn.setDatepickerDate=function(date,endDate){return this.each(function(){var inst=$k.datepicker._getInst(this._calId);if(inst){inst._setDate(date,endDate);$k.datepicker._updateDatepicker(inst);}});};$k.fn.getDatepickerDate=function(){var inst=(this.length>0?$k.datepicker._getInst(this[0]._calId):null);return(inst?inst._getDate():null);};$k(document).ready(function(){$k.datepicker=new Datepicker();$k(document.body).append($k.datepicker._datepickerDiv).mousedown($k.datepicker._checkExternalClick);});

/*
 * Autocomplete - jQuery plugin 1.0.2
 *
 * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.autocomplete.js 5747 2008-06-25 18:30:55Z joern.zaefferer $
 *
 */

/*
 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
 * @requires jQuery v1.2 or above
 *
 * http://gmarwaha.com/jquery/jcarousellite/
 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 1.0.1 (modified by Paolo Vaca)
 * Note: Requires jquery 1.2 or above from version 1.0.1
 */
 
 // this file has $ encapsulated

(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,displayPage:false,btnNavigation:false,miniNav:false,container:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var running=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var div=$(this),ul=$("ul:first",div),tLi=$("li",ul),tl=tLi.size(),v=o.visible,container=$(o.container);if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v;}
var oli=$(">li",ul);var olength=oli.size();var grps=Math.ceil(olength/o.scroll);var fullSet=o.scroll*grps;if(olength<fullSet){var html="";for(var i=1;i<=(fullSet-olength);i++){html+='<li class="filler"></li>';}
ul.append(html);}
var li=$(">li",ul),itemLength=li.size(),curr=o.start;li.addClass('crsl-item');div.css("visibility","visible");li.css({"overflow":"hidden","float":o.vertical?"none":"left"});ul.css({"margin":"0","padding":"0","position":"relative","list-style-type":"none","z-index":"1"}).addClass('clrfix');div.css({"overflow":"hidden","position":"relative","z-index":"2",left:"0px"});var liSize=o.vertical?height(li):width(li);var ulSize=liSize*itemLength;var divSize=liSize*v;var singlePage=(itemLength<=o.visible);li.css({width:li.outerWidth(),height:li.outerHeight()});ul.css(sizeCss,ulSize+"px").css(animCss,-(curr*liSize));div.css(sizeCss,divSize+"px");if(o.miniNav){container.addClass('mini-nav');var miniNavHtml='<div class="nav clrfix">';miniNavHtml+='    <div class="prev-btn">previous</div>';miniNavHtml+='    <div class="controls"></div>';miniNavHtml+='    <div class="next-btn">next</div>';miniNavHtml+='</div>';container.find('.hd').append(miniNavHtml);$(o.btnPrev).addClass("disabled");}else{container.addClass('default-nav');container.find('.hd').after('<div class="nav clrfix"><div class="controls"></div></div>');container.find('.hd').before('<div class="prev-btn">previous</div>');container.append('<div class="next-btn">next</div>');$(o.btnPrev).addClass("disabled");container.find('.nav').css('width',divSize+"px");}
if(singlePage){$(o.btnNext).addClass("disabled");}
var ctrl=container.find('.controls');if(!singlePage){if(o.displayPage){container.find('.controls').html('1 of '+grps);}else{var btns,imgPos;for(var i=1;i<=grps;i++){if(i==1){btns+='<span data-load-img="0" class="active">'+i+'</span>';}else{imgPos=((i-1)*o.scroll);btns+='<span data-load-img='+imgPos+'>'+i+'</span>';}}
btns=$(btns);$.each(btns,function(){var loadImg=parseInt($(this).attr('data-load-img'));$(this).click(function(){ctrl.find('span').removeClass('active');$(this).addClass('active');return go(loadImg);});});ctrl.addClass('btn-nav clrfix');ctrl.html(btns);}}
if(!o.miniNav){var offset=parseInt(divSize/2)-parseInt(width(ctrl)/2);ctrl.css('left',offset+'px');}
ul.find(">li:lt("+o.scroll+")").each(function(){var img=$(this).find('img');SNI.Util.LazyLoad(img);});if(o.btnPrev)
$(o.btnPrev).click(function(){return go(curr-o.scroll);});if(o.btnNext)
$(o.btnNext).click(function(){return go(curr+o.scroll);});if(o.btnGo)
$.each(o.btnGo,function(i,val){$(val).click(function(){return go(o.circular?o.visible+i:i);});});if(o.mouseWheel&&div.mousewheel)
div.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll);});if(o.auto)
setInterval(function(){go(curr+o.scroll);},o.auto+o.speed);function vis(){return li.slice(curr).slice(0,v);};function visImgs(){var list=li.slice(curr).slice(0,v);list.each(function(){var img=$(this).find('img');SNI.Util.LazyLoad(img);});};function pageIndex(){var cp=Math.ceil(curr/o.scroll)+1;container.find('.controls').html(cp+' of '+grps);}
function go(to){if(!running){if(o.beforeStart)
o.beforeStart.call(this,vis());if(o.circular){if(to<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*liSize)+"px");curr=to==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll;}else if(to>=itemLength-v+1){ul.css(animCss,-((v)*liSize)+"px");curr=to==itemLength-v+1?v+1:v+o.scroll;}else curr=to;}else{if(to<0||to>itemLength-v)return;else curr=to;}
running=true;if(o.displayPage){pageIndex();}
if(o.btnNavigation){container.find('.controls span').removeClass('active');container.find('.controls span[data-load-img='+curr+']').addClass('active');}
visImgs();ul.animate(animCss=="left"?{left:-(curr*liSize)}:{top:-(curr*liSize)},o.speed,o.easing,function(){if(o.afterEnd)
o.afterEnd.call(this,vis());running=false;});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled");}}
return false;};});};function css(el,prop){return parseInt($.css(el[0],prop))||0;};function width(el){return el[0].offsetWidth+css(el,'marginLeft')+css(el,'marginRight')+css(el,'borderLeftWidth')+css(el,'borderRightWidth');};function height(el){return el[0].offsetHeight+css(el,'marginTop')+css(el,'marginBottom');};})(jQuery);
/*
 * MouseWheel
 * Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * Version: 3.0.2
 *
 * Requires: 1.2.2+
 */
 
 
// this file has $ encapsulated

(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);

/*** sni-functionality ***/
 

(function($){$k.extend($k.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$k.data(this[0],'validator');if(validator){return validator;}validator=new $k.validator(options,this[0]);$k.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$k("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($k(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$k(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$k.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$k.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$k.validator.staticRules(element);switch(command){case"add":$k.extend(existingRules,$k.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$k.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$k.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$k.validator.normalizeRules($k.extend({},$k.validator.metadataRules(element),$k.validator.classRules(element),$k.validator.attributeRules(element),$k.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$k.extend({required:param},data);}return data;}});$k.extend($k.expr[":"],{blank:function(a){return!$k.trim(""+a.value);},filled:function(a){return!!$k.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$k.validator=function(options,form){this.settings=$k.extend(true,{},$k.validator.defaults,options);this.currentForm=form;this.init();};$k.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$k.makeArray(arguments);args.unshift(source);return $k.validator.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$k.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$k.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$k.extend($k.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$k([]),errorLabelContainer:$k([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$k(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$k(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$k.extend($k.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$k.validator.format("Please enter no more than {0} characters."),minlength:$k.validator.format("Please enter at least {0} characters."),rangelength:$k.validator.format("Please enter a value between {0} and {1} characters long."),range:$k.validator.format("Please enter a value between {0} and {1}."),max:$k.validator.format("Please enter a value less than or equal to {0}."),min:$k.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$k(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$k(this.currentForm);this.containers=$k(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$k.each(this.settings.groups,function(key,value){$k.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$k.each(rules,function(key,value){rules[key]=$k.validator.normalizeRule(value);});function delegate(event){var validator=$k.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$k(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$k(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$k.extend(this.submitted,this.errorMap);this.invalid=$k.extend({},this.errorMap);if(!this.valid())$k(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$k(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$k.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$k.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($k.fn.resetForm)$k(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$k(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$k.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $k([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($k(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $k(selector)[0];},errors:function(){return $k(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$k([]);this.toHide=$k([]);this.currentElements=$k([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$k(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$k.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
+", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$k.metadata)return;var meta=this.settings.meta?$k(element).metadata()[this.settings.meta]:$k(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$k.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $k(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$k("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$k(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $k(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $k(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $k("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$k(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$k.validator.methods.required.call(this,$k.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$k(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$k(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $k.data(element,"previousValue")||$k.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$k.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$k(element).attr('class');classes&&$k.each(classes.split(' '),function(){if(this in $k.validator.classRuleSettings){$k.extend(rules,$k.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$k(element);for(method in $k.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$k.metadata)return{};var meta=$k.data(element.form,'validator').settings.meta;return meta?$k(element).metadata()[meta]:$k(element).metadata();},staticRules:function(element){var rules={};var validator=$k.data(element.form,'validator');if(validator.settings.rules){rules=$k.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$k.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$k(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$k.each(rules,function(rule,parameter){rules[rule]=$k.isFunction(parameter)?parameter(element):parameter;});$k.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$k.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($k.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$k.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$k.validator.methods[name]=method;$k.validator.messages[name]=message!=undefined?message:$k.validator.messages[name];if(method.length<3){$k.validator.addClassRules(name,$k.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$k(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $k.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$k.ajax($k.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$k.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($k.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($k.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($k.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([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(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([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])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$k(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$k(element).valid();});return value==target.val();}}});$k.format=$k.validator.format;})(jQuery);;(function($){var ajax=$k.ajax;var pendingRequests={};$k.ajax=function(settings){settings=$k.extend(settings,$k.extend({},$k.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$k.each({focus:'focusin',blur:'focusout'},function(original,fix){$k.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$k.event.fix(e);arguments[0].type=fix;return $k.event.handle.apply(this,arguments);}};function handler(e){e=$k.event.fix(e);e.type=fix;return $k.event.handle.call(this,e);}});};$k.extend($k.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$k(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery);$k.validator.setDefaults({errorElement:'span',onfocusout:false,onkeyup:false,onclick:false,highlight:function(element,errorClass){$k(element).addClass(errorClass);$k(element.form).find("label[for="+element.id+"]").addClass(errorClass);},unhighlight:function(element,errorClass){$k(element).removeClass(errorClass);$k(element.form).find("label[for="+element.id+"]").removeClass(errorClass);}});$k.validator.addMethod("spaces",function(value,element){return this.optional(element)||value.indexOf(' ')==-1;},"Spaces are not allowed");$k.validator.addMethod("multipleEmails",function(value,element){if(this.optional(element)){return true;}
var friendsEmails=value.split(",");var isEmail=true;$k.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($k.trim(this));if(patternTest==false){isEmail=false;};});return isEmail;},"One of these is not a valid e-mail address");
new function(settings){var $separator=settings.separator||'&';var $spaces=settings.spaces===false?false:true;var $suffix=settings.suffix===false?'':'[]';jQuery.query=new function(){var queryObject=function(a){var self=this;self.keys={};if(a.queryObject){jQuery.each(a.keys,function(key,val){self.destructiveSet(key,val);});}else{var q=""+a;q=q.replace(/^\?/,'');q=q.replace(/[;&]$/,'');if($spaces)q=q.replace('+',' ');jQuery.each(q.split(/[&;]/),function(){var key=this.split('=')[0];var val=this.split('=')[1];var temp,hashKey=null,type=null;if(/^-?[0-9]+\.[0-9]+$/.test(val))
val=parseFloat(val);else if(/^-?[0-9]+$/.test(val))
val=parseInt(val);if(/\[([^\] ]+)\]$/.test(key))
type=Object,hashkey=key.replace(/^.+\[([^\] ]+)\]$/,"$1"),key=key.replace(/\[([^\] ]+)\]$/,"");else if(/\[\]$/.test(key))
type=Array,key=key.replace(/\[\]$/,"");val=val||true;if(!type&&self.has(key))
type=Array,self.destructiveSet(key,self.has(key,Array)?self.keys[key]:[self.keys[key]]);if(!type)
self.destructiveSet(key,val);else
if(type==Object)
temp=self.keys[key]||{},temp[hashkey]=val,self.destructiveSet(key,temp);else if(type==Array)
temp=self.keys[key]||[],temp.push(val),self.destructiveSet(key,temp);});}
return self;};queryObject.prototype={queryObject:true,has:function(key,type){var keys=this.keys;return!!type?keys[key]!=undefined&&keys[key]!==null&&keys[key].constructor==type:keys[key]!=undefined&&keys[key]!==null;},get:function(key){var value=(key==undefined)?this.keys:this.keys[key];if(value.constructor==Array)
return value.slice(0);else if(value.constructor==Object)
return jQuery.extend({},value);else
return value;},destructiveSet:function(key,val){if(val==undefined||val===null)
this.destructiveRemove(key);else
this.keys[key]=val;return this;},set:function(key,val){return this.copy().destructiveSet(key,val);},destructiveRemove:function(key){if(typeof this.keys[key]!='undefined')
delete this.keys[key];return this;},remove:function(key){return this.copy().destructiveRemove(key);},destructiveEmpty:function(){var self=this;jQuery.each(self.keys,function(key,value){delete self.keys[key];});return self;},copy:function(){return new queryObject(this);},empty:function(destructive){return this.copy().destructiveEmpty();},toString:function(){var i=0,queryString=[],self=this,addFields=function(o,key,value){o.push(key);if(value!==true){o.push("=");o.push(encodeURIComponent(value));}};jQuery.each(this.keys,function(key,value){var o=[];if(value!==false){if(i++==0)
o.push("?");if(self.has(key,Object)){var _o=[]
jQuery.each(value,function(_key,_value){var __o=[];addFields(__o,key+"["+_key+"]",_value);_o.push(__o.join(""));});o.push(_o.join($separator));}else if(self.has(key,Array)){var _o=[]
jQuery.each(value,function(_key,_value){var __o=[];addFields(__o,key+$suffix,_value);_o.push(__o.join(""));});o.push(_o.join($separator));}else{addFields(o,key,value);}}
queryString.push(o.join(""));});return queryString.join($separator);}};return new queryObject(location.search);};}(jQuery.query||{});
(function($){$k.widget("ui.dropdown",{_init:function(){this.options.title=this.options.title||this.element.find('option.select-title').text();if(parseInt($k.ui.version.charAt(2))>=8){this.options=$k.extend(true,$[this.namespace][this.widgetName].defaults,this.options);}
this.list=$k.ui.dropdown.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();}},enable:function(){var $this=this;this.options.disabled=false;this.element.removeAttr('disabled');this.list.find('.disabled').removeClass('disabled');var handle=this.list.find('dt a');handle.mousedown(function(){$k.ui.dropdown.hideDropDowns();$this.list.find('.fly-dd').show();$k(this).parent('.fly-dt').addClass('active');$k('body').bind("mousedown",$k.ui.dropdown.bodyClicked);return false;});return this.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.element.removeData("dropdown");this.list.remove();this.element.show();},reset:function(){this.list.remove();this.options.title=this.element.find('option.select-title').text();this.list=$k.ui.dropdown.buildList(this.element,this.options);this.element.after(this.list);},select:function(){if(this.element.get(0).selectedIndex>-1){var html='<em></em><span>'+this.element.get(0)[this.element.get(0).selectedIndex].text+'</span>';this.list.find('.fly-dt a').html(html);}}});$k.ui.dropdown.buildList=function(element,options){select=element.get(0);option=select.selectedIndex>-1?select[select.selectedIndex]:false;var selected=option?option.text:'';var classNames='ui-dropdown '+element.get(0).className;var ddList='<dl class="'+classNames+'">';ddList+=options.disabled?'<dt class="fly-dt disabled">':'<dt class="fly-dt">';ddList+='<a><em></em><span>'+selected+'</span></a></dt>';var ddClassName=options.ddClassName?options.ddClassName+' fly-dd ':'fly-dd ';ddList+='<dd style="display: none;" class="'+ddClassName+'">';ddList+='<div class="fly-hd"></div>';ddList+='<div class="fly-bd">';ddList+='<a class="close"></a>';if(options.title){ddList+='<h3>'+options.title+'</h3>';}
ddList+='</div>';ddList+='<div class="fly-ft"></div>';ddList+='</dd>';ddList+='</dl>';ddList=$k(ddList);ddList.find('.close').click(function(){$k.ui.dropdown.hideDropDowns();return false;});var list=$k('<ul class="fly-ul"></ul>');element.children('option:not(.select-title)').each(function(index){var linkText=$k(this).text();var link=$k('<a href="#">'+linkText+'</a>');var isSelected=element[0].options[element[0].selectedIndex].text==linkText;link.click(function(){$k('li',list).removeClass("selected");$k(this).parent().addClass("selected");if(!isSelected){ddList.find('.fly-dt a').html('<em></em><span>'+linkText+'</span>');element.find('option:not(.select-title)')[index].selected=true;$k.ui.dropdown.hideDropDowns();element.trigger('change');}else{$k.ui.dropdown.hideDropDowns();}
return false;});var item=$k('<li class="fly-li'+(isSelected?' selected':'')+'"></li>').append(link);list.append(item);});ddList.find('.fly-bd').append(list);return ddList;};$k.ui.dropdown.hideDropDowns=function(event){$k('dl.ui-dropdown .fly-dd').hide();$k('dl.ui-dropdown .active').removeClass('active');$k('body').unbind("mousedown",$k.ui.dropdown.bodyClicked);return true;};$k.ui.dropdown.bodyClicked=function(event){var element=$k(event.target);if(element.parents().is('.ui-dropdown')){return false;}
$k.ui.dropdown.hideDropDowns();};$k.ui.dropdown.defaults={title:'',disabled:false,ddClassName:'flyout'};$k.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=$k.data(this,"ui-dependent-dropdowns");dependent_dropdowns[options].apply(dependent_dropdowns,args);}else if(!$k(this).is(".ui-dependent-dropdowns")){$k.data(this,"ui-dependent-dropdowns",new $k.ui.dependent_dropdowns(this,options));}});}});$k.ui.dependent_dropdowns=function(container,options){this.element=$k(container);this.options=options=$k.extend({},$k.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;$k.each(this.dropdowns,function(i,val){$k(val).dropdown();$k(val).bind("change",function(){index=$k.inArray(this,dd.dropdowns);if(index!=-1){dd._updateValues(index+1);}});});this.enable();};$k.ui.dependent_dropdowns.prototype={enable:function(){this._updateValues(0);this.defaults();},disable:function(){},destroy:function(){$k.each(this.dropdowns,function(key,value){$k(value).destroy();});this.element.removeClass("ui-dependent-dropdowns");$k.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;$k.each(this.data.defaults,function(key,values){times=key.split('-');if(dd._checkTime(times[0],times[1],time)){index=0;$k.each(values,function(k,v){if(select=dd.dropdowns[index]){$k(select).find('option').each(function(){if($k(this).val()==v){this.selected=true;$k(select).dropdown('select');$k(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=$k(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){$k.each(values,function(key,val){options+='<option value="'+key+'"';if(previous_value&&previous_value==key){options+=' selected="selected"';}
options+='>'+val.label+'</option>';});}
if(!values){$k(dropdown).dropdown('disable');}
$k(dropdown).html(options);$k(dropdown).dropdown('reset');if(values){$k(dropdown).dropdown('enable');}
this._updateValues(index+1);}},_findValues:function(values,start_index,end_index){if(start_index==end_index){return values;}else{values=values[$k(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=$k.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;}};})(jQuery);
if(typeof(SNI.Omniture)=='undefined'){SNI.Omniture={};}
SNI.Omniture.timeout=null;SNI.Omniture.queue=[];SNI.Omniture.getLinkText=function($elt){var linkText="";linkText=$elt.closest("a").text();if(linkText==''&&element.is("img")){linkText='Photo : '+element.attr("alt");}
return linkText;}
SNI.Omniture.MultiVar=function(jsel,module,searchKey){var $el=$k(jsel);if($el.length==0||$el.data('events.click.omniture')){return;}
$el.bind('click.omniture',function(e){SNI.Omniture.ClickTrackFire(e.target,module,searchKey);e.stopPropagation();});};SNI.Omniture.SingleVar=function(jsel,module,section){var $el=$k(jsel);var sv=this;sv.getLinkText=SNI.Omniture.getLinkText;if($el.length==0||$el.data('events.click.omniture')){return;}
$el.bind('click.omniture',function(e){var $clicked=$k(e.target);if($clicked.is("a")||$clicked.parent().is("a")){var linkText=sv.getLinkText($clicked);var s={};s.linkTrackVars=SNI.Config.omnitureSingleVariable;s.prop26=section+" : "+module+" : "+linkText;s.element=this;SNI.Omniture.ClickTrackTrigger(s);e.stopPropagation();}});};SNI.Omniture.ClickTrackFire=function(element,module,searchKey){var site;var originalElement=element;var element=$k(element);var isLink=element.is("a");this.getLinkText=SNI.Omniture.getLinkText;if(isLink){var formId=element.parents().filter('form').attr("id");if(formId=='hgSearchForm'||formId=='hgFtSearchForm'){return;}}
var parentElement=element.parent();var isParentLink=parentElement.is("a");var isSubmit=element.attr("type")=="submit";if(isLink||isParentLink||isSubmit){if(isSubmit){site=SNI.Config.site+" : "+element.parents().filter('form').attr("name");}else{site=SNI.Config.site+" : "+module;}
var s={};s.linkTrackVars=SNI.Config.omnitureMultiVariable;s.prop14=site;s.eVar16=s.prop14;var linkText=this.getLinkText(element);s.prop15=site+" : "+linkText;s.eVar18=s.prop15;var relid="relid?";var linkUrl=element.attr("href");if(isLink){relid=element.attr("rel");}else if(isParentLink){relid=parentElement.attr("rel");linkUrl=parentElement.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.element=originalElement;SNI.Omniture.ClickTrackTrigger(s);}};SNI.Omniture.ClickTrackTrigger=function(data){if(typeof data=='object'){SNI.Omniture.queue.push(data);}
if(typeof s_gi=='function'){if(SNI.Omniture.timeout!==null){clearTimeout(SNI.Omniture.timeout);SNI.Omniture.timeout=null;}}else{SNI.Omniture.timeout=setTimeout(function(){clearTimeout(SNI.Omniture.timeout);SNI.Omniture.timeout=null;SNI.Omniture.ClickTrackTrigger();},1000);return false;}
while(SNI.Omniture.queue.length>0){var d=SNI.Omniture.queue.pop();var s=s_gi(s_account);$k.each(d,function(key,value){if(key!='element'){s[key]=value;}});s.tl(d.element,'o','Link Name');}};
if(typeof(SNI.Player)=="undefined")
{SNI.Player={};}
if(typeof(SNI.Player.Settings)=="undefined")
{SNI.Player.Settings={snap_swf_url:SNI.Config.snapBinary,flash_express_install_url:"http://common.scrippsnetworks.com/common/flash-express-install/expressInstall.swf",flash_minimum_version:"9"};}
if(typeof(SNI.Player.UserInterfaceConfigs)=="undefined")
{SNI.Player.UserInterfaceConfigs={FullSize:{enableSyncAdFix:1,dimensions:{width:'576',height:'636'},flashvars:{config:"http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-style.xml,http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-config-std.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent",bgcolor:"#ffffff"}},FullSizeNoPlaylist:{enableSyncAdFix:1,dimensions:{width:'576',height:'460'},flashvars:{showCarousel:"false",config:"http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-style.xml,http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-config-std.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},RightRail:{enableSyncAdFix:0,dimensions:{width:'320',height:'360'},flashvars:{config:"http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-style.xml,http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-config-rr.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},RightRailNoPlaylist:{enableSyncAdFix:0,dimensions:{width:'320',height:'263'},flashvars:{showCarousel:"false",config:"http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-style.xml,http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-config-rr.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},Blog:{enableSyncAdFix:1,dimensions:{width:'320',height:'263'},flashvars:{showCarousel:"false",config:"http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-style.xml,http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-config-std.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},BlogNoPlaylist:{enableSyncAdFix:1,dimensions:{width:'320',height:'263'},flashvars:{showCarousel:"false",config:"http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-style.xml,http://frontend.scrippsnetworks.com/~jhung/snap2/configs/snap-config-std.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}}};}
SNI.Player.getPlayerContainerDivId=function()
{return this.container_div_id;};SNI.Player.getPlayerInstanceId=function()
{return this.instance_id;};SNI.Player.loadPlaylist=function(channelId,playlistTitle,videoId)
{if(channelId=="undefined"){channelId='';}
if(playlistTitle=="undefined"){playlistTitle='';}
if(videoId=="undefined"){videoId='';}
var playlistUrl=this.getPlaylistUrl(channelId);var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{fl.setPlaylist(channelId,playlistUrl,escape(playlistTitle),videoId);}};SNI.Player.SNAP=function(config)
{if(typeof(config)=="undefined")
{alert("Error loading video player");return null;}
else
{if(config.container_div_id=="undefined")
{alert("Error loading video player");return null;}
else
{this.container_div_id=config.container_div_id;this.instance_id=config.container_div_id+'-instance';}
if(config.ui_config=="undefined")
{alert("Error loading video player configuration");return null;}
else
{this.ui_config=config.ui_config;}
if(typeof(config.fcn_build_playlist_url)=="undefined"||config.fcn_build_playlist_url=='')
{this.getPlaylistUrl=SNI.Player.getPlaylistUrl;}
else
{this.getPlaylistUrl=config.fcn_build_playlist_url;}
if(typeof(config.channel_id)=="undefined")
{alert("No playlist specified.");return null;}
else
{this.channel_id=config.channel_id;this.channel_url=this.getPlaylistUrl(this.channel_id);}
this.video_id=SNI.Player.getUrlParam('videoId');if(this.video_id=="")
{if(typeof(config.video_id)!="undefined")
{this.video_id=config.video_id;}}
this.play=function()
{var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{if(!fl.playerPlay){alert('play() not yet implemented');return;}
fl.playerPlay();}}
this.pause=function()
{var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{if(!fl.playerPause){alert('pause() not yet implemented');return;}
fl.playerPause();}}
this.seek=function(mins,secs)
{if(mins=="undefined"){mins=0;}
if(secs=="undefined"){secs=0;}
var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{if(!fl.playerSeek){alert('seek() not yet implemented');return;}
fl.playerSeek((mins*60)+secs);}}
this.nextVideo=function()
{var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{if(!fl.nextVideo){alert('nextVideo() not yet implemented');return;}
fl.nextVideo();}}
this.prevVideo=function()
{var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{if(!fl.prevVideo){alert('prevVideo() not yet implemented');return;}
fl.prevVideo();}}
this.mute=function()
{var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{if(!fl.mute){alert('mute() not yet implemented');return;}
fl.mute();}}
this.unmute=function()
{var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{if(!fl.unmute){alert('unmute() not yet implemented');return;}
fl.unmute();}}
this.setPlaylistChannel=function(chId,url){if(chId=="undefined"){chId='';}
if(url=="undefined"){url='';}
var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{fl.setPlaylistChannel(chId,url);}}
this.setPlaylistTitle=function(ttl){if(ttl=="undefined"){ttl='';}
var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{fl.setPlaylistTitle(ttl);}}
this.setPlaylistVideo=function(videoId){if(videoId=="undefined"){videoId='';}
var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{fl.setPlaylistVideo(videoId);}}
this.fullScreen=function()
{var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{if(!fl.fullScreen){alert('fullScreen() not yet implemented');return;}
fl.fullScreen();}}
this.showMenu=function(tab)
{if(tab=="undefined"){tab='';}
var fl=document.getElementById(this.instance_id);if(fl!="undefined")
{if(!fl.showMenu){alert('showMenu() not yet implemented');return;}
fl.showMenu(tab);}}}
if(typeof(mdManager)!="undefined")
{mdManager.addParameter("VideoPlayer","SNAP");}
var attributes={id:this.instance_id,name:this.instance_id+' Player'};var flashvars=this.ui_config.flashvars;flashvars.channel=this.channel_id,flashvars.channelurl=this.channel_url,flashvars.videoId=this.video_id,flashvars.snapDivId=this.container_div_id
if(typeof(config.playlist_title)!="undefined")
{flashvars.playlistTitle=escape(config.playlist_title);}
if(this.ui_config.enableSyncAdFix!="undefined"&&this.ui_config.enableSyncAdFix)
{flashvars.systemEventHandler="SNI.Player.callbackSystem";}
if(typeof(config.fcn_callback_user)!="undefined")
{flashvars.userEventHandler=config.fcn_callback_user;}
swfobject.embedSWF(SNI.Player.Settings.snap_swf_url,this.container_div_id,this.ui_config.dimensions.width,this.ui_config.dimensions.height,SNI.Player.Settings.flash_minimum_version,SNI.Player.Settings.flash_express_install_url,flashvars,this.ui_config.params,attributes);};SNI.Player.getPlaylistUrl=function(channelId)
{return SNI.Config.snapPlayListUrl+'/channel/xml/0,,'+channelId+',00.xml';};SNI.Player.getUrlParam=function(paramName)
{paramName=paramName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+paramName+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null){return"";}else{return results[1];}};SNI.Player.getJSON=function(json)
{return eval('('+json+')');};SNI.Player.callbackSystem=function(eventType,eventInfo)
{var eventJson=SNI.Player.getJSON(eventInfo);if(eventType=='playerReady')
{var isAutoPlay=eventJson.isAutoPlay;var hasPreroll=eventJson.hasPreroll;if(isAutoPlay=='false'||hasPreroll=='false')
{if(typeof(setDefaultBigboxAd)=="function")
{setDefaultBigboxAd();}}}}
SNI.Player.FullSize=function(divId,channelId,videoId,callback,ui_config)
{return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.Player.UserInterfaceConfigs.FullSize,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_callback_user":callback});};SNI.Player.FullSizeNoPlaylist=function(divId,channelId,videoId,callback,ui_config)
{return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.Player.UserInterfaceConfigs.FullSizeNoPlaylist,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_callback_user":callback});};SNI.Player.RightRail=function(divId,channelId,videoId,callback,ui_config)
{return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.Player.UserInterfaceConfigs.RightRail,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_callback_user":callback});};SNI.Player.RightRailNoPlaylist=function(divId,channelId,videoId,callback,ui_config)
{return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.Player.UserInterfaceConfigs.RightRailNoPlaylist,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_callback_user":callback});};SNI.Player.Blog=function(divId,channelId,videoId,callback,ui_config)
{getPlaylistUrlForBlogs=function(channelId){return SNI.Config.snapPlayListUrl+'/channel/xml/0,,'+channelId+',00.xml';};return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.Player.UserInterfaceConfigs.FullSizeNoPlaylist,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_callback_user":getPlaylistUrlForBlogs});};


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

SNI.HGTV.ANIMATION_SPEED = 150;




if(typeof(SNI.HGTV.Omniture)=='undefined'){SNI.HGTV.Omniture={};}
SNI.Omniture.getLinkText=function($elt){var linkText="";linkText=$elt.closest("a").text();if(linkText==''&&element.is("img")){linkText='Photo : '+element.attr("alt");}else if($elt.closest("#hg-sitenav .subnav").length>0){$thislink=$elt.closest("a");if(!$thislink.is("#hg-sitenav .subnav li.nav > a")){linkText=$elt.closest("#hg-sitenav .subnav > li.nav").children("a").text()+'-'+linkText;}
linkText=$elt.closest("#hg-sitenav .topnav > li").children("a.toplink").text()+'-'+linkText;}
return linkText;}
SNI.HGTV.Omniture.ClickTrack=SNI.Omniture.MultiVar;SNI.HGTV.Omniture.ClickTrackSingle=SNI.Omniture.SingleVar;SNI.HGTV.Omniture.ClickTrackSingleCustom=function(jsel,module,propVal,trackEvent){var $el=$k(jsel);if($el.length==0||$el.data('events.click.omniture')){return;}
$el.bind('click.omniture',function(e){var $clicked=$k(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;};
if(typeof(SNI)=='undefined'){SNI={};}
if(typeof(SNI.Community)=='undefined'){SNI.Community={};}
if(typeof(SNI.Community.UR)=='undefined'){SNI.Community.UR={};}
SNI.Community.UR={init:function(){if((SNI.Community.siteName==undefined)||(SNI.Community.siteName==null)){SNI.Community.UR.urUser=new SNI.UR.UrUser(new HGTVApplicationConfig());if(SNI.Community.UR.urUser.isLoggedIn==true){SNI.Community.UR.ViewingUserId=SNI.Community.UR.urUser.getUserId();SNI.Community.UR.ViewingUserName=SNI.Community.UR.urUser.getEmail();SNI.Community.UR.ViewingUserDisplayName=SNI.Community.UR.urUser.getUserName();if((SNI.Community.UR.ViewingUserDisplayName==undefined)||(SNI.Community.UR.ViewingUserDisplayName==null)||(SNI.Community.UR.ViewingUserDisplayName=='')){if((SNI.Community.UR.ViewingUserName!=null)){if(SNI.Community.UR.ViewingUserName.indexOf("@")==-1){SNI.Community.UR.ViewingUserDisplayName=SNI.Community.UR.ViewingUserName;}else{SNI.Community.UR.ViewingUserDisplayName=SNI.Community.UR.ViewingUserName.substring(0,SNI.Community.UR.ViewingUserName.indexOf("@"));}}}
SNI.Community.UR.ViewingUserPostalCode=SNI.Community.UR.urUser.getPostalCode();SNI.Community.UR.logged_in='true';}else{}}
else if((SNI.Community.UR.ViewingUserName!=undefined)&&(SNI.Community.UR.ViewingUserName!=null)){if((SNI.Community.UR.ViewingUserDisplayName==undefined)||(SNI.Community.UR.ViewingUserDisplayName==null)||(SNI.Community.UR.ViewingUserDisplayName=='')){if(SNI.Community.UR.ViewingUserName!=null){if(SNI.Community.UR.ViewingUserName.indexOf("@")==-1){SNI.Community.UR.ViewingUserDisplayName=SNI.Community.UR.ViewingUserName;}else{SNI.Community.UR.ViewingUserDisplayName=SNI.Community.UR.ViewingUserName.substring(0,SNI.Community.UR.ViewingUserName.indexOf("@"));}}}
SNI.Community.UR.logged_in='true';}},logout:function(){var destURL=document.location;document.location="http://my.hgtv.com/redirectors/logout_redirector.jsp?DEST_URL="+escape(destURL);}};
HGTVApplicationConfig.prototype=new SNI.UR.ApplicationConfig();function HGTVApplicationConfig(){HGTVApplicationConfig.prototype=new SNI.UR.ApplicationConfig();this.loginServer["DEV"]="http://vdev2.scrippsnetworks.com/";this.loginServer["STAGE"]="http://swwd.scrippsweb.com/";this.loginServer["PROD"]="http://web.hgtv.com/";this.urVersion=urVersion;function urVersion(){return 1;}}
(function($){$k.fn.jcarousel=function(o){if(typeof o=='string'){var instance=$k(this).data('jcarousel'),args=Array.prototype.slice.call(arguments,1);return instance[o].apply(instance,args);}else
return this.each(function(){$k(this).data('jcarousel',new $jc(this,o));});};var defaults={vertical:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:'normal',easing:'swing',auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:'<div></div>',buttonPrevHTML:'<div></div>',buttonNextEvent:'click',buttonPrevEvent:'click',buttonNextCallback:null,buttonPrevCallback:null};$k.jcarousel=function(e,o){this.options=$k.extend({},defaults,o||{});this.locked=false;this.container=null;this.clip=null;this.list=null;this.buttonNext=null;this.buttonPrev=null;this.wh=!this.options.vertical?'width':'height';this.lt=!this.options.vertical?'left':'top';var skin='',split=e.className.split(' ');for(var i=0;i<split.length;i++){if(split[i].indexOf('jcarousel-skin')!=-1){$k(e).removeClass(split[i]);skin=split[i];break;}}if(e.nodeName=='UL'||e.nodeName=='OL'){this.list=$k(e);this.container=this.list.parent();if(this.container.hasClass('jcarousel-clip')){if(!this.container.parent().hasClass('jcarousel-container'))this.container=this.container.wrap('<div></div>');this.container=this.container.parent();}else if(!this.container.hasClass('jcarousel-container'))this.container=this.list.wrap('<div></div>').parent();}else{this.container=$k(e);this.list=this.container.find('ul,ol').eq(0);}if(skin!=''&&this.container.parent()[0].className.indexOf('jcarousel-skin')==-1)this.container.wrap('<div class=" '+skin+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass('jcarousel-clip'))this.clip=this.list.wrap('<div></div>').parent();this.buttonNext=$k('.jcarousel-next',this.container);if(this.buttonNext.size()==0&&this.options.buttonNextHTML!=null)this.buttonNext=this.clip.after(this.options.buttonNextHTML).next();this.buttonNext.addClass(this.className('jcarousel-next'));this.buttonPrev=$k('.jcarousel-prev',this.container);if(this.buttonPrev.size()==0&&this.options.buttonPrevHTML!=null)this.buttonPrev=this.clip.after(this.options.buttonPrevHTML).next();this.buttonPrev.addClass(this.className('jcarousel-prev'));this.clip.addClass(this.className('jcarousel-clip')).css({overflow:'hidden',position:'relative'});this.list.addClass(this.className('jcarousel-list')).css({overflow:'hidden',position:'relative',top:0,left:0,margin:0,padding:0});this.container.addClass(this.className('jcarousel-container')).css({position:'relative'});var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var li=this.list.children('li');var self=this;if(li.size()>0){var wh=0,i=this.options.offset;li.each(function(){self.format(this,i++);wh+=self.dimension(this,di);});this.list.css(this.wh,wh+'px');if(!o||o.size===undefined)this.options.size=li.size();}this.container.css('display','block');this.buttonNext.css('display','block');this.buttonPrev.css('display','block');this.funcNext=function(){self.next();};this.funcPrev=function(){self.prev();};this.funcResize=function(){self.reload();};if(this.options.initCallback!=null)this.options.initCallback(this,'init');if($k.browser.safari){this.buttons(false,false);$k(window).bind('load.jcarousel',function(){self.setup();});}else
this.setup();};var $jc=$k.jcarousel;$jc.fn=$jc.prototype={jcarousel:'0.2.4'};$jc.fn.extend=$jc.extend=$k.extend;$jc.fn.extend({setup:function(){this.first=null;this.last=null;this.prevFirst=null;this.prevLast=null;this.animating=false;this.timer=null;this.tail=null;this.inTail=false;if(this.locked)return;this.list.css(this.lt,this.pos(this.options.offset)+'px');var p=this.pos(this.options.start);this.prevFirst=this.prevLast=null;this.animate(p,false);$k(window).unbind('resize.jcarousel',this.funcResize).bind('resize.jcarousel',this.funcResize);},reset:function(){this.list.empty();this.list.css(this.lt,'0px');this.list.css(this.wh,'10px');if(this.options.initCallback!=null)this.options.initCallback(this,'reset');this.setup();},reload:function(){if(this.tail!=null&&this.inTail)this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;if(this.options.reloadCallback!=null)this.options.reloadCallback(this);if(this.options.visible!=null){var self=this;var di=Math.ceil(this.clipping()/this.options.visible),wh=0,lt=0;$k('li',this.list).each(function(i){wh+=self.dimension(this,di);if(i+1<self.first)lt=wh;});this.list.css(this.wh,wh+'px');this.list.css(this.lt,-lt+'px');}this.scroll(this.first,false);},lock:function(){this.locked=true;this.buttons();},unlock:function(){this.locked=false;this.buttons();},size:function(s){if(s!=undefined){this.options.size=s;if(!this.locked)this.buttons();}return this.options.size;},has:function(i,i2){if(i2==undefined||!i2)i2=i;if(this.options.size!==null&&i2>this.options.size)i2=this.options.size;for(var j=i;j<=i2;j++){var e=this.get(j);if(!e.length||e.hasClass('jcarousel-item-placeholder'))return false;}return true;},get:function(i){return $k('.jcarousel-item-'+i,this.list);},add:function(i,s){var e=this.get(i),old=0,add=0;if(e.length==0){var c,e=this.create(i),j=$jc.intval(i);while(c=this.get(--j)){if(j<=0||c.length){j<=0?this.list.prepend(e):c.after(e);break;}}}else
old=this.dimension(e);e.removeClass(this.className('jcarousel-item-placeholder'));typeof s=='string'?e.html(s):e.empty().append(s);var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var wh=this.dimension(e,di)-old;if(i>0&&i<this.first)this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-wh+'px');this.list.css(this.wh,$jc.intval(this.list.css(this.wh))+wh+'px');return e;},remove:function(i){var e=this.get(i);if(!e.length||(i>=this.first&&i<=this.last))return;var d=this.dimension(e);if(i<this.first)this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+d+'px');e.remove();this.list.css(this.wh,$jc.intval(this.list.css(this.wh))-d+'px');},next:function(){this.stopAuto();if(this.tail!=null&&!this.inTail)this.scrollTail(false);else
this.scroll(((this.options.wrap=='both'||this.options.wrap=='last')&&this.options.size!=null&&this.last==this.options.size)?1:this.first+this.options.scroll);},prev:function(){this.stopAuto();if(this.tail!=null&&this.inTail)this.scrollTail(true);else
this.scroll(((this.options.wrap=='both'||this.options.wrap=='first')&&this.options.size!=null&&this.first==1)?this.options.size:this.first-this.options.scroll);},scrollTail:function(b){if(this.locked||this.animating||!this.tail)return;var pos=$jc.intval(this.list.css(this.lt));!b?pos-=this.tail:pos+=this.tail;this.inTail=!b;this.prevFirst=this.first;this.prevLast=this.last;this.animate(pos);},scroll:function(i,a){if(this.locked||this.animating)return;this.animate(this.pos(i),a);},pos:function(i){var pos=$jc.intval(this.list.css(this.lt));if(this.locked||this.animating)return pos;if(this.options.wrap!='circular')i=i<1?1:(this.options.size&&i>this.options.size?this.options.size:i);var back=this.first>i;var f=this.options.wrap!='circular'&&this.first<=1?1:this.first;var c=back?this.get(f):this.get(this.last);var j=back?f:f-1;var e=null,l=0,p=false,d=0,g;while(back?--j>=i:++j<i){e=this.get(j);p=!e.length;if(e.length==0){e=this.create(j).addClass(this.className('jcarousel-item-placeholder'));c[back?'before':'after'](e);if(this.first!=null&&this.options.wrap=='circular'&&this.options.size!==null&&(j<=0||j>this.options.size)){g=this.get(this.index(j));if(g.length)this.add(j,g.children().clone(true));}}c=e;d=this.dimension(e);if(p)l+=d;if(this.first!=null&&(this.options.wrap=='circular'||(j>=1&&(this.options.size==null||j<=this.options.size))))pos=back?pos+d:pos-d;}var clipping=this.clipping();var cache=[];var visible=0,j=i,v=0;var c=this.get(i-1);while(++visible){e=this.get(j);p=!e.length;if(e.length==0){e=this.create(j).addClass(this.className('jcarousel-item-placeholder'));c.length==0?this.list.prepend(e):c[back?'before':'after'](e);if(this.first!=null&&this.options.wrap=='circular'&&this.options.size!==null&&(j<=0||j>this.options.size)){g=this.get(this.index(j));if(g.length)this.add(j,g.find('>*').clone(true));}}c=e;var d=this.dimension(e);if(d==0){return 0;}if(this.options.wrap!='circular'&&this.options.size!==null&&j>this.options.size)cache.push(e);else if(p)l+=d;v+=d;if(v>=clipping)break;j++;}for(var x=0;x<cache.length;x++)cache[x].remove();if(l>0){this.list.css(this.wh,this.dimension(this.list)+l+'px');if(back){pos-=l;this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-l+'px');}}var last=i+visible-1;if(this.options.wrap!='circular'&&this.options.size&&last>this.options.size)last=this.options.size;if(j>last){visible=0,j=last,v=0;while(++visible){var e=this.get(j--);if(!e.length)break;v+=this.dimension(e);if(v>=clipping)break;}}var first=last-visible+1;if(this.options.wrap!='circular'&&first<1)first=1;if(this.inTail&&back){pos+=this.tail;this.inTail=false;}this.tail=null;if(this.options.wrap!='circular'&&last==this.options.size&&(last-visible+1)>=1){var m=$jc.margin(this.get(last),!this.options.vertical?'marginRight':'marginBottom');if((v-m)>clipping)this.tail=v-clipping-m;}while(i-->first)pos+=this.dimension(this.get(i));this.prevFirst=this.first;this.prevLast=this.last;this.first=first;this.last=last;return pos;},animate:function(p,a){if(this.locked||this.animating)return;this.animating=true;var self=this;var scrolled=function(){self.animating=false;if(p==0)self.list.css(self.lt,0);if(self.options.wrap=='circular'||self.options.wrap=='both'||self.options.wrap=='last'||self.options.size==null||self.last<self.options.size)self.startAuto();self.buttons();self.notify('onAfterAnimation');};this.notify('onBeforeAnimation');if(!this.options.animation||a==false){this.list.css(this.lt,p+'px');scrolled();}else{var o=!this.options.vertical?{'left':p}:{'top':p};this.list.animate(o,this.options.animation,this.options.easing,scrolled);}},startAuto:function(s){if(s!=undefined)this.options.auto=s;if(this.options.auto==0)return this.stopAuto();if(this.timer!=null)return;var self=this;this.timer=setTimeout(function(){self.next();},this.options.auto*1000);},stopAuto:function(){if(this.timer==null)return;clearTimeout(this.timer);this.timer=null;},buttons:function(n,p){if(n==undefined||n==null){var n=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!='first')||this.options.size==null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap=='first')&&this.options.size!=null&&this.last>=this.options.size)n=this.tail!=null&&!this.inTail;}if(p==undefined||p==null){var p=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!='last')||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=='last')&&this.options.size!=null&&this.first==1)p=this.tail!=null&&this.inTail;}var self=this;this.buttonNext[n?'bind':'unbind'](this.options.buttonNextEvent+'.jcarousel',this.funcNext)[n?'removeClass':'addClass'](this.className('jcarousel-next-disabled')).attr('disabled',n?false:true);this.buttonPrev[p?'bind':'unbind'](this.options.buttonPrevEvent+'.jcarousel',this.funcPrev)[p?'removeClass':'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled',p?false:true);if(this.buttonNext.length>0&&(this.buttonNext[0].jcarouselstate==undefined||this.buttonNext[0].jcarouselstate!=n)&&this.options.buttonNextCallback!=null){this.buttonNext.each(function(){self.options.buttonNextCallback(self,this,n);});this.buttonNext[0].jcarouselstate=n;}if(this.buttonPrev.length>0&&(this.buttonPrev[0].jcarouselstate==undefined||this.buttonPrev[0].jcarouselstate!=p)&&this.options.buttonPrevCallback!=null){this.buttonPrev.each(function(){self.options.buttonPrevCallback(self,this,p);});this.buttonPrev[0].jcarouselstate=p;}},notify:function(evt){var state=this.prevFirst==null?'init':(this.prevFirst<this.first?'next':'prev');this.callback('itemLoadCallback',evt,state);if(this.prevFirst!==this.first){this.callback('itemFirstInCallback',evt,state,this.first);this.callback('itemFirstOutCallback',evt,state,this.prevFirst);}if(this.prevLast!==this.last){this.callback('itemLastInCallback',evt,state,this.last);this.callback('itemLastOutCallback',evt,state,this.prevLast);}this.callback('itemVisibleInCallback',evt,state,this.first,this.last,this.prevFirst,this.prevLast);this.callback('itemVisibleOutCallback',evt,state,this.prevFirst,this.prevLast,this.first,this.last);},callback:function(cb,evt,state,i1,i2,i3,i4){if(this.options[cb]==undefined||(typeof this.options[cb]!='object'&&evt!='onAfterAnimation'))return;var callback=typeof this.options[cb]=='object'?this.options[cb][evt]:this.options[cb];if(!$k.isFunction(callback))return;var self=this;if(i1===undefined)callback(self,state,evt);else if(i2===undefined)this.get(i1).each(function(){callback(self,this,i1,state,evt);});else{for(var i=i1;i<=i2;i++)if(i!==null&&!(i>=i3&&i<=i4))this.get(i).each(function(){callback(self,this,i,state,evt);});}},create:function(i){return this.format('<li></li>',i);},format:function(e,i){var $e=$k(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-'+i)).css({'float':'left','list-style':'none'});$e.attr('jcarouselindex',i);return $e;},className:function(c){return c+' '+c+(!this.options.vertical?'-horizontal':'-vertical');},dimension:function(e,d){var el=e.jquery!=undefined?e[0]:e;var old=!this.options.vertical?el.offsetWidth+$jc.margin(el,'marginLeft')+$jc.margin(el,'marginRight'):el.offsetHeight+$jc.margin(el,'marginTop')+$jc.margin(el,'marginBottom');if(d==undefined||old==d)return old;var w=!this.options.vertical?d-$jc.margin(el,'marginLeft')-$jc.margin(el,'marginRight'):d-$jc.margin(el,'marginTop')-$jc.margin(el,'marginBottom');$k(el).css(this.wh,w+'px');return this.dimension(el);},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-$jc.intval(this.clip.css('borderLeftWidth'))-$jc.intval(this.clip.css('borderRightWidth')):this.clip[0].offsetHeight-$jc.intval(this.clip.css('borderTopWidth'))-$jc.intval(this.clip.css('borderBottomWidth'));},index:function(i,s){if(s==undefined)s=this.options.size;return Math.round((((i-1)/s)-Math.floor((i-1)/s))*s)+1;}});$jc.extend({defaults:function(d){return $k.extend(defaults,d||{});},margin:function(e,p){if(!e)return 0;var el=e.jquery!=undefined?e[0]:e;if(p=='marginRight'&&$k.browser.safari){var old={'display':'block','float':'none','width':'auto'},oWidth,oWidth2;$k.swap(el,old,function(){oWidth=el.offsetWidth;});old['marginRight']=0;$k.swap(el,old,function(){oWidth2=el.offsetWidth;});return oWidth2-oWidth;}return $jc.intval($k.css(el,p));},intval:function(v){v=parseInt(v);return isNaN(v)?0:v;}});})(jQuery);
jQuery.dpl={init:function(type,config){return this.each(function(i){if(this.id){}
else{this.id=type+"-"+new Date().getTime();}
try{document.execCommand('BackgroundImageCache',false,true);}catch(e){}
var init=$k.dpl[type];if($k.isFunction(init)){init(this,config);}});},carousel:function(ele,config){config=$k.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($k(ele).width())/2-parseInt($k(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;});}};$k(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=$k.extend({delay:15000,loops:0,showThumbnails:false,widthThumbails:110,pause:null},config);var _timeout;var currentSlide=0;var slides=$k(ele).find(".dl-content li");var pageLinks=$k(ele).find(".dl-menu");var maxSlides=slides.length;var countLoop=0;$k(".video-cn").hide();$k(ele).find(".videolink").click(function(){clearTimeout(_timeout);$k(this).hide();$k(this).parent().find(".video-cn").show();});var play=true;if(config["pause"]!=null){$k(ele).find("."+config["pause"]).click(function(){txt=($k(this).html()=="PAUSE")?"PLAY":"PAUSE";$k(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=$k(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=$k("#cluetip-inner").outerHeight();$k('#cluetip').hide();opt={margin:true,padding:true,border:true,scroll:true};anchorPos=$k(this).offset({scroll:true,margin:true,padding:true,border:true});_top=parseInt(anchorPos["top"])-parseInt(height);$k('#cluetip').css('top',_top);$k('#cluetip').show();},function(){if($k('#cluetip').is(':visible')){$k('#cluetip').hover(function(){$k('#cluetip').show();},function(){$k('#cluetip').hide();});$k('#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];$k(ele).find("li.active").removeClass("active");pageLinks.find("ul > li:eq("+currentSlide+")").addClass("active");$k(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=$k.extend({autoheight:true,header:'.acco-link',animated:($k.browser.msie?false:'easeOutSine')},config);jQuery(el).accordion(config);},tabs:function(el,config){jQuery(el).tabs(config);},collapser:function(el,config){config=$k.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){$k("#prog-guide .morning").addClass("active");}
else if(current_time>=9&&current_time<12){$k("#prog-guide .morning").addClass("active");}
else if(current_time>=12&&current_time<16){$k("#prog-guide .daytime").addClass("active");}
else if(current_time>=16&&current_time<19){$k("#prog-guide .evening").addClass("active");}
else if(current_time>=19&&current_time<23){$k("#prog-guide .primetime").addClass("active");}
else{$k("#prog-guide .latenight").addClass("active");};};if(config["videochannels"]==true){togglelist=$k(el).find('li.switch');togglelist.each(function(){var $this=$k(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){$k(el).children(":first").each(function(){var $this=$k(this);$this.click(function(){$this.parent().toggleClass("active");});});};}};jQuery.fn.dpl=jQuery.dpl.init;
$k.ui=$k.ui||{};$k.fn.extend({dropdown:function(options,data){if(navigator.userAgent.match(/iPhone|android|blackberry/i)){return;}
var args=Array.prototype.slice.call(arguments,1);return this.each(function(){if(typeof options=="string"){var dropdown=$k.data(this,"ui-dropdown");dropdown[options].apply(dropdown,args);}else if(!$k(this).is(".ui-dropdown")){$k.data(this,"ui-dropdown",new $k.ui.dropdown(this,options));}});}});$k.ui.dropdown=function(container,options){this.element=$k(container);this.options=options=$k.extend({},$k.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();}};$k.extend($k.ui.dropdown,{defaults:{title:'',disabled:false}});$k.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();$k(this).parent('dt').addClass('active');$k('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");$k.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=$k(ddList);ddList.find('.close').click(function(){hideDropDowns();return false;});var list=$k('<ul class="dd-ul"></ul>');element.children('option:not(.select-title)').each(function(i){var link=$k('<a href="#">'+$k(this).text()+'</a>');link.click(function(){ddList.find('dt a').html($k(this).text()+'<em></em>');element.find('option:not(.select-title)')[i].selected=true;hideDropDowns();element.trigger('change');return false;});var item=$k('<li class="dd-li"></li>').append(link);list.append(item);});ddList.find('.dd-bd').append(list);return ddList;}
function hideDropDowns(event){if(event&&$k.browser.mozilla&&$k(event.target).hasClass('dd-ul')){return true;}
$k('.dd-list dd').hide();$k('.dd-list .active').removeClass('active');$k('body').unbind("mousedown",bodyClicked);return true;}
function bodyClicked(event){var element=$k(event.target);if(element.parents().is('.dd-list')){return false;}else{hideDropDowns();}}
$k.ui=$k.ui||{};$k.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=$k.data(this,"ui-dependent-dropdowns");dependent_dropdowns[options].apply(dependent_dropdowns,args);}else if(!$k(this).is(".ui-dependent-dropdowns")){$k.data(this,"ui-dependent-dropdowns",new $k.ui.dependent_dropdowns(this,options));}});}});$k.ui.dependent_dropdowns=function(container,options){this.element=$k(container);this.options=options=$k.extend({},$k.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;$k.each(this.dropdowns,function(i,val){$k(val).dropdown();$k(val).bind("change",function(){index=$k.inArray(this,dd.dropdowns);if(index!=-1){dd._updateValues(index+1);}});});this.enable();};$k.ui.dependent_dropdowns.prototype={enable:function(){this._updateValues(0);this.defaults();},disable:function(){},destroy:function(){$k.each(this.dropdowns,function(key,value){$k(value).destroy();});this.element.removeClass("ui-dependent-dropdowns");$k.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;$k.each(this.data.defaults,function(key,values){times=key.split('-');if(dd._checkTime(times[0],times[1],time)){index=0;$k.each(values,function(k,v){if(select=dd.dropdowns[index]){$k(select).find('option').each(function(){if($k(this).val()==v){this.selected=true;$k(select).dropdown('select');$k(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=$k(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){$k.each(values,function(key,val){options+='<option value="'+key+'"';if(previous_value&&previous_value==key){options+=' selected="selected"';}
options+='>'+val.label+'</option>';});}
if(!values){$k(dropdown).dropdown('disable');}
$k(dropdown).html(options);$k(dropdown).dropdown('reset');if(values){$k(dropdown).dropdown('enable');}
this._updateValues(index+1);}},_findValues:function(values,start_index,end_index){if(start_index==end_index){return values;}else{values=values[$k(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=$k.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;}};
$k.validator.setDefaults({errorElement:'span',onfocusout:false,onkeyup:false,onclick:false,highlight:function(element,errorClass){$k(element).addClass(errorClass);$k(element.form).find("label[for="+element.id+"]").addClass(errorClass);},unhighlight:function(element,errorClass){$k(element).removeClass(errorClass);$k(element.form).find("label[for="+element.id+"]").removeClass(errorClass);}});$k.validator.addMethod("spaces",function(value,element){return this.optional(element)||value.indexOf(' ')==-1;},"Spaces are not allowed");$k.validator.addMethod("multipleEmails",function(value,element){if(this.optional(element)){return true;}
var friendsEmails=value.split(",");var isEmail=true;$k.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($k.trim(this));if(patternTest==false){isEmail=false;};});return isEmail;},"One of these is not a valid e-mail address");
(function($){var GlobalHeader=function(){var GlobalHeader=this;var globalNav=function(){var globalNav=this;globalNav.MENU_DELAY=500;globalNav.oSiteNav={};globalNav.init=function($nav){initTopNav($nav);initSubNavs($nav.find(".subnav"));globalNav.setSelectedTabs($nav,globalNav.getTabsToSelect(mdManager));globalNav.loadDropsDta();return;};function initTopNav($nav){var navTimer=null;var navDelay=globalNav.MENU_DELAY;var $topNav=$nav.find(".topnav");var $subNav=$nav.find(".subnav");$topNav.children("li").data("drops",false).filter(".sel").addClass("savesel");$subNav.filter(".sel").addClass("savesel");$topNav.children("li").hover(function(e){var $this=$k(this);clearTimeout(navTimer);navTimer=null;if($this.hasClass("sel")){return;}
navTimer=setTimeout(function(){if(!$this.data("drops")){if(fillDrops((/tab-([\S]+)/.exec($this.attr("class")))[1])){$this.data("drops",true);}}
$topNav.children("li.sel").removeClass("sel").find(".subnav > li.dd-on").removeClass("dd-on");$this.addClass("sel");},navDelay);},function(e){var $this=$k(this);clearTimeout(navTimer);navTimer=null;navTimer=setTimeout(function(){$topNav.children("li.sel").removeClass("sel").find(".subnav > li.dd-on").removeClass("dd-on");$topNav.children("li.savesel").addClass("sel");},navDelay);});return;}
function initSubNavs($subnavs){function initOneSubNav($subnav){var navTimer=null;var navDelay=globalNav.MENU_DELAY;$subnav.children("li.nav").hover(function(e){var $this=$k(this);clearTimeout(navTimer);navTimer=null;if($this.hasClass("dd-on")){return;}
$this.siblings("li.nav").removeClass("dd-on");$this.addClass("dd-on");},function(e){var $this=$k(this);clearTimeout(navTimer);navTimer=null;navTimer=setTimeout(function(){$this.removeClass("dd-on");},navDelay);});return;}
$subnavs.each(function(i){initOneSubNav($k(this));});return;}
globalNav.getTabsToSelect=function(md){var o={tTab:"xyz",sTab:"abc"};if(((typeof md.getParameter("SctnNameLineage"))!="undefined")&&(md.getParameter("SctnNameLineage")!="")){var aLin=md.getParameter("SctnNameLineage").split(',');if(typeof aLin[0]!="undefined"){aLin.pop();}
if(typeof aLin[0]!="undefined"){o.tTab=aLin.pop().toLowerCase().replace(' ','-');}
if(typeof aLin[0]!="undefined"){o.sTab=aLin.pop().toLowerCase().replace(' ','-');}}else{if(((typeof md.getParameter("CategoryDspName"))!="undefined")&&(md.getParameter("CategoryDspName")!="")){o.tTab=md.getParameter("CategoryDspName").toLowerCase();}
if(((typeof md.getParameter("SctnDspName"))!="undefined")&&(md.getParameter("SctnDspName")!="")){o.sTab=md.getParameter("SctnDspName").toLowerCase();}}
return o;};globalNav.setSelectedTabs=function($nav,oTabs){var $tTabs=$nav.find(".topnav > li");$tTabs.removeClass("sel savesel");var $tTab=$tTabs.filter(".tab-"+oTabs.tTab);if($tTab.length>0){$tTab.addClass("sel savesel");var $sTab=$tTab.find(".tab-"+oTabs.sTab);if($sTab.length>0){$sTab.addClass("sel");}}else{$tTabs.eq(0).addClass("sel savesel");}
return;};globalNav.loadDropsDta=function(){$k.ajax({url:SNI.Config.navDropJsonPath+"&callback=SNI.HGTV.GlobalHeader.globalNav.processNavLoad",dataType:'script',cache:true,timeout:5000,error:SNI.HGTV.GlobalHeader.globalNav.errorNavLoad});};globalNav.processNavLoad=function(jsondta){globalNav.oSiteNav=jsondta;$tTab=$k("#hg-sitenav .topnav > li.sel");if($tTab.length>0){fillDrops((/tab-([\S]+)/.exec($tTab.attr("class")))[1]);$tTab.data("drops",true);}
return;};globalNav.errorNavLoad=function(oXHR,sError){return;}
function fillDrops(topTab){if(typeof globalNav.oSiteNav!="object")return false;if(!$k.isArray(globalNav.oSiteNav.topTabs))return false;var o=globalNav.oSiteNav.topTabs;for(var i=0;i<o.length;i++){if((typeof o[i].keyName!="undefined")&&(o[i].keyName==topTab)){with(o[i]){if($k.isArray(subTabs)){for(var j=0;j<subTabs.length;j++){$subTab=$k("#hg-sitenav .topnav").find("> li.tab-"+topTab+" li.tab-"+subTabs[j].keyName);var myHtml=fmtOneDropHtml(subTabs[j],"gh-t"+(i+1)+"s"+(j+1));if(myHtml!=""){$subTab.append(myHtml);$subTab.find("span.r").addClass("on");}}}}
break;}}
return true;}
function fmtOneDropHtml(oSubTab,relVal){function fmtLinkGrp(oLG,bLast){var retHtml="";var extraClass="";if((typeof bLast!=undefined)&&bLast){extraClass=" last";}
if((typeof oLG.dspName)=="string"){retHtml+='\t\t\t<h3>'+oLG.dspName+'</h3>\n';}
if($k.isArray(oLG.links)){retHtml+='\t\t\t<ul class="first">\n';var mhalf=Math.round(oLG.links.length/2,0);for(var m=0;m<oLG.links.length;m++){if(m==mhalf){retHtml+="\t\t\t</ul>\n";retHtml+="\t\t\t<ul>\n";}
if((aHtml=fmtALink(oLG.links[m]))!=""){retHtml+='\t\t\t\t<li>'+aHtml+'</li>\n';}}
retHtml+="\t\t\t</ul>\n";}
if((aHtml=fmtALink(oLG.cta))!=""){retHtml+='\t\t\t<p class="cta">'+aHtml+'</p>\n';}
if((aHtml=fmtALink(oLG.oneLink))!=""){retHtml+='\t\t\t<p>'+aHtml+'</p>\n';}
if(retHtml!=""){retHtml="\t\t<div class=\"grp clrfix"+extraClass+"\">\n"+retHtml+"\t\t</div>\n";}
return retHtml;}
function fmtALink(oLnk){retHtml="";if(typeof oLnk!="object"){return retHtml;}
if(((typeof oLnk.text)!="string")||((typeof oLnk.url)!=="string")){return retHtml;}
var url=oLnk.url;if(url.indexOf("http://")==-1){url="http://"+SNI.Config.domain+url;}
retHtml='<a href="'+url+'"';retHtml+=' rel='+relVal+"-"+(++linkCt);if(((typeof oLnk.rel)=="string")){retHtml+=' rel="'+oLnk.rel+'"';}
if(((typeof oLnk.newWin)=="string")&&oLnk.newWin=="true"){retHtml+=' target=\"_blank\"';}
retHtml+='>'+oLnk.text+'</a>';return retHtml;}
var retHtml="";var linkCt=0;if($k.isArray(oSubTab.linkGrps)){for(var i=0;i<oSubTab.linkGrps.length;i++){retHtml+=fmtLinkGrp(oSubTab.linkGrps[i],(i==(oSubTab.linkGrps.length-1)));}}
if(retHtml!=""){var tmp=retHtml;retHtml="<div class=\"dd20\">\n";retHtml+="\t<div class=\"dd20-hd\"><span class=\"l\"></span><span class=\"c\"></span><span class=\"r\"></span></div>\n";retHtml+="\t<div class=\"dd20-bd-outer clrfix\">";retHtml+="\t\t<div class=\"dd20-bd\">\n";retHtml+="\t\t\t<div class=\"content clrfix\">\n";retHtml+=tmp;retHtml+="\t\t\t</div>\n";retHtml+="\t\t</div>\n";retHtml+="\t</div>\n";retHtml+="\t<div class=\"dd20-ft\"><span class=\"l\"></span><span class=\"c\"></span><span class=\"r\"></span></div>\n";retHtml+="</div>\n";}
return retHtml;}};GlobalHeader.globalNav=new globalNav;GlobalHeader.globalSearch=function(element,autosuggest){SNI.Util.inputField(element+' input','Search');if(autosuggest===true){function findValue(li){if(li==null){return alert("No match!");}else{return li.selectValue;}}
function selectItem(li){findValue(li);}
function formatItem(row){return row[0];}
if(document.domain=="www.hgtv.com"){$k(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});}}
$k(element+" select").dropdown({title:'Search In:'});$k(element+' form').submit(function(){var $form=$k(this);var $searchInput=$form.find('input');var searchText=$k.trim($searchInput.val());var searchIn=$form.find('option:selected').attr('id');if((aSearch=/[^_]{2}_([\S]+)/.exec(searchIn))!=null){searchIn=aSearch[1];}
var searchAction=$form.find('select').val();if(searchText==''||searchText.toLowerCase()=='search'){$searchInput.get(0).focus();return false;}else if(searchIn=='tv-shows'){$form.attr('action',searchAction);}else if(searchIn=='rate-my-space'){window.location.href=searchAction.replace(/(.*)(SEARCH_STRING)(.*)/,"$1"+escape(searchText)+"$3");return false;}else if(searchIn=='designers-portfolio'){$form.attr('action',searchAction);}else if(searchIn=='products'){searchText=searchText.replace(/\s+/,'%20').toLowerCase();window.location.href=searchAction+searchText+'_keyword';return false;}else if(searchIn=='services'){searchText=encodeURIComponent(searchText);window.location.href=searchAction+"&searchVal="+searchText;return false;}
return true;});};GlobalHeader.myHGTV=function(){if((SNI.Community.UR.logged_in!=null)&&(SNI.Community.UR.logged_in=="true")){var $dd=$k('#my-hgtv .signed-in .dd20');$k('#my-hgtv .signed-in .dd20-cntnr').hover(function(){$dd.show();},function(){var timer=setTimeout(function(){$dd.hide();clearTimeout(timer);timer=null;},100);});$k('#my-hgtv .signed-in .hello a').text(SNI.Community.UR.ViewingUserDisplayName);$k('#my-hgtv .not-signed-in').hide();$k('#my-hgtv .signed-in').show();}};GlobalHeader.init=function(){GlobalHeader.globalNav.init($k("#hg-sitenav"));GlobalHeader.globalSearch('#hg-hd .search',true);GlobalHeader.myHGTV();};};SNI.HGTV.GlobalHeader=new GlobalHeader;})(jQuery);
SNI.HGTV.GlobalFooter={init:function(){SNI.HGTV.GlobalHeader.globalSearch('#hg-ft .search');}};
SNI.HGTV.Photogallery={gallery:function(){$k("#pgallery .prev a.desc").hover(function(){$k(".prev a.btn").addClass("hover");},function(){$k('.prev a.btn').removeClass("hover");});$k("#pgallery .next a.desc").hover(function(){$k(".next a.btn").addClass("hover");},function(){$k('.next a.btn').removeClass("hover");});var topmargin=13;var panelheight=$k('#pgallery .imgpanel').height();var shrinkheight=panelheight-topmargin;$k("#pgallery .close-btn").click(function(){$k(".imgpanel").animate({bottom:-shrinkheight+"px"},500);$k("#pgallery .imgpanel span.close-btn").css("display","none");$k("#pgallery .imgpanel span.open-btn").css("display","block");});$k("#pgallery .open-btn").click(function(){$k(".imgpanel").animate({bottom:"1px"},500);$k("#pgallery .imgpanel span.open-btn").css("display","none");$k("#pgallery .imgpanel span.close-btn").css("display","block");});$k(window).load(function(){$k("#pgallery .largeImage .imgpanel").css("left","1px");$k("#pgallery .largeImage .imgpanel").css("bottom","1px");});}};
SNI.HGTV.Photogallery3={cbackHotSpotJSON:function(){if(SNI.HGTV.Photogallery3.ImageData[ITMCUR].bhs){SNI.HGTV.Photogallery3.doHotSpots(ITMCUR);}
SNI.HGTV.Photogallery3.insertProdsTab();return;},doHotSpots:function(itmSel){if(typeof SNI.HGTV.Photogallery3.Hotspots=="undefined"){return;}
imgId=$k("#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=$k("#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(){$k(this).parent().find("span").addClass("on");},function(){$k(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($k(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($k(prodSel).length==0){for(i=0;i<SNI.HGTV.Photogallery3.Hotspots.images.length;++i){if(imgCMA==SNI.HGTV.Photogallery3.Hotspots.images[i].id){oHS=SNI.HGTV.Photogallery3.Hotspots.images[i].hotspots;hTabs='<h4>Products From this Photo:</h4>\n<div class="tab-wrap">\n<ul class="tabs">\n';hCont='<ul class="cont">';bMkt=true;for(j=0;j<oHS.length;++j){hTabs+='<li><a href="'+oHS[j].url+'">'+oHS[j].name+'</a></li>\n';hCont+='<li>\n<h4><a target="_blank" href="'+oHS[j].url+'">'+SNI.Util.strTrimEllips(oHS[j].name,42)+'</a></h4>\n';hCont+='<a class="pframe" target="_blank" href="'+oHS[j].url+'"><img width="266" height="200" src="'+oHS[j].imageURL+'"><span>More Info</span></a>';hCont+='<p>'+SNI.Util.strTrimEllips(oHS[j].description,180)+'</p>\n</li>';bMkt=bMkt&&(oHS[j].marketplaceId!="");}
hTabs+="</ul>\n</div>\n";hCont+="</ul>\n";break;}}
hOut='<div class="prod clrfix" id="prod-'+imgNum+'">\n';hOut+='<div class="l clrfix">';hOut+='<a class="close" href="#"><img width="160" src="'+$k(imgSel).find("img").attr("src")+'"></a>\n';hOut+='<p><a class="close" href="#">Back to Photo</a></p>'
hOut+=hTabs;hOut+='</div>\n';hOut+='<div class="r">';hOut+='<a href="#" class="close">Close</a>\n';hOut+=hCont;if(bMkt){hOut+=SNI.HGTV.Photogallery3.getProdYMAL();}
hOut+='</div>\n';$k("#pgallery3 .pglnkmask").before(hOut);bNew=true;$k(prodSel+" .r ul.cont li").each(function(i){$k(this).find("a").bind("click",{oHSthis:oHS[i]},function(e){SNI.HGTV.Omniture.HotSpotClick(e.data.oHSthis,"l");return true;});});$k(prodSel+" .l .tabs li a").click(function(){if($k(this).parent().hasClass("sel")){return false;};$k(prodSel).find(".l .tabs li").removeClass("sel");$k(prodSel).find(".r .cont li").removeClass("sel");$k(this).parent().addClass("sel");$k(prodSel).find(".r .cont li").eq($k(prodSel).find(".l .tabs li").index($k(prodSel).find(".l .tabs li.sel"))).addClass("sel");if($k(prodSel).find(".r .relProd").length>0){$k(prodSel).find(".r .relProd").replaceWith(SNI.HGTV.Photogallery3.getProdYMAL());}
return false;});$k(prodSel+" a.close").click(function(){var $prodCont=$k(this).parents(".prod");var aID=$prodCont.attr("id").split("-");var imgNum=parseInt(aID[1]);var imgSel="#pgallery3 #img-"+imgNum;$prodCont.hide();$k(imgSel).show();return false;});}
$k(prodSel+" .l .tabs li").removeClass("sel").eq(hsNum).addClass("sel");$k(prodSel+" .r .cont li").removeClass("sel").eq(hsNum).addClass("sel");$k(imgSel).hide();$k(prodSel).show();if(bNew){$k(prodSel+" .tab-wrap").height($k(prodSel).offset().top+$k(prodSel).innerHeight()-parseInt($k(prodSel).css("padding-bottom"))-$k(prodSel+" .tab-wrap").offset().top);}
return false;},getProdYMAL:function(){hRet='';if(typeof SNI.HGTV.ProductIdeas=="undefined"){return hRet;}
iSrcLen=SNI.HGTV.ProductIdeas.length;if(iSrcLen==0){return hRet;}
aSrc=new Array(iSrcLen);for(i=0;i<iSrcLen;++i){aSrc[i]=i;}
iDrawnLen=Math.min(iSrcLen,3);aDrawn=new Array(iDrawnLen);for(i=0;i<iDrawnLen;++i){j=Math.floor(Math.random()*aSrc.length);aDrawn[i]=aSrc[j];aSrc.splice(j,1);}
hRet='<div class="relProd clrfix">\n';hRet+='<a class="more" href="http://marketplace.hgtv.com/">More Products</a><h4>You Might Also Like:</h4>\n';hRet+='<ul class="clrfix">\n';itmClass='';for(i=0;i<iDrawnLen;++i){with(SNI.HGTV.ProductIdeas[aDrawn[i]]){if(i==iDrawnLen-1){itmClass=' class="last"';}
hRet+='<li'+itmClass+'><a target="_blank" href="'+pURL+'"><img width="92" height="69" src="'+iURL+'" alt="'+iAlt+'" /><span>'+pName+'</span></a></li>\n';}}
hRet+='</ul>\n';hRet+='</div>\n';return hRet;},insertProdsTab:function(){if(typeof SNI.HGTV.Photogallery3.Hotspots=="undefined"){return;}
hRet="<ul>\n<h4>Products From This Gallery</h4>";for(i=0;i<SNI.HGTV.Photogallery3.Hotspots.images.length;++i){oHS=SNI.HGTV.Photogallery3.Hotspots.images[i].hotspots;;for(j=0;j<oHS.length;++j){hRet+='<li><a target="_blank" href="'+oHS[j].url+'"><img src="'+oHS[j].imageURL+'" alt="'+oHS[j].name+'" />';hRet+='<p class="first"><a target="_blank" href="'+oHS[j].url+'">'+oHS[j].name+'</a></p></li>\n';}}
hRet+="</ul>\n";$k("#pgallery3 .endframe .tab.shop").append(hRet);$k("#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=$k("#pgallery3 .pglnks li").index($k("#pgallery3 .pglnks li.sel"));BYLINE="";if($k("#hg-w > .intro p.byline").length>0){BYLINE=$k("#hg-w > .intro p.byline").text();}
ITMPERPANEL=9;XBASE=$k("#pgallery3 .pglnks").position().left;ITMLAST=$k("#pgallery3 .pglnks li").length-1;ITMWIDTH=$k("#pgallery3 .pglnks li").innerWidth()+parseInt($k("#pgallery3 .pglnks li").css("margin-left"))+parseInt($k("#pgallery3 .pglnks li").css("margin-right"));newwidth=(ITMLAST+1)*ITMWIDTH;if(ITMLAST>ITMPERPANEL){++newwidth;}
$k("#pgallery3 .pglnks").css("width",newwidth);$k("#pgallery3 .pglnkmask .leftctrl a").click(function(){if($k(this).hasClass("dis")){return false;}
itmBaseCur=Math.round((XBASE-$k("#pgallery3 .pglnks").position().left)/ITMWIDTH);itmBaseNew=Math.max(0,itmBaseCur-ITMPERPANEL);if(itmBaseCur==ITMLAST-ITMPERPANEL){$k("#pgallery3 .pglnkmask .rightctrl a").removeClass("dis");}
$k("#pgallery3 .pglnks").animate({left:(XBASE-itmBaseNew*ITMWIDTH)+"px"},SNI.HGTV.ANIMATION_SPEED);if(itmBaseNew==0){$k("#pgallery3 .pglnkmask .leftctrl a").addClass("dis");}
return false;});$k("#pgallery3 .pglnkmask .rightctrl a").click(function(){if($k(this).hasClass("dis")){return false;}
itmBaseCur=Math.round((XBASE-$k("#pgallery3 .pglnks").position().left)/ITMWIDTH);itmBaseNew=Math.min(ITMLAST-ITMPERPANEL,itmBaseCur+ITMPERPANEL);if(itmBaseCur==0){$k("#pgallery3 .pglnkmask .leftctrl a").removeClass("dis");}
$k("#pgallery3 .pglnks").animate({left:(XBASE-itmBaseNew*ITMWIDTH)+"px"},SNI.HGTV.ANIMATION_SPEED);if(itmBaseNew==ITMLAST-ITMPERPANEL){$k("#pgallery3 .pglnkmask .rightctrl a").addClass("dis");}
return false;});$k("#pgallery3 .pglnks li a").bind("mouseenter",function(){if($k(this).parent().hasClass("sel")){return false;}
$k(this).parent().find(".tnframe").show();$k(this).parents(".pglnkmask").addClass("popactive");}).bind("mouseleave",function(){$k(this).parent().find(".tnframe").hide();$k(this).parents(".pglnkmask").removeClass("popactive");});$k("#pgallery3 .photonav .prevlnk a").click(function(){setImg((ITMCUR+ITMLAST)%(ITMLAST+1));return false;});$k("#pgallery3 .photonav .nextlnk a, #pgallery3 .largeImage a.bigimg").click(function(){setImg((ITMCUR+1)%(ITMLAST+1));return false;});$k("#pgallery3 .pglnks a").click(function(){if(!$k(this).parent().hasClass("sel")){$k(this).parent().find(".tnframe").hide();setImg($k(this).text()-1);}
return false;});$k("#pgallery3 .largeImage a.vtoggle.enl").click(function(){$myImgCont=$k(this).parents(".largeImage");$myImgCont.removeClass("vert-shr").addClass("vert-enl");if($myImgCont.find(" .hs.v").length==0){SNI.HGTV.Photogallery3.doHotSpots(parseInt($k(this).parents(".largeImage").attr("id").split("-")[1]))}
return false;});$k("#pgallery3 .largeImage a.vtoggle.shr").click(function(){$myImgCont=$k(this).parents(".largeImage");$myImgCont.removeClass("vert-enl").addClass("vert-shr");return false;});$k("#pgallery3 .largeImage .imgpanel a.open").click(function(){$myPanel=$k(this).parent();$myPanel.find("a.open").hide();$myPanel.animate({bottom:"0"});$myPanel.find("a.close").show();return false;});$k("#pgallery3 .largeImage .imgpanel a.close").click(function(){$myPanel=$k(this).parent();myCollapseHt=parseInt(Math.max($myPanel.find("h2").outerHeight(),$myPanel.find("a.cap-lnk.close").outerHeight())+parseInt($myPanel.css("padding-top"))-$myPanel.innerHeight())+"px";$myPanel.find("a.close").hide();$myPanel.animate({bottom:myCollapseHt});$myPanel.find("a.open").show();return false;});function setImg(itmSel){if(itmSel==ITMCUR){return;}
doDynOmni(itmSel);newImgCont="#pgallery3 #img-"+itmSel;if($k(newImgCont).length>0){$k("#pgallery3 .largeImage, #pgallery3 .prod").hide();$k(newImgCont).show();}else{$k("#pgallery3 .largeImage").eq(0).clone(true).attr("id","img-"+itmSel).insertAfter("#pgallery3 .largeImage:last");$k(newImgCont).hide();$k("#pgallery3 .largeImage.loading").show();$k(newImgCont).find(".hs").remove();$k(newImgCont+" img").remove();myImg=new Image();if($k(newImgCont+" a.bigimg").length>0){$k(myImg).appendTo(newImgCont+" a.bigimg");}else{$k(myImg).appendTo(newImgCont+" .imgwrap");}
$k(myImg).load(function(){$k("#pgallery3 .largeImage, #pgallery3 .prod").hide();$k(newImgCont).show();if(SNI.HGTV.Photogallery3.ImageData[itmSel].bhs){SNI.HGTV.Photogallery3.doHotSpots(itmSel);}
$k("#pgallery3 .largeImage.loading").hide();});setImgData(SNI.HGTV.Photogallery3.ImageData[itmSel],$k(newImgCont));}
fixByLine(itmSel);if(itmSel==0){$k("#pgallery3 .photonav .prevlnk").css("visibility","hidden");}
else if(ITMCUR==0){$k("#pgallery3 .photonav .prevlnk").css("visibility","visible");}
$k("#pgallery3 .photonav .pagen span").text(itmSel+1);topPrev="#pgallery3 .photonav .prevlnk";$k(topPrev+" img").remove();$pgItmPrev=$k("#pgallery3 .pglnks li").eq((itmSel+ITMLAST)%(ITMLAST+1));if($pgItmPrev.find("img").length>0){$pgItmPrev.find("img").clone().prependTo(topPrev+" a");}
$k(topPrev+" a").attr("href",$pgItmPrev.find("a").attr("href"));topNext="#pgallery3 .photonav .nextlnk";$k(topNext+" img").remove();$pgItmNext=$k("#pgallery3 .pglnks li").eq((itmSel+1)%(ITMLAST+1));if($pgItmNext.find("img").length>0){$pgItmNext.find("img").clone().prependTo(topNext+" a");}
$k(topNext+" a").attr("href",$pgItmNext.find("a").attr("href"));if($k(newImgCont+" a.bigimg").length>0){$k(newImgCont+" a.bigimg").attr("href",$pgItmNext.find("a").attr("href"));}
$k("#pgallery3 .pglnks li").eq(ITMCUR).removeClass("sel");$k("#pgallery3 .pglnks li").eq(itmSel).addClass("sel");ITMCUR=itmSel;SNI.HGTV.DynAds.refresh();if($k("#print-select a.this").length>0){plink=$k("#print-select a.this").attr("href");i=itmSel+1;if(i<10){i='0'+parseInt(itmSel+1);}
plink=$k("#print-select a.this").attr("href");plink=plink.replace(/(.*ARTICLE-PRINT-PHOTO-GALLERY-CURRENT).*?(,00.html)$/,"$1_"+i+"$2");$k("#print-select a.this").attr("href",plink);}
setPanel();SNI.Util.hitCount();return;}
function doDynOmni(i){++i;if(mdManager.getParameterString("oUrl")==""){mdManager.setParameter("oUrl",mdManager.getParameterString("Url"))}
mdManager.setParameter("Url",mdManager.getParameter("oUrl")+"?i="+parseInt(i));if(i<10){i='0'+parseInt(i);}
mdManager.setParameter("UniqueId",mdManager.getParameterString("UniqueId").replace(/(.*?)-([0-9]{1,2})$/,"$1-"+i));if(typeof s=="object"){s.t();}
return;}
function setImgData(imgData,$inImgCont){if(imgData.bvert){$inImgCont.removeClass("vert-enl").addClass("vert-shr");}else{$inImgCont.removeClass("vert-shr vert-enl");}
$inImgCont.find("img").attr("src",imgData.iurl).attr("alt",imgData.ialt);$myPanel=$inImgCont.find(".imgpanel");$myPanel.find("h2").html(imgData.ititle);$myPanel.find("cite").html(imgData.icap);if((imgData.rurl!="")&&(imgData.rtxt!="")){$myPanel.find(".lgbtn a").attr("href",imgData.rurl);$myPanel.find(".lgbtn .lgbtn-text").text(imgData.rtxt);$myPanel.find(".lgbtn").removeClass("hide");}else{$myPanel.find(".lgbtn").addClass("hide");}
if((imgData.ititle=="")&&(imgData.icap=="")&&(imgData.rurl=="")&&(imgData.rtxt=="")){$myPanel.addClass("hide");}else{$myPanel.find("a.open").hide();$myPanel.find("a.close").show();$myPanel.css({bottom:"0"});$myPanel.removeClass("hide");}
return;}
function fixByLine(itmSel){iCreator="";if(itmSel<SNI.HGTV.Photogallery3.ImageData.length){iCreator=SNI.HGTV.Photogallery3.ImageData[itmSel].creator;}
if(iCreator!=""){if($k("#hg-w > .intro p.byline").length==0){$k("#hg-w > .intro").append("<p class=\"byline\"></p>");}
$k("#hg-w > .intro p.byline").addClass("pic").text("By "+iCreator);}else if($k("#hg-w > .intro p.byline.pic").length>0){if(BYLINE!=""){$k("#hg-w > .intro p.byline").removeClass("pic").text(BYLINE);}else{$k("#hg-w > .intro p.byline").remove();}}
return;}
$k("#pgallery3 .endframe .nav a").click(function(){$k("#pgallery3 .endframe .nav li.sel").removeClass("sel");$k(".endframe .tab").hide();$k(".endframe .tab."+$k(this).parent().parent().attr("class")).show();$k(this).parent().parent().addClass("sel");return false;});$k("#pgallery3 .endframe div.share p#copylink a").click(function(){$k("#embed_code").select();return false;});$k("#pgallery3 .endframe .share .digg a").click(function(){window.open('http://digg.com/submit?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(mdManager.getParameter('Title')));return false;});$k("#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;});$k("#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;});$k("#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;$k.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){$k("#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-$k("#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));$k("#pgallery3 .pglnks").css("left",(XBASE-itmBaseNew*ITMWIDTH)+"px");if(itmBaseCur==0){$k("#pgallery3 .pglnkmask .leftctrl a").removeClass("dis");}
if(itmBaseNew==0){$k("#pgallery3 .pglnkmask .leftctrl a").addClass("dis");}
if(itmBaseCur==ITMLAST-ITMPERPANEL){$k("#pgallery3 .pglnkmask .rightctrl a").removeClass("dis");}
if(itmBaseNew==ITMLAST-ITMPERPANEL){$k("#pgallery3 .pglnkmask .rightctrl a").addClass("dis");}}}
function fixEndFrame(){if($k("#pgallery3 .endframe .tab.shop img").length==0){$k("#pgallery3 .endframe .nav .shop").hide();}
if($k("#pgallery3 .endframe .tab.ymal img").length==0){$k("#pgallery3 .endframe .nav .ymal").hide();$k("#pgallery3 .endframe .nav .email").addClass("sel");$k("#pgallery3 .endframe .tab.email").show();}
if($k("#pgallery3 .pglnks li:last img").length==0){$k("#pgallery3 .pglnks li:last .tnframe").append(EF_IMG_HTML);if((ITMCUR==ITMLAST)&&($k("#pgallery3 .photonav .nextlnk img").length==0)){$k("#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);}
$k("#pgallery3 .photowrap").append('<div class="largeImage loading"><span></span><p>loading</p></div>');SNI.HGTV.DynAds.init();var itmSel=ITMCUR;if($k.query.has('i')){itmSel=parseInt($k.query.get('i'));if(isNaN(itmSel)||(itmSel<1)||(itmSel>ITMLAST+1)){itmSel=ITMCUR;}else{--itmSel;}}
if(itmSel!=ITMCUR){setImg(itmSel);}
setPanel();fixEndFrame();return;}};SNI.HGTV.DynAds={descr:{active:true,refreshRate:3,interstitial:false},iparm:{iURL:"",iFmt:"",iHREF:"",iHeight:"",iWidth:"",iTrackURL:"",bURL:""},impressionCt:1,init:function(){myJSON=getDartEnterpriseUrl("PHOTO_DESCRIPTOR",1);myJSON+="&params.styles=photoGallery&callback=?";$k.getJSON(myJSON,SNI.HGTV.DynAds.cback_descrJSON);return;},cback_descrJSON:function(oJSON){if(typeof oJSON!="object"){return false;}
if(oJSON.photo_descriptor==undefined){return false;}
oJSON=oJSON.photo_descriptor;if(oJSON.active==undefined){return false;}
if(oJSON.refreshRate==undefined){return false;}
if(oJSON.active!="true"){return false;}
tmp=parseInt(oJSON.refreshRate);if(isNaN(tmp)){return false;}
if(tmp<1||tmp>100){return false;}
SNI.HGTV.DynAds.descr.active=true;SNI.HGTV.DynAds.descr.refreshRate=tmp;if(oJSON.interstitial==undefined){return false;}
if(oJSON.interstitial=="true"){SNI.HGTV.DynAds.descr.interstitial=true;}
return true;},refresh:function(){if(!this.descr.active){return;}
$k("#pgallery3 .interwrap").remove();this.impressionCt++;if(this.impressionCt==this.descr.refreshRate){this.impressionCt=0;if(this.descr.interstitial){myJSON=getDartEnterpriseUrl("PHOTO_INTERSTITIAL",1);myJSON+="&params.styles=photoGallery&callback=?";$k.getJSON(myJSON,SNI.HGTV.DynAds.cback_interJSON);return;}else{setDartEnterpriseBanner("BIGBOX",getDartEnterpriseUrl("BIGBOX",5));}}
return;},cback_interJSON:function(oJSON){$k.each(SNI.HGTV.DynAds.iparm,function(key,val){SNI.HGTV.DynAds.iparm[key]="";});if(typeof oJSON!="object"){return false;}
if(typeof oJSON.scrippsads!="object"){return false;}
if(typeof oJSON.scrippsads.ad!="object"){return false;}
for(i=0;i<oJSON.scrippsads.ad.length;++i){if(typeof oJSON.scrippsads.ad[i].position!="object"){return false;}
with(oJSON.scrippsads.ad[i].position){with(SNI.HGTV.DynAds){if((iparm.iURL=="")&&(id=="interstitial")){iparm.iURL=media.src;iparm.iFmt=media.format;iparm.iHREF=media.href;iparm.iHeight=media.height;iparm.iWidth=media.width;if(typeof media.tracking.audit=="object"){iparm.iTrackURL=media.tracking.audit.src;}}
if((iparm.bURL=="")&&(id=="300syncBanner")){iparm.bURL=media.src;}}}}
with(SNI.HGTV.DynAds){if(iparm.iURL==""||iparm.iFmt==""||iparm.bURL==""){return false;}}
SNI.HGTV.DynAds.gen_interstitial();return true;},gen_interstitial:function(){hRet="";with(SNI.HGTV.DynAds){hRet+='<div class="interwrap">';hRet+='<a href="#" class="close"><span></span>Next Photo</a>';hRet+='<h6>Advertisement</h6>';if(iparm.iFmt.toLowerCase()=="swf"){hRet+='<div id="interad"></div>';}else{if(iHREF!=""){hRet+='<a href="'+iparm.iHREF+'">';}
hRet+='<img src ="'+iparm.iURL+'" />';if(iHREF!=""){hRet+='</a>';}}
hRet+='<iframe class="tracker" width="0" height="0" frameborder="0"></iframe>';hRet+='</div>';$myImgCont=$k("#pgallery3 #img-"+ITMCUR);if($myImgCont.hasClass("vert-enl")){$myImgCont.removeClass("vert-enl").addClass("vert-shr");}
$k("#pgallery3 .photowrap").append(hRet);$k("#pgallery3 .interwrap .close").click(function(){$k("#pgallery3 .interwrap").remove();return false;});if(iparm.iFmt.toLowerCase()=="swf"){swfobject.embedSWF(iparm.iURL,"interad",iparm.iWidth,iparm.iHeight,"9","http://common.scrippsnetworks.com/common/flash-express-install/expressInstall.swf","",{wmode:"opaque",allowScriptAccess:"always",quality:"high"});}
setDartEnterpriseBanner("BIGBOX",iparm.bURL);$k("#pgallery3 .interwrap .tracker").attr("src",iparm.iTrackURL);}
return;}};
SNI.HGTV.GetInspired={colorPicker:function(colorList,typeList,hrefList){var swfUrl='http://web.hgtv.com/webhgtv/hg20/swf/color-picker/color-picker.swf';var elementId='color-picker';var width=160;var height=160;var flashvars={colorList:colorList,typeList:typeList,hrefList:hrefList};var params={wmode:"transparent",allowScriptAccess:"always",quality:"high"};swfobject.embedSWF(swfUrl,elementId,width,height,"9","http://common.scrippsnetworks.com/common/flash-express-install/expressInstall.swf",flashvars,params,{});}};SNI.HGTV.ZoneFinder={init:function(){$k("#zone-finder form").submit(function(){zip=$k.trim($k("#zone-zip").val());if(zip==''){return false;}
var url="/cf/com/hgtv/zonefinder/ZipCodeSearch.cfc?method=findZone&zipCode="+zip;try{$k.ajax({dataType:"text",url:url,success:function(zone){$k('#zone-finder .message').hide();zone=$k.trim(zone);if(zone=='-1'||zone=='-2'||zone==''){$k('#zone-finder .error').show();}else{$k('#zone-finder form').hide();success=$k('#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($k.browser.msie&&parseInt($k.browser.version)==6){$k(el).find('li').hover(function(){$k(this).addClass('hover');},function(){$k(this).removeClass('hover');});}};$k.extend($k.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=$k(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=$k.extend($el[bUseOffset===true?"offset":"position"](),{width:$el.outerWidth(),height:$el.outerHeight(),marginLeft:parseInt($k.curCSS($el[0],"marginLeft",true),10)||0,marginRight:parseInt($k.curCSS($el[0],"marginRight",true),10)||0,marginTop:parseInt($k.curCSS($el[0],"marginTop",true),10)||0,marginBottom:parseInt($k.curCSS($el[0],"marginBottom",true),10)||0});if(pos.marginTop<0)pos.top+=pos.marginTop;if(pos.marginLeft<0)pos.left+=pos.marginLeft;pos["bottom"]=pos.top+pos.height;pos["right"]=pos.left+pos.width;if(bHidden)$el.hide().css("visibility","visible");return pos;},alphaCompare:function(a,b){a=a.toLowerCase();b=b.toLowerCase();return a<b?-1:a>b?1:0;}};SNI.Util.hitCount=function(){var myURL;if(location.host=="www.hgtv.com"){myURL="http://img.hgtv.com/webhgtv/hg20/html/fixHits.html";}else{myURL="http://frontend.scrippsnetworks.com/hgtv/fixHits.html";}
if($k("#hitCounter").length>0){$k("#hitCounter").remove();}
$k("head").append('<iframe id="hitCounter" src="'+myURL+'" width="0" height="0" frameborder="0" style="height:0; width:0; display:none;"></iframe>')
return;};SNI.Util.Flyout={create:function(settings){var flyout={draw_list:function(items){var flyout=this;items=items||flyout.select.children('option').not('.excluded');var flyout_list=jQuery('<ul class="flyout-list"></ul>');items.each(function(i){var $this=jQuery(this);var list_item=jQuery('<li><span>'+jQuery.trim($this.text())+'</span></li>');if($this.attr('selected')){list_item.addClass('selected');}
if($this.attr('disabled')){list_item.addClass('disabled');}
list_item.not('.disabled').click(function(event){flyout.anchor.children('.'+flyout.settings.trigger_class[0]).children('span').text(jQuery.trim($this.text()))
$this.siblings().removeAttr('selected');$this.attr('selected','selected');flyout.hide();flyout.select.change();});flyout_list.append(list_item);});return flyout_list;},show:function(speed){var flyout=this;flyout.element.fadeIn(speed||100);flyout.anchor.addClass('flyout-is-open');},hide:function(speed){var flyout=this;flyout.element.fadeOut(speed||100);flyout.anchor.removeClass('flyout-is-open');},create_flyout:function(){var flyout=this;var html=jQuery('<div></div>');var id=flyout.flyout_id();var settings=flyout.settings;jQuery.each(settings.wrapper_classes,function(){html.addClass(this.toString());});if(id){html.attr('id',id);}
var head=flyout._flyout_hd();head.children('.close').click(function(e){flyout.hide();});html.append(head);html.append(flyout._flyout_bd());html.append(flyout._flyout_ft());return html;},_flyout_hd:function(){var html=jQuery('<div></div>')
jQuery.each(settings.header_wrap,function(){html.addClass(this.toString());});if(settings.close_button){html.prepend('<span class="close">Close</span>')}
if(settings.title){html.prepend('<'+settings.title_element+' class="'+settings.title_class+'">'+settings.title+'</'+settings.title_element+'>');}
return html;},_flyout_bd:function(){var html=jQuery('<div></div>')
jQuery.each(settings.body_wrap,function(){html.addClass(this.toString());});html.append(flyout.list);return html;},_flyout_ft:function(){var html=jQuery('<div></div>')
jQuery.each(settings.footer_wrap,function(){html.addClass(this.toString());});return html;},flyout_id:function(){var flyout=this;var id;if(flyout.select&&flyout.select.attr('id')){id="flyout-for-"+flyout.select.attr('id');}
return id;},build_options:function(settings){settings.title_element=settings.title_element||'h4';settings.title_class=settings.title_class||'flyout-title';settings.close_button=settings.close_button?true:false;settings.wrapper_classes=settings.wrapper_classes||['flyout'];settings.header_wrap=settings.header_wrap||['flyout-hd'];settings.body_wrap=settings.body_wrap||['flyout-bd'];settings.footer_wrap=settings.footer_wrap||['flyout-ft'];this.settings=settings;return settings;}};flyout.build_options(settings);return flyout;},createFor:function(select_element,settings){settings.wrapper_classes=['flyout','flyout-med','flyout-for-select']
settings.attach_to=settings.attach_to||select_element.parent();settings.anchor_class=settings.anchor_class||['select-flyout'];settings.trigger_class=settings.trigger_class||['select-flyout-selector'];settings.flyout_css=(settings.flyout_css===false)?false:true;var flyout=this.create(settings);flyout.anchor=jQuery('<div><div><span>'+jQuery.trim(select_element.children(':selected').text())+'</span></div></div>');flyout.select=select_element;flyout.list=flyout.draw_list(flyout.sele);flyout.element=flyout.create_flyout();if(flyout.select.attr('id')){flyout.anchor.attr('id',"selector-for-"+flyout.select.attr('id'));}
jQuery.each(settings.anchor_class,function(){flyout.anchor.addClass(this.toString());});jQuery.each(settings.trigger_class,function(){flyout.anchor.children('div').addClass(this.toString());});flyout.select.change(function(event){flyout.anchor.children('span').html(jQuery.trim(flyout.select.children(':selected').text()));flyout.select.children('option').not('.excluded').each(function(i){if(jQuery(this).is(':selected')){var selected_list_item=flyout.element.find('.flyout-list > li').eq(i);if(!selected_list_item.hasClass('selected')){selected_list_item.siblings().removeClass('selected');selected_list_item.addClass('selected');}
return false;}});});if(settings.flyout_css===true){flyout.element.css({'position':'absolute','top':0,'left':0,'display':'none'});}
flyout.anchor.append(flyout.element);var body_click=function(event){var fly=flyout;var element=$k(event.target);if(fly.element.is(':visible')){if(element.parents().is('#'+fly.anchor.attr('id'))){event.stopPropagation();}else{fly.hide();jQuery('body').unbind('click',body_click);}}else{event.stopPropagation();}};flyout.anchor.children('.'+settings.trigger_class[0]).bind('click focus',function(e){flyout.show();jQuery('body').bind('click',body_click);});select_element.hide();flyout.settings.attach_to.append(flyout.anchor);return flyout;}};
if($k.browser.msie){$k(function(){$k('button.button').mousedown(function(){$k(this).addClass('active');}).mouseup(function(){$k(this).removeClass('active');});$k('a.button, .button-nav a, a.button-sm, .button-nav-sm a').mouseup(function(){$k(this).blur();});});}
SNI.HGTV.BrowserCheck={init:function(){if($k.browser.msie&&parseInt($k.browser.version)<7&&!window.XMLHttpRequest&&($k("body#print").length==0)){var bc=this;if(SNI.Util.Cookie.get('upgradeReminderSet')==null){var html='<div id="ie6-msg" class="clrfix"><a href="#" class="close">Close</a><div id="ie6-txt"><h3>We Noticed You Are Using Internet Explorer 6.</h3><p>We detected your browser is out of date. For the best possible experience, upgrade to the latest version of <a href="http://www.browserforthebetter.com/download.html" target="_blank">Internet Explorer</a>, or try one of these fine browsers: <a href="http://www.firefox.com" target="_blank">Firefox</a> or <a href="http://www.apple.com/safari/download/" target="_blank">Safari</a>.</p>';if(SNI.Util.Cookie.get('upgradePreviouslyReminded')=='1'){html+='<p class="remind"><a href="#" class="yes">Remind Me in 30 Days</a> or <a href="#" class="no">Don\'t Remind Me</a></p>';}
html+='</div><ul><li><a id="icn-ie" href="http://www.browserforthebetter.com/download.html" target="_blank">Get Internet Explorer</a></li><li><a id="icn-ff" href="http://www.firefox.com" target="_blank">Get Firefox</a></li><li><a id="icn-sf" href="http://www.apple.com/safari/download/" target="_blank">Get Safari</a></li></ul></div>';html=$k(html);$k('a.close, .remind a.yes',html).click(function(){bc.setReminder(30);$k(html).slideUp();SNI.HGTV.Omniture.ClickTrackSingle(this,"UpgradeIE6 ","HGTV");return false;});$k('.remind a.no',html).click(function(){bc.setReminder(365);$k(html).slideUp();SNI.HGTV.Omniture.ClickTrackSingle(this,"UpgradeIE6 ","HGTV");return false;});if($k('#hg-bd').length){$k('#hg-bd').prepend(html);}
else{$k('#site-wrapper').prepend(html);}
html.show();SNI.HGTV.Omniture.ClickTrackSingle("#ie6-msg #ie6-txt","UpgradeIE6 ","Food");SNI.HGTV.Omniture.ClickTrackSingle("#ie6-msg ul li","UpgradeIE6 ","Food");SNI.HGTV.Omniture.ClickTrackSingle("#ie6-msg .remind","UpgradeIE6 ","Food");}}},setReminder:function(days){SNI.Util.Cookie.set('upgradeReminderSet','1',days);SNI.Util.Cookie.set('upgradePreviouslyReminded','1',365*2);}};$k(document).ready(function(){SNI.HGTV.BrowserCheck.init();});
if(typeof(SNI.HGTV.Player)=='undefined'){SNI.HGTV.Player={};}
SNI.HGTV.Player.Configs={FullSize:{enableSyncAdFix:1,dimensions:{width:'576',height:'688'},flashvars:{config:SNI.Config.snapConfigs+"/snap-style-playlist-w-title.xml,"+SNI.Config.snapConfigs+"/snap-config-std.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent",bgcolor:"#ffffff"}},FullSizeNoPlaylist:{enableSyncAdFix:1,dimensions:{width:'576',height:'460'},flashvars:{showCarousel:"false",config:SNI.Config.snapConfigs+"/snap-style.xml,"+SNI.Config.snapConfigs+"/snap-config-std.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},RightRail:{enableSyncAdFix:0,dimensions:{width:'320',height:'360'},flashvars:{config:SNI.Config.snapConfigs+"/snap-style-rr.xml,"+SNI.Config.snapConfigs+"/snap-config-rr.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},Blog:{enableSyncAdFix:1,dimensions:{width:'320',height:'263'},flashvars:{config:SNI.Config.snapConfigs+"/snap-style-rr.xml,"+SNI.Config.snapConfigs+"/snap-config-std-no-autoplay.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}},Lead:{enableSyncAdFix:1,dimensions:{width:'400',height:'300'},flashvars:{autoPlay:"false",showPlaylistTitle:"false",showCarousel:"false",config:SNI.Config.snapConfigs+"/snap-style-v4.xml,"+SNI.Config.snapConfigs+"/snap-config-std.xml"},params:{menu:"false",scale:"noscale",allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent"}}};SNI.Player.UserInterfaceConfigs=SNI.Util.mergeObjects(SNI.Player.UserInterfaceConfigs,SNI.HGTV.Player.Configs);SNI.HGTV.Player.FullSize=SNI.Player.FullSize;SNI.HGTV.Player.Big=SNI.HGTV.Player.FullSize;SNI.HGTV.Player.VideoLibrary=SNI.HGTV.Player.FullSize;SNI.HGTV.Player.FullSizeNoPlaylist=SNI.Player.FullSizeNoPlaylist;SNI.HGTV.Player.VideoAsset=SNI.HGTV.Player.FullSizeNoPlaylist;SNI.HGTV.Player.RightRail=SNI.Player.RightRail;SNI.HGTV.Player.RightRailMyHGTV=function(divId,channelId,videoId,ui_config){var buildChannelFeed=function(chId){return'http://www.hgtv.com/hgtv/channel/xml/0,,'+chId+',00.xml';};return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.HGTV.Player.Configs.RightRail,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_build_playlist_url":buildChannelFeed});};SNI.HGTV.Player.Blog=function(divId,channelId,videoId,ui_config){var buildChannelFeed=function(chId){return'http://www.hgtv.com/hgtv/channel/xml/0,,'+chId+',00.xml';};return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.HGTV.Player.Configs.Blog,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_build_playlist_url":buildChannelFeed});};SNI.HGTV.Player.BigBlog=function(divId,channelId,videoId,ui_config){var buildChannelFeed=function(chId){return'http://www.hgtv.com/hgtv/channel/xml/0,,'+chId+',00.xml';};var bigBlogConfig=SNI.Util.mergeObjects(SNI.HGTV.Player.Configs.FullSizeNoPlaylist,{flashvars:{config:SNI.Config.snapConfigs+"/snap-style.xml,"+SNI.Config.snapConfigs+"/snap-config-std-no-autoplay.xml"}},true);return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(bigBlogConfig,ui_config,true),"channel_id":channelId,"video_id":videoId,"fcn_build_playlist_url":buildChannelFeed});};SNI.HGTV.Player.Lead=function(divId,channelId,videoId,ui_config){return new SNI.Player.SNAP({"container_div_id":divId,"ui_config":SNI.Util.mergeObjects(SNI.HGTV.Player.Configs.Lead,ui_config,true),"channel_id":channelId,"video_id":videoId});};
SNI.HGTV.EpisodeFinder={init:function(){$k('#episode-finder .acco-round').dpl('accordion');$k("#episode-finder .button-nav").dpl('tabs');$k("#episode-finder .date-box input").attr('readonly','readonly');$k("#episode-finder-w .date-box input").attr('readonly','readonly');SNI.Util.inputField('#ef-topic','Topic');$k(document).ready(function(){$k("#episode-finder .date").attachDatepicker();$k("#episode-finder-w .date").attachDatepicker();});}};
function HgtvAd(adtype,adsize,pos,keywords){if(pos<0||pos==undefined){pos=1;}
if(keywords==undefined){keywords="";}
var ad=new DartAd();ad.setUrl("http://"+SNI.Ads._adServerHostname+"/js.ng/");if(adtype=='BIGBOX'&&pos==5){ad.addParameter("adtype",'BIGBOX');}else{ad.addParameter("adtype",adtype);}
if(adtype=='LEADERBOARD'){ad.addParameter("Params.styles","SNI_LEADERBOARD");}
ad.addParameter("adsize",adsize);ad.addParameter("PagePos",pos);ad.useFeature("tile");if(keywords!=""){var words=keywords.split(" ");for(i=0;i<words.length;i++){ad.addParameter("keyword",words[i]);}}
switch(adtype){default:writeAd(ad);break;}}
function writeAd(ad){if(typeof adRestrictionManager!='undefined'){ad.useIframe=adRestrictionManager.isIframe(ad,mdManager);if(adRestrictionManager.isActive(ad,mdManager)!=false){adManager.createAd(ad);}}else{adManager.createAd(ad);}}
function LeaderboardAd(pos){if(pos<0||pos==undefined||pos==''){pos=1;}
HgtvAd('LEADERBOARD','468x60',pos);}
function PushdownAd(pos){if(pos<0||pos==undefined){pos=1;}
HgtvAd('PUSHDOWN','',pos);}
function GoogleBigboxAd(pos){if(pos<0||pos==undefined){pos=1;}
HgtvAd('GOOGLE_BIGBOX','',pos);}
function GoogleLeaderboardAd(pos){if(pos<0||pos==undefined){pos=1;}
HgtvAd('GOOGLE_LEADERBOARD','',pos);}
function BigboxAd(pos,keywords){if(typeof(mdManager)!=undefined&&mdManager.getParameterString("VideoPlayer")==""){if(pos<0||pos==undefined){pos=1;}
HgtvAd('BIGBOX','',pos,keywords);}}
function BigboxAd300x150(pos,keywords){if(pos<0||pos==undefined){pos=1;}
HgtvAd('SPONSORSHIP_CONTENT','',pos,keywords);}
function SuperstitialAd(pos){if(pos<0||pos==undefined){pos=1;}
HgtvAd('SUPERSTITIAL','',pos);}
function VideoPlayerAd(adtype,adsize,pos){var ad=new AdUrl();ad.setUrl("http://"+SNI.Ads._adServerHostname+"/html.ng/");if(adtype!=''){ad.addParameter("adtype",adtype);}
if(adsize!=''){ad.addParameter("adsize",adsize);}
if(!pos||pos==''){pos=1;}
ad.addParameter("PagePos",pos);ad.useFeature("tile");writeAd(ad);return ad.buildExpandedUrl();}
function getDartEnterpriseUrl(adtype,pos){adtype=adtype.toUpperCase();var strUrl=VideoPlayerAd(adtype,'',pos);return strUrl;}
function setDartEnterpriseBanner(adType,sync_banner){if(adType=='LEADERBOARD'){if($k("#leaderboard").length>0){boxW=728;boxH=90;$k("#leaderboard").html("<iframe src='"+sync_banner+"\' width=\'"+boxW+"\' height=\'"+boxH+"\'"+"frameborder='0' scrolling='no' marginheight='0' marginwidth='0'></iframe>");}}else{if($k("#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;}
$k("#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($k("#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;}
$k("#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);$k(document).ready(function(){if($k(".sponsor-multi-logo a img").length>0){if($k(".sponsor-multi-logo").parent().hasClass("west-spons")){$k(".sponsor-multi-logo").prepend("<em>Sponsored by:</em>");$k(".west-spons").css("display","block");}else{$k(".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(){$k(".status-message .close a").each(function(e){$k(this).bind("click",function(){var obj=$k(this).parents(".status-message");obj.css("height",obj.height());obj.find(".wrap").fadeOut("slow",function(){obj.slideUp("slow");});return false;});});}};
if(typeof(SNI.HGTV.Toolbar)=="undefined"){SNI.HGTV.Toolbar={};}
SNI.HGTV.Toolbar={toolbar:"#toolbar",toolbarElement:$k(SNI.HGTV.Toolbar.toolbar),revealModule:function(trigger,module){$k(SNI.HGTV.Toolbar.toolbar).find(trigger).click(function(){module.fadeIn(SNI.HGTV.ANIMATION_SPEED);$k(this).addClass("active");return false;})},closeModule:function(trigger,module,speed){if(speed==null){speed=SNI.HGTV.ANIMATION_SPEED;};module.fadeOut(speed);if($k(trigger).hasClass("active")){$k(trigger).removeClass("active");};},fontResize:function(element){$k(element).find("li").click(function(){var defaultSize="100%";$k(element).find("li").removeClass("active");$k(this).addClass("active");if($k(this).hasClass("med")){$k("#hg-art-we").css("font-size",defaultSize);}else if($k(this).hasClass("sm")){$k("#hg-art-we").css("font-size","85%");}else{$k("#hg-art-we").css("font-size","116%");}});},printPage:function(){var module=$k("#print-select");SNI.HGTV.Toolbar.revealModule(".print",module);$k("em.close").click(function(){SNI.HGTV.Toolbar.closeModule(".print",module);});$k(".email").click(function(){SNI.HGTV.Toolbar.closeModule(".print",module);});},emailAFriend:function(inMod){if(inMod==undefined){SNI.HGTV.Toolbar.emailAFriend1($k("#email-a-friend"));}else{SNI.HGTV.Toolbar.emailAFriend2($k(inMod));}},emailAFriend2:function(module){var form=module.find("form");initMessage=form.find("textarea").val();clear_form=function(){form.find("input:text").each(function(){$k(this).val("");});form.find("textarea").val(initMessage);form.find("label").removeClass("error");module.find(".message").removeClass("alert").text("All fields are required.");return;};clear_form();$k("#pgallery3 .email form .form-submit a").click(function(){clear_form();return false;});if(mdManager.getPageTitle){var page_title=mdManager.getPageTitle();success_message=module.find('.success strong');success_message.text(page_title);}else{success_message.text('this page');}
form.validate({errorLabelContainer:false,rules:{from_name:{required:true},from_email:{required:true,email:true},to_emails:{required:true,multipleEmails:true}},messages:{from_name:{required:"Whoops. Please enter your name."},from_email:{required:"Whoops. Please enter your e-mail address.",email:"Whoops. Please check the format of your e-mail address and re-enter (i.e. joe@hgtv.com)."},to_emails:{required:"Whoops. Please enter at least one friend e-mail address.",multipleEmails:"Whoops. One or more of your friend e-mail addresses is not formatted correctly. Please check the format and re-enter (i.e. joe@hgtv.com)."}},showErrors:function(errorMap,errorList){if(errorList.length){module.find('.message').addClass('alert').html(errorList[0].message);element=$k(errorList[0].element);if(element.hasClass('isemail')){element.select();}
this.errorList=[this.errorList[0]];this.defaultShowErrors();}},submitHandler:function(){var txtarea=form.find('textarea[name="body"]');var txtarea_comment=txtarea.val();var page_title=mdManager.getPageTitle();var msg_body=form.find('input[name="from_name"]').val()+" thought you would be interested in this link to \""+page_title+"\" on the  HGTV Web site:\n\n";msg_body+="http://"+location.hostname;msg_body+=mdManager.getParameter("Url")+"\n\n";if(txtarea.val()!=""){msg_body+="Comments from "+form.find('input[name="from_name"]').val()+":\n";msg_body+=txtarea.val();};module.find('.message').hide().removeClass("alert");form.find('fieldset').hide();form.find("label").removeClass("error");form.find('button').addClass('disabled').attr('disabled','disabled');form.find('.cancel').addClass("disabled");form.find('.loading').show();txtarea.val(msg_body);var form_data="";form.find(":input:not('button')").each(function(){var input_name=$k(this).attr("name");var input_value=$k(this).val();form_data+=input_name+"="+input_value+"&";});$k.ajax({type:"POST",url:form.attr("action"),data:form_data.slice(0,-1),cache:false,success:function(data){form.find('.loading').hide();var response=$k(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");$k("#friends-email").select();module.find('.message').addClass("alert").text("Whoops. The e-mail could not be sent to one or more of your friends. Please check the format of their e-mail address and re-enter (i.e. joe@HGTV.com).").show();}else{var success=module.find('.success');var page_title="this page"
form.hide();success.show();var timeout=setTimeout(function(){success.hide();txtarea.val(txtarea_comment);module.find('.message').text("All fields are required.").show();form.find("input:text").each(function(){$k(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();form.find('fieldset').show();},3000);$k(".close").click(function(){clearTimeout(timeout);close_module();module.hide();success.hide();txtarea.val(txtarea_comment);module.find('.message').text("All fields are required.").show();form.find("input:text").each(function(){$k(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();});}},error:function(){form.find('.loading').hide();txtarea.val(txtarea_comment);form.find('fieldset').show();form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");module.find('.message').addClass("alert").text("Whoops. We encountered an error when trying to e-mail this page. Please wait a few moments and try again.").show();}});}});},emailAFriend1:function(module){var form=module.find("form");var null_value="";var initMessage=form.find("textarea").val();$k(".print").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);});SNI.HGTV.Toolbar.revealModule(".email",module);$k(".close").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);});$k(".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=$k(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=$k(this).attr("name");var input_value=$k(this).val();form_data+=input_name+"="+input_value+"&";});$k.ajax({type:"POST",url:form.attr("action"),data:form_data.slice(0,-1),cache:false,success:function(data){form.find('.loading').hide();var response=$k(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");$k("#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(){$k(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();},3000);$k(".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(){$k(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();});}},error:function(){form.find('.loading').hide();txtarea.val(txtarea_comment);form.find('fieldset').show();form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");module.find('.message').addClass("alert").text("Whoops. We encountered an error when trying to e-mail this page. Please wait a few moments and try again.").show();}});}});},emailAFriendCaptcha:function(module){var module=$k("#email-a-friend");var form=module.find("form");var null_value="";var initMessage=form.find("textarea").val();form.submit(function(e){e.preventDefault();return false;});function newCaptchaImg(){addtime=new Date().getTime();};$k(".email").click(function(){form.find('#captcha-img').html('<img src="/app/emailservice2/captchaImg" height="30" width="93" />');});$k("#captcha-request a, .email").click(function(){newCaptchaImg();form.find('#captcha-img').html('<img src="/app/emailservice2/captchaImg?generateNew=true&t='+addtime+'" height="30" width="93" />');return false;});$k(".print").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);});SNI.HGTV.Toolbar.revealModule(".email",module);$k(".close").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);});$k(".form-submit a").click(function(){SNI.HGTV.Toolbar.closeModule(".email",module);return false;});if(mdManager.getPageTitle){var page_title=mdManager.getPageTitle();var success_message=module.find('.success strong');success_message.text(page_title);}else{success_message.text('this page');};var captcha_msg="Whoops. Please enter the characters in the image to verify you are human."
form.validate({errorLabelContainer:form.find("p.message"),rules:{from_name:{required:true},from_email:{required:true,email:true},to_emails:{required:true,multipleEmails:true},captcha_answer:{required:true}},messages:{from_name:{required:"Whoops. Please enter your name."},from_email:{required:"Whoops. Please enter your e-mail address.",email:"Whoops. Please check the format of your e-mail address and re-enter (i.e. joe@hgtv.com)."},to_emails:{required:"Whoops. Please enter at least one friend e-mail address.",multipleEmails:"Whoops. One or more of your friend e-mail addresses is not formatted correctly. Please check the format and re-enter (i.e. joe@hgtv.com)."},captcha_answer:{required:captcha_msg}},showErrors:function(errorMap,errorList){if(errorList.length){module.find('.message').addClass('alert').html(errorList[0].message);element=$k(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=$k(this).attr("name");var input_value=$k(this).val();form_data+=input_name+"="+input_value+"&";});$k.ajax({type:"POST",url:form.attr("action"),dataType:'json',data:form_data.slice(0,-1),cache:false,success:function(data){form.find('.loading').hide();var response=$k(data);var emailSent=data.emailSent;var captchaCorrect=data.captchaAnswerValid;if(!emailSent){txtarea.val(txtarea_comment);form.find('fieldset').show();form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");if(!captchaCorrect){form.find("label[for='captcha_answer']").addClass("error");$k("#captcha_answer").select();module.find('.message').addClass("alert").text(captcha_msg).show();}else{form.find("label[for='friends-email']").addClass("error");$k("#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(){$k(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();},3000);$k(".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(){$k(this).val("");});form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");form.find('fieldset').show();form.show();});}},error:function(){form.find('.loading').hide();txtarea.val(txtarea_comment);form.find('fieldset').show();form.find('button').removeClass('disabled').removeAttr('disabled');form.find('.cancel').removeClass("disabled");module.find('.message').addClass("alert").text("Whoops. We encountered an error when trying to e-mail this page. Please wait a few moments and try again.").show();}});}});},shareThis:function(){var share_url=SNI.Util.Url.setParameter(document.location.href,"soc","share");var page_title=jQuery("<div>"+mdManager.getPageTitle()+"</div>").text();var twitter_shared_object=SHARETHIS.addEntry({title:page_title+" #HGTV ",url:share_url});var facebook_shared_object=SHARETHIS.addEntry({title:page_title,url:share_url});twitter_shared_object.attachChicklet("twitter",SNI.HGTV.Toolbar.toolbarElement.find(".sharing .twitter a.chicklet")[0]);facebook_shared_object.attachChicklet("facebook",SNI.HGTV.Toolbar.toolbarElement.find(".sharing .facebook a.chicklet")[0]);},init:function(){if(!SNI.HGTV.Toolbar.toolbarElement||SNI.HGTV.Toolbar.toolbarElement.length==0){SNI.HGTV.Toolbar.toolbarElement=jQuery(SNI.HGTV.Toolbar.toolbar);}
SNI.HGTV.Toolbar.fontResize(".font-resize");SNI.HGTV.Toolbar.printPage();if(SNI.HGTV.Toolbar.toolbarElement.find(".sharing .facebook a.chicklet").length>0){SNI.HGTV.Toolbar.shareThis();}
if(jQuery("#email-a-friend form").attr("name")){SNI.HGTV.Toolbar.emailAFriendCaptcha();}
else{SNI.HGTV.Toolbar.emailAFriend();}}};
(function($){if(typeof(SNI.HGTV.ArticleInfo)=="undefined"){SNI.HGTV.ArticleInfo={};}
SNI.HGTV.ArticleInfo={moreTags:function(){var $tags=$k(".article-info .tags");var $more_tags=$tags.find(".more-tags");var $trigger=$tags.find("div.more");var fadeOutTimeout,fadeInTimeout;$more_tags.css({top:"15px",left:"0px"});$trigger.hover(function(e){clearTimeout(fadeOutTimeout);$trigger.addClass("on");fadeInTimeout=setTimeout(function(){$more_tags.fadeIn("fast");},100);},function(e){clearTimeout(fadeInTimeout);$trigger.removeClass("on");fadeOutTimeout=setTimeout(function(){$more_tags.fadeOut("fast");},100);});$k("body").click(function(){$more_tags.fadeOut("fast");});}}})(jQuery);
(function(){_egg=function(){return;if($k("#fn-ft div.brand").length==0){return;}
var o=$k("#fn-ft .brand").get(0);if(o!==null){var ee=document.createElement("div");ee.className="_egg";o.appendChild(ee);$k(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=($k(window).width()-img_w)/2;var y=($k(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);$k(yolk).click(function(){yolk.parentNode.removeChild(yolk);});$k(yolk).animate({width:img_w+'px',height:img_h+'px'},700);}}});}};$k(document).ready(_egg);})();
SNI.HGTV.Newsletters={subscribe:function(){this.setupAccordion();$k(".nl-bd .check-all a").click(function(){link=$k(this);if(link.text()=='Check All'){checked="checked";link.html('<span>Uncheck All</span>');}else{checked='';link.html('<span>Check All</span>');}
$k('.nl-choose :checkbox').attr('checked',checked);return false;});$k('.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=$k(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');}
$k('html, body').animate({scrollTop:$k('.nl-bd .form-errors').offset().top-10},'slow');$k('.nl-bd .form-errors').fadeIn();}}});},changeEmail:function(){$k('.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();$k('.nl-bd .form-errors').fadeIn();}}});},unsubscribe:function(){this.setupAccordion();$k('.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=$k(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');}
$k('html, body').animate({scrollTop:$k('.nl-bd .form-errors').offset().top-10},'slow');$k('.nl-bd .form-errors').fadeIn();}}});},setupAccordion:function(){$k(".nl-bd .acco-res li.selected").each(function(){$k(this).find(".acco-bd").show();});$k(".nl-bd .acco-res .acco-link").click(function(){acco_link=$k(this);acco_bd=acco_link.next();acco_li=acco_link.parent();if(acco_li.hasClass("selected")){acco_bd.slideUp("slow");acco_li.removeClass("selected");}else{acco_bd.slideDown("slow");acco_li.addClass("selected");}});}};(function($){var NewsLetterAjax=function(form){var $nl_form,submit_url,$nl_error_list;$nl_form=$k(form);$nl_error_list=$nl_form.find(".nl-errors")
submit_url=$nl_form.attr("action");$nl_form.submit(function(e){$nl_form.find(".nl-loading").show();$nl_error_list.find("li").hide();var privacy=$nl_form.find("#nl-agree").attr("checked")?1:"";var ajax_url=submit_url
+'?&list[]='+$nl_form.find("#nl-list").val()
+'&email='+$nl_form.find("#nl-emailaddress").val()
+'&privacy='+privacy;$k.ajax({url:ajax_url,timeout:10000,dataType:"json",success:function(response){$nl_form.find(".highlight").removeClass("highlight");$nl_form.find("p.nl-intro").hide();if(response.success===true){$nl_form.find("fieldset").hide();$nl_form.find(".nl-thank-you").show();}else if(response.error&&response.error.code){var error=response.error;$nl_error_list.find(".error-"+error.code).show();$nl_form.find(".highlight-"+error.code).addClass("highlight");}
$nl_form.find(".nl-loading").fadeOut("fast");}});e.preventDefault();return false;});return $nl_form;}
SNI.HGTV.Newsletters.ajaxHandler=NewsLetterAjax;})(jQuery);
SNI.HGTV.Contact={init:function(){$k('.contact-bd select').dropdown();$k('.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();$k('html, body').animate({scrollTop:$k('.contact-bd .form-errors').offset().top-10},'slow');$k('.contact-bd .form-errors').fadeIn();}}});},liveChat:function(){$k('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){$k('.form-errors').fadeIn();this.defaultShowErrors();}}});}};
SNI.HGTV.SearchFilter={srchLeftNavFilter:function(){var flyout_container=$k("<div id='search-flyouts'></div>");$k("body").prepend(flyout_container);$k("#hg-filters .bd ul").not('.dp-color-srf').each(function(i){var count=$k(this).children().size();var title=$k(this).prev().text();var count_diff=parseInt(count-4);if(count>5){$k(this).attr("id","srf-list"+i);var results=document.createElement("div");var $results=$k(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>');$k(this).children("li").each(function(i){$k(this).find("a").click(function(){$k(this).parents().filter(".drops").hide();return true;});if(i<=3){$k(this).clone(true).appendTo($results.find(".bd ul"));}else{$results.find(".bd ul").append($k(this));}});$k("#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){$k('#alpha'+i).html(($it.map(function(){return'<li><a href="'+this.href+'">'+this.innerHTML+'</a><span>'+$k(this).parent().children("span")[0].innerHTML+'</span></li>';}).get().join('\n')));}
alphaList($k('#alpha'+i+' li a').sort(function(a,b){return SNI.HGTV.Util.flyOuts.alphaCompare(a.innerHTML,b.innerHTML);}));$k("#srf-drop"+i).find(".cta").click(function(e){var $fDiv=$k("#search-flyouts").find("#flyout"+i);var $aDiv=$k("#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");$k('body').bind("click",function(e){bodyClick(e);});return false;}).css({cursor:"pointer"});$k("#search-flyouts .drops").find('.close').click(function(){hideAll();}).css({cursor:"pointer"});}});function bodyClick(e){var $clicked=$k(e.target);if($clicked.is('.cta')||$clicked.parents().is('.drops')){return false;}else{hideAll();$k('body').unbind();}}
function hideAll(){$k("#search-flyouts .drops").each(function(){if(jQuery.browser.msie){$k(this).css({background:"B1B1B1"});}
$k(this).fadeOut("fast");});}},init:function(){SNI.HGTV.SearchFilter.srchLeftNavFilter();}};
SNI.HGTV.Hosts={init:function(){$k('#hgtv-hosts select').dropdown();$k('#hgtv-hosts select').change(function(){location.href=$k(this).val();});}};
SNI.HGTV.Topics={topicNav:function(){$k("#topicNav .nav li").each(function(i){$k(this).click(function(){$k("#topicNav .active").removeClass("active");$k(this).addClass("active");$k("#topicNav .bbsctnt:eq("+i+")").addClass("active");});if($k(this).hasClass("active")){$k("#topicNav .bbsctnt:eq("+i+")").addClass("active");}});$k("#topicNav .nav li a").click(function(){return false;});}};
if(typeof(SNI.HGTV.DesignPortfolio)=="undefined"){SNI.HGTV.DesignPortfolio={};}
SNI.HGTV.DesignPortfolio={spacesNav:function(){var expanded_nav=$k('#dp-expanded-nav');expanded_nav.find('.close').click(function(e){expanded_nav.hide();return false;});$k('#dp-nav-spaces').click(function(e){if(expanded_nav.is(':visible')){expanded_nav.hide();}else{expanded_nav.show();}
return false;});},browseByStyle:function(){var styles_list=jQuery("#browse-by-style .nav ul li");$k("#browse-by-style .active").removeClass("active");var random_pick=Math.floor(Math.random()*styles_list.length);jQuery(styles_list[random_pick]).addClass("active");jQuery(jQuery("#browse-by-style .ctnt .bbsctnt")[random_pick]).addClass("active");styles_list.each(function(i){$k(this).click(function(){$k("#browse-by-style .active").removeClass("active");$k(this).addClass("active");$k("#browse-by-style .bbsctnt:eq("+i+")").addClass("active");});});},gridHeight:function(){var itemHeight=0;$k(".grid li").each(function(e){var thisHeight=$k(this).height();if(thisHeight>itemHeight){itemHeight=thisHeight;}});$k(".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=$k("#"+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(){$k('#dp-space-more select').dropdown({title:"Browse More Spaces"});$k('#dp-designer-more select').dropdown({title:"Browse More Designers"});$k('#dp-sponsor-more select').dropdown({title:"Browse More Showrooms"});$k('#dp-style-more select').dropdown({title:"Browse More Styles"});$k('#dp-browse .more-pod').each(function(){var select=$k(this);select.change(function(){window.location.href=$k(this).val();return false;});});$k("#dp-browse-designer .bd ul").each(function(i){var list=$k(this);var length=list.find("li").length;if(length>1){list.width(list.find("li:first").width()*length);var obj=list.parents("li");var id=obj.attr('id');SNI.HGTV.DesignPortfolio.browseByStylePods[id]=new SNI.HGTV.DesignPortfolio.browseByStylePods.node(id,length);obj.find(".pod").addClass("multiple");obj.find(".wrap").before('<p class="previous"><a href="#">Previous</a></p>\n');obj.find(".wrap").before('<p class="next"><a href="#">Next</a></p>\n');obj.find(".previous a").bind("click",function(){var n=SNI.HGTV.DesignPortfolio.browseByStylePods.advance(id,-1);SNI.HGTV.DesignPortfolio.browseByStylePods.set(id,n);return false;});obj.find(".next a").bind("click",function(){var n=SNI.HGTV.DesignPortfolio.browseByStylePods.advance(id,1);SNI.HGTV.DesignPortfolio.browseByStylePods.set(id,n);return false;});SNI.HGTV.DesignPortfolio.browseByStylePods.set(id,0);}});}},RoomBrowser:{inter_refreshed:true,getRooms:function(data,count){var browser=this;var next_button=browser.element.find('.navigate .next');var previous_button=browser.element.find('.navigate .previous');var room_count=count||data.length;var first_room=data[0];var this_room=parseInt(browser.portfolioId);browser.rooms=data;if(window.location.hash){var id_in_hash=window.location.hash.split('/')[1];if(id_in_hash){var id_value=id_in_hash.split('-');id_value.shift();var hash_id=parseInt(id_value.join('-'));if(hash_id&&(jQuery.inArray(hash_id,data)>=0)){first_room=data[jQuery.inArray(hash_id,data)];if(first_room!=this_room){this_room=null;}}}}
if(this_room&&(jQuery.inArray(this_room,data)>=0)){first_room=data[jQuery.inArray(this_room,data)];browser.portfolioId=null;}
browser.setRoomCount(room_count);if((first_room!=this_room)&&(!browser.previewFlg)){browser.loadRoom(first_room);}else{browser.hideLoadingFilters();}
if(!(data.length<=1)){browser.navigateRooms(first_room);if(next_button.hasClass('disabled')){next_button.removeClass('disabled');}
if(previous_button.hasClass('disabled')){previous_button.removeClass('disabled');}}else{next_button.addClass('disabled');previous_button.addClass('disabled');}
return data;},navigateRooms:function(current_room){var browser=this;var rooms=browser.rooms;var current_room_index=jQuery.inArray(current_room,rooms);if(current_room_index===0){browser.previous_room=rooms[rooms.length-1];browser.next_room=rooms[current_room_index+1];}else if(current_room_index===(rooms.length-1)){browser.previous_room=rooms[current_room_index-1];browser.next_room=rooms[0];}else{browser.previous_room=rooms[current_room_index-1];browser.next_room=rooms[current_room_index+1];}
return rooms;},goNextRoom:function(){var browser=this;if(SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed===true&&SNI.HGTV.DynamicAds.refresh('#room-viewer .interwrap')){SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed=false;setTimeout(function(){SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed=true;},5000);return false;}
var current_room=browser.loadRoom(browser.next_room);if(current_room){browser.navigateRooms(current_room);}
return browser.current_room;},goPreviousRoom:function(){var browser=this;if(SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed===true&&SNI.HGTV.DynamicAds.refresh('#room-viewer .interwrap')){SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed=false;setTimeout(function(){SNI.HGTV.DesignPortfolio.RoomBrowser.inter_refreshed=true;},5000);return false;}
var current_room=browser.loadRoom(browser.previous_room);if(current_room){browser.navigateRooms(current_room);}
return browser.current_room;},loadRoom:function(room_id){var browser=this;var applied_filters=(window.location.hash||"#").split('/');var url=browser.serviceUrl+'PortfolioService/index.json?portfolio='+room_id+'&site=HGTV';if(browser.previewFlg){url+='&preview=true'}
var room_type=browser.portfolioRoomName;var room_type_filter=browser.element.find('#select-filter-room :selected');browser.displayLoadingMessage(room_id);browser.current_room=room_id;jQuery.ajax({url:url,dataType:'script',success:function(result,textStatus){if(typeof dpCurrentRoom=="undefined"){eval(result);}
applied_filters[1]=("id-"+dpCurrentRoom.portfolioId);window.location.hash=applied_filters.join('/');if(!browser.sponsorFlg&&(dpCurrentRoom.sponsorFlag.length>0)){browser.refreshPage();return dpCurrentRoom;}
if(browser.sponsorFlg&&(dpCurrentRoom.sponsorFlag.length<=0)){browser.sponsorFlg=false;browser.refreshPage();return dpCurrentRoom;}
if(browser.sponsorFlg&&(dpCurrentRoom.sponsorshipValue!=mdManager.getSponsorship())){browser.refreshPage();return dpCurrentRoom;}
jQuery.each(dpCurrentRoom.metadata,function(key,val){mdManager.setParameter(key,val);});if(typeof s=="object"){s.t();}
SNI.Util.hitCount();browser.constructRoom(dpCurrentRoom);browser.hideLoadingFilters();browser.hideLoadingMessage();}});return browser.current_room;},displayLoadingMessage:function(room_id){var browser=this;var room_viewer=browser.viewer;var content_well=jQuery('#hg-w');var designers_notes=room_viewer.find('.dp-notes');var loader=jQuery('<div id="room-loading"></div>');var message=jQuery('<div class="flyout flyout-for-select"><div class="flyout-hd"></div><div class="flyout-bd"></div><div class="flyout-ft"></div></div>');message.children('.flyout-bd').append('<p><img src="http://web.hgtv.com/webhgtv/hg20/imgs/hg-loader.gif" alt="Sending E-mail" width="30" height="30"> <span>Loading...</span></p>')
loader.append(message);content_well.empty();designers_notes.empty();room_viewer.append(loader);},hideLoadingMessage:function(){var browser=this;browser.viewer.find('#room-loading').hide().remove();},setRoomCount:function(count){var browser=this;var criteria=browser.element.find('.navigate > .room-count .criteria');var room_count_html=browser.element.find('.navigate > .room-count strong');var room_text=' Rooms';if(count===1){room_text=' Room';}
room_count_html.html('<span class="count">'+count+'</span>'+room_text);if(browser.filterIsApplied()){criteria.text('Based on the above criteria');}else{criteria.text('Set your criteria above to narrow your results');}
return room_count_html;},filterIsApplied:function(){var browser=this;var filters=browser.element.find('.filter-select :selected').not('.excluded')
return!(filters.length<=0);},generateFilters:function(filters){var browser=this;var select_lists=browser.element.find('.filter');var flyouts=[];jQuery.each(filters,function(i,filter){if(browser.sponsorFlg){if(filter.name=="designer"){return true;}}else{if(filter.name=="sponsor"){return true;}}
var $select_list=select_lists.eq(i);if(filter.name=="sponsor"){$select_list=select_lists.eq(3);}
var label=jQuery('<label class="filter-title"></label>');var select=jQuery('<select class="filter-select"></select>');var option="<option></option>";label.attr('for',filter.id);label.text(filter.label+":");select.attr('id',filter.id);select.attr('name',filter.name);select.append('<option class="excluded">Any '+filter.label+'</option>');jQuery.each(filter.options,function(j,option){var $option=jQuery('<option value="'+option.v+'">'+option.t+'</option>');if(option.s){$option.attr('selected','selected');}
if(option.d){$option.attr('disabled','disabled');}
select.append($option);});$select_list.empty();$select_list.append(label);$select_list.append(select);flyouts.push(browser.generateFlyout(select).flyout);});browser.checkSelectedFilters(flyouts);jQuery.each(flyouts,function(index,flyout){if(flyout.select.attr('id')==='select-filter-room'){browser.changeRoomType(flyout.select.find(':selected'));}
flyout.resetLink.click(function(e){jQuery.each(flyouts,function(index,flyout){flyout.hide();flyout.flyout_reset.attr('selected','selected');flyout.select.change();browser.element.removeClass("filtered");});});});browser.filterClickTracking();return select_lists;},checkSelectedFilters:function(flyouts){var browser=this;var reset_all=true;if(!browser.element.hasClass("filtered")){browser.element.addClass("filtered");}
jQuery.each(flyouts,function(index,flyout){if(flyout.select[0].selectedIndex>0){reset_all=false;return false;}});if(reset_all){browser.element.removeClass("filtered");}},changeRoomType:function(option){var browser=this;var navigation=$k('#dp-nav-menu');var right_rail=$k('#hg-e');function menuReset(selector){navigation.children('li').removeClass('selected active');navigation.children(selector).addClass('selected active');}
switch(option.val()){case'bathrooms':menuReset('#dp-nav-bathrooms');break;case'bedrooms':menuReset('#dp-nav-bedrooms');break;case'dining-rooms':menuReset('#dp-nav-diningroom');break;case'entryways':menuReset('#dp-nav-entryways');break;case'home-offices':menuReset('#dp-nav-homeoffices');break;case'kids-rooms':menuReset('#dp-nav-kidsrooms');break;case'kitchens':menuReset('#dp-nav-kitchens');break;case'living-rooms':menuReset('#dp-nav-livingroom');break;default:menuReset('#dp-nav-main');}},loadRightRail:function(room_type){var browser=this;var right_rail=$k('#hg-e');jQuery.ajax({url:browser.rightRailService(room_type),dataType:'script',success:function(result,textStatus){if(typeof roomTypeRightRail=="undefined"){eval(result);}}});},generateFlyout:function(select){var browser=this;var config={};config.flyout_css=false;config.close_button=true;if(select.attr('id')){var label=jQuery("label[for='"+select.attr('id')+"']");if(label.size()>0){config['title']='Select a '+jQuery.trim(label.text());}}
select.change(function(e){var $this=$k(this);var select_lists=browser.element.find('select');var applied_filters=("#").split('/');applied_filters[1]=window.location.hash.split('/')[1];var filter=$this.attr('name')
var option=$this.children(':selected').val();var url=browser.browserService();var selected_hash=[];var room_type=browser.portfolioRoomName;jQuery.each(select_lists,function(i,list){var $list=jQuery(list);var $selected=$list.children(':selected');if($selected.hasClass('excluded')){return true;}
url+=$list.attr('name')+"/"+$selected.val()+"/";selected_hash.push($list.attr('name')+'-'+$selected.val());});jQuery.merge(applied_filters,selected_hash);window.location.hash=applied_filters.join('/');url+='roomfilter.js';browser.generateBrowser(url);});var flyout=SNI.Util.Flyout.createFor(select,config);var flyout_body=flyout.element.children('.flyout-bd');var flyout_reset=flyout.select.children('.excluded');var select_name=select.attr('name').charAt(0).toUpperCase()+select.attr('name').substr(1).toLowerCase();var reset_button=jQuery('<button class="button"><span><em>See Any Available '+select_name+'</em></span></button>');reset_button.click(function(e){flyout.hide();flyout_reset.attr('selected','selected');flyout.select.change();});flyout_body.append(reset_button);var reset_container=jQuery('<div class="reset">Or </div>');var reset_link=jQuery('<a href="javascript: void(0);">Start a New Search</a>');reset_container.append(reset_link)
flyout_body.append(reset_container);flyout.resetLink=reset_link;flyout.flyout_reset=flyout_reset;select.flyout=flyout;return select;},generateBrowser:function(service_url){var browser=this;browser.showLoadingFilters();jQuery.ajax({url:service_url,dataType:'script',success:function(result,textStatus){if(typeof dpRoomBrowser=="undefined"){eval(result);}
browser.generateFilters(dpRoomBrowser.filters);browser.getRooms(dpRoomBrowser.rooms,dpRoomBrowser.count);}});return browser;},browserService:function(){var url;switch(window.location.host){case'www.dev-hgtv.com':url='http://10.64.36.113:18080/HGTVSearchServiceCXF/browseByRoom/'
break;case'www.staging-hgtv.com':url='http://search1.staging-hgtv.com/hgtv/cxfservice/browseByRoom/';break;default:url='http://www.hgtv.com/hgtv/cxfservice/browseByRoom/';}
return url;},rightRailService:function(room_type){room_type=room_type||'';return'http://'+window.location.host+'/hgtv/feeds/portfolio-right-rail/0,,HGTV_'+room_type+',00.html'},showLoadingFilters:function(){var browser=this;if(browser.element.find('.loading').length<=0){browser.element.append('<div class="loading">Loading Filters</div>');}},hideLoadingFilters:function(){var browser=this;browser.element.children('.loading').remove();},constructRoom:function(data){var browser=this;var room_viewer=browser.viewer;var content_well=jQuery('#hg-w');var room_image=room_viewer.find('.large-image');var designers_notes=room_viewer.find('.dp-notes');designers_notes.empty();content_well.empty();room_image.empty();var designer_info=jQuery('<div id="dp-about-designers" class="dp-acco"><div class="hd"><h4>About the Designer(s)</h4></div>');var more_from_sponsor=jQuery('<div id="dp-more-sponsor" class="dp-notes"><h4>More From This Sponsor</h4></div>');if(data.multimedia&&data.multimedia.length>0){room_image.append(data.multimedia);}else if(data.images&&data.images.length>0){var new_img=$k('<img src="'+data.images[0].lgUrl+'" alt="'+data.images[0].img_alt+'" />');new_img.click(function(e){browser.goNextRoom();return false;});room_image.append(new_img);}
if(data.designerNotes.length>=1){if(data.sponsorFlag.length>=1){designers_notes.append('<h4>About This Room</h4>');}else{designers_notes.append("<h4>Designer's Notes</h4>");}
designers_notes.append(browser.truncateNotes(data.designerNotes));}
content_well.append(data.toolbar);if(data.sponsorFlag.length<=0){designer_info.append(data.designerList);designer_info.append('<div class="ft"></div>');content_well.append(designer_info);content_well.find('#dp-about-designers .acco-dp').dpl('accordion');}
content_well.append(data.otherRoomsEndeca);return data;},truncateNotes:function(notes){var browser=this
var $notes=$k(notes);var text=$notes.text();var cut_off=333;if(text.length>cut_off){var new_notes=text.slice(0,cut_off)+"... ";var more_link=jQuery('<a href="#">more</a>').click(function(e){$k(this).parent().text(text);return false;});$notes.text(new_notes);$notes.append(more_link);}
return $notes;},refreshPage:function(url){var path;try{path=dpCurrentRoom.metadata.Url;}catch(err){path=url||window.location.pathname}
var new_location='http://'+window.location.host+path+window.location.search+window.location.hash;window.location=new_location;return new_location;},filterClickTracking:function(){var browser=this;var filters=browser.element.find('.filters .flyout-for-select .flyout-bd');if(filters.length<=0){return;}
filters.bind('click',function(e){var $clicked=$k(e.target);var filter=$clicked.parents('#room-browser li.filter').children('.filter-title').text().split(':')[0];var option=$clicked.text();var s=s_gi(s_account);s.linkTrackVars='prop50,eVar8';s.linkTrackEvents='None';s.prop50=filter+': '+option;s.eVar8=s.prop50;s.tl(this,'o','DP Room Filter');s.linkTrackVars='';s.linkTrackEvents='';s.prop50='';s.eVar8='';});},init:function(){var browser=this;browser.element=jQuery('#room-browser');browser.viewer=jQuery('#room-viewer');var next_button=browser.element.find('.navigate .next');var previous_button=browser.element.find('.navigate .previous');var service_url=browser.browserService();if(window.location.hash){var filters=window.location.hash.split('/');var url='';jQuery.each(filters,function(i,val){if(i==0||!val){return true;}
var filter=val.split('-');var name=filter.shift();var value=filter.join('-');if(name=='id'){return true;}
url+=name+'/'+value+'/';});if(url){service_url+=url;}}
browser.generateBrowser(service_url+'roomfilter.js');previous_button.click(function(e){if($k(this).hasClass('disabled')){return false;}
browser.goPreviousRoom();return false;});next_button.click(function(e){if($k(this).hasClass('disabled')){return false;}
browser.goNextRoom();return false;});browser.viewer.find('.large-image img').click(function(e){browser.goNextRoom();return false;});SNI.HGTV.DynamicAds.init();SNI.HGTV.Omniture.ClickTrack("#room-browser .navigate","Designer's Portfolio Room Gallery");return browser;}},searchFieldHandler:function(){var searchField=jQuery("#hg-w-search-input");var label="Search Over 2000 Spaces";if(searchField.val()!=label){searchField.removeClass("grayedout");}
searchField.focus(function(e){var field=jQuery(this);field.removeClass("grayedout");if(field.val()==label){field.val("");}});searchField.blur(function(e){var field=jQuery(this);if(field.val()==""){field.addClass("grayedout");field.val(label);}});jQuery("#dp-search .search .input").click(function(){searchField.focus();});jQuery("#dp-search-form").submit(function(e){if(searchField.val()==label){searchField.val("");}});}};
SNI.HGTV.MessageBoard={init:function(url){messageList=$k('#messageboard .mb-bd ul');$k.ajax({type:"GET",url:url,dataType:"xml",success:function(xml){var data=$k(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=[];$k(nodeName,xml).each(function(){var item={};$k(this).children().each(function(){item[this.nodeName]=$k(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(){$k(SNI.HGTV.ImageEnlarge.clickCtrl).bind("click",SNI.HGTV.ImageEnlarge.clickExpand);},clickExpand:function(e){$k(this).parents().filter(".thumb-wrap").before(SNI.HGTV.ImageEnlarge.htmlImage(this.href));$k(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){$k(SNI.HGTV.ImageEnlarge.imgFrame).remove();return false;}};
if(typeof(SNI.HGTV.QuickVote)=="undefined"){SNI.HGTV.QuickVote={};}
SNI.HGTV.QuickVote={inputLink:"#poll-input-link",resultLink:"#poll-result-link",submitLink:"#poll-submit-link",inputPanel:"#inputPanel",inputForm:"#quick-vote-poll",resultsPanel:"#resultsPanel",submittingPanel:".qv-ww .submitting",loadingPanel:".qv-ww .loading",validateOptions:{errorElement:"",highlight:"",rules:{Rating:"required"},messages:{Rating:""},errorContainer:"#quick-vote-poll .errormsg"},voteURL:'',resURL:'',POLL_Cookie:'',oValidator:'',init:function(pollnum,voteURL,resURL){SNI.HGTV.QuickVote.voteURL=voteURL;SNI.HGTV.QuickVote.resURL=resURL;SNI.HGTV.QuickVote.POLL_Cookie="HGTV_poll_"+pollnum;SNI.HGTV.QuickVote.oValidator=$k(SNI.HGTV.QuickVote.inputForm).validate(SNI.HGTV.QuickVote.validateOptions);SNI.HGTV.QuickVote.oValidator.resetForm();$k(SNI.HGTV.QuickVote.inputForm).get(0).reset();$k(SNI.HGTV.QuickVote.resultLink).click(function(){$k(SNI.HGTV.QuickVote.inputPanel).hide();SNI.HGTV.QuickVote.showResults(resURL);return false;});$k(SNI.HGTV.QuickVote.inputPanel).submit(SNI.HGTV.QuickVote.submitVote);if(SNI.Util.Cookie.get(SNI.HGTV.QuickVote.POLL_Cookie)=="yes"){$k(SNI.HGTV.QuickVote.inputPanel).hide();SNI.HGTV.QuickVote.showResults(resURL);}
else
{$k(SNI.HGTV.QuickVote.inputPanel).show();}},submitVote:function(){$k(SNI.HGTV.QuickVote.inputPanel).hide();$k(SNI.HGTV.QuickVote.submittingPanel).show();$k.post(SNI.HGTV.QuickVote.voteURL,$k(SNI.HGTV.QuickVote.inputForm).serialize(),SNI.HGTV.QuickVote.afterSubmit);return false;},afterSubmit:function(){SNI.Util.Cookie.set(SNI.HGTV.QuickVote.POLL_Cookie,"yes");$k(SNI.HGTV.QuickVote.submittingPanel).hide();SNI.HGTV.QuickVote.showResults();},showResults:function(){$k(SNI.HGTV.QuickVote.loadingPanel).show();$k(SNI.HGTV.QuickVote.resultsPanel).load(SNI.HGTV.QuickVote.resURL,'',SNI.HGTV.QuickVote.resInit);return false;},resInit:function(){$k(SNI.HGTV.QuickVote.loadingPanel).hide();$k(SNI.HGTV.QuickVote.resultsPanel).show();$k(SNI.HGTV.QuickVote.inputLink).click(function(){SNI.HGTV.QuickVote.showInputForm();return false;});return;},showInputForm:function(){$k(SNI.HGTV.QuickVote.resultsPanel).empty();$k(SNI.HGTV.QuickVote.resultsPanel).hide();SNI.HGTV.QuickVote.oValidator.resetForm();$k(SNI.HGTV.QuickVote.inputForm).get(0).reset();$k(SNI.HGTV.QuickVote.inputPanel).show();return false;}};
SNI.HGTV.OnHGTV={init:function(){$k(".tvschedule").dpl("accordion");$k('.tvschedule .acco-link a').click(function(){if($k(this).parents().is('li.selected')){window.location.href=this.href;return true;}});}};;SNI.HGTV.LazyImage={load:function(img_element,src){var image_src=src||img_element.attr('data-src');img_element.attr('src',image_src);return img_element;}};SNI.HGTV.ViewSlider=(function(){function ViewSlider(){this.updateImageList=function(){this.images=this.images.not('[src]');return this.images;},this.monitorScroll=function(){var sliding_window=this;var slider=sliding_window.slider;sliding_window.images=slider.find('img').not('[src]');if(sliding_window.images.length>0){slider.scroll(function(e){sliding_window.images.each(function(i){var $this=jQuery(this);if(($this.offset().left-slider.offset().left)<=slider.width()){SNI.HGTV.LazyImage.load($this);sliding_window.updateImageList();}});});}},this.calculateBodyWidth=function(slider_body){slider_body=slider_body||sliding_window.slider.children('ul');var total_body_width=0;slider_body.children('li').each(function(i){var $this=$k(this);var list_item_width=$this.outerWidth()+parseInt($this.css('margin-left'))+parseInt($this.css('margin-right'));total_body_width=total_body_width+list_item_width;});return total_body_width;},this.init=function(element){var sliding_window=this;var slider=element||jQuery('.view-slider');sliding_window.slider=slider;slider.addClass("view-slider-setup")
sliding_window.images=slider.find('img').not('[src]');var slider_body=slider.children('ul');var slider_body_width=sliding_window.calculateBodyWidth(slider_body);if(slider_body.width()!==slider_body_width){slider_body.width(slider_body_width);}
sliding_window.images.each(function(i){var $this=jQuery(this);if($this.position().left<=sliding_window.slider.width()){SNI.HGTV.LazyImage.load($this);}});sliding_window.updateImageList();sliding_window.monitorScroll();}}
return{init:function(element){var view_slider=new ViewSlider();view_slider.init(element);return view_slider;}};})();
SNI.HGTV.BestOf={init:function(){SNI.HGTV.Drops.init($k(".best-of-full .drops"),$k(".best-of-full .more-lnk"));SNI.HGTV.ViewSlider.init();return;}}
SNI.HGTV.Drops={init:function($eDrop,$eLnk){$eLnk.click(function(){if($eLnk.hasClass("sel")){$eDrop.find(".close").trigger("click");}
else{$eLnk.addClass("sel");$k("body").bind("click.drops_out",function(ev){if($k(ev.target).parents(".drops").length==0){$eDrop.find(".close").trigger("click");}
return true;});$eDrop.show();}
return false;});$eDrop.find(".close").click(function(){$eDrop.hide();$eLnk.removeClass("sel");$k("body").unbind("click.drops_out");return false;});return;}}
SNI.HGTV.DynamicAds={descr:{active:true,refreshRate:4,interstitial:false},iparm:{iURL:"",iFmt:"",iHREF:"",iHeight:"",iWidth:"",iTrackURL:"",bURL:""},impressionCt:1,init:function(descriptor,param_styles,gen_inter_func){descriptor=descriptor||"PHOTO_DESCRIPTOR";param_styles=param_styles||'photoGallery';SNI.HGTV.DynamicAds.gen_interstitial=gen_inter_func||SNI.HGTV.DynamicAds.gen_interstitial;myJSON=getDartEnterpriseUrl(descriptor,1);myJSON+="&params.styles="+param_styles+"&callback=?";$k.getJSON(myJSON,SNI.HGTV.DynamicAds.cback_descrJSON);return;},cback_descrJSON:function(oJSON){if(typeof oJSON!="object"){return false;}
if(oJSON.photo_descriptor==undefined){return false;}
oJSON=oJSON.photo_descriptor;if(oJSON.active==undefined){return false;}
if(oJSON.refreshRate==undefined){return false;}
if(oJSON.active!="true"){return false;}
tmp=parseInt(oJSON.refreshRate);if(isNaN(tmp)){return false;}
if(tmp<1||tmp>100){return false;}
SNI.HGTV.DynamicAds.descr.active=true;SNI.HGTV.DynamicAds.descr.refreshRate=tmp;if(oJSON.interstitial==undefined){return false;}
if(oJSON.interstitial=="true"){SNI.HGTV.DynamicAds.descr.interstitial=true;}
return true;},refresh:function(interstitial_selector){if(!this.descr.active){return;}
var interstitial_element=interstitial_selector||'#pgallery3 .interwrap';$k(interstitial_element).remove();this.impressionCt++;if(this.impressionCt==this.descr.refreshRate){this.impressionCt=0;if(this.descr.interstitial){myJSON=getDartEnterpriseUrl("PHOTO_INTERSTITIAL",1);myJSON+="&params.styles=photoGallery&callback=?";$k.getJSON(myJSON,SNI.HGTV.DynamicAds.cback_interJSON);return true;}else{setDartEnterpriseBanner("BIGBOX",getDartEnterpriseUrl("BIGBOX",5));}}
return;},cback_interJSON:function(oJSON){$k.each(SNI.HGTV.DynamicAds.iparm,function(key,val){SNI.HGTV.DynamicAds.iparm[key]="";});if(typeof oJSON!="object"){return false;}
if(typeof oJSON.scrippsads!="object"){return false;}
if(typeof oJSON.scrippsads.ad!="object"){return false;}
for(i=0;i<oJSON.scrippsads.ad.length;++i){if(typeof oJSON.scrippsads.ad[i].position!="object"){return false;}
with(oJSON.scrippsads.ad[i].position){with(SNI.HGTV.DynamicAds){if((iparm.iURL=="")&&(id=="interstitial")){iparm.iURL=media.src;iparm.iFmt=media.format;iparm.iHREF=media.href;iparm.iHeight=media.height;iparm.iWidth=media.width;if(typeof media.tracking.audit=="object"){iparm.iTrackURL=media.tracking.audit.src;}}
if((iparm.bURL=="")&&(id=="300syncBanner")){iparm.bURL=media.src;}}}}
with(SNI.HGTV.DynamicAds){if(iparm.iURL==""||iparm.iFmt==""||iparm.bURL==""){return false;}}
SNI.HGTV.DynamicAds.gen_interstitial();return true;},gen_interstitial:function(){var hRet="";with(SNI.HGTV.DynamicAds){hRet+='<div class="interwrap">';hRet+='<a href="#" class="close"><span></span>Continue to Next Room</a>';hRet+='<h6>Advertisement</h6>';if(iparm.iFmt.toLowerCase()=="swf"){hRet+='<div id="interad"></div>';}else{if(iparm.iHREF!=""){hRet+='<a href="'+iparm.iHREF+'">';}
hRet+='<img src ="'+iparm.iURL+'" />';if(iparm.iHREF!=""){hRet+='</a>';}}
hRet+='<iframe class="tracker" width="0" height="0" frameborder="0"></iframe>';hRet+='</div>';$k("#room-viewer").append(hRet);$k("#room-viewer .interwrap .close").click(function(){SNI.HGTV.DesignPortfolio.RoomBrowser.goNextRoom()
return false;});if(iparm.iFmt.toLowerCase()=="swf"){swfobject.embedSWF(iparm.iURL,"interad",iparm.iWidth,iparm.iHeight,"9","http://common.scrippsnetworks.com/common/flash-express-install/expressInstall.swf","",{wmode:"opaque",allowScriptAccess:"always",quality:"high"});}
setDartEnterpriseBanner("BIGBOX",iparm.bURL);$k("#room-viewer .interwrap .tracker").attr("src",iparm.iTrackURL);}
return;}};
SNI.SimpleTabs={init:function($elt,nInit){$elt.find(".tab-nav li a").click(function(){if($k(this).parent().hasClass("sel")){return false;}
$elt.find(".tab-nav li.sel").removeClass("sel");$k(this).parent().addClass("sel");idx=$elt.find(".tab-nav li").index($k(this).parent());$elt.find(".tab-cont > li.sel").removeClass("sel");$elt.find(".tab-cont > li").eq(idx).addClass("sel");return false;});if((typeof nInit!="undefined")&&(nInit!=0)){idx=0;if(nInit<0){idx=Math.floor(Math.random()*$elt.find(".tab-nav li").length);}
else if(nInit<$elt.find(".tab-nav li").length){idx=nInit;}
if(idx!=0){$elt.find(".tab-nav li").removeClass("sel").eq(idx).addClass("sel");$elt.find(".tab-cont > li").removeClass("sel").eq(idx).addClass("sel");}}
return;}}
if(typeof(SNI.Common)=='undefined'){SNI.Common={};}
SNI.Common.Carousel=function(element,config){config=$k.extend({btnNext:element+" .next-btn",btnPrev:element+" .prev-btn",visible:1,circular:false,displayPage:false,miniNav:false},config);return $k(element+' .crsl-wrap').jCarouselLite({btnNext:config.btnNext,btnPrev:config.btnPrev,visible:config.visible,circular:config.circular,scroll:config.visible,displayPage:(config.displayPage),btnNavigation:(config.displayPage)?false:true,miniNav:config.miniNav,container:element,mouseWheel:true});};SNI.Common.Accordion=function(element,config){var ca=this;ca.overflowFix=($k.browser.mozilla&&parseFloat($k.browser.version)<=1.9);SNI.Common.Accordion.dynamicFix=($k.browser.msie&&parseInt($k.browser.version)<8);config=$k.extend({autoheight:true,header:'.acco-link',change:ca.change,animated:'easeOutSine'},config);var acco=$k(element).accordion(config);if(ca.overflowFix||ca.dynamicFix){$k(config.header,acco).click(function(){var link=$k(this);if(!link.hasClass('ui-state-active')){if(ca.dynamicFix){$k('.ui-accordion-content .crsl',acco).hide();}
if(ca.overflowFix){$k('.ui-accordion-content .list, .ui-accordion-content .thumbs',acco).css('overflow','hidden');}}});}};SNI.Common.Accordion.change=function(event,ui){if(SNI.Common.Accordion.dynamicFix){$k('.crsl',ui.newContent).show();}
if(SNI.Common.Accordion.overflowFix){$k('.list, .thumbs',ui.newContent).css('overflow','auto');}};SNI.Common.Tabs=function(element,config){var tabs=$k(element).tabs(config);};
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;};
(function($){var DEFAULT_CONFIG={current_index:0,thumbnail_loader:"http://web.hgtv.com/webhgtv/hg20/imgs/hg-loader.gif",default_product_image_sm:"../img/product_unavailable_sm.jpg",default_product_image_lg:"../img/product_unavailable_al.jpg",images:null,interstitial_refresh_rate:5000};var PhotoGallery=function(element,config){for(var prop in DEFAULT_CONFIG){if(!config.hasOwnProperty(prop)){config[prop]=DEFAULT_CONFIG[prop];}}
config.images=config.images||imageData;var gallery=this,gallery_element,count_label,photo_display,thumbnails_button,thumbnails_frame,next_button,previous_button,ad_unit,photo_description,photo_author,caption_head,caption,toggler,endframe_info,template_element,hsproduct_wrapper,ymal,ymal_list,_load_once,current_index,loader_img=new Image(),default_product_img_sm=new Image(),default_product_img_lg=new Image(),inter_wrap,inter_next=false,print_link,inter_refreshed=true;loader_img.src=config.thumbnail_loader;function doDynOmni(i){++i;if(mdManager.getParameterString("oUrl")==""){mdManager.setParameter("oUrl",mdManager.getParameterString("Url"));}
mdManager.setParameter("Url",mdManager.getParameter("oUrl")+"?i="+parseInt(i,10));if(i<10){i='0'+parseInt(i,10);}
mdManager.setParameter("UniqueId",mdManager.getParameterString("UniqueId").replace(/(.*?)-([0-9]{1,2})$/,"$1-"+i));if(typeof s=="object"){s.t();}
return;}
function createImageWrapper(current_data){var clone=template_element.clone(),clone_image=clone.find("a img"),new_image=new Image(),toggler=clone.children(".pg-toggler");clone.attr("id","pg-photo-"+current_data.iid);clone.find("a.photo").attr("href",current_data.pgUrl).click(function(e){if(current_data.bhs!=-1){gallery.nextPhoto(e);}
return false;});clone.children(".pg-hotspots").remove();clone_image.attr("alt",current_data.ialt);jQuery(new_image).load(function(response,status,xhr){clone.appendTo(photo_display);current_data.image_wrapper=clone;clone_image.attr("src",new_image.src);clone_image.attr("style","");clone.attr("style","");if(current_data.bvert){setupToggler(toggler,current_index);toggler.show();}
else{toggler.hide();clone.removeClass("pg-fitted");}
applyHotspots(current_data);gallery_element.removeClass("pg-loading");clone.hide();clone.fadeIn("fast");}).error(function(){gallery_element.removeClass("pg-loading");gallery_element.addClass("pg-errored");});new_image.src=current_data.iurl;}
function setupToggler(toggler,index){var enlarge=toggler.find(".pg-enlarge");var shrink=toggler.find(".pg-shrink");var current_data=config.images[index];current_data.image_wrapper.addClass("pg-fitted");current_data.toggler=toggler;current_data.toggler.enlarge=enlarge;current_data.toggler.shrink=shrink;enlarge.click(function(){current_data.image_wrapper.animate({width:"602px"},200);current_data.image_wrapper.find("a.photo img").animate({width:"602px"},200);enlarge.hide();shrink.show();});enlarge.children(".pg-toggler-button").hover(function(){enlarge.children(".pg-toggler-label").show();},function(){enlarge.children(".pg-toggler-label").hide();});enlarge.children(".pg-toggler-label").hover(function(){enlarge.children(".pg-toggler-label").show();},function(){enlarge.children(".pg-toggler-label").hide();});shrink.click(function(){current_data.image_wrapper.animate({width:"339px"},250);current_data.image_wrapper.find("a.photo img").animate({width:"339px"},250);shrink.hide();enlarge.show();});shrink.children(".pg-toggler-button").hover(function(){shrink.children(".pg-toggler-label").show();},function(){shrink.children(".pg-toggler-label").hide();});shrink.children(".pg-toggler-label").hover(function(){shrink.children(".pg-toggler-label").show();},function(){shrink.children(".pg-toggler-label").hide();});}
function loadPhotoInfo(index){var current_data=config.images[index];var caption_length=207;var cap_start,cap_end='';var next_index=(index+1)%config.images.length;doDynOmni(index);SNI.Util.hitCount();next_button.attr("href",config.images[next_index].pgUrl);if(print_link.length>0){var i=index+1;var plink=print_link.attr("href");if(i<10){i='0'+parseInt(index+1,10);}
plink=plink.replace(/(.*ARTICLE-PRINT-PHOTO-GALLERY-CURRENT).*?(,00.html)$/,"$1_"+i+"$2");print_link.attr("href",plink);}
gallery_element.addClass("pg-loading");count_label.html(index+1);if(current_data.iid!="endframe"){photo_description.show();endframe_info.hide();if(current_data.ititle.length>41){caption_length=157;}
cap_start=current_data.icap_txt.substring(0,caption_length);if(cap_start.length<current_data.icap_txt.length){cap_end='<span class="pg-cap-elipse">&#8230; <span class="pg-show-caption">more</span></span><span class="pg-full-caption">'
+current_data.icap_txt.substring(caption_length,current_data.icap_txt.length)
+'</span>';photo_description.addClass("pg-short-caption");}else{photo_description.removeClass("pg-short-caption");}
var rendered_content=cap_start+cap_end;caption_head.html(current_data.ititle);caption.html(rendered_content);caption.find(".pg-show-caption").click(function(){caption.find(".pg-cap-elipse").hide();caption.hide();caption.find(".pg-full-caption").css({display:"inline"});caption.slideDown(175,function(){photo_description.removeClass("pg-short-caption");caption.html(current_data.icap)});});if(current_data.rtitle&&current_data.rtitle!=""){ymal.show();ymal_list.html('<li><a href="'+current_data.rurl+'">'+current_data.rtitle+'</a></li>');}
else{ymal.hide();}
if(current_data.creator){photo_author.children(".pg-author-name").html(current_data.creator);photo_author.show();}
else{photo_author.hide();}}else{photo_description.hide();photo_author.hide();endframe_info.show();ymal.hide();}
$k(thumbnails_frame.find(".pg-thumbnails li")[index]).addClass("pg-selected-thumbnail");if(!current_data.image_wrapper){createImageWrapper(current_data);}else{gallery_element.removeClass("pg-loading");current_data.image_wrapper.fadeIn("fast");}}
function applyHotspots(current_data){if(SNI.HGTV.Photogallery3.Hotspots){$k(SNI.HGTV.Photogallery3.Hotspots.images).each(function(){var hotspotImage=this;if(hotspotImage.id==current_data.iid&&!current_data.hotspotSet){current_data.hotspotSet=true;var hotspots_container=$k('<div class="pg-hotspots"></div>').appendTo(current_data.image_wrapper);var hotspots_products,hotspot_items_info;var list_html=[],product_info_html=[],panel_html=[];list_html.push('<h3>Products From This Photo:</h3><ul class="pg-hotspot-list">');product_info_html.push('<ul class="pg-hsproducts">');panel_html.push('<div class="pg-hotspot-panel clrfix"><div class="l"><div class="pg-close-hspanel pg-close"><img src="'+current_data.itnurl+'" /><span><a href="javascript: void(0);">Back to this Photo</a></span></div>');var showProducts=function(e){SNI.HGTV.Omniture.HotSpotClick(e.data.hotspot,"c");current_data.image_wrapper.fadeOut("fast",function(){hotspots_products.find("ul.pg-hotspot-list li.selected").removeClass("selected");hotspot_items_info.hide();$k(hotspots_products.find("ul.pg-hotspot-list li")[e.data.index]).addClass("selected");$k(hotspot_items_info[e.data.index]).show();current_data.image_wrapper.product_panel.fadeIn("fast",function(){current_data.image_wrapper.addClass("pg-hide-hotspots");});hsproduct_wrapper.fadeIn("fast");});};var hoverIn=function(){$k(this).children().fadeIn("fast");};var hoverOut=function(){$k(this).children().fadeOut("fast");};var product_image_url,product_description;$k(hotspotImage.hotspots).each(function(index){var hotspot=this;product_image_url=hotspot.imageURL;product_description=hotspot.description;if(product_description.length>180){product_description=product_description.substring(0,180)+'... <a class="hotspot_readmore_'+index+'" href="'+hotspot.url+'">Read More</a>';}
if(hotspot.imageURL==="null"||hotspot.imageURL==""||hotspot.imageURL==null){product_image_url=default_product_img_lg.src;}
list_html.push('<li>'+hotspot.name+'</li>');product_info_html.push('<li class="clrfix">'
+'<h4><a class="hotspot_readmore_'+index+'" href="'+hotspot.url+'" target="_blank">'+hotspot.name+'</a></h4>'
+' <div class="pg-hsproduct-img"><a class="hotspot_readmore_'+index+'" href="'+hotspot.url+'" target="_blank"><img src="'+product_image_url+'" alt="'+hotspot.name+'" /></a></div>'
+' <p>'+product_description+'</p>'
+' <a class="pg-hsproduct-moreinfo hotspot_readmore_'+index+'" href="'+hotspot.url+'" target="_blank">'
+' <span>More info</span></a>'
+'</li>');var hotspotCSS={left:hotspot.hotspotXPercent+"%",top:hotspot.hotspotYPercent+"%"};var hotspot_element=$k('<div class="pg-hotspot"><span class="pg-hotspot-name">'+hotspot.name+'</span></div>').appendTo(hotspots_container);hotspot_element.css(hotspotCSS);hotspot_element.bind("click",{hotspot:hotspot,index:index},showProducts);hotspot_element.hover(hoverIn,hoverOut);});list_html.push('</ul>');product_info_html.push('</ul>');panel_html.push(list_html.join("\n"));panel_html.push('</div><div class="r">');panel_html.push(product_info_html.join("\n"));panel_html.push('</div><span class="pg-close-btn pg-close">close</span></div>');hotspots_products=$k(panel_html.join("\n")).appendTo(hsproduct_wrapper);current_data.image_wrapper.product_panel=hotspots_products;hotspot_items_info=hotspots_products.find("ul.pg-hsproducts li");$k(hotspot_items_info[0]).show();hotspots_products.find("ul.pg-hotspot-list li").each(function(index){$k(this).click(function(){SNI.HGTV.Omniture.HotSpotClick(hotspotImage.hotspots[index],"c");hotspots_products.find("ul.pg-hotspot-list li.selected").removeClass("selected");hotspot_items_info.hide();$k(this).addClass("selected");$k(hotspot_items_info[index]).show();});});hotspots_products.find(".pg-close").click(function(){hsproduct_wrapper.fadeOut("fast",function(){current_data.image_wrapper.product_panel.hide();current_data.image_wrapper.removeClass("pg-hide-hotspots");current_data.image_wrapper.fadeIn("fast");});});hotspots_products.find("ul.pg-hsproducts li").each(function(index){$k(this).find("a.hotspot_readmore_"+index).click(function(e){SNI.HGTV.Omniture.HotSpotClick(hotspotImage.hotspots[index],"1");e.stopPropagation();return true;});});}});}}
gallery.previousPhoto=function(e){e.preventDefault();if(!previous_button.hasClass("pg-disabled")){if(gallery_element.hasClass("pg-errored")){gallery_element.removeClass("pg-errored");}
inter_next=false;gallery.goToPhoto((current_index-1));}
e.preventDefault();};gallery.nextPhoto=function(e){if(!next_button.hasClass("pg-disabled")){if(gallery_element.hasClass("pg-errored")){gallery_element.removeClass("pg-errored");}
inter_next=true;gallery.goToPhoto(((current_index+1)%config.images.length));}
e.preventDefault();};_load_once=function(){thumbnails_frame.find(".hd span.pg-close-btn").click(function(e){gallery.hideThumbnails(e);});thumbnails_frame.find(".pg-thumbnail").each(function(){var thumb_container=$k(this);var thumb=$k(thumb_container.children("img"));thumb.attr("src",loader_img.src);var img=new Image();$k(img).load(function(){thumb_container.removeClass("pg-thumbnails-loading");thumb.attr("src",img.src);});thumb_container.addClass("pg-thumbnails-loading");img.src=thumb.attr("data-src");});_load_once=function(){return;};};gallery.showThumbnails=function(e){if(!gallery_element.hasClass("pg-loading")){_load_once();thumbnails_button.addClass("selected");thumbnails_frame.fadeIn("fast");}
e.stopPropagation();};gallery.hideThumbnails=function(e){thumbnails_button.removeClass("selected");thumbnails_frame.fadeOut("fast");e.stopPropagation();};gallery.toggleThumbnails=function(e){if(!gallery_element.hasClass("pg-loading")){_load_once();if(thumbnails_button.hasClass("selected")){thumbnails_button.removeClass("selected");}else{thumbnails_button.addClass("selected");}
thumbnails_frame.animate({opacity:'toggle'});}
e.stopPropagation();};gallery.goToPhoto=function(index,skip_interstitial){if(gallery_element.hasClass("pg-errored")){gallery_element.removeClass("pg-errored");}
if(!gallery_element.hasClass("pg-loading")){gallery_element.addClass("pg-loading");gallery_element.removeClass("interstitial-show");if(inter_refreshed===true&&!skip_interstitial&&SNI.HGTV.DynamicAds.refresh(inter_wrap)){gallery_element.removeClass("pg-loading");gallery_element.addClass("interstitial-show");inter_refreshed=false;setTimeout(function(){inter_refreshed=true;},config.interstitial_refresh_rate);return;}
hsproduct_wrapper.hide();if(current_index>=0){var previous_data=config.images[current_index];if(previous_data.image_wrapper){previous_data.image_wrapper.hide();if(previous_data.image_wrapper.product_panel){previous_data.image_wrapper.product_panel.hide();previous_data.image_wrapper.removeClass("pg-hide-hotspots");}
thumbnails_frame.find(".pg-thumbnails li.pg-selected-thumbnail").removeClass("pg-selected-thumbnail");previous_button.attr("href",previous_data.pgUrl);}}
current_index=index;if(current_index<=0){current_index=0;previous_button.addClass("pg-disabled");}else if(current_index>0&&previous_button.hasClass("pg-disabled")){previous_button.removeClass("pg-disabled");}
loadPhotoInfo(current_index);}};gallery_element=$k(element);photo_display=gallery_element.find(".pg-viewport .pg-photo-display-wrapper");count_label=gallery_element.find(".pg-navigation .pg-photo-count .count");thumbnails_button=gallery_element.find(".pg-navigation a.pg-thumbnails-button");thumbnails_frame=gallery_element.find(".pg-navigation .pg-thumbnails-frame");next_button=gallery_element.find(".pg-navigation .pg-next");previous_button=gallery_element.find(".pg-navigation .pg-previous");template_element=photo_display.children(".pg-photo-wrapper");photo_description=$k(".pg-viewport .pg-photo-description");photo_author=$k(".pg-author");caption_head=photo_description.children("h2");caption=photo_description.children("p");endframe_info=$k(".pg-viewport .pg-endframe-info");hsproduct_wrapper=$k('<div class="pg-photo-hsproduct-wrapper"></div>').appendTo(photo_display);ymal=gallery_element.find(".pg-you-might-like");ymal_list=ymal.find("ul");inter_wrap=$k('<div class="interwrap"></div>').appendTo(photo_display);print_link=$k("#print-select a.this");current_index=config.current_index;config.images.push({iid:"endframe",image_wrapper:$k(photo_display).children(".pg-endframe")});if(!config.images[current_index]){current_index=0;}
template_element.hide();if(config.images[current_index].iid!="endframe"){if(current_index==0){previous_button.addClass("pg-disabled");}
config.images[current_index].image_wrapper=template_element;toggler=template_element.children(".pg-toggler");if(config.images[current_index].bvert==1){setupToggler(toggler,current_index);toggler.show();}else{toggler.hide();template_element.removeClass("pg-fitted");}
config.images[current_index].image_wrapper.find("a.photo").click(function(e){if(config.images[current_index].bhs!=-1){gallery.nextPhoto(e);}
return false;});}
var applyHotspotImg=config.images[current_index];$k.ajax({url:config.hotspotURL,dataType:"script",timeout:10000,success:function(data){SNI.HGTV.buildProductsTab=function(){var endframe_products=[];applyHotspots(applyHotspotImg);var count=0;default_product_img_sm.src=config.default_product_image_sm;default_product_img_lg.src=config.default_product_image_lg;$k(config.images).each(function(){var image=this;var product_image_url;var even_class;if(image.bhs!=0){$k(SNI.HGTV.Photogallery3.Hotspots.images).each(function(){if(image.iid==this.id){$k(this.hotspots).each(function(){count++;even_class="";product_image_url=this.imageURL;if(this.imageURL=="null"||this.imageURL==""||this.imageURL==null){product_image_url=default_product_img_sm.src;}
if((count%2)==0){even_class=" even";}
endframe_products.push('<li class="clrfix hs-product'+even_class+'"><div class="pg-endframe-product-img"><img src="'+product_image_url+'" /></div><p><a href="'+this.url+'">'+this.name+'</a></p></li>');});}});}});if(endframe_products.length>0){var endframe_products_list=$k('<ul class="pg-endframe-products clrfix">'+endframe_products.join("\n")+'</ul>').appendTo(".pg-endframe .pg-endframe-content");var $endframe_products=endframe_products_list.find("li.hs-product");$k($endframe_products[$endframe_products.length-1]).addClass("last");if(($endframe_products.length%2)==0){$k($endframe_products[$endframe_products.length-2]).addClass("last");}else{$k('<li class="last"></li>').appendTo(endframe_products_list);}
$k(".pg-endframe .tabs .pg-endframe-ymal-btn").click(function(){$k(".pg-endframe .tabs .pg-endframe-products-btn").removeClass("selected");$k(this).addClass("selected");$k(".pg-endframe-content .pg-endframe-products").hide();$k(".pg-endframe-content .recommend").fadeIn("fast");});$k(".pg-endframe .tabs .pg-endframe-products-btn").click(function(){$k(".pg-endframe .tabs .pg-endframe-ymal-btn").removeClass("selected");$k(this).addClass("selected");$k(".pg-endframe-content .recommend").hide();$k(".pg-endframe-content .pg-endframe-products").fadeIn("fast");});$k(".pg-endframe-products-btn").show();$k(".pg-endframe .tabs .pg-endframe-products-btn").click();}};$k("head").append('<script type="text/javascript">'+data+' \n SNI.HGTV.buildProductsTab(); </script>');},complete:function(){loadPhotoInfo(current_index);applyHotspots(config.images[current_index]);}});thumbnails_button.click(gallery.toggleThumbnails);thumbnails_frame.find(".pg-thumbnails li").each(function(index){jQuery(this).click(function(e){gallery.goToPhoto(index,false,true);gallery.hideThumbnails(e);e.stopPropagation();});});thumbnails_frame.click(function(e){e.stopPropagation();});$k(document).click(function(e){gallery.hideThumbnails(e);});previous_button.click(gallery.previousPhoto);gallery_element.find(".pg-error button").click(function(e){gallery.goToPhoto(current_index);e.preventDefault();});next_button.click(gallery.nextPhoto);$k("#toolbar .font-resize").find("li").click(function(){var defaultSize="100%";$k(element).find("li.active").removeClass("active");$k(this).addClass("active");if($k(this).hasClass("med")){photo_description.css("font-size",defaultSize);}else if($k(this).hasClass("sm")){photo_description.css("font-size","85%");}else{photo_description.css("font-size","116%");}});var share_url=SNI.Util.Url.setParameter(document.location.href,"soc","share");var page_title=jQuery("<div>"+mdManager.getPageTitle()+"</div>").text();var facebook_shared_object=SHARETHIS.addEntry({title:page_title,url:share_url});var twitter_shared_object=SHARETHIS.addEntry({title:page_title+" #HGTV ",url:share_url});facebook_shared_object.attachChicklet("facebook",endframe_info.find(".pg-share .facebook a")[0]);twitter_shared_object.attachChicklet("twitter",endframe_info.find(".pg-share .twitter a")[0]);endframe_info.find(".pg-share li a").click(function(){return false;});SNI.HGTV.DynamicAds.init(null,null,function(){var hRet="";with(SNI.HGTV.DynamicAds){hRet+='<div class="pg-inter-wrap">';hRet+='<a href="#" class="close"><span></span>Continue to Next Photo</a>';hRet+='<h6 class="mrec">Advertisement</h6>';hRet+='<div class="pg-inter-container">';if(iparm.iFmt.toLowerCase()=="swf"){hRet+='<div id="interad">'
+'<a class="no-flash-message" href="http://www.adobe.com/go/getflashplayer">'
+'<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />'
+'</a>'
+'</div>';}else{if(iparm.iHREF!=""){hRet+='<a href="'+iparm.iHREF+'">';}
hRet+='<img src ="'+iparm.iURL+'" />';if(iparm.iHREF!=""){hRet+='</a>';}}
hRet+='<iframe class="tracker" width="0" height="0" frameborder="0"></iframe>';hRet+='</div>';hRet+='</div>';inter_wrap=$k(hRet).appendTo(photo_display);$k(inter_wrap).find(".close").click(function(e){gallery_element.removeClass("interstitial-show");if(inter_next){gallery.nextPhoto(e);}
else{gallery.previousPhoto(e);}
return false;});if(iparm.iFmt.toLowerCase()=="swf"){swfobject.embedSWF(iparm.iURL,"interad",iparm.iWidth,iparm.iHeight,"9","http://common.scrippsnetworks.com/common/flash-express-install/expressInstall.swf",null,{wmode:"transparent",allowScriptAccess:"always",quality:"high"});}
setDartEnterpriseBanner("BIGBOX",iparm.bURL);$k(inter_wrap).find(".tracker").attr("src",iparm.iTrackURL);}
return;});return gallery;}
SNI.HGTV.PhotoGallery4=PhotoGallery;})(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};$k.extend(this._defaults,this.regional['']);this._datepickerDiv=$k('<div id="datepicker"><div class="hd"></div><div class="bd"></div><div class="ft"></div></div>');}
$k.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=$k.datepicker._getInst(this._calId);if($k.datepicker._datepickerShowing){switch(e.keyCode){case 9:$k.datepicker.hideDatepicker('');break;case 13:$k.datepicker._selectDay(inst,inst._selectedMonth,inst._selectedYear,$k('td.datepicker_daysCellOver',inst._datepickerDiv)[0]);return false;case 27:$k.datepicker.hideDatepicker(inst._get('speed'));break;case 33:$k.datepicker._adjustDate(inst,(e.ctrlKey?-1:-inst._get('stepMonths')),(e.ctrlKey?'Y':'M'));break;case 34:$k.datepicker._adjustDate(inst,(e.ctrlKey?+1:+inst._get('stepMonths')),(e.ctrlKey?'Y':'M'));break;case 35:if(e.ctrlKey){$k.datepicker._clearDate(inst);}
break;case 36:if(e.ctrlKey){$k.datepicker._gotoToday(inst);}
break;case 37:if(e.ctrlKey){$k.datepicker._adjustDate(inst,-1,'D');}
break;case 38:if(e.ctrlKey){$k.datepicker._adjustDate(inst,-7,'D');}
break;case 39:if(e.ctrlKey){$k.datepicker._adjustDate(inst,+1,'D');}
break;case 40:if(e.ctrlKey){$k.datepicker._adjustDate(inst,+7,'D');}
break;}}
else if(e.keyCode==36&&e.ctrlKey){$k.datepicker.showFor(this);}},_doKeyPress:function(e){var inst=$k.datepicker._getInst(this._calId);var chars=$k.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=$k(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=$k(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=$k(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]*$k('.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=$k('<input type="text" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$k('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($k.blockUI){$k.blockUI(this._datepickerDiv);}
return this;},showFor:function(control){control=(control.jquery?control[0]:(typeof control=='string'?$k(control)[0]:control));var input=(control.nodeName&&control.nodeName.toLowerCase()=='input'?control:this);if(input.nodeName.toLowerCase()!='input'){input=$k('input',input.parentNode)[0];}
if($k.datepicker._lastInput==input){return;}
if($k(input).isDisabledDatepicker()){return;}
var inst=$k.datepicker._getInst(input._calId);var beforeShow=inst._get('beforeShow');extendRemove(inst._settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$k.datepicker.hideDatepicker('');$k.datepicker._lastInput=input;inst._setDateFromField(input);if($k.datepicker._inDialog){input.value='';}
if(!$k.datepicker._pos){$k.datepicker._pos=$k.datepicker._findPos(input);$k.datepicker._pos[1]+=input.offsetHeight;}
var isFixed=false;$k(input).parents().each(function(){isFixed|=$k(this).css('position')=='fixed';});if(isFixed&&$k.browser.opera){$k.datepicker._pos[0]-=document.documentElement.scrollLeft;$k.datepicker._pos[1]-=document.documentElement.scrollTop;}
if(!$k.datepicker._inDialog){var iconOffset=7;var horizontalOffset=$k(inst._input).outerWidth()-$k.datepicker._datepickerDiv.outerWidth()-iconOffset;$k.datepicker._pos[0]=$k.datepicker._pos[0]+horizontalOffset;}
inst._datepickerDiv.css('position',($k.datepicker._inDialog&&$k.blockUI?'static':(isFixed?'fixed':'absolute'))).css('left',$k.datepicker._pos[0]+'px').css('top',$k.datepicker._pos[1]+'px');$k.datepicker._pos=null;$k.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(){$k.datepicker._datepickerShowing=true;$k.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?$k.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&&$k.browser.msie?document.documentElement.scrollTop:0))>(browserHeight+scrollY)){inst._datepickerDiv.css('top',Math.max(scrollY,pos[1]-(this._inDialog?0:inst._datepickerDiv.height())-
(isFixed&&$k.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(){$k.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($k.blockUI){$k.unblockUI();$k('body').append(this._datepickerDiv);}}
this._inDialog=false;}
this._curInst=null;},_tidyDialog:function(inst){inst._datepickerDiv.removeClass('datepicker_dialog');$k('.datepicker_prompt',inst._datepickerDiv).remove();},_checkExternalClick:function(event){if(!$k.datepicker._curInst){return;}
var target=$k(event.target);if((target.parents("#datepicker").length==0)&&(target.attr('class')!='datepicker_trigger')&&$k.datepicker._datepickerShowing&&!($k.datepicker._inDialog&&$k.blockUI)){$k.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&&!$k.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($k(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){$k('.datepicker_table td').removeClass('datepicker_currentDay');$k(td).addClass('datepicker_currentDay');}
this._stayOpen=!this._stayOpen;}
inst._currentDay=$k('a',td).html();inst._currentMonth=month;inst._currentYear=year;this._selectDate(id,inst._formatDate(inst._currentDay,inst._currentMonth,inst._currentYear));if(printRange){selectedDate=$k.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 $k.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 $k.datepicker.iso8601Week(checkDate);}}
return Math.floor(((checkDate-firstMon)/86400000)/7)+1;},dateStatus:function(date,inst){return $k.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=$k.datepicker._register(this);this._selectedDay=0;this._selectedMonth=0;this._selectedYear=0;this._input=null;this._inline=inline;this._datepickerDiv=(!inline?$k.datepicker._datepickerDiv:$k('<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());}}
$k.extend(DatepickerInstance.prototype,{_get:function(name){return(this._settings[name]!=null?this._settings[name]:$k.datepicker._defaults[name]);},_setDateFromField:function(input){this._input=$k(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=$k.datepicker.parseDate(dateFormat,dates[1],settings)||defaultDate;this._endDay=date.getDate();this._endMonth=date.getMonth();this._endYear=date.getFullYear();}
try{date=$k.datepicker.parseDate(dateFormat,dates[0],settings)||defaultDate;}
catch(e){$k.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')||$k.datepicker.iso8601Week;var dateStatus=this._get('statusForDate')||$k.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 $k.datepicker.formatDate(this._get('dateFormat'),date,this._getFormatConfig());}});function extendRemove(target,props){$k.extend(target,props);for(var name in props){if(props[name]==null){target[name]=null;}}
return target;};$k.fn.attachDatepicker=function(settings){return this.each(function(){var inlineSettings=null;for(attrName in $k.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?$k.extend($k.extend({},settings||{}),inlineSettings||{}):settings);var inst=(inst&&!inlineSettings?inst:new DatepickerInstance(instSettings,false));$k.datepicker._connectDatepicker(this,inst);}
else if(nodeName=='div'||nodeName=='span'){var instSettings=$k.extend($k.extend({},settings||{}),inlineSettings||{});var inst=new DatepickerInstance(instSettings,true);$k.datepicker._inlineDatepicker(this,inst);}});};$k.fn.removeDatepicker=function(){var jq=this.each(function(){var $this=$k(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($k.datepicker.markerClassName).unbind('focus',$k.datepicker.showFor).unbind('keydown',$k.datepicker._doKeyDown).unbind('keypress',$k.datepicker._doKeyPress);var wrapper=$this.parents('.datepicker_wrap');if(wrapper){wrapper.replaceWith(wrapper.html());}}
else if(nodeName=='div'||nodeName=='span'){$this.removeClass($k.datepicker.markerClassName).empty();}
if($k('input[_calId='+calId+']').length==0){$k.datepicker._inst[calId]=null;}});if($k('input.hasDatepicker').length==0){$k.datepicker._datepickerDiv.replaceWith('');}
return jq;};$k.fn.enableDatepicker=function(){return this.each(function(){this.disabled=false;$k(this).siblings('button.datepicker_trigger').each(function(){this.disabled=false;});$k(this).siblings('img.datepicker_trigger').css({opacity:'1.0',cursor:''});var $this=this;$k.datepicker._disabledInputs=$k.map($k.datepicker._disabledInputs,function(value){return(value==$this?null:value);});});};$k.fn.disableDatepicker=function(){return this.each(function(){this.disabled=true;$k(this).siblings('button.datepicker_trigger').each(function(){this.disabled=true;});$k(this).siblings('img.datepicker_trigger').css({opacity:'0.5',cursor:'default'});var $this=this;$k.datepicker._disabledInputs=$k.map($k.datepicker._disabledInputs,function(value){return(value==$this?null:value);});$k.datepicker._disabledInputs[$k.datepicker._disabledInputs.length]=this;});};$k.fn.isDisabledDatepicker=function(){if(this.length==0){return false;}
for(var i=0;i<$k.datepicker._disabledInputs.length;i++){if($k.datepicker._disabledInputs[i]==this[0]){return true;}}
return false;};$k.fn.changeDatepicker=function(name,value){var settings=name||{};if(typeof name=='string'){settings={};settings[name]=value;}
return this.each(function(){var inst=$k.datepicker._getInst(this._calId);if(inst){extendRemove(inst._settings,settings);$k.datepicker._updateDatepicker(inst);}});};$k.fn.showDatepicker=function(){$k.datepicker.showFor(this);return this;};$k.fn.setDatepickerDate=function(date,endDate){return this.each(function(){var inst=$k.datepicker._getInst(this._calId);if(inst){inst._setDate(date,endDate);$k.datepicker._updateDatepicker(inst);}});};$k.fn.getDatepickerDate=function(){var inst=(this.length>0?$k.datepicker._getInst(this[0]._calId):null);return(inst?inst._getDate():null);};$k(document).ready(function(){$k.datepicker=new Datepicker();$k(document.body).append($k.datepicker._datepickerDiv).mousedown($k.datepicker._checkExternalClick);});

(function($) {

	// load time leg work
	var hitCountQueue = [];

	// ensure that SNI.Config.Nielsen exists, and has at least a default value for the customer identifier param
	SNI.Config = $.extend(true, {}, {
		Nielsen: {
			ci: "us-200639h",
			autoTrackPages: false,
			useIframeTracking: true,
			hitCountIframeContainer: "hitCountIframeContainer",
			hitCountHtmlUrl: ((location.host == "www.hgtv.com") ? "http://img.hgtv.com/webhgtv/hg20/html/fixHits.html" : "http://frontend.scrippsnetworks.com/hgtv/fixHits.html")
		}
	}, SNI.Config);

	var config = SNI.Config.Nielsen;
	config.element = $("<div id=\"" + config.hitCountIframeContainer + "\" style=\"display: none;\"></div>");

	// add the Nielsen namespace to the SNI namespace
	$.extend(true, SNI, {
		Nielsen: {
			hitCount: function() {
				
				hitCountQueue.push(true);
			},
			trackPageView: function() {
				var d = new Image(1, 1);
				d.onerror = d.onload = function () {
					d.onerror = d.onload = null;
				};
				d.src = ["//secure-us.imrworldwide.com/cgi-bin/m?ci=", SNI.Config.Nielsen.ci, "&cg=0&cc=1&si=", escape(window.location.href), "&rp=",
				escape(document.referrer), "&ts=compact&rnd=", (new Date()).getTime()].join('');
			},
			trackNSE: function() {
				if(config.useIframeTracking) {
					SNI.Nielsen.hitCount();
				}
				var d = new Image(1, 1);
				d.src = ["//secure-us.imrworldwide.com/cgi-bin/m?ci=", SNI.Config.Nielsen.ci, "&cg=0&cc=1&si=",
				escape(window.location.href), "&rp=", escape(document.referrer),
				"&c0=usergen,1&rnd=", (new Date()).getTime()].join('');
			}
		}
	});
	
	$(document).ready(function(){
		$(document.body).append(config.element);
		// make a page-level tracking call for Nielsen if autoTrackPages is set to true
		if(config.autoTrackPages) {
			SNI.Nielsen.trackPageView();
		}
		// redefining the function to process queues without ready check
		SNI.Nielsen.hitCount = function() {
			var cacheBuster = new Date();
			// append iframe to “element” with dummy page as src
			$(config.element).append('<iframe class="hitCounter" src="' + config.hitCountHtmlUrl + "?t=" + cacheBuster.getTime()+'" width="0" height="0" frameborder="0" style="height:0; width:0; display:none;"></iframe>');
			return;
		};

		// process the hitCountQueue array by calling hitCount for each item in queue
		$.each(hitCountQueue, function(){
			SNI.Nielsen.hitCount();
		});
	});
})(jQuery);
// site-specific wrapper for core Nielsen page tracking functionality

(function($) {
	var o = this;
	
	// define exclusion conditions for pages NOT to track
	o.exclPg = function() {
		var retVal = false;
		var re = /kudzu\.com$/;
		retVal = retVal || re.test(window.location.hostname);
		return retVal;
	}
	
	o.trackPageView = function() {
		if (!o.exclPg()) SNI.Nielsen.trackPageView();
	}
	
	SNI.HGTV.Nielsen = o;
}) (jQuery);


