var _gdeChrome = new function() {this.setupVars = function(){this['runStateFlag'] = 0;this['chromeButtons'] = new Object();this['chromePlayButtons'] = new Array();this['chromeExploreButtons'] = new Array();this['settignsObject'] = window[this.getQuery('settings')];this['highlightedChromeButton'];var protocol=window.location.protocol.toString();if (protocol == 'https:') {this['secure'] = true;} else {this['secure'] = false;};this['isIE6'] = false;var JSCO = new Object();JSCO.chAppVersion=navigator.appVersion.split('MSIE');JSCO.chBrwsrVer=parseFloat(JSCO.chAppVersion[1]);if((JSCO.chBrwsrVer>=5.5&&JSCO.chBrwsrVer<7)&&(document.body.filters)){this['isIE6'] = true;};};this.getQuery = function(var_name){var s = document.documentElement.getElementsByTagName('script');var queryString = s[s.length-1].getAttribute('src', 0);m = (new RegExp('[?&;]' + var_name + '=([^&;#]*)')).exec(queryString);return m ? unescape(m[1]) : null;};this.setupSettings = function(){this.checkVariable('cds');this.checkVariable('customClickFunction');this.checkVariable('highlightedChromeItem');this.checkVariable('homeButtonActive');this.checkVariable('chromeVisible');this.checkVariable('chromeStyle','');this.checkVariable('styleText');this.checkVariable('styleTextHover');this.checkVariable('styleTextSelected');this.checkVariable('styleBackground');this.checkVariable('styleHover');this.checkVariable('styleSelected');this.checkVariable('styleMiddleLine');};this.isNotBlank = function(v){r = true;if(v == null || v == '' || v == undefined || v == 'null' || v == 'undefined'){r = false;};return r;};this.checkVariable = function(varName, defaultValue){if(this.isNotBlank(this.settignsObject) && this.isNotBlank(this.settignsObject[varName])){this[varName] = this.settignsObject[varName];} else {this[varName] = this.getQuery(varName);if(this[varName] == null && defaultValue != null && defaultValue != undefined){this[varName] = defaultValue;};};};this.buildData = function(){this['homeButtonTitle'] = "Disney.com";this['homeButtonURL'] = "http://disney.go.com";this['searchTitle'] = "Search Disney.com";this['searchText'] = "Search Disney.com";this['searchBaseURL'] = "http://disney.go.com/search/?q=";this['searchURL'] = "http://disney.go.com/search";this.addChromeButton("explore", "Movies", "movies", "http://disney.go.com/movies/index", "", "","--");this.addChromeButton("explore", "TV", "tv", "http://home.disney.go.com/tv/", "", "","--");this.addChromeButton("explore", "Music", "music", "http://disney.go.com/music/index", "", "","--");this.addChromeButton("explore", "Live Events", "live_events", "http://disney.go.com/live-events/index", "", "","--");this.addChromeButton("explore", "Books", "books", "http://disney.go.com/books/index", "", "","--");this.addChromeButton("explore", "Parks & Travel", "parks", "http://disneyparks.disney.go.com/disneyparks/en_US/index?name=HomePage", "", "","--");this.addChromeButton("explore", "Store", "store", "http://www.disneystore.com/transfer/526272/?CMP=OTL-Dcom:ChrmShpTb", "", "","--");this.addChromeButton("play", "Characters & Stars", "characters", "http://disney.go.com/characters/#/characters/", "iconCharacters", "153608","--");this.addChromeButton("play", "Games", "games", "http://disney.go.com/games/#/games/", "iconGames", "153603","--");this.addChromeButton("play", "Videos", "videos", "http://disney.go.com/videos/#/videos/", "iconVideos", "153585","--");this.addChromeButton("play", "Create", "create", "http://disney.go.com/create/#/create/", "iconCreate", "307445","--");this.addChromeButton("play", "My Page", "my_page", "http://disney.go.com/mypage/#/mypage/", "iconMyPage", "153582","--");};this.analyticsTrackLink = function(lid,lpos,type) {try{cto.linkId=lid;cto.linkPosition=lpos;cto.linkType=type;cto.trackLink();cto.linkId='';cto.linkPosition='';cto.linkType='';}catch(e){};};this.addChromeButton = function(type,name,id,url,image,panelID, targetWindow){var chromeButtonObject = new Object();chromeButtonObject.name = name;chromeButtonObject.id = id;chromeButtonObject.url = url;chromeButtonObject.image = image;chromeButtonObject.panelID = panelID;chromeButtonObject.targetWindow = targetWindow;chromeButtonObject.type = type;if(type == 'play'){this.chromePlayButtons.push(chromeButtonObject);} else if (type == 'explore'){this.chromeExploreButtons.push(chromeButtonObject);};this.chromeButtons[id] = chromeButtonObject;};this.buildChromeExplore = function(){var chromeExploreContents ="<table class='gde_chromeExploreButtons' id='gde_chromeExploreButtons' cellpadding='0' cellspacing='0'>";chromeExploreContents += '<tr>';var contentLength = this.chromeExploreButtons.length;for(var i = 0;i<contentLength;i++){chromeExploreContents += "<td class='gde_chromeButtonTD'>"+this.buildChromeExploreButton(i)+"</td>";};chromeExploreContents += '</tr>';chromeExploreContents += '</table>';return chromeExploreContents;};this.buildChromePlay = function(){var chromePlayContents = "<table class='gde_chromePlayButtons' id='gde_chromePlayButtons' cellpadding='0' cellspacing='0'>";chromePlayContents += '<tr>';var contentLength = this.chromePlayButtons.length;for(var i = 0;i<contentLength;i++){chromePlayContents += "<td class='gde_chromeButtonTD'>"+this.buildChromePlayButton(i)+"</td>";};chromePlayContents += '</tr>';chromePlayContents += '</table>';return chromePlayContents;};this.buildChromeContents = function(){var chromeContents = this.buildChromeStyle();chromeContents += "<div id='gde_chromeContainer' style='visibility:hidden;'><div id='gde_chromeContents'>";chromeContents += "<div id='gde_chromeHomeButton'><span class='gde_homeLink'></span></div>";chromeContents += "<a id='gde_chromeSearchButton' onClick='_gdeChrome.chromeSearchAction();return false;' href='"+_gdeChrome.searchURL+"' title='"+_gdeChrome.searchTitle+"'></a>";chromeContents += "<div id='gde_chromeButtons'>";chromeContents += this.buildChromeExplore();chromeContents += this.buildChromePlay();chromeContents += '</div>';chromeContents += "<form name='gde_chromeSearchForm' onSubmit='return _gdeChrome.chromeSearchAction()' style='margin:0; padding:0;'><input id='gde_chromeSearch' class='gde_chromeSearchBlurred' onFocus='_gdeChrome.clearText(this,true)' onBlur='_gdeChrome.clearText(this,false)' value='"+_gdeChrome.searchText+"' /></form>";chromeContents += '</div></div>';return chromeContents;};this.urlencode = function(str) {return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');};this.chromeSearchAction = function(){var q = document.gde_chromeSearchForm.gde_chromeSearch.value;if(q != document.gde_chromeSearchForm.gde_chromeSearch.defaultValue && q != null && q.length > 0){this.analyticsTrackLink('chrome_search_na','','');window.location.href = _gdeChrome.searchBaseURL+this.urlencode(q);} else {this.analyticsTrackLink('chrome_search_na','','');window.location.href = _gdeChrome.searchURL;}return false;};this.buildHomeButton = function(){this.addChromeButton('home',_gdeChrome.homeButtonTitle,'home',_gdeChrome.homeButtonURL,'','','');this.homeLinkActive(true);};this.buildChromeExploreButton = function(i){var chromeButtonData = new Object(this.chromeExploreButtons[i]);var image = ''; if(chromeButtonData.image){image = "<span id='gde_"+chromeButtonData.image+"' class='gde_chromeButtonImage' /></span>";};var link = "<span class='gde_chromeButtonContents'><a name='&lid=chrome_"+chromeButtonData.id+"_na' id='gde_"+chromeButtonData.id.toLowerCase()+"' class='gde_chromeExploreButton' onClick='_gdeChrome.chromeClick(\""+chromeButtonData.id+"\");return false;' href='"+chromeButtonData.url+"' title='"+chromeButtonData.name+"'>";return link+image+chromeButtonData.name.toUpperCase()+'</a></span>';};this.buildChromePlayButton = function(i){var chromeButtonData = new Object(this.chromePlayButtons[i]);var image = ''; if(chromeButtonData.image){image = "<span id='gde_"+chromeButtonData.image+"' class='gde_chromeButtonImage' /></span>";};var link = "<span class='gde_chromeButtonContents'><a name='&lid=chrome_"+chromeButtonData.id+"_na' id='gde_"+chromeButtonData.id.toLowerCase()+"' class='gde_chromePlayButton' onClick='_gdeChrome.chromeClick(\""+chromeButtonData.id+"\");return false;' href='"+chromeButtonData.url+"' title='"+chromeButtonData.name+"'>";return link+image+chromeButtonData.name.toUpperCase()+'</a></span>';};this.highlightChromeButton = function(id){if(this.isNotBlank(this.highlightedChromeButton)){if(document.getElementById('gde_'+this.highlightedChromeButton.toLowerCase()).className == 'gde_chromePlayButtonSelected'){document.getElementById('gde_'+this.highlightedChromeButton.toLowerCase()).className = 'gde_chromePlayButton';} else if(document.getElementById('gde_'+this.highlightedChromeButton.toLowerCase()).className == 'gde_chromeExploreButtonSelected'){document.getElementById('gde_'+this.highlightedChromeButton.toLowerCase()).className = 'gde_chromeExploreButton';};};if(this.isNotBlank(id) && this.chromeButtons[id]){if(document.getElementById('gde_'+id.toLowerCase()).className == 'gde_chromePlayButton'){document.getElementById('gde_'+id.toLowerCase()).className = 'gde_chromePlayButtonSelected';} else if(document.getElementById('gde_'+id.toLowerCase()).className == 'gde_chromeExploreButton'){document.getElementById('gde_'+id.toLowerCase()).className = 'gde_chromeExploreButtonSelected';}this.highlightedChromeButton = id;} else {this.highlightedChromeButton = '';};};this.setCDS = function(state){if(state){this.cds = 'true';document.getElementById('gde_chromeExploreButtons').style['visibility']='hidden';document.getElementById('gde_chromePlayButtons').style['visibility']='hidden';document.getElementById('gde_chromeSearch').style['visibility']='hidden';document.getElementById('gde_chromeSearchButton').style['visibility']='hidden';if(this.homeButtonActive == 'true'){this.homeLinkActive(true);} else {this.homeLinkActive(false);};} else {this.cds = 'false';document.getElementById('gde_chromeExploreButtons').style['visibility']='inherit';document.getElementById('gde_chromePlayButtons').style['visibility']='inherit';document.getElementById('gde_chromeSearch').style['visibility']='inherit';document.getElementById('gde_chromeSearchButton').style['visibility']='inherit';this.homeLinkActive(true);};};this.homeLinkActive = function(state){var homeButtonName = '';if(this.cds == 'true'){homeButtonName = '&lid=chrome_home_cds';} else {homeButtonName = '&lid=chrome_home';};if(state){document.getElementById('gde_chromeHomeButton').innerHTML = "<a name='"+homeButtonName+"' id='gde_home' class='gde_homeLink' onClick='_gdeChrome.chromeClick(\"home\");return false;' href='"+_gdeChrome.homeButtonURL+"' title='"+_gdeChrome.homeButtonTitle+"'>";} else {document.getElementById('gde_chromeHomeButton').innerHTML = "<span class='gde_homeLink'></span>";};};this.chromeClick  = function(id){if(id != this.highlightedChromeButton){this.highlightChromeButton(id);};if(this.isNotBlank(this.customClickFunction)){window[this.customClickFunction](this.chromeButtons[id]);} else {this.chromeLinkAction(this.chromeButtons[id]);};};this.chromeLinkAction = function(chromeButtonData){this.chromeDefaultLinkAction(chromeButtonData);};this.chromeDefaultLinkAction = function(chromeButtonData){window.location.href = chromeButtonData.url;};this.clearText = function(field,focused){if (field.defaultValue == field.value){field.value = '';} else if (field.value == ''){field.value = field.defaultValue;}if (focused){document.getElementById('gde_chromeSearch').className = 'gde_chromeSearchFocused';} else {document.getElementById('gde_chromeSearch').className = 'gde_chromeSearchBlurred';}};this.showChrome = function(){document.getElementById('gde_chromeContainer').style['visibility']='visible';};this.hideChrome = function(){document.getElementById('gde_chromeContainer').style['visibility']='hidden';};this.loadStyle = function(styleName) {var url = '';if (_gdeChrome.secure) {url = 'https://home.disney.go.com/globalelements/chrome/style.txt?styleName='+styleName;} else {url = 'http://ahome.disney.go.com/globalelements/chrome/style.txt?styleName='+styleName;};var js = document.createElement('script');js.setAttribute('src',url);js.setAttribute('type','text/javascript');document.body.appendChild(js);};this.applyLoadedStyle = function(data) {_gdeChrome.setStyle('backgroundColor',data.backgroundColor);_gdeChrome.setStyle('textColor',data.textColor);_gdeChrome.setStyle('textHoverColor',data.textHoverColor);_gdeChrome.setStyle('textSelectedColor',data.textSelectedColor);_gdeChrome.setStyle('buttonHoverColor',data.buttonHoverColor);_gdeChrome.setStyle('buttonSelectedColor',data.buttonSelectedColor);_gdeChrome.setStyle('horizontalLineColor',data.horizontalLineColor);var mediaPath = '';if (_gdeChrome.secure) {mediaPath = 'https://s.dolimg.com/en-US/dcom/media/chrome/sprites/';} else {mediaPath = 'http://a.dolimg.com/en-US/dcom/media/chrome/sprites/';};if (_gdeChrome.isIE6) {_gdeChrome.setCSS('.gde_homeLink','background-image','url('+mediaPath+data.spriteImageGIF+')');_gdeChrome.setCSS('#gde_chromeSearchButton','background-image','url('+mediaPath+data.spriteImageGIF+')');_gdeChrome.setCSS('.gde_chromeButtonImage','background-image','url('+mediaPath+data.spriteImageGIF+')');} else {_gdeChrome.setCSS('.gde_homeLink','background-image','url('+mediaPath+data.spriteImagePNG+')');_gdeChrome.setCSS('#gde_chromeSearchButton','background-image','url('+mediaPath+data.spriteImagePNG+')');_gdeChrome.setCSS('.gde_chromeButtonImage','background-image','url('+mediaPath+data.spriteImagePNG+')');};};this.setCSS = function(theClass,element,value) {var cssRules;for (var S = 0; S < document.styleSheets.length; S++){if (document.styleSheets[S]['rules']) {cssRules = 'rules';} else if (document.styleSheets[S]['cssRules']) {cssRules = 'cssRules';} else {};if(document.styleSheets[S].insertRule){document.styleSheets[S].insertRule(theClass+'{'+element+':'+value+';}',document.styleSheets[S][cssRules].length);} else if (document.styleSheets[S].addRule) {document.styleSheets[S].addRule(theClass,element+': '+value+';');};};};this.setStyle = function(style,color){color = '#'+color;switch(style){case 'backgroundColor':_gdeChrome.setCSS('#gde_chromeContents','background-color',color);break;case 'textColor':_gdeChrome.setCSS('a.gde_chromePlayButton','color',color);_gdeChrome.setCSS('a.gde_chromePlayButton:link','color',color);_gdeChrome.setCSS('a.gde_chromePlayButton:visited','color',color);_gdeChrome.setCSS('a.gde_chromeExploreButton','color',color);_gdeChrome.setCSS('a.gde_chromeExploreButton:link','color',color);_gdeChrome.setCSS('a.gde_chromeExploreButton:visited','color',color);break;case 'textHoverColor':_gdeChrome.setCSS('a.gde_chromePlayButton:hover','color',color);_gdeChrome.setCSS('a.gde_chromeExploreButton:hover','color',color);break;case 'textSelectedColor':_gdeChrome.setCSS('a.gde_chromePlayButtonSelected','color',color);_gdeChrome.setCSS('a.gde_chromePlayButtonSelected:link','color',color);_gdeChrome.setCSS('a.gde_chromePlayButtonSelected:visited','color',color);_gdeChrome.setCSS('a.gde_chromeExploreButtonSelected','color',color);_gdeChrome.setCSS('a.gde_chromeExploreButtonSelected:link','color',color);_gdeChrome.setCSS('a.gde_chromeExploreButtonSelected:visited','color',color);break;case 'buttonHoverColor':_gdeChrome.setCSS('a.gde_chromePlayButton:hover','background-color',color);_gdeChrome.setCSS('a.gde_chromeExploreButton:hover','background-color',color);_gdeChrome.setCSS('a.gde_homeLink:hover','background-color',color);break;case 'buttonSelectedColor':_gdeChrome.setCSS('a.gde_chromePlayButtonSelected','background-color',color);_gdeChrome.setCSS('a.gde_chromePlayButtonSelected:link','background-color',color);_gdeChrome.setCSS('a.gde_chromePlayButtonSelected:visited','background-color',color);_gdeChrome.setCSS('a.gde_chromeExploreButtonSelected','background-color',color);_gdeChrome.setCSS('a.gde_chromeExploreButtonSelected:link','background-color',color);_gdeChrome.setCSS('a.gde_chromeExploreButtonSelected:visited','background-color',color);break;case 'horizontalLineColor':_gdeChrome.setCSS('.gde_chromeExploreButtons','border-bottom','solid 1px '+color);break;};};this.buildChromeStyle = function(){var styleContents;var JSCO = new Object();JSCO.chIsIE6=false; JSCO.chAppVersion=navigator.appVersion.split('MSIE'); JSCO.chBrwsrVer=parseFloat(JSCO.chAppVersion[1]); JSCO.chBrwsrAgnt=navigator.userAgent; if((JSCO.chBrwsrVer>=5.5&&JSCO.chBrwsrVer<7)&&(document.body.filters)){JSCO.chIsIE6=true;};if(this.chromeStyle.toLowerCase() == 'none'){styleContents = '';} else if(this.chromeStyle.substring(this.chromeStyle.length-4,this.chromeStyle.length).toLowerCase() == '.css'){styleContents = "<link rel='stylesheet' type='text/css' href='"+this.chromeStyle+"' media='screen' />"} else {var protocol=window.location.protocol.toString();var secure = '';var cssPath = '';if (protocol == 'https:') {secure = 'true';cssPath = 'https://home.disney.go.com/globalelements/chrome.css';} else {secure = 'false';cssPath = 'http://ahome.disney.go.com/globalelements/chrome.css';};var queryString = '?secure='+secure+'&IE6='+JSCO.chIsIE6+'&styleSet='+this.chromeStyle+'&styleText='+this.styleText+'&styleTextHover='+this.styleTextHover+'&styleTextSelected='+this.styleTextSelected+'&styleBackground='+this.styleBackground+'&styleHover='+this.styleHover+'&styleMiddleLine='+this.styleMiddleLine+'&styleSelected='+this.styleSelected;styleContents = "<link rel='stylesheet' type='text/css' href='"+cssPath+queryString+"' media='screen' />";};return styleContents;};this.buildChrome = function(){this.setupVars();this.buildData();this.setupSettings();document.write(this.buildChromeContents());this.checkDOMLoadState();};this.checkDOMLoadState = function(){if (document.addEventListener){document.addEventListener('DOMContentLoaded', function(){_gdeChrome.runStateFlag=1; _gdeChrome.documentLoaded()}, false);} else if (document.all && !window.opera){var proto = "src='javascript:void(0)'";if (location.protocol == 'https:') proto = 'src=//:';document.write('<scr' + 'ipt id=loadTagChrome defer ' + proto + '><\/scr' + 'ipt>');var loadTagChrome=document.getElementById('loadTagChrome');loadTagChrome.onreadystatechange=function(){if (this.readyState=='complete'){_gdeChrome.runStateFlag = 1;_gdeChrome.documentLoaded();};};};var oldOnload = window.onload;window.onload = function(){if (typeof oldOnload == 'function') {oldOnload();};setTimeout('if (!_gdeChrome.runStateFlag) _gdeChrome.documentLoaded()', 0);}};this.documentLoaded = function(){this.buildHomeButton();if(this.cds == 'true'){this.setCDS(true);};if(this.isNotBlank(this.highlightedChromeItem)){this.highlightChromeButton(this.highlightedChromeItem);};if(this.chromeVisible != 'false'){this.showChrome();};};};_gdeChrome.buildChrome();
