/*global PINT */
// Built from PINJSJ revision #11817 
if(typeof this.PINT=="undefined"){var PINT={};}PINT.util={};PINT.connection={};PINT.widget={};
if(!PINT.util){PINT.util={};}PINT.util.getQueryParamValue=function(sParam){var aTemp=document.location.search.split('&');for(var i=0;i<aTemp.length;i++){var aTemp2=aTemp[i].split('=');if(aTemp2[0]==sParam){return aTemp2[1];}}return "";};PINT.util.setWindowTitle=function(sTitle){document.title=sTitle;};PINT.util.setWindowStatus=function(sStatus){window.status=sStatus;};PINT.util.getRandomString=function(iLength,sChars){iLength=iLength||8;sChars=sChars||"abcdefghijklmnopqrstuvwxyz0123456789";var sRandomString="";for(var i=0;i<iLength;i++){sRandomString += sChars.charAt(parseInt(sChars.length*Math.random(),10));}return sRandomString;};PINT.util.getCurrentFileName=function(){var sUrl=decodeURI(window.location.pathname);var iStart=sUrl.lastIndexOf("/")+1;var iEnd=(sUrl.indexOf("?")>0)? sUrl.indexOf("?"):sUrl.length;return sUrl.substring(iStart,iEnd);};PINT.util.getCurrentFilePath=function(){var sUrl=decodeURI(window.location.pathname);var iStart=sUrl.lastIndexOf("/");return sUrl.substring(0,iStart);};PINT.util.getCurrentDirectory=function(){var sFilePath=this.getCurrentFilePath();var aDirectories=sFilePath.split("/");return aDirectories.length&&aDirectories[aDirectories.length-1] !== "" ? aDirectories[aDirectories.length-1]:"";};PINT.util.encodeJSON=function(sData){sData=sData.replace(/\[/gi,"[");sData=sData.replace(/\]/gi,"]");sData=sData.replace(/\{/gi,"{");sData=sData.replace(/\}/gi,"}");sData=sData.replace(/\'/gi,"0x27");sData=sData.replace(/\"/gi,"0x22");sData=sData.replace(/\\/gi,"\\\\");sData=sData.replace(/\t/gi,"0x09");sData=sData.replace(/\n/gi,"0x0A");sData=sData.replace(/\f/gi,"0x0C");sData=sData.replace(/\r/gi,"0x0D");return sData;};PINT.util.decodeJSON=function(sData){sData=sData.replace(/\[/gi,"[");sData=sData.replace(/\]/gi,"]");sData=sData.replace(/\{/gi,"{");sData=sData.replace(/\}/gi,"}");sData=sData.replace(/0x27/gi,"'");sData=sData.replace(/0x28/gi,'"');sData=sData.replace(/\\\\/gi,"\\");sData=sData.replace(/0x09/gi,"\t");sData=sData.replace(/0x0A/gi,"\n");sData=sData.replace(/0x0C/gi,"\f");sData=sData.replace(/0x0D/gi,"\r");return sData;};PINT.util.obfuscateMailto=function(sDomain,sUser,sText){var sLinkText;if(sText === null){sLinkText=sUser+"&#"+64+";"+sDomain;}else{sLinkText=sText;}document.write("<a href=\"m&#"+97+";il&#"+116+";o:"+ sUser +"&#"+64+";"+sDomain+"\">"+sLinkText+"</a>");};PINT.util.anchorPopupWindows=function(){if(!document.getElementsByTagName){return;}var getPopupAnchors=function(el){var rel=el.getAttribute("rel");if(rel){return(rel.indexOf("popup")>=0);}else{return false;}};var anchors=YAHOO.util.Dom.getElementsBy(getPopupAnchors,"a");var currentAnchor;for(var anchorIndex=0; anchorIndex<anchors.length; anchorIndex++){var targetLink,relArray,relInformation,windowAttributes,javascriptTargetLink;var location,menubar,resizable,scrollbars,status,toolbar;var width,height,windowType,windowName;currentAnchor=anchors[anchorIndex];targetLink=currentAnchor.getAttribute("href"); relInformation=currentAnchor.getAttribute("rel"); if(relInformation&&targetLink){relArray=relInformation.split("|");var size=PINT.util.browser.getSize();if(relArray.length>=4){if(relArray[1]!="null"){width=parseInt(relArray[1],10)? parseInt(relArray[1],10):400;}else{width=size[2];}if(relArray[2]!="null"){height=parseInt(relArray[2],10)? parseInt(relArray[2],10):400;}else{height=size[3];}windowType=relArray[3];windowAttributes="width="+width+",height="+height; if(windowType=="custom"){if(relArray.length<10){return false;}location=parseInt(relArray[4],10)? parseInt(relArray[4],10): 0;menubar=parseInt(relArray[5],10)? parseInt(relArray[5],10): 0;resizable=parseInt(relArray[6],10)? parseInt(relArray[6],10): 0;scrollbars=parseInt(relArray[7],10)? parseInt(relArray[7],10): 0;status=parseInt(relArray[8],10)? parseInt(relArray[8],10): 0;toolbar=parseInt(relArray[9],10)? parseInt(relArray[9],10): 0;if(relArray.length==11){windowName=relArray[10];}else{windowName="popupWindow";}windowAttributes += ",location="+ location +",menubar="+menubar +",resizable="+resizable+",scrollbars="+scrollbars+",status="+status+",toolbar="+ toolbar;}else{if(relArray.length==5){windowName=relArray[4];}else{windowName="popupWindow";}if(windowType=="standard"){windowAttributes += ",location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0";}else if(windowType=="resize"){windowAttributes += ",location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0";}else if(windowType=="scrollbar"){windowAttributes += ",location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0";}else if(windowType=="blank"){windowAttributes="";}else{return false;}}var parameters=[targetLink,windowName,windowAttributes];YAHOO.util.Event.addListener(currentAnchor,'click',PINT.util.popupWindow,parameters);}}}};PINT.util.popupWindow=function(e,params){if(params.length<1){return false;}var popupWin=null;popupWin=window.open(params[0],params[1],params[2]);YAHOO.util.Event.preventDefault(e);};PINT.util.getUrlSeperator=function(sUrl){return(sUrl.indexOf("?")!=-1 ? "&":"?");};PINT.util.getPropertyFromClass=function(str,widget,property){var regex=new RegExp(widget+"-"+property+"-(.+)");var classNames=str.split(' ');if(classNames.length){for(var i=0; i<classNames.length; i++){var hasMatch=classNames[i].match(regex);if(hasMatch){return hasMatch[1];}}}else{return null;}};PINT.util.pngFix=function(){for(var i=0; i<document.images.length; i++){var img=document.images[i];var imgName=img.src.toUpperCase();if(imgName.substring(imgName.length-3,imgName.length)=="PNG"){var imgID=img.id ? "id='"+img.id+"' ":"";var imgClass=img.className ? "class='pngFix "+img.className+"' ":"";var imgTitle=img.title ? "title='"+img.title+"' ":"title='"+img.alt+"' ";var imgStyle="display:inline-block;"+img.style.cssText;if(img.align=="left"){imgStyle="float:left;"+imgStyle;}if(img.align=="right"){imgStyle="float:right;"+imgStyle;}if(img.parentElement.href){imgStyle="cursor:hand;"+imgStyle;}var strNewHTML="<span "+imgID+imgClass+imgTitle+"style=\""+"width:"+img.width+"px; height:"+img.height+"px;"+imgStyle+"; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'"+img.src+"\',sizingMethod='scale');\"></span>";img.outerHTML=strNewHTML;i=i-1;}}};
var sUserAgent=navigator.userAgent.toLowerCase();if(!PINT.env){PINT.env={};PINT.env.sUA=navigator.userAgent.toLowerCase();PINT.env.fVersion=navigator.appVersion;}if(!PINT.util.browser){PINT.util.browser={};}PINT.util.browser.bNetscape4=(typeof document.layers !="undefined")?true:false;PINT.util.browser.bSafari=(PINT.env.sUA.indexOf("safari")!=-1);PINT.util.browser.bKonqueror=(PINT.env.sUA.indexOf("konqueror")!=-1);PINT.util.browser.bNetscape6=(PINT.env.sUA.indexOf("netscape")!=-1);PINT.util.browser.bMozilla=((PINT.env.sUA.indexOf("mozilla")!=-1)&&(PINT.env.sUA.indexOf("gecko")!=-1)&&(PINT.env.sUA.indexOf("konqueror")==-1));PINT.util.browser.bFirefox=(PINT.env.sUA.indexOf("firefox")!=-1);PINT.util.browser.bOpera=(PINT.env.sUA.indexOf("opera")!=-1);PINT.util.browser.bIe=((PINT.env.sUA.indexOf("msie")!=-1)&&(PINT.env.sUA.indexOf("opera")==-1));PINT.util.browser.bIe4=((PINT.env.sUA.indexOf("msie 4.")!=-1)&&(PINT.env.sUA.indexOf("opera")==-1));PINT.util.browser.bIe5=((PINT.env.sUA.indexOf("msie 5.")!=-1)&&(PINT.env.sUA.indexOf("opera")==-1));PINT.util.browser.bIe6=((PINT.env.sUA.indexOf("msie 6.")!=-1)&&(PINT.env.sUA.indexOf("opera")==-1));PINT.util.browser.bIe7=((PINT.env.sUA.indexOf("msie 7.")!=-1)&&(PINT.env.sUA.indexOf("opera")==-1));PINT.util.browser.bIe8=((PINT.env.sUA.indexOf("msie 8.")!=-1)&&(PINT.env.sUA.indexOf("opera")==-1));PINT.util.browser.bChrome=(PINT.env.sUA.indexOf("chrome")!=-1);PINT.util.browser.bIphone=(PINT.env.sUA.indexOf("iPhone")!=-1);PINT.util.browser.bAndroid=(PINT.env.sUA.indexOf("Android")!=-1);PINT.util.browser.bOmniWeb=(PINT.env.sUA.indexOf("omniweb")!=-1);PINT.util.browser.bWebTv=(PINT.env.sUA.indexOf("webtv")!=-1);PINT.util.browser.bICab=(PINT.env.sUA.indexOf("icab")!=-1);PINT.util.browser.bMac=(PINT.env.sUA.indexOf("mac")!=-1);PINT.util.browser.sUserAgent=PINT.env.sUA.userAgent;PINT.util.browser.fVersion=parseFloat(PINT.env.fVersion);PINT.util.browser.setCookie=function(sName,sValue,iExpYear,iExpMonth,iExpDay,sPath,sDomain,bSecure){var sCookie=sName+"="+encodeURIComponent(sValue);if(iExpYear&&iExpMonth&&iExpDay){var oExpireDate=new Date(iExpYear,iExpMonth,iExpDay);sCookie += "; expires="+oExpireDate.toGMTString();}if(sPath){if(sPath=="/"){sCookie += "; path=/";}else{sCookie += "; path="+encodeURIComponent(sPath);}}if(sDomain){sCookie += "; domain="+encodeURIComponent(sDomain);}if(bSecure){sCookie += "; secure";}document.cookie=sCookie;};PINT.util.browser.getCookie=function(sName){var iStart=document.cookie.indexOf(sName+"=");var iLen=iStart+sName.length+1;if(!iStart&&(sName!=document.cookie.substring(0,sName.length))){return null;}if(iStart==-1){return null;}var iEnd=document.cookie.indexOf(";",iLen);if(iEnd==-1){iEnd=document.cookie.length;}return decodeURIComponent(document.cookie.substring(iLen,iEnd));};PINT.util.browser.deleteCookie=function(sName){var oExpireDate=new Date();oExpireDate.setTime(oExpireDate.getTime()-1);document.cookie=sName += "=; expires="+oExpireDate.toGMTString();};PINT.util.browser.getBrowserInfo=function(){var sOs="Others";if(PINT.env.sUA.indexOf("linux")!=-1){sOs="Linux";}else if(PINT.env.sUA.indexOf("x11")!=-1){sOs="Unix";}else if(PINT.env.sUA.indexOf("mac")!=-1){sOs="Mac";}else if(PINT.env.sUA.indexOf("win")!=-1){sOs="Windows";}var sBrowser="Others";if(PINT.util.browser.bIe){sBrowser="Internet Explorer";}else if(PINT.util.browser.bNetscape4||PINT.util.browser.bNetscape6){sBrowser="Netscape Navigator";}else if(PINT.util.browser.bOpera){sBrowser="Opera";}else if(PINT.util.browser.bSafari){sBrowser="Safari";}else if(PINT.util.browser.bKonqueror){sBrowser="Konqueror";}else if(PINT.util.browser.bMozilla&&!PINT.util.browser.bFirefox){sBrowser="Mozilla";}else if(PINT.util.browser.bFirefox){sBrowser="Firefox";}else if(PINT.util.browser.bOmniWeb){sBrowser="OmniWeb";}else if(PINT.util.browser.bWebTv){sBrowser="WebTv";}else if(PINT.util.browser.bICab){sBrowser="iCab";}else if(PINT.util.browser.bIphone){sBrowser="iPhone";}else if(PINT.util.browser.bAndroid){sBrowser="Android";}else if(PINT.util.browser.bChrome){sBrowser="Chrome";}return [sOs,sBrowser,PINT.util.browser.fVersion];};PINT.util.browser.getResolution=function(){return [screen.width,screen.height];};PINT.util.browser.getSize=function(){var iDocWidth=0;var iDocHeight=0;var iWinWidth;var iWinHeight;if(typeof window.innerWidth=="number"){iWinWidth=window.innerWidth;iWinHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){iWinWidth=document.documentElement.clientWidth;iWinHeight=document.documentElement.clientHeight;}else if(document.body&&document.body.clientWidth){iWinWidth=document.body.clientWidth;iWinHeight=document.body.clientHeight;}if(typeof window.innerWidth=="number"){if(window.innerWidth>0&&window.innerWidth>iDocWidth){iDocWidth=window.innerWidth;}if(window.innerHeight>0&&window.innerHeight>iDocHeight){iDocHeight=window.innerHeight;}}if(document.body&&typeof document.body.clientWidth=="number"){if(document.body.clientWidth>0&&document.body.clientWidth>iDocWidth){iDocWidth=document.body.clientWidth;}if(document.body.clientHeight>0&&document.body.clientHeight>iDocHeight){iDocHeight=document.body.clientHeight;}}if(document.documentElement&&typeof document.documentElement.clientWidth=="number"){if(document.documentElement.clientWidth>0&&document.documentElement.clientWidth>iDocWidth){iDocWidth=document.documentElement.clientWidth;}if(document.documentElement.clientHeight>0&&document.documentElement.clientHeight>iDocHeight){iDocHeight=document.documentElement.clientHeight;}}return [iWinWidth,iWinHeight,iDocWidth,iDocHeight];};PINT.util.browser.getScroll=function(){var iScrollLeft=0;var iScrollTop=0;if(typeof window.pageXOffset=="number"){if(window.pageXOffset>0&&window.pageXOffset>iScrollLeft){iScrollLeft=window.pageXOffset;}if(window.pageYOffset>0&&window.pageYOffset>iScrollTop){iScrollTop=window.pageYOffset;}}if(document.body&&typeof document.body.scrollLeft=="number"){if(document.body.scrollLeft>0&&document.body.scrollLeft>iScrollLeft){iScrollLeft=document.body.scrollLeft;}if(document.body.scrollTop>0&&document.body.scrollTop>iScrollTop){iScrollTop=document.body.scrollTop;}}if(document.documentElement&&typeof document.documentElement.scrollLeft=="number"){if(document.documentElement.scrollLeft>0&&document.documentElement.scrollLeft>iScrollLeft){iScrollLeft=document.documentElement.scrollLeft;}if(document.documentElement.scrollTop>0&&document.documentElement.scrollTop>iScrollTop){iScrollTop=document.documentElement.scrollTop;}}return [iScrollLeft,iScrollTop];};PINT.util.browser.redirectUnsupportedBrowser=function(sRedirectUrl){var browserUpgradeFile="";var sCurrentFileName=PINT.util.getCurrentFileName();if(!document.getElementById&&(browserUpgradeFile.indexOf(sCurrentFileName)=="-1"||sCurrentFileName === "")){window.location.replace(sRedirectUrl);}};
PINT.util.flash=function(){this.aParams=arguments[0]||[];this.sId=this.aParams.id||Math.floor(Math.random()*5000+1);this.sSwf=this.aParams.swf||"";this.iWidth=this.aParams.width||0;this.iHeight=this.aParams.height||0;this.sAlign=this.aParams.align||"middle";this.iVersion=this.aParams.version||6;this.sImageMap=this.aParams.imagemap||"";this.sCodeBase=this.iVersion+",0,0,0";this.sDefaultImage=this.aParams.defaultimage||"";this.sNoScriptId=this.aParams.noscriptId||"";this.sAltText=this.aParams.alttext||"Please <a href='http://www.macromedia.com/go/getflashplayer'>upgrade your Flash Player</a>.";this.sBypassText=this.aParams.bypasstext||"";this.sRedirectUrl=this.aParams.redirecturl||"";this.sBgColor=this.aParams.bgcolor||"";this.aParams={};this.aVars={};this.addParam=function(sName,sValue){this.aParams[sName]=sValue;};this.getParams=function(sName){if(sName){return this.aParams[sName];}else{return this.aParams;}};this.addVariable=function(sName,sValue){this.aVars[sName]=sValue;};this.getVars=function(sName){if(sName){return this.aVars[sName];}else{return this.aVars;}};this.getParamTags=function(){var sParamTags="";for(var sParam in this.getParams()){if(typeof sParam=="string"){sParamTags += '<param name="'+sParam+'" value="'+this.getParams(sParam)+'" />';}}if(sParamTags === ""){sParamTags=null;}return sParamTags;};this.getHTML=function(){var sFlashHTML="";if(window.ActiveXObject&&navigator.userAgent.indexOf('Mac')==-1){var protocol=(("https:"==document.location.protocol)? "https://":"http://");sFlashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+protocol+'fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.sCodeBase+'" width="'+this.iWidth+'" height="'+this.iHeight+'" id="'+this.sId+'" name="'+this.sId+'" align="'+this.sAlign+'">';sFlashHTML += '<param name="movie" value="'+this.sSwf+'" />';if(this.getParamTags()!== null){sFlashHTML += this.getParamTags();}if(this.getVariablePairs()!== null){sFlashHTML += '<param name="flashVars" value="'+this.getVariablePairs()+'" />';}sFlashHTML += '</object>';}else{sFlashHTML += '<embed type="application/x-shockwave-flash" src="'+this.sSwf+'" width="'+this.iWidth+'" height="'+this.iHeight+'" id="'+this.sId+'" name="'+this.sId+'" align="'+this.sAlign+'"';for(var sParam in this.getParams()){if(typeof sParam=="string"){sFlashHTML += ' '+sParam+'="'+this.getParams(sParam)+'"';}}if(this.getVariablePairs()!== null){sFlashHTML += ' flashVars="'+this.getVariablePairs()+'"';}sFlashHTML += '></embed>';}return sFlashHTML;};this.getVariablePairs=function(){var aVariablePairs=[];for(var sName in this.getVars()){if(typeof sName=="string"){aVariablePairs.push(sName+"="+encodeURIComponent(this.getVars(sName)));}}if(aVariablePairs.length>0){return aVariablePairs.join("&");}else{return null;}};this.render=function(sIdContainer){this.addParam("quality","high");if(this.sBgColor){this.addParam("bgcolor",this.sBgColor);}this.sDetect=PINT.util.getQueryParamValue("detectflash");if(this.detectFlash(this.iVersion)||this.sDetect=="false"){if(sIdContainer){document.getElementById(sIdContainer).innerHTML=this.getHTML();}else{document.write(this.getHTML());}}else{if(this.sRedirectUrl !== ""){document.location.replace(this.sRedirectUrl);}else if(this.sNoScriptId !== ""){var oElement=document.getElementById(this.sNoScriptId);if(oElement){oElement.style.display=oElement.parentNode.style.display;}}else if(this.sDefaultImage !== ""){var sImageString="<img src=\""+this.sDefaultImage+"\" width=\""+this.iWidth+"\" height=\""+this.iHeight+"\" border=\"0\" alt=\"\"";if(typeof this.sImageMap!="undefined"&&this.sImageMap !== ""){sImageString += " usemap=\"#"+this.sImageMap+"\" ";}sImageString += " class=\"inlineimage\" />";if(sIdContainer){document.getElementById(sIdContainer).innerHTML=sImageString;}else{document.write(sImageString);}}else{if(sIdContainer){document.getElementById(sIdContainer).innerHTML=this.sAltText+""+this.sBypassText;}else{document.write(this.sAltText+""+this.sBypassText);}}}};this.getFlashVersion=function(){var iFlashVersion=0;if(navigator.plugins&&navigator.plugins.length){var swVer2=navigator.plugins["Shockwave Flash 2.0"] ? " 2.0":"";var oPlugin=navigator.plugins["Shockwave Flash"+swVer2];if(oPlugin){if(oPlugin.description){var sDescription=oPlugin.description;var aDescription=oPlugin.description.split(" ");var aMajorVersion=aDescription[2].split(".");iFlashVersion=aMajorVersion[0];}}}else{var axo;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.10");iFlashVersion=10;}catch(e){}if(!iFlashVersion){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.9");iFlashVersion=9;}catch(e1){}}if(!iFlashVersion){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.8");iFlashVersion=8;}catch(e2){}}if(!iFlashVersion){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");iFlashVersion=7;}catch(e3){}}if(!iFlashVersion){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");iFlashVersion=6;}catch(e4){}}}return iFlashVersion;};this.detectFlash=function(iVersion){return(this.getFlashVersion()>=iVersion);};};var PINT_FlashObject=function(swf,id,w,h,defaultImage,ver,imageMap,c){var f=new PINT.util.flash({swf:swf,width:w,height:h,defaultimage:defaultImage,version:ver,imagemap:imageMap,bgcolor:c});f.write=function(){this.render(arguments.length==1 ? arguments[0]:null);};return f;};
 PINT.widget.lightbox={};PINT.widget.lightbox.validFileTypes={images:['.png','.gif','.jpg'],videos:['.swf','.flv']};PINT.widget.lightbox.defaultDimensions={iframe:{width:600,height:500},video:{width:400,height:222}};PINT.widget.lightbox.panel=null;PINT.widget.lightbox.panelLoading=null;PINT.widget.lightbox.init=function(){var anchors=YAHOO.util.Dom.getElementsBy(PINT.widget.lightbox.isValidAnchor,'a',document.body,PINT.widget.lightbox.applyToAnchor);var areas=YAHOO.util.Dom.getElementsBy(PINT.widget.lightbox.isValidAnchor,'area',document.body,PINT.widget.lightbox.applyToAnchor);if(anchors.length||areas.length){var params=arguments.length==1 ? arguments[0]:{};var configPanel=(params.configPanel ? params.configPanel:{visible:false,fixedcenter:true,constraintoviewport:true,draggable:false,modal:true,width:"20px"});var configPanelLoading=(params.configPanelLoading ? params.configPanelLoading:{width: "240px",fixedcenter: true,close: false,draggable: false,modal: true,visible: false});var loadingHeader=(params.loadingHeader ? params.loadingHeader:"Loading,&nbsp;please&nbsp;wait...");var loadingBody=(params.loadingBody ? params.loadingBody:"<img src=\"http://us.i1.yimg.com/us.yimg.com/i/us/per/gr/gp/rel_interstitial_loading.gif\"/>");PINT.widget.lightbox.panel =new YAHOO.widget.Panel("pintboxPanel",configPanel);PINT.widget.lightbox.panel.setHeader("&nbsp;");PINT.widget.lightbox.panel.setBody("&nbsp;");PINT.widget.lightbox.panel.render(document.body);PINT.widget.lightbox.panelLoading=new YAHOO.widget.Panel("pintboxLoading",configPanelLoading);PINT.widget.lightbox.panelLoading.setHeader(loadingHeader);PINT.widget.lightbox.panelLoading.setBody(loadingBody);PINT.widget.lightbox.panelLoading.render(document.body);PINT.widget.lightbox.panel.beforeHideEvent.subscribe(function(){PINT.widget.lightbox.panel.setBody("&nbsp;");});YAHOO.widget.Overlay.windowScrollEvent.subscribe(PINT.widget.lightbox.checkDimensions);YAHOO.widget.Overlay.windowResizeEvent.subscribe(PINT.widget.lightbox.checkDimensions);}};PINT.widget.lightbox.applyToAnchor=function(el){YAHOO.util.Event.addListener(el,"click",PINT.widget.lightbox.showPanel,{path:(el.getAttribute('href')?el.getAttribute('href'):''),title:(el.getAttribute('title')?el.getAttribute('title'):'&nbsp;'),classNames:(el.className?el.className:'')},true);};PINT.widget.lightbox.isValidAnchor=function(el){return YAHOO.util.Dom.hasClass(el,'pintbox')?true:false;};PINT.widget.lightbox.showPanel=function(e,params,scopeOverride){YAHOO.util.Event.preventDefault(e);PINT.widget.lightbox.panelLoading.show();var i,objToShow;var isVideo,isImage=false;if(scopeOverride){objToShow=params;}else{objToShow=this;}for(i=0; i<PINT.widget.lightbox.validFileTypes.images.length; i++){if(objToShow.path.toLowerCase().indexOf(PINT.widget.lightbox.validFileTypes.images[i])>-1){isImage=true;}}for(i=0; i<PINT.widget.lightbox.validFileTypes.videos.length; i++){if(objToShow.path.toLowerCase().indexOf(PINT.widget.lightbox.validFileTypes.videos[i])>-1){isVideo=true;}}if(isImage){var img=new Image();img.onload=function(){var paramWidth=PINT.util.getPropertyFromClass(objToShow.classNames,'pintbox','width');var paramHeight=PINT.util.getPropertyFromClass(objToShow.classNames,'pintbox','height');var imageWidth=parseInt(img.width,10);var imageHeight=parseInt(img.height,10);var resizedWidth,resizedHeight;if(imageWidth>paramWidth||imageHeight>paramHeight){if(paramWidth&&imageWidth>paramWidth){resizedWidth=paramWidth;resizedHeight=(img.height*paramWidth)/img.width;if(paramHeight&&resizedHeight>paramHeight){resizedWidth=(img.width*paramHeight)/img.height;resizedHeight=paramHeight;}}if(paramHeight&&imageHeight>paramHeight){resizedWidth=(img.width*paramHeight)/img.height;resizedHeight=paramHeight;if(paramWidth&&resizedWidth>paramWidth){resizedWidth=paramWidth;resizedHeight=(img.height*paramWidth)/img.width;}}imageHeight=resizedHeight;imageWidth=resizedWidth;YAHOO.util.Dom.setStyle(img,'height',imageHeight+'px');YAHOO.util.Dom.setStyle(img,'width',imageWidth+'px');}PINT.widget.lightbox.panel.cfg.setProperty('width',(parseInt(imageWidth,10)+parseInt(YAHOO.util.Dom.getStyle(PINT.widget.lightbox.panel.body,'padding-left'),10)+parseInt(YAHOO.util.Dom.getStyle(PINT.widget.lightbox.panel.body,'padding-right'),10))+"px");PINT.widget.lightbox.panel.setHeader(params.title);PINT.widget.lightbox.panel.setBody(img);PINT.widget.lightbox.panelLoading.hide();PINT.widget.lightbox.panel.show();};img.src=objToShow.path;}else if(isVideo){objToShow.width=(PINT.util.getPropertyFromClass(objToShow.classNames,'pintbox','width')? PINT.util.getPropertyFromClass(objToShow.classNames,'pintbox','width'):PINT.widget.lightbox.defaultDimensions.video.width);objToShow.height=(PINT.util.getPropertyFromClass(objToShow.classNames,'pintbox','height')? PINT.util.getPropertyFromClass(objToShow.classNames,'pintbox','height'):PINT.widget.lightbox.defaultDimensions.video.height);PINT.widget.lightbox.panel.body.id='videoCon';PINT.widget.lightbox.panel.setHeader(params.title);PINT.widget.lightbox.panel.cfg.setProperty('width',(parseInt(objToShow.width,10)+parseInt(YAHOO.util.Dom.getStyle(PINT.widget.lightbox.panel.body,'padding-left'),10)+parseInt(YAHOO.util.Dom.getStyle(PINT.widget.lightbox.panel.body,'padding-right'),10))+"px");var flash=new PINT.util.flash({"id":"swf","swf":PINT.themeRootDirectory+"/assets/flash/player.swf","width":objToShow.width,"height":objToShow.height});flash.addParam("wmode","transparent");flash.addParam("allowfullscreen","true");flash.addParam("allowscriptaccess","always");flash.addParam("flashvars","file="+objToShow.path);flash.render("videoCon");PINT.widget.lightbox.panel.render(document.body);PINT.widget.lightbox.panelLoading.hide();PINT.widget.lightbox.panel.show();}else{var iframe=document.createElement('iframe');objToShow.width=(PINT.util.getPropertyFromClass(objToShow.classNames,'pintbox','width')? PINT.util.getPropertyFromClass(objToShow.classNames,'pintbox','width'):PINT.widget.lightbox.defaultDimensions.iframe.width);objToShow.height=(PINT.util.getPropertyFromClass(objToShow.classNames,'pintbox','height')? PINT.util.getPropertyFromClass(objToShow.classNames,'pintbox','height'):PINT.widget.lightbox.defaultDimensions.iframe.height);iframe.setAttribute('frameBorder',0);iframe.setAttribute('width',parseInt(objToShow.width,10));iframe.setAttribute('height',parseInt(objToShow.height,10));iframe.src=objToShow.path;PINT.widget.lightbox.panel.cfg.setProperty('width',(parseInt(objToShow.width,10)+parseInt(YAHOO.util.Dom.getStyle(PINT.widget.lightbox.panel.body,'padding-left'),10)+parseInt(YAHOO.util.Dom.getStyle(PINT.widget.lightbox.panel.body,'padding-right'),10))+"px");PINT.widget.lightbox.panel.setHeader(params.title);PINT.widget.lightbox.panel.setBody(iframe);PINT.widget.lightbox.panelLoading.hide();PINT.widget.lightbox.panel.show();}};PINT.widget.lightbox.checkDimensions=function(){if(YAHOO.util.Dom.getViewportHeight()<PINT.widget.lightbox.panel.element.offsetHeight){YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(PINT.widget.lightbox.panel.doCenterOnDOMEvent,PINT.widget.lightbox.panel);}};
/*global PINT */

/* COLORBOX v1.3.6 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 */
(function(c){function r(b,d){d=d==="x"?m.width():m.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function M(b){b=c.isFunction(b)?b.call(i):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function Y(){for(var b in a)if(c.isFunction(a[b])&&b.substring(0,2)!=="on")a[b]=a[b].call(i);a.rel=a.rel||i.rel;a.href=a.href||i.href;a.title=a.title||i.title}function Z(b){i=b;a=c(i).data(q);Y();if(a.rel&&a.rel!=="nofollow"){g= c(".cboxElement").filter(function(){return(c(this).data(q).rel||this.rel)===a.rel});j=g.index(i);if(j<0){g=g.add(i);j=g.length-1}}else{g=c(i);j=0}if(!B){C=B=n;N=i;N.blur();c(document).bind("keydown.cbox_close",function(d){if(d.keyCode===27){d.preventDefault();e.close()}}).bind("keydown.cbox_arrows",function(d){if(g.length>1)if(d.keyCode===37){d.preventDefault();D.click()}else if(d.keyCode===39){d.preventDefault();E.click()}});a.overlayClose&&s.css({cursor:"pointer"}).one("click",e.close);c.event.trigger(aa); a.onOpen&&a.onOpen.call(i);s.css({opacity:a.opacity}).show();a.w=r(a.initialWidth,"x");a.h=r(a.initialHeight,"y");e.position(0);O&&m.bind("resize.cboxie6 scroll.cboxie6",function(){s.css({width:m.width(),height:m.height(),top:m.scrollTop(),left:m.scrollLeft()})}).trigger("scroll.cboxie6")}P.add(D).add(E).add(t).add(Q).hide();R.html(a.close).show();e.slideshow();e.load()}var q="colorbox",F="hover",n=true,e,x=!c.support.opacity,O=x&&!window.XMLHttpRequest,aa="cbox_open",H="cbox_load",S="cbox_complete", T="resize.cbox_resize",s,k,u,p,U,V,W,X,g,m,l,I,J,K,Q,P,t,E,D,R,y,z,v,w,i,N,j,a,B,C,$={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false,scalePhotos:n,scrolling:n,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:n,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:n,slideshow:false, slideshowAuto:n,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false};e=c.fn.colorbox=function(b,d){var h=this;if(!h.length)if(h.selector===""){h=c("<a/>");b.open=n}else return this;h.each(function(){var f=c.extend({},c(this).data(q)?c(this).data(q):$,b);c(this).data(q,f).addClass("cboxElement");if(d)c(this).data(q).onComplete=d});b&&b.open&&Z(h);return this};e.init=function(){function b(d){return c('<div id="cbox'+ d+'"/>')}m=c(window);k=c('<div id="colorbox"/>');s=b("Overlay").hide();u=b("Wrapper");p=b("Content").append(l=b("LoadedContent").css({width:0,height:0}),J=b("LoadingOverlay"),K=b("LoadingGraphic"),Q=b("Title"),P=b("Current"),t=b("Slideshow"),E=b("Next"),D=b("Previous"),R=b("Close"));u.append(c("<div/>").append(b("TopLeft"),U=b("TopCenter"),b("TopRight")),c("<div/>").append(V=b("MiddleLeft"),p,W=b("MiddleRight")),c("<div/>").append(b("BottomLeft"),X=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"}); I=c("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");c("body").prepend(s,k.append(u,I));if(x){k.addClass("cboxIE");O&&s.css("position","absolute")}p.children().bind("mouseover mouseout",function(){c(this).toggleClass(F)}).addClass(F);y=U.height()+X.height()+p.outerHeight(n)-p.height();z=V.width()+W.width()+p.outerWidth(n)-p.width();v=l.outerHeight(n);w=l.outerWidth(n);k.css({"padding-bottom":y,"padding-right":z}).hide();E.click(e.next);D.click(e.prev);R.click(e.close);p.children().removeClass(F); c(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined")return n;else{Z(this);return false}})};e.position=function(b,d){function h(A){U[0].style.width=X[0].style.width=p[0].style.width=A.style.width;K[0].style.height=J[0].style.height=p[0].style.height=V[0].style.height=W[0].style.height=A.style.height}var f=m.height();f=Math.max(f-a.h-v-y,0)/2+m.scrollTop();var o=Math.max(document.documentElement.clientWidth-a.w-w-z,0)/2+m.scrollLeft();b=k.width()===a.w+w&&k.height()=== a.h+v?0:b;u[0].style.width=u[0].style.height="9999px";k.dequeue().animate({width:a.w+w,height:a.h+v,top:f,left:o},{duration:b,complete:function(){h(this);C=false;u[0].style.width=a.w+w+z+"px";u[0].style.height=a.h+v+y+"px";d&&d()},step:function(){h(this)}})};e.resize=function(b){function d(){a.w=a.w||l.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}function h(){a.h=a.h||l.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}function f(G){e.position(G,function(){if(B){if(x){A&&l.fadeIn(100);k[0].style.removeAttribute("filter")}if(a.iframe)l.append("<iframe id='cboxIframe'"+ (a.scrolling?" ":"scrolling='no'")+" name='iframe_"+(new Date).getTime()+"' frameborder=0 src='"+a.href+"' "+(x?"allowtransparency='true'":"")+" />");l.show();Q.show().html(a.title);if(g.length>1){P.html(a.current.replace(/\{current\}/,j+1).replace(/\{total\}/,g.length)).show();E.html(a.next).show();D.html(a.previous).show();a.slideshow&&t.show()}J.hide();K.hide();c.event.trigger(S);a.onComplete&&a.onComplete.call(i);a.transition==="fade"&&k.fadeTo(L,1,function(){x&&k[0].style.removeAttribute("filter")}); m.bind(T,function(){e.position(0)})}})}if(B){var o,A,L=a.transition==="none"?0:a.speed;m.unbind(T);if(b){l.remove();l=c('<div id="cboxLoadedContent"/>').html(b);l.hide().appendTo(I).css({width:d(),overflow:a.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(p);c("#cboxPhoto").css({cssFloat:"none"});O&&c("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",function(){this.style.visibility="inherit"});a.transition=== "fade"&&k.fadeTo(L,0,function(){f(0)})||f(L);if(a.preloading&&g.length>1){b=j>0?g[j-1]:g[g.length-1];o=j<g.length-1?g[j+1]:g[0];o=c(o).data(q).href||o.href;b=c(b).data(q).href||b.href;M(o)&&c("<img />").attr("src",o);M(b)&&c("<img />").attr("src",b)}}else setTimeout(function(){var G=l.wrapInner("<div style='overflow:auto'></div>").children();a.h=G.height();l.css({height:a.h});G.replaceWith(G.children());e.position(L)},1)}};e.load=function(){var b,d,h,f=e.resize;C=n;i=g[j];a=c(i).data(q);Y();c.event.trigger(H); a.onLoad&&a.onLoad.call(i);a.h=a.height?r(a.height,"y")-v-y:a.innerHeight?r(a.innerHeight,"y"):false;a.w=a.width?r(a.width,"x")-w-z:a.innerWidth?r(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=r(a.maxWidth,"x")-w-z;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=r(a.maxHeight,"y")-v-y;a.mh=a.h&&a.h<a.mh?a.h:a.mh}b=a.href;J.show();K.show();if(a.inline){c('<div id="cboxInlineTemp" />').hide().insertBefore(c(b)[0]).bind(H+" cbox_cleanup",function(){c(this).replaceWith(l.children())}); f(c(b))}else if(a.iframe)f(" ");else if(a.html)f(a.html);else if(M(b)){d=new Image;d.onload=function(){var o;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){h=function(){d.height-=d.height*o;d.width-=d.width*o};if(a.mw&&d.width>a.mw){o=(d.width-a.mw)/d.width;h()}if(a.mh&&d.height>a.mh){o=(d.height-a.mh)/d.height;h()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";f(d);g.length>1&&c(d).css({cursor:"pointer"}).click(e.next); if(x)d.style.msInterpolationMode="bicubic"};d.src=b}else c("<div />").appendTo(I).load(b,function(o,A){A==="success"?f(this):f(c("<p>Request unsuccessful.</p>"))})};e.next=function(){if(!C){j=j<g.length-1?j+1:0;e.load()}};e.prev=function(){if(!C){j=j>0?j-1:g.length-1;e.load()}};e.slideshow=function(){function b(){t.text(a.slideshowStop).bind(S,function(){h=setTimeout(e.next,a.slideshowSpeed)}).bind(H,function(){clearTimeout(h)}).one("click",function(){d();c(this).removeClass(F)});k.removeClass(f+ "off").addClass(f+"on")}var d,h,f="cboxSlideshow_";t.bind("cbox_closed",function(){t.unbind();clearTimeout(h);k.removeClass(f+"off "+f+"on")});d=function(){clearTimeout(h);t.text(a.slideshowStart).unbind(S+" "+H).one("click",function(){b();h=setTimeout(e.next,a.slideshowSpeed);c(this).removeClass(F)});k.removeClass(f+"on").addClass(f+"off")};if(a.slideshow&&g.length>1)a.slideshowAuto?b():d()};e.close=function(){c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(i);B=false;c(document).unbind("keydown.cbox_close keydown.cbox_arrows"); m.unbind(T+" resize.cboxie6 scroll.cboxie6");s.css({cursor:"auto"}).fadeOut("fast");k.stop(n,false).fadeOut("fast",function(){c("#colorbox iframe").attr("src","about:blank");l.remove();k.css({opacity:1});try{N.focus()}catch(b){}c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(i)})};e.element=function(){return c(i)};e.settings=$;c(e.init)})(jQuery);
/* ENDS COLORBOX */

// Setup Globals
PINT.themeRootDirectory = (typeof PINT.themeRootDirectory != "undefined") ? PINT.themeRootDirectory : '';
PINT.isEditing = (typeof PINT.isEditing != "undefined") ? PINT.isEditing : false;

PINT.init = function(){
    /* PNGFIX **********/
	// Sets a load delay on the pngfix and sIFR to fix a PWP load clobbering bug
    //if (PINT.isEditing) {
        //if (PINT.util.browser.bIe6) var pnginit = setTimeout('PINT.util.pngFix()', 1000); // uncomment if using pngfix
    //} else {
        if (PINT.util.browser.bIe6) PINT.util.pngFix(); // uncomment if using pngfix
    //}
    
    /* COLORBOX 'PINTBOX' OVERLAY **********/
    $(".pintbox").colorbox({close:'Close (ESC)'});
    $(".pintbox-iframe").colorbox({iframe:true, width:650, height:550});

    /* INPUT 'FOCUS/BLUR **********/
    if ($('.input-search').length) PINT.focusBlur('.input-search','Enter Keyword(s)'); // Header 'Search' - Focus/Blur
    
    /* MAIN NAV ALTERNATE DROPDOWN **********/
    // JS Controlled Main-Nav Dropdown (Overides CSS-Only dropdown)
    //if ($('#product-finder-box').length) PINT.menu('.product-finder','#product-finder-box');
    if ($('#product-finder-box').length) PINT.menu('product-finder');
    
    /* SIDEBAR HEIGHT **********/
    // Sets the left sidebar's height to match that of #col2
    PINT.matchHeight('.sidebar .sidebar .sidebar','#col2',73);

    /* TABS **********/
    // Hides the tabbox titles in the tab-boxes when JS enabled. When JS disabled, the <ul> is hidden (currently being written out w/ JS) and the H2 then act as section headers.
    // With JS enabled, having these H2s show would be redundant. View homepage w/o JS enabled to see effect.
    if ($('.tabs').length) $(".tabs > DIV > .tab-title").css('display', 'none');
    // 'Hotel/Flight' Tabs
    if ($('.tabs').length) $(".tabs").tabs();

    /* TOGGLEBOX (SHOW/HIDE) **********/
    if ($('.component-togglebox').length) PINT.toggleBox('Click to see Ingredients','Click to hide Ingredients');
    
    if ($('.brand-togglebox').length) PINT.brandBox('Click here to see other Central Pet Brands','Click here to hide other Central Pet Brands');


    
    /*$('.product-finder, #product-finder-box').hover(function(e){
        $('.product-finder').addClass('hover');
        $('#product-finder-box').show();
    },
    function(e){
        
        if( $(e.relatedTarget).is('#product-finder-box, #product-finder-box *') )
        {
            return;
        }
        $('.product-finder').removeClass('hover');
        $('#product-finder-box').hide();
        
    });*/
    
	if ($('.listTitle').length) {
		var c = 1;
		$('.listTitle').each(function() {
			$('#productTypeLinks').append('<li><a href="#' + c + '">' + this.innerHTML + '</a></li>');
			c++;
		});
	}

};

$(document).ready(function(){
  PINT.init();
});


/* FUNCTIONS *******************/

// INPUT 'Focus/Blur'
PINT.focusBlur = function(id,text) {
    $(id).focus(function(){ if ($(this).val() == text) $(this).val('') });
    $(id).blur(function(){ if ($(this).val() == '') $(this).val(text) });
};

/* MAIN NAV ALTERNATE DROPDOWN **********/
// JS Controlled Main-Nav Dropdown (Overides CSS-Only dropdown)
PINT.menu = function(menuTgt) {
    var menuTgtTrigger = '.'+menuTgt;
    var menuTgtDropBox = '#'+menuTgt+'-box';
    var menuTgtTriggerGroup = menuTgtTrigger+','+menuTgtTrigger+'on';
    var menuHoverItems = menuTgtTriggerGroup+','+menuTgtDropBox;
    var menuBoxProp = menuTgtDropBox+','+menuTgtDropBox+' *';
    $(menuHoverItems).hover(function(e) {
        $(menuTgtTrigger).addClass('hover');
        $(menuTgtDropBox).show();
    },
    function(e) {        
        if( $(e.relatedTarget).is(menuBoxProp)) return;
        $(menuTgtTrigger).removeClass('hover');
        $(menuTgtDropBox).hide();
    });
};

/* SIDEBAR HEIGHT **********/
// Sets the target's height to match that of another element
// tgt = The element you want to set the height for
// copy = The element who you are copying the height from
// offset [optional] = If tgt has other factors affecting height, use offset to compensate
PINT.matchHeight = function(tgt,copy,offset) {
    var tgtHeight = $(tgt).height();
    var copyHeight = $(copy).height();
    offset = (offset) ? offset : 0; // If offset set use it, else set offset to zero
    var newHeight = copyHeight-offset; 
    if (($(tgt).length))
    if ((copyHeight > tgtHeight));
    if (($(tgt).length) && (copyHeight > tgtHeight)) $(tgt).css('height',newHeight);
};

/* TABS **********/
// Write out the tabs in JS so that w/ JS disabled we don't show buttons that don't work!
// tabID = ID of tabs <ul>
// tabArray = Array of tab names
PINT.tabs = function(tabName) {
    $('.tabs').addClass('tabs-jsenabled');
    document.write('<ul class="tab-links">');
    for (i=0; i<=(tabName.length-1); i++) {
        var tabIden = tabName[i].replace(/ /g,'-');
        // If only one tab don't write out a link
        if (tabName.length <= 1) document.write('<li id="tab-'+tabName[i].toLowerCase()+'">'+tabName[i].toUpperCase()+'<span>&nbsp;</span></li>');
        else document.write('<li id="tab-'+tabIden.toLowerCase()+'"><a href="#tabbox'+(i+1)+'"><span>'+tabName[i]+'</span></a></li>');
    }
    document.write('</ul>');
};

/* TOGGLEBOX (SHOW/HIDE) **********/
// Show/Hide Toggle Box ('Hide Filters' on Hotel pages)
PINT.toggleBox = function(startText,endText) {
    if ($('.component-togglebox').length) {
        $('.component-togglebox').addClass('component-togglebox-js');
        $('.component-togglebox').append('<span class="toggle open">'+startText+'</span>');
        $(".toggle").click(function(){
            if ($(this).is('.open')) {
                $(this).toggleClass('open').html(endText);
                $('.component-togglebox .togglebox-inner').animate({ opacity:1, height:'toggle'}, 700, function() {/*Animation complete.*/});
            } else {
                $(this).toggleClass('open').html(startText);
                //$('.component-togglebox .togglebox-inner').toggle('slow');
                $('.component-togglebox .togglebox-inner').animate({ opacity:0, height:'toggle'}, 700, function() {/*Animation complete.*/});
            }
        });
    }
};

/* BRANDBOX (SHOW/HIDE) **********/
// Show/Hide Toggle Box (Club Nyla Content Interests)
PINT.brandBox = function(startText,endText) {
    if ($('.brand-togglebox').length) {
        $('.brand-togglebox').addClass('component-togglebox-js');
        $('.brand-togglebox').append('<span class="toggle open">'+startText+'</span>');
        $(".toggle").click(function(){
            if ($(this).is('.open')) {
                $(this).toggleClass('open').html(endText);
                $('.brand-togglebox .togglebox-inner').animate({ opacity:1, height:'toggle'}, 700, function() {/*Animation complete.*/});
            } else {
                $(this).toggleClass('open').html(startText);
                //$('.brand-togglebox .togglebox-inner').toggle('slow');
                $('.brand-togglebox .togglebox-inner').animate({ opacity:0, height:'toggle'}, 700, function() {/*Animation complete.*/});
            }
        });
    }
};


function openPollResults(url) {
    window.open(url,'pollResults','height=347,width=640,screenX=50,left=50,screenY=50,top=50,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=no,scrollbars=0,status=0,toolbar=0'); 
    return false;
}

function submitPoll(f,el) {
    var pId = f.pId.value;
    var poll_answer = "";
    if (getCookie("centralZilla"+pId, false)) document.getElementById(el).innerHTML = "You have already voted.";
    else {
    	for (m=0; m < f.pollAnswer.length; m++) {
    		if (f.pollAnswer[m].checked) {
                // set cookie to last just for the session
                setCookie("hasCookieEnabled", 1);
    			var poll_answer = f.pollAnswer[m].value;
                var separator = "?";
                if (f.action.indexOf("?") != -1) separator = "&";
                var actionPath = f.action + separator + "pId="+pId+"&pollAnswer="+poll_answer;
    			openPollResults(actionPath);
    		}
    	}
        if (poll_answer == "") alert("You must make a selection before you can submit."); 
    }
    return false;
}
// this function gets the cookie, if it exists
function getCookie(name, defaultVal) {
	var returnVal;
	var start = document.cookie.indexOf(name + "=");
	var len = start + name.length + 1;
	if ((!start ) && (name != document.cookie.substring(0, name.length)))returnVal = null;
	else if (start == -1) returnVal = null;
	else {
        var end = document.cookie.indexOf( ";", len );
    	if (end == -1) end = document.cookie.length;
    	returnVal = unescape( document.cookie.substring( len, end ) );
    }
    return returnVal === null ? defaultVal : returnVal;
}

function setCookie(name, value, expires, path, domain, secure) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime(today.getTime());
	// if the expires variable is set, make the correct expires time, the
	// current script below will set it for x number of days, to make it
	// for hours, delete * 24, for minutes, delete * 60 * 24
	if (expires)expires = expires * 1000 * 60 * 60 * 24;
	var expires_date = new Date(today.getTime() + (expires) );
	document.cookie = name + "=" +escape(value) + ((expires) ? ";expires=" + expires_date.toGMTString() : "" ) + ((path) ? ";path=" + path : "" ) + ((domain) ? ";domain=" + domain : "" ) + ((secure) ? ";secure" : "" );
}

// this deletes the cookie when called
function deleteCookie(name, path, domain) {
	if (getCookie(name)) {
            document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
     }
}
