/*Disney's Pirates of the Caribbean Online (c)*/
imgPath='http://a.disney.go.com/pirates/online/v3/global/images/';swfPath='http://a.disney.go.com/pirates/online/v3/global/flash/';function buttonPlay(){top.window.location='https://'+piratesDomain+'/pirates/v3/index?pageId=createAccount';}function button_about_mc(){top.window.location='http://'+piratesDomain+'/pirates/v3/#/game_info/about.html';}function button_gamepass_mc(){top.window.location='https://register.go.com/commerce/InComm/gameCard';}function button_trailer_mc(){top.window.location='http://'+piratesDomain+'/pirates/v3/#/game_info/video.html?viewTrailer=true';}function button_news_mc(){top.window.location='http://'+piratesDomain+'/pirates/v3/#/news/currentnews.html';}function password_btn(){top.window.open('https://register.go.com/global/pirates/recoverPassword','external','');}function createAccount_btn(){top.window.location='https://'+piratesDomain+'/pirates/v3/index?pageId=createAccount';}function runCurrentNewsAjax(){var varAtlasIframe=document.getElementById('atlasIframe');varAtlasIframe.src="http://switch.atdmt.com/iaction/tgmptc_HomepageCurrentNews_1";}function runCongratBasicAjax(){var varAtlasIframe=document.getElementById('atlasIframe');varAtlasIframe.src="http://switch.atdmt.com/iaction/tgmptc_BasicAccountTrialConfirmation_1";}function runCongratUnlimitedAjax(disMem){if(disMem==undefined||disMem==""||disMem=="null")return;var varAtlasIframe=document.getElementById('atlasIframe');varAtlasIframe.src="http://switch.atdmt.com/iaction/tgmptc_SubscriptionConfirmation_1/v3/ato.pirates/atc1."+disMem;}function checkIframe(){if(document.iframesfix){var windowlocator=new PageLocator("window.location.href","#");document.write("<iframe id='ajaxnav' name='ajaxnav' src='/pirates/v3/global/backbutton?hash="+windowlocator.getHash()+"' class='DisplayNone'></iframe>");}}function searchAndReplace(input,stringToFind,stringToInsert){var output="";var findLen=stringToFind.length;while(input.indexOf(stringToFind)>=0){var currOffset=input.indexOf(stringToFind);output+=input.substr(0,currOffset);output=output.substr(0,output.length);output=output+=stringToInsert;input=input.substr((currOffset)+findLen,input.length-1);}output+=input;return output;}function thisMovie(movieName){if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName];}else{return document[movieName];}}function onPurchase(){top.window.location='http://'+piratesDomain+'/pirates/v3/register/finalization';}function popContest(url){window.open(url,"popContest","width=612,height=816,scrollbars=0,resizable=1");}function popUp(url,width,height){window.open(url,"popUp","width="+width+",height="+height+",scrollbars=0,resizable=0");}function popUp2(url,width,height){window.open(url,"popUp","width="+width+",height="+height+",scrollbars=1,resizable=1");}function reset_form(id){document.getElementById(id).reset();}function validate_field(id){if(document.getElementById(id).value==null||document.getElementById(id).value==""){return false;}else{return true;}}function validate_email(email){return(email.indexOf(".")>2)&&(email.indexOf("@")>0);}function max_chars(max){var textField=document.upload_video_form.description;if(max==null||max==''){var max=35}if(textField.value.length>max){textField.value=textField.value.substring(0,max);textField.blur();}}function upload_video_validation(){submit_form=false;no_blank_fields=false;valid_email=false;terms=false;valid_comments=false;textField=document.upload_video_form.comments;if(textField.value.length>0){valid_comments=true;}if(valid_comments&&validate_field('email')&&validate_field('address')&&validate_field('city')&&validate_field('state')&&validate_field('zip')){no_blank_fields=true;}eMail=document.getElementById("email");if(validate_email(eMail.value)){valid_email=true;}else{}if(document.upload_video_form.terms.checked==true){terms=true;}if(no_blank_fields&&valid_email&&terms){object=document.getElementById('upload_btn_id_off');object.style.display='none';object=document.getElementById('upload_btn_id_on');object.style.display='';return true;}}function upload_video_submit_form(){if(upload_video_validation()){document.forms['upload_video_form'].submit();}}function upload_video_reset_form(){reset_form('upload_video_form');}function redirectToPiratesChannel(){var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){return false;}}}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){xmlDoc=createXMLParser(xmlHttp.responseText);if(xmlDoc.getElementsByTagName("status").length>0){statusValue=xmlDoc.getElementsByTagName("status")[0].childNodes[0].nodeValue;if(statusValue=="success"){if(xmlDoc.getElementsByTagName("url").length>0){url=xmlDoc.getElementsByTagName("url")[0].childNodes[0].nodeValue;if(url!=undefined&&url.indexOf("http:")||url.indexOf("https:")){top.window.location=url;}}}}}};xmlHttp.open("GET","http://"+piratesDomain+"/pirates/v3/util/rpc/getPiratesChannel?cacheBuster="+Math.random(),true);xmlHttp.send(null);}var varDisplayLiveSupport="false";function checkLiveSupport(){var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){return false;}}}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){xmlDoc=createXMLParser(xmlHttp.responseText);result=xmlDoc.getElementsByTagName("result")[0].childNodes[0].nodeValue;if(result!=null&&result!='undefined'&&result=="success"){if(xmlDoc.getElementsByTagName("dayAndTime").length>0){dayAndTime=xmlDoc.getElementsByTagName("dayAndTime")[0].childNodes[0].nodeValue;dayAndTimeArray=dayAndTime.split("|");params=getURLParams();if(params["day"]!=undefined&&params["hour"]!=undefined&&params["meridian"]!=undefined){day=params["day"];hour=params["hour"];meridian=params["meridian"];}else{day=dayAndTimeArray[0];hour=dayAndTimeArray[1];meridian=dayAndTimeArray[2];}isSatOrSun=(day.indexOf("Sat")==0||day.indexOf("Sun")==0);isWithinTimeSpanSatOrSun=(hour>=6&&hour<=11&&meridian=="AM")||hour==12&&meridian=="PM"||(hour>=1&&hour<7&&meridian=="PM");isMonThruFri=(isSatOrSun!=true);isWithinTimeSpanMonThruFri=(hour>=10&&hour<=11&&meridian=="AM")||hour==12&&meridian=="PM"||(hour>=1&&hour<7&&meridian=="PM");if((isSatOrSun&&isWithinTimeSpanSatOrSun)||(isMonThruFri&&isWithinTimeSpanMonThruFri)){varDisplayLiveSupport="true";}else{}}}}};xmlHttp.open("GET","http://"+piratesDomain+"/pirates/v3/util/calendar/dayAndTime?cacheBuster="+Math.random(),true);xmlHttp.send(null);}function createXMLParser(xText){if(typeof DOMParser!="undefined"){var parseX=new DOMParser();return parseX.parseFromString(xText,"text/xml");}else if(typeof ActiveXObject!="undefined"){var XMLobj=new ActiveXObject("Microsoft.XMLDOM");if(XMLobj){XMLobj.async=false;XMLobj.loadXML(xText);return XMLobj;}else{return false;}}else{return false;}}function postProcessor(){checkLiveSupport();window.setInterval("checkLiveSupport()",60000*15);}function getURLParams(){var params=[];var strHref=window.location.href;if(strHref.indexOf("?")>-1){var strQueryString=strHref.substr(strHref.indexOf("?")+1);var re=new RegExp("^(.*)?\#.*","g");strQueryString=strQueryString.replace(re,"$1");var aQueryString=strQueryString.split("&");for(var iParam=0;iParam<aQueryString.length;iParam++){var aParam=aQueryString[iParam].split("=");params[aParam[0]]=aParam[1];}}return params;}function getUsername(){if(getcookie("USERNAME")!=null&&getcookie("USERNAME")!=""){return getcookie("USERNAME");}else{return"Guest";}}function updateElementTextByElementId(id,newText){document.getElementById(id).innerHTML=newText;}function setFocus(id){document.getElementById(id).focus();}var varNavInit=false;var varNAVURLs_Array=[];function getNavURLS_Array(){thisMovie("leftnav").updateURLSArray(varNAVURLs_Array);}function navInit(){varNavInit=true;setNavSection(document.location.toString());}function setNavSection(xURL){if(varNavInit&&thisMovie("leftnav")!=null){thisMovie("leftnav").setSection(xURL,varNAVURLs_Array,varDisplayLiveSupport,isLoggedIn);}}
function runPageLoaded() {
	if (document.getElementById("adbar")!=null||document.getElementById("adbar")!="null") {
		varHBPath = ((typeof varHBPath == "undefined") ? '' : varHBPath);
		varHBPageName = ((typeof varHBPageName == "undefined") ? '' : varHBPageName);
		var varURL = varHBPath + varHBPageName;
		varURL=searchAndReplace(varURL,"v3/content_html","");
		var varAdText="<IFRAME id=\"adIFrame2\" SRC=\"http://disney.go.com/Adserver?CallDown&AdTypes=Skyscraper;&url=/pirates/mmo"+varURL+"&secure=false\" WIDTH=\"160\" HEIGHT=\"610\" MARGINWIDTH=\"0\" MARGINHEIGHT=\"0\" HSPACE=\"0\" VSPACE=\"0\" FRAMEBORDER=\"0\" SCROLLING=no BORDERCOLOR=\"#000000\"></IFRAME>";
		document.getElementById("adbar").innerHTML=varAdText;
		setNavSection(document.location.toString());
	}
	pageTrack(varHBPageName,"/pirates/"+varHBPath);
	runHBXAlt(varHBPageName,"/pirates/"+varHBPath);
}
var dosTrak_url='http://'+piratesDomain+'/logging/collector.php';function dosTrak_genAjaxObj(){var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){return false;}}}return xmlHttp;}
function dosTrak_sendData(data) {
	var xmlHttp=dosTrak_genAjaxObj();
	
	if(!xmlHttp){
		return;
	}
	xmlHttp.onreadystatechange=function(){};
	var navigator=window.navigator;
	data+="&CodeName="+navigator.appCodeName;
	data+="&MinorVer="+getMinorVersion();
	data+="&appName="+navigator.appName;
	data+="&version="+navigator.appVersion;
	data+="&CookieEnabled="+navigator.cookieEnabled;
	data+="&Platform="+navigator.platform;
	data+="&UA="+navigator.userAgent;
	var n=navigator.userAgent;
	if(/MSIE/.test(n)){
		data+="&CPUClass="+navigator.cpuClass;
		data+="&bLang="+navigator.browserLanguage;
		data+="&sLang="+navigator.systemLanguage;
		data+="&uLang="+navigator.userLanguage;
	} else {
		data+="&bLang="+navigator.language;
	};
	data+="&sid="+Math.random();
	if(document.referrer!=''){
		data+="&referer="+document.referrer;
	}
	try {
		xmlHttp.open("POST",dosTrak_url,true);
		xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length",data.length);
		xmlHttp.setRequestHeader("Connection","close");
		xmlHttp.send(data);
	} catch (e) {
	}
}
function getMinorVersion(){var varAppVersion=navigator.appVersion.toLowerCase();var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("sv1")!=-1){spb=true;}else{if(ua.indexOf("msie 7")==-1){spb=false;}else{spb=true;}}if(varAppVersion.indexOf("windows")<0){return"MAC"}var n=navigator.userAgent;if(/msie/.test(ua)){varOsVersion=varAppVersion.substring(varAppVersion.indexOf("windows")+7,varAppVersion.length);}else{varOsVersion=ua.substring(ua.indexOf("; windows")+10,ua.length);varOsVersion=varOsVersion.substring(0,varOsVersion.indexOf(";"));}varOsVersionNum=searchAndReplace(varOsVersion,"nt","");varOsVersionNum=searchAndReplace(varOsVersionNum," ","");varOsVersionNum=parseFloat(varOsVersionNum);var varMinorVersion="";switch(true){case(varOsVersion.indexOf("nt")<0):varMinorVersion="nt";break;case(varOsVersionNum==4.1):varMinorVersion="win98";break;case(varOsVersionNum==4.9):varMinorVersion="winME";break;case(varOsVersionNum==5):varMinorVersion="win2k";break;case(varOsVersionNum==5.1):if(spb==true){varMinorVersion="XPSP1";}else{varMinorVersion="XPSP2";}break;case(varOsVersionNum>=6&&varOsVersionNum!=98):varMinorVersion="VISTA";break;default:varMinorVersion="XPSP2";}return varMinorVersion;}function dosTrak_trackPage(page,path){dosTrak_sendData("page="+page+"&path="+path);}function runHBXAlt(xPage,xPath){dosTrak_trackPage(xPage,xPath);return;var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){return false;}}}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.responseText=="undefined"||xmlHttp.responseText==""){return;}}};var varPOSTPath="http://"+piratesDomain+"/pirates/util/hitbox/getHitboxAlt?page="+escape(xPage)+"&path="+escape(xPath)+"&sid="+Math.random();xmlHttp.open("GET",varPOSTPath,true);xmlHttp.send(null);}function createXMLParser(xText){if(typeof DOMParser!="undefined"){var parseX=new DOMParser();return parseX.parseFromString(xText,"text/xml");}else if(typeof ActiveXObject!="undefined"){var XMLobj=new ActiveXObject("Microsoft.XMLDOM");if(XMLobj){XMLobj.async=false;XMLobj.loadXML(xText);return XMLobj;}else{return false;}}else{return false;}}function putcookie(c_name,value,expiredays){var date=new Date();date.setTime(date.getTime()+(expiredays*24*60*60*1000));document.cookie=c_name+"="+escape(value)+((expiredays==null)?"":";expires="+date.toGMTString()+";path=/");}function remove_cookie(cookie_name){var cookie_date=new Date();cookie_date.setTime(cookie_date.getTime()-1);document.cookie=cookie_name+="=; expires="+cookie_date.toGMTString();}function getcookie(c_name){if(document.cookie.length>0){var c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;var c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}return null;}var platform=navigator.platform.toLowerCase();var appVersion=navigator.appVersion.toLowerCase();var userAgent=navigator.userAgent.toLowerCase();var isMac=platform.indexOf('mac')==0||userAgent.indexOf('macintosh')>=0||userAgent.indexOf('mac os')>=0;var isWindows=platform.indexOf('win32')==0||userAgent.indexOf('windows')>=0;var isOldWindows=false;if(isWindows){if(appVersion.indexOf('windows 95')>=0||appVersion.indexOf('windows 98')>=0||userAgent.indexOf('win95')>=0||userAgent.indexOf('win98')>=0||userAgent.indexOf('win 9x')>=0||userAgent.indexOf('windows 95')>=0||userAgent.indexOf('windows 98')>=0||userAgent.indexOf('windows me')>=0){isOldWindows=true;}}if(isMac){}else if(isWindows&&isOldWindows){window.location='http://disney.go.com/pirates/online/v3/help/minspec.html';}function pageTrack(pn,mlc,account){try{var pattern=/(\x2Fpirates){1,2}\x2Fv\d\x2F/;var omni_sec=mlc.replace(pattern,"");omni_sec=omni_sec.replace(/content_html\//,"");if(omni_sec.length>0&&omni_sec.substring(omni_sec.length-1)=="/")omni_sec=omni_sec.substring(0,omni_sec.length-1);if(omni_sec.length>0){omni_sec=omni_sec.replace(/[^\w\/]+/g,"_");omni_sec=omni_sec.toLowerCase().replace(/[\/]/g,":");omni_sec="website:"+omni_sec;}else{omni_sec="website";}var omni_pn=pn.toLowerCase().replace(/.htm[l]?/,"").replace(/[^\w]+/g,"_");cto.h.mlc=mlc;cto.h.pageName=pn;cto.account="piratesonline";cto.category="dgame";cto.site="pir_onl";cto.siteSection=omni_sec;cto.pageName=omni_pn;cto.contentType="regular";cto.property="pir";cto.track();}catch(err){}}function pollSent(pollName){var cookieValue=getcookie("polls");var newValue=true;if(cookieValue){var pollValues=cookieValue.split('|');for(var i=0;i<pollValues.length;i++){if(pollValues[i]==pollName){newValue=false;}}}if(newValue){if(cookieValue&&cookieValue!=""){putcookie("polls",cookieValue+"|"+pollName,365);}else{putcookie("polls",pollName,365);}}}function sanitySet(){document.cookie="WDIGAGE=1;path=/;domain=.go.com;";}function sanityClear(){document.cookie="WDIGAGE=0;path=/;domain=.go.com;";}function findDomFile(file){fileFound=false;if(file.indexOf('.js')>=0){tag='script';attr='src';}else if(file.indexOf('.css')>=0){tag='link';attr='href';}else if(file.indexOf('.jpg')>=0||file.indexOf('.gif')>=0||file.indexOf('.png')>=0){tag='img';attr='src';}else{return fileFound;}var allsuspects=document.getElementsByTagName(tag);for(var i=allsuspects.length;i>=0;i--){if(allsuspects[i]&&allsuspects[i].getAttribute(attr)!=null&&allsuspects[i].getAttribute(attr).indexOf(file)!=-1){fileFound=true;break;}}return fileFound;}function loadJs(file,path){jsFound=false;var tag='script';var attr='src';var varScriptPath='';if(path==''||path==null){varScriptPath=baseUrlJavascript+'/'+file;}else{varScriptPath=path+file;}jsFound=findDomFile(file);if(!jsFound){var head=document.getElementsByTagName('head')[0];var script=document.createElement('script');script.type='text/javascript';script.src=varScriptPath;head.appendChild(script);}}function loadCss(file,path){cssFound=false;var tag='link';var attr='href';cssFound=findDomFile(file);if(!cssFound){var fileref='';var loadedobjects='';if(path==''||path==null){file=baseUrlMedia+'/css/'+file;}fileref=document.createElement("link");fileref.setAttribute("rel","stylesheet");fileref.setAttribute("type","text/css");fileref.setAttribute("href",file);document.getElementsByTagName("head").item(0).appendChild(fileref);}}function addPopDisclaimerJs(){fileFound=false;if(location.protocol=='https'){file='https://disney.go.com/features/javascript/featuresGlobalSecure.js';}else{file='http://a.disney.go.com/features/javascript/featuresGlobal.js';}fileFound=findDomFile(file);if(!fileFound){var head=document.getElementsByTagName('head')[0];var script=document.createElement('script');script.type='text/javascript';var varScriptPath=file;script.src=varScriptPath;head.appendChild(script);}}function backBtnFix(){platform=navigator.platform.toLowerCase();userAgent=navigator.userAgent.toLowerCase();var isMac=platform.indexOf('mac')==0||userAgent.indexOf('macintosh')>=0||userAgent.indexOf('mac os')>=0;if(isMac&&userAgent.indexOf("safari")!=-1&&userAgent.indexOf("version/3")==-1){loadJs('backbutton-safari.js');}else{loadJs('backbutton.js');}}fileFoundCounter=0;function loadImg2(file){if(fileFoundCounter==0){document.write('<div class="preload"><img src="'+file+'" /></div>');}}function initPotco(){html='';html+='<div id="prldTxt">Please wait while loading</div>';html+='<img id="imgLoading" src="'+imgPath+'sworsdman.gif" width="483" height="58" alt="Loading" border="0" />';document.write(html);}var maxTime=1;var imgLoadCounter=0;var maxImgLoadCounter=60;var bgImg='potcoHdr.jpg';
function togglePotco() {
	document.getElementById("potcoLoad").style.display="none";
	document.getElementById("nav").style.display="block";
	document.getElementById("navMain").style.display="block";
	document.getElementById("atlastag").style.display="block";
	
	if (document.getElementById("esrb"))
		document.getElementById("esrb").style.display="block";

	if (document.getElementById("foot"))
		document.getElementById("foot").style.display="block";

	bgUrl=imgPath+bgImg;
	document.getElementById("potco_body").style.backgroundImage="url("+bgUrl+")";
}
function checkImgLoad(id){imgLoaded=document.getElementById(id).complete;if(imgLoaded||(imgLoadCounter>=maxImgLoadCounter)){togglePotco();}else{imgLoadCounter++;setTimeout('checkImgLoad("'+id+'")',maxTime*1000);}}function initHiddenDivs(){loadCss('core.css');loadJs('databases/db.js');loadJs('databases/news_db.js');loadJs('featuresGlobal.js','http://a.disney.go.com/features/javascript/');}function loadingHtml(){html='';html+='<div class="preload"><img id="potcoBg" src="'+imgPath+bgImg+'" /></div>';html+='<img src="http://a.disney.go.com/pirates/online/v3/global/images/spacer.gif" height="0" width="0" onload="checkImgLoad(\'potcoBg\')">';return html;}
