﻿
var searchTimerId=null;var IS_ENABLED_XSLT=$.browser.mozilla;function initializeArmory(){bindDropDownMenu();bindLanguageLinks();if(isLoggedIn)
bindBookmarkMenu();else
bindLoginLink();bindToolTips();initializeAds(theLang);}
function initializeAds(theLang)
{var randomNum=Math.round(Math.random()*100000000);if(!pageNum)var pageNum=Math.round(Math.random()*100000000);var longAdiFrameSrc="";var longAdjsSrc="";var boxAdiFrameSrc="";var boxAdjsSrc="";if(theLang!='ko_kr')
{if(isNotHomePage=="true"){longAdiFrameSrc='http://cgm.adbureau.net/hserver/acc_random='+randomNum+'/SITE=WOW.ARMORY.COM/AREA=NETWORK/AAMSZ=728X90/pageid='+pageNum;longAdjsSrc='http://cgm.adbureau.net/jnserver/acc_random='+randomNum+'/SITE=WOW.ARMORY.COM/AREA=NETWORK/AAMSZ=728X90/pageid='+pageNum;boxAdiFrameSrc='http://cgm.adbureau.net/hserver/acc_random='+randomNum+'/SITE=WOW.ARMORY.COM/AREA=NETWORK/AAMSZ=300X250/pageid='+pageNum;boxAdjsSrc='http://cgm.adbureau.net/jnserver/acc_random='+randomNum+'/SITE=WOW.ARMORY.COM/AREA=NETWORK/AAMSZ=300X250/pageid='+pageNum;$("#ad_728x90").html('<iframe width="728" height="90" marginwidth="0" marginheight="0" '+'src="'+longAdiFrameSrc+'" frameborder="0" scrolling="no">'+'<script type="text/javacript" '+'src="'+longAdjsSrc+'"></script>'+'</iframe>');}else{boxAdiFrameSrc='http://cgm.adbureau.net/hserver/acc_random='+randomNum+'/SITE=WOW.ARMORY.COM.HOME/AREA=NETWORK/AAMSZ=300X250/pageid='+pageNum;boxAdjsSrc='http://cgm.adbureau.net/jnserver/acc_random='+randomNum+'/SITE=WOW.ARMORY.COM.HOME/AREA=NETWORK/AAMSZ=300X250/pageid='+pageNum;}
$("#ad_300x250").html('<iframe width="300" height="250" marginwidth="0" marginheight="0" '+'src="'+boxAdiFrameSrc+'" frameborder="0" scrolling="no">'+'<script type="text/javascript" '+'src="'+boxAdjsSrc+'"></script>'+'</iframe>');}else{if(isNotHomePage=="true"){$("#ad_728x90").html('<iframe width=728 height=90 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling="no" bordercolor="#000000" src="http://gamead.smartad.co.kr/NMR?VNHTML&MN3&SN3&PN6&TN10&DNgamead.smartad.co.kr"></iframe>');$("#ad_300x250").html('<iframe width=300 height=250 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling="no" bordercolor="#000000" src="http://gamead.smartad.co.kr/NMR?VNHTML&MN3&SN3&PN6&TN9&DNgamead.smartad.co.kr"></iframe>');}else{$("#ad_300x250").html('<iframe width=300 height=250 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling="no" bordercolor="#000000" src="http://gamead.smartad.co.kr/NMR?VNHTML&MN3&SN3&PN5&TN8&DNgamead.smartad.co.kr"></iframe>');}}}
function ajaxChangePinned(nameOne,realmOne,allChars){var curPage='/vault/character-select-submit.xml?';var charArray=new Array();var charCounter=2;var queryString="n1="+encodeURI(nameOne)+"&r1="+encodeURI(realmOne);charArray=allChars.split(",");for(i=0;i<charArray.length;i++){charArray[i]=charArray[i].split("_");if(nameOne!=charArray[i][0]||realmOne!=charArray[i][1]){queryString+="&n"+charCounter+"="+encodeURI(charArray[i][0])+"&r"+charCounter+"="+encodeURI(charArray[i][1]);charCounter++;}}
$.ajax({async:false,type:"GET",url:curPage+queryString,success:function(msg){window.location.reload();},error:function(msg){}});}
var Utf8={encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";var sLength=string.length;for(var n=0;n<sLength;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},decode:function(utftext){var string="";var i=0;var c=c1=c2=0;var textLength=utftext.length;while(i<textLength){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}}
var pathnameParse=document.location.href.split(window.location.protocol+"//")[1].split("/")[1];var hashParse=pathnameParse.split("#")[1];pathnameParse=pathnameParse.split("#")[0];if(!IS_ENABLED_XSLT&&hashParse&&hashParse.indexOf(".xml")>-1){document.location.hash="";document.location=hashParse;}
if(IS_ENABLED_XSLT&&Browser.ie){if(!pathnameParse&&!hashParse){setcookie("currentPage","index.xml","session");setcookie("historyStorage","","session")
document.location.href=document.location.href+'?';}}
function PageQuery(q){var qSplit=q.split("?");if(qSplit.length>1)
this.q=qSplit[qSplit.length-1];else
this.q=null;this.keyValuePairs=new Array();if(this.q){for(var i=0;i<this.q.split("&").length;i++){this.keyValuePairs[i]=this.q.split("&")[i];}}
this.getKeyValuePairs=function(){return this.keyValuePairs;}
this.getValue=function(s){for(var j=0;j<this.keyValuePairs.length;j++){if(this.keyValuePairs[j].split("=")[0]==s)
return this.keyValuePairs[j].split("=")[1];}
return false;}
this.getParameters=function(){var a=new Array(this.getLength());for(var j=0;j<this.keyValuePairs.length;j++){a[j]=this.keyValuePairs[j].split("=")[0];}
return a;}
this.getLength=function(){return this.keyValuePairs.length;}}
function queryString(key,defaultValue){var theHash;var pageHash;var queryValueHash
if(IS_ENABLED_XSLT&&!window.location.search){if(Browser.ie6)
theHash=window.location.href.split('#')[1];else
theHash=window.location.hash;if(!theHash)
theHash=window.historyStorage.getCurrentPage();pageHash=new PageQuery(theHash);queryValueHash=pageHash.getValue(key);}
if(queryValueHash){return(decodeURI(queryValueHash));}else{var page=new PageQuery(window.location.search);var queryValue=page.getValue(key);if(queryValue)
return(decodeURI(queryValue));else
return defaultValue;}}
function setSelectIndexToValue(selectObject,optionValue){if((selectObject!="")&&(optionValue!="")&&(selectObject.selectedIndex>-1)&&(selectObject[selectObject.selectedIndex].value!=optionValue)){var newIndex=0;var objectLength=selectObject.length;for(var i=0;i<objectLength;i++){if(selectObject[i].value==optionValue){newIndex=i;break;}}
selectObject.selectedIndex=newIndex;}}
function appendUrlParam(source,paramName,paramValue){var result="";if(source!="")
result=source+'&';result=result+paramName+"="+encodeURI(paramValue);return result;}
function appendUrlMapParam(source,mapName,paramName,paramValue){var result="";if(source!="")
result=source+'&';result=result+mapName+"["+paramName+"]="+encodeURI(paramValue);return result;}
function insertUrlParam(source,paramName,paramValue){var tempUrl="";var anchorArray=source.split("#");var queryArray=anchorArray[0].split("?");tempUrl=queryArray[0]+"?";if(queryArray.length>1)
tempUrl=tempUrl+queryArray[1]+"&";tempUrl=tempUrl+paramName+"="+escape(paramValue);if(anchorArray.length>1)
tempUrl=tempUrl+"#"+anchorArray[1];return tempUrl;}
var armoryJSLoaded=1;function getexpirydate(nodays){var UTCstring;Today=new Date();nomilli=Date.parse(Today);Today.setTime(nomilli+nodays*24*60*60*1000);UTCstring=Today.toUTCString();return UTCstring;}
function getcookie2(cookiename){var cookiestring=""+document.cookie;var index1=cookiestring.indexOf(cookiename);if(index1==-1||cookiename=="")return"";var index2=cookiestring.indexOf(';',index1);if(index2==-1)index2=cookiestring.length;return unescape(cookiestring.substring(index1+cookiename.length+1,index2));}
function setcookie(name,value,expire){var expireString="EXPIRES="+getexpirydate(365)+";"
if(expire=="session")
expireString="";cookiestring=name+"="+escape(value)+";"+expireString+"PATH=/";document.cookie=cookiestring;}
function deletecookie(name,path,domain){if(getcookie2(name))document.cookie=name+"="+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT";}
var region="";if(document.location.href.indexOf("www.wowarmory.com")!=-1){region="US";}else if(document.location.href.indexOf("wow-europe.com")!=-1||document.location.href.indexOf("80.239.186.40")!=-1||document.location.href.indexOf("eu.")!=-1||document.location.href.indexOf("preprod")!=-1||document.location.href.indexOf("eu.wowarmory.com")!=-1)
region="EU"
else if(document.location.href.indexOf("armory.worldofwarcraft.co.kr")!=-1||document.location.href.indexOf("kr.wowarmory.com")!=-1){region="KR";}else if(document.location.href.indexOf("armory.wowtaiwan.com.tw")!=-1||document.location.href.indexOf("tw.wowarmory.com")!=-1){region="TW";}else if(document.location.href.indexOf("armory.wowtaiwan.com.cn")!=-1||document.location.href.indexOf("cn.wowarmory.com")!=-1){region="CN";}else
region="US"
function truncateString(theString,maxChars){if(theString.length>maxChars&&maxChars)
return theString.substring(0,maxChars-3)+"...";else
return theString;}
function sortNumberRightAs(a,b){a=a[0][0]+a[1];b=b[0][0]+b[1];return a==b?0:(a<b?-1:1)}
function selectLang(theDisplay,cookieValue){document.getElementById("dropdownHiddenLang").style.display="none";document.getElementById("displayLang").innerHTML=theDisplay;setcookie("cookieLangId",cookieValue);document.location.reload();}
var Url={encode:function(string){return escape(this._utf8_encode(string));},decode:function(string){return this._utf8_decode(unescape(string));},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}}
function setDualTooltipCookie(){if(document.getElementById('checkboxDualTooltip').checked)
setcookie("armory.cookieDualTooltip",1);else
setcookie("armory.cookieDualTooltip",0);}
function addEvent(obj,evType,fn){if(obj.addEventListener){obj.addEventListener(evType,fn,false);return true;}else if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r;}else{return false;}}
function dropdownMenuToggle(whichOne){theStyle=document.getElementById(whichOne).style;if(theStyle.display=="none"){theStyle.display="block";}else
theStyle.display="none";}
var MM_contentVersion=8;var plugin=(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"])?navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin:0;if(plugin){var words=navigator.plugins["Shockwave Flash"].description.split(" ");var wordsLength=words.length;for(var i=0;i<wordsLength;++i)
{if(isNaN(parseInt(words[i])))
continue;var MM_PluginVersion=words[i];}
var MM_FlashCanPlay=MM_PluginVersion>=MM_contentVersion;}
else if(navigator.userAgent&&navigator.userAgent.indexOf("MSIE")>=0&&(navigator.appVersion.indexOf("Win")!=-1)){document.write('<SCR'+'IPT LANGUAGE=VBScript\> \n');document.write('on error resume next \n');document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');document.write('</SCR'+'IPT\> \n');}
function showNoflashMessage(){document.getElementById("noflash-message").style.display="block";}
var flashString;var tempObj;var flashCount=1;function printFlash(id,src,wmode,menu,bgcolor,width,height,quality,base,flashvars,noflash){if(MM_FlashCanPlay){flashString='<object id= "'+id+'Flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'"><param name="movie" value="'+src+'"></param><param name="quality" value="'+quality+'"></param>';if(base){flashString+='<param name="base" value="'+base+'"/>';}
flashString+='<param name="flashvars" value="'+flashvars+'" ></param><param name="bgcolor" value="'+bgcolor+'" ></param><param name="menu" value="'+menu+'" ></param><param name="wmode" value="'+wmode+'" ></param><param name="salign" value="tl" ></param><embed name= "'+id+'Flash" src="'+src+'" wmode="'+wmode+'" menu="'+menu+'" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" quality="'+quality+'" pluginspage="http://www.macromedia.com/go/getflas/new-hplayer" type="application/x-shockwave-flash" salign="tl" base="'+base+'" flashvars="'+flashvars+'" /></object>';}else{flashString=noflash;}
if(id=="loader"&&!Browser.moz)
flashString=noflash;document.getElementById(id).innerHTML=flashString;document.getElementById(id).style.display="block";}
mouseY=false;windowWidth=false;Browser.safari=((navigator.userAgent.indexOf("Safari")!=-1))?true:false;isShowing=false;visibilityOverride=false;var defaultWidth=300;function showTip(toolTipContent,defaultWidthOverride){windowHeight=elemDoc.clientHeight;windowWidth=elemDoc.clientWidth;elemtb1.innerHTML=toolTipContent;elemttc.style.display="block";if(elemt1c.offsetWidth>299){elemt1c.style.width="300px";}
if(Browser.ie||Browser.safari||Browser.opera)elemttc.style.width="300px";if(!visibilityOverride)elemttc.style.visibility="visible";isShowing=true;}
function adjustTooltipPosition(){if(!mouseY)return false;else
{var varYoffset=window.pageYOffset;var ttipOvershoot=(!Browser.safari)?elemttc.offsetHeight+mouseY+10:elemttc.offsetHeight+mouseY+10-varYoffset;var ttipSideOvershoot=elemttc.offsetWidth+mouseX+10;if(ttipOvershoot>windowHeight){elemttc.style.top=(!Browser.safari)?windowHeight-elemttc.offsetHeight+elemDoc.scrollTop+2+"px":windowHeight-elemttc.offsetHeight+varYoffset+"px";}else{elemttc.style.top=(!Browser.safari)?mouseY+10+elemDoc.scrollTop+"px":mouseY+5+"px";}
if(ttipSideOvershoot>windowWidth){elemttc.style.left=windowWidth-elemttc.offsetWidth+"px";}else{elemttc.style.left=mouseX+10+"px";}}}
function showTipTwo(toolTipContent){if(getcookie2("armory.cookieDualTooltip")!=0){elemtb2.innerHTML=textCurrentlyEquipped+toolTipContent;elemt2c.style.display="block";if(elemt2c.offsetWidth>299){elemt2c.style.width="300px";}}}
function showTipThree(toolTipContent){if(getcookie2("armory.cookieDualTooltip")!=0){elemtb3.innerHTML=textCurrentlyEquipped+toolTipContent;elemt3c.style.display="block";if(elemt3c.offsetWidth>299){elemt3c.style.width="300px";}}}
function emergencyPurge(){elemt1c.style.width="auto";elemt2c.style.width="auto";}
function hideTip(){isShowing=false;elemttc.style.display="none";elemt1c.style.width="auto";elemt2c.style.display="none";elemt3c.style.display="none";elemttc.style.width="auto";}
document.onmousemove=tipPosition;function tipPosition(callingEvent){try{if(!callingEvent)callingEvent=window.event;mouseX=callingEvent.clientX;mouseY=callingEvent.clientY-1;if(isShowing){var ttipSideOvershoot=elemttc.offsetWidth+mouseX+10;var varYoffset=window.pageYOffset;var ttipOvershoot=(!Browser.safari)?elemttc.offsetHeight+mouseY+10:elemttc.offsetHeight+mouseY+10-varYoffset;if(ttipOvershoot>windowHeight){elemttc.style.top=(!Browser.safari)?windowHeight-elemttc.offsetHeight+elemDoc.scrollTop+2+"px":windowHeight-elemttc.offsetHeight+varYoffset+"px";}else{elemttc.style.top=(!Browser.safari)?mouseY+10+elemDoc.scrollTop+"px":mouseY+5+"px";}
if(ttipSideOvershoot>windowWidth){elemttc.style.left=windowWidth-elemttc.offsetWidth+"px";}else{elemttc.style.left=mouseX+10+"px";}}}catch(e){}}
var resultsSideState="middle";function resultsSideRight(){if(resultsSideState=="middle"){document.getElementById("results-side-switch").className="results-side-collapsed";resultsSideState="right";}}
function resultsSideLeft(redirectUrl){if(resultsSideState=="right"){document.getElementById("results-side-switch").className="results-side-expanded";resultsSideState="middle";}else{if(redirectUrl){window.location.href=redirectUrl;}}}
function thisMovie(movieName){if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName]}else{return document[movieName]}}
function popIconLarge(movieName,mcName){if(MM_FlashCanPlay){try{if(Browser.ie)
try{thisMovie(movieName).TGotoFrame(mcName,1);}catch(e){throw e;}
else if(!Browser.opera&&thisMovie(movieName)&&thisMovie(movieName).TGotoFrame)
thisMovie(movieName).TGotoFrame(mcName,1);}catch(e){throw e;}}}
function popIconSmall(movieName,mcName){if(MM_FlashCanPlay){try{if(Browser.ie)
try{thisMovie(movieName).TGotoFrame(mcName,2);}catch(e){throw e;}
else
if(!Browser.opera&&thisMovie(movieName)&&thisMovie(movieName).TGotoFrame)
thisMovie(movieName).TGotoFrame(mcName,2);}catch(e){throw e;}}}
var currentFaq=1;function faqSwitch(faqId){$("#faqlink"+currentFaq).attr("class","faq-off");$("#faqlink"+faqId).attr("class","faq-over");currentFaq=faqId;$('#faq-container').html($("#faq"+faqId).html());}
var pageChangerXsltProcessor;function initXsltProcessor(xsltProc,xslUrl){var xslDoc=Sarissa.getDomDocument();xslDoc.async=true;if(Browser.ie)
xslDoc.async=false;xslDoc.load(xslUrl);xsltProc.importStylesheet(xslDoc);}
function xmlDataLoadSarissa(xmlSource,xslSource,container){pageChangerXsltProcessor=new XSLTProcessor();initXsltProcessor(pageChangerXsltProcessor,xslSource);if(xmlSource.indexOf('?')==-1)
xmlSource+='?';xmlSource+="&lang="+getcookie2("cookieLangId");fetchXmlData(xmlSource,container,pageChangerXsltProcessor);var urlSplit=xmlSource.split('?');var xmlName=urlSplit[0].split('.')[0];if(xmlName.indexOf("index")>-1&&!document.location.hash)
document.getElementById('indexChange1').className="home";else
document.getElementById('indexChange1').className="other";}
var ajaxOverride=false;var historyChangeBool=0;function historyChange(newLocation)
{if((!historyChangeBool&&window.historyStorage.getCurrentPage()==parseXMLurl(document.location.href).escapeUrl)||(!document.location.hash&&historyChangeBool==1)||(window.historyStorage.getCurrentPage()=="index.xml")){}else{if(!newLocation)
newLocation=window.historyStorage.getCurrentPage();var urlObj=parseXMLurl(newLocation);window.historyStorage.setCurrentPage(urlObj.url);xmlDataLoadSarissa(newLocation,urlObj.xsl,'dataElement')}}
function parseXMLurl(xmlUrl,xslUrl,escapeBool){if(xmlUrl.lastIndexOf('/')>=0)
xmlUrl=xmlUrl.substring(xmlUrl.lastIndexOf('/')+1,xmlUrl.length)
var urlSplit=xmlUrl.split('?');xmlUrl=urlSplit[0];xml=xmlUrl;if(xslUrl){xsl=xslUrl;}else{xsl='layout/'+xml.split('.')[0]+'-ajax.xsl';}
query=urlSplit[1];var pageObject=new Object();pageObject.xml=xml;pageObject.xsl=xsl;pageObject.query=query;pageObject.url=xml;if(query)pageObject.url+="?"+query;pageObject.escapeUrl=xml;pageObject.escapeQuery="";if(query){var queryConstructor=new PageQuery("?"+query);var queryParams=queryConstructor.getParameters();var queryParamsLength=queryParams.length;for(i=0;i<queryParamsLength;i++){if(Browser.ie||escapeBool||Browser.opera)
pageObject.escapeQuery+=queryParams[i]+"="+encodeURI(Utf8.decode(queryConstructor.getValue(queryParams[i])));else{pageObject.escapeQuery+=queryParams[i]+"="+encodeURI(queryConstructor.getValue(queryParams[i]));}
if(i!=queryParams.length-1)
pageObject.escapeQuery+="&";}
pageObject.escapeQuery=pageObject.escapeQuery.replace("'","%27");pageObject.escapeQuery=pageObject.escapeQuery.replace("%25","%");pageObject.escapeQuery=pageObject.escapeQuery.replace("%20","+");pageObject.escapeUrl+="?"+pageObject.escapeQuery;}
return pageObject;}
if(IS_ENABLED_XSLT){if(!hashParse){var urlObj=parseXMLurl(document.location.href);setcookie("currentPage",urlObj.escapeUrl,"session");}}
function addHistory(url){dhtmlHistory.add(url,"a");window.historyStorage.setCurrentPage(url);}
function ajaxLink(xmlUrl,xslUrl,appendRandomNumber){if(Browser.safari&&region=="TW"){theUrl=xmlUrl;theUrl=encodeURI(theUrl);window.location.href=theUrl;}else if(!Browser.moz&&region=="TW"){theUrl=Url.decode(xmlUrl);theUrl=encodeURI(theUrl);window.location.href=theUrl;}else if(Browser.safari&&region=="KR"){theUrl=xmlUrl;theUrl=encodeURI(theUrl);window.location.href=theUrl;}else if(!Browser.moz&&region=="KR"){theUrl=Url.decode(xmlUrl);theUrl=encodeURI(theUrl);window.location.href=theUrl;}else
window.location.href=xmlUrl;}
var ajaxXmlUrl;var ajaxDataElementName;var ajaxXsltProcessor;function fetchXmlData(xmlUrl,dataElementName,xsltProcessor){historyChangeBool=1;ajaxXmlUrl=xmlUrl;ajaxDataElementName=dataElementName;ajaxXsltProcessor=xsltProcessor;window.setTimeout("fetchXmlData2()",50);}
function fetchXmlData2(){if(!IS_ENABLED_XSLT){window.location.replace(ajaxXmlUrl);return;}
isItems=0;isArenaTeams=0;updateDataContent(ajaxXmlUrl,document.getElementById(ajaxDataElementName),ajaxXsltProcessor);}
function ieFix(){var tempDiv=document.createElement("div");tempDiv.style.position="absolute";tempDiv.style.top="-100px";document.body.appendChild(tempDiv);}
var head;var numHeadNodes=0;function initHead(){head=document.getElementsByTagName("head");numHeadNodes=head[0].childNodes.length;}
addEvent(window,'load',initHead);var jsLoaded=true;var jsLoadCount=1;var tempString;var jsArrayLength;function checkJSLoad(){while(jsLoadCount<jsArrayLength&&jsLoaded){scriptString=tempArray[jsLoadCount].split('</SCRIPT>')[0];theSrc="";theScript="";srcStartLoc=scriptString.substring(0,6).indexOf(" src=");scriptTagEndLoc=scriptString.indexOf(" type=text/javascript>");if(srcStartLoc!=-1)
theSrc=scriptString.substring(srcStartLoc+6,scriptTagEndLoc-1)
theScript=scriptString.substring(scriptTagEndLoc+22,scriptString.length);script=document.createElement("script");head[0].appendChild(script);if(theSrc)jsLoaded=false;script.type="text/javascript";if(theSrc)script.src=theSrc;if(theScript)script.text=theScript;jsLoadCount++;if(theSrc)
return false;}
if(jsLoadCount>=jsArrayLength){jsLoaded=true;jsLoadCount=1;clearInterval(checkLoadInterval)}}
var checkLoadInterval=0;function updateDataContent(sFromUrl,oTargetElement,xsltproc){try{oTargetElement.style.cursor="wait";var xmlhttp=new XMLHttpRequest();xmlhttp.open("GET",sFromUrl,true);function sarissa_dhtml_loadHandler(){if(xmlhttp.readyState==4){oTargetElement.style.cursor="auto";if(xmlhttp.responseXML!=null){var procer=xsltproc;if(Browser.ie){while(numHeadNodes!=head[0].childNodes.length)
head[0].removeChild(head[0].lastChild)}
var newFrag=procer.transformToFragment(xmlhttp.responseXML,window.document);oTargetElement.innerHTML="";oTargetElement.appendChild(newFrag);if(Browser.ie){embeddedStyles=oTargetElement.getElementsByTagName("link");embeddedStylesLength=embeddedStyles.length;for(count=0;count<embeddedStylesLength;count++){embeddedStyle=document.createElement("link");head[0].appendChild(embeddedStyle);embeddedStyle.type=embeddedStyles[count].type
embeddedStyle.rel=embeddedStyles[count].rel;embeddedStyle.href=embeddedStyles[count].href;embeddedStyle.media=embeddedStyles[count].media;}
tempString=document.getElementById("dataElement").innerHTML;tempArray=tempString.split('<SCRIPT');jsArrayLength=tempArray.length;window.setTimeout("ieFix()",100)
checkLoadInterval=window.setInterval("checkJSLoad()",100)}else{}}}}
xmlhttp.onreadystatechange=sarissa_dhtml_loadHandler;xmlhttp.send(null);oTargetElement.style.cursor="auto";}catch(e){oTargetElement.style.cursor="auto";throw e;}}
function arenaLadderLink(battlegroup,teamSize){var URL_XML="/arena-ladder.xml";var URL_BATTLEGROUP_SELECT="/battlegroups.xml";var XSL_URL_BATTLEGROUP_SELECT="/layout/battlegroups-ajax.xsl";var URL_TEAMSIZE_SELECT="/select-team-type.xml";var selectedBG;if(battlegroup){selectedBG=battlegroup;setcookie("armory.cookieBG",battlegroup);}else{selectedBG=getcookie2("armory.cookieBG");}
var selectedTS;if(teamSize){selectedTS=teamSize;setcookie("armory.cookieTS",teamSize);}else{selectedTS=getcookie2("armory.cookieTS");}
if(!selectedBG){window.location.href=URL_BATTLEGROUP_SELECT;return;}
if(!selectedTS){window.location.href=URL_TEAMSIZE_SELECT;return;}
var arenaLadderUrl=URL_XML+"?b="+escape(selectedBG)+"&ts="+selectedTS;if(region=="KR"){selectedBG=Url.encode(selectedBG);arenaLadderUrl=URL_XML+"?b="+selectedBG+"&ts="+selectedTS;}else if(region=="TW"){selectedBG=Url.encode(selectedBG);arenaLadderUrl=URL_XML+"?b="+selectedBG+"&ts="+selectedTS;}
window.location.href=arenaLadderUrl;}
function replaceLink(siteUrl){var replaceUrl="";if(IS_ENABLED_XSLT)
replaceUrl=siteUrl+"/"+window.historyStorage.getCurrentPage();else
replaceUrl=document.location.href;var browserVer="";jQuery.each(jQuery.browser,function(i,val){if(i=="version")
browserVer+=" Version: "+val;if(val==true)
browserVer+=", "+i;});document.getElementById("reportLink").href=document.getElementById("reportLink").href.replace("REPLACEURL",replaceUrl.replace('&','%26')).replace("REPLACEBROWSER",browserVer)}
function guildLink(){window.location.href=guildUrl;}
function forumLink(forumName,lang){var forumsUrl="";if(region=="EU")
forumsUrl="http://forums.wow-europe.com/";else if(region=="US")
forumsUrl="http://forums.worldofwarcraft.com/";else if(region=="TW")
forumsUrl="http://forum.wowtaiwan.com.tw/";window.open(forumsUrl+"board.html?forumName="+forumName)}
function menuCheckLength(formReference){}
function resetSearch()
{$("#armorySearch").removeClass();$("#armorySearch").val("");$('#searchCat').hide();$('#searchOptions').css('background-position','')}
function displayNone(whichBlock){document.getElementById(whichBlock).style.display='none';}
function changeBlock(whichBlock){document.getElementById(whichBlock).style.display='block';}
function getArenaIconBorder(teamSize,whichBadge){var theIcon;var theRank;var theIconDivId;if(teamSize>5){theRank=teamSize;theIconDivId="iconPropassteam";}else if(arenaTeamArray[teamSize]){theRank=arenaTeamArray[teamSize][2];theIconDivId="icon"+teamSize+"v"+teamSize+"team";}else{return false;}
if(!theRank||theRank>1000){theIcon="parchment";theIconImage="arena-6";}else if(theRank>500){theIcon="bronze";theIconImage="arena-5";}else if(theRank>100){theIcon="bronze-large";theIconImage="arena-4";}else if(theRank>10){theIcon="silver"
theIconImage="arena-3";}else if(theRank>1){theIcon="gold";theIconImage="arena-2";}else if(theRank==1){theIcon="gold-large";theIconImage="arena-1";}else{theIcon="parchment";theIconImage="arena-6";}
$("#"+whichBadge).attr("src","/images/badge-border-pvp-"+theIcon+".gif");$("#"+theIconDivId).css("background-image","url('/images/icons/badges/arena/"+theIconImage+".jpg')");}
function goToPropass(){if(getcookie2("armory.cookiePropassBG"))
document.location.href="/arena-ladder.xml?b="+encodeURI(getcookie2("armory.cookiePropassBG"))+"&ts=3";else
document.location.href="/battlegroups.xml#tournament";}
function setCharSheetIcons()
{$(".charSheetImg").each(function(){if(this.id!="")$(this).css("background-image","url('/wow-icons/_images/51x51/"+this.id+".jpg')");else $(this).attr("src","images/pixel.gif");});}
function setCharSheetLinks()
{$("a.itemToolTip").each(function(){if($(this).hasClass("staticTip")){$(this).attr("href","javascript:void(0)");}});}
function bindDropDownMenu()
{$("#nav ul").css({display:"none"});$("#nav li").hover(function(){$(this).find('ul:first').css({visibility:"visible",display:"none"}).show();$(this).children("a:first").attr("style","background-color: #101615; color: #FFF");$(this).children("span:first").attr("style","background-color: #101615;font-weight:bold;cursor:pointer;color:#FFF;");if(($.browser.msie)&&($.browser.version=="6.0")){$("select").hide();}},function(){$(this).find('ul:first').css({visibility:"hidden"});$(this).children("a:first").removeAttr("style");$(this).children("span:first").removeAttr("style");if(($.browser.msie)&&($.browser.version=="6.0")){$("select").show();}});}
function setCharSheetUpgradeMenu()
{}
function bindLanguageLinks()
{$("#languageFooter .langLink").each(function(){var currLink=location.href;var theLangHref=$(this).attr("href");if(currLink.indexOf("?")!=-1){currLink=currLink.substr(currLink.indexOf("?")+1);if(theLangHref.indexOf("?")==-1)
$(this).attr("href",$(this).attr("href")+"?"+currLink);else
$(this).attr("href",$(this).attr("href")+"&"+currLink);}});}
function bindLoginLink()
{var currLink=location.href;if(currLink.indexOf("?")==-1){$("#loginLinkRedirect").attr("href",currLink+"?login=1");$("#loginLinkRedirect2").attr("href",currLink+"?login=1");}else{$("#loginLinkRedirect").attr("href",currLink+"&login=1");$("#loginLinkRedirect2").attr("href",currLink+"&login=1");}}
if(!this['L10n'])
L10n={};L10n.formatTimestamps=function(domQuery,formatConfig){var datePartRegex=/([\d]{4})-([\d]{2})-([\d]{2})(?:T([\d]{2}):([\d]{2}):([\d]{2})(?:([+-])([\d]{2}):([\d]{2}))?)?/;var curTime=(new Date()).getTime();$(domQuery).each(function(i){var node=$(this);var p=datePartRegex.exec(node.text());var d=new Date(Date.UTC(p[1],p[2]-1,p[3],p[4],p[5],p[6]));if(p[8]||p[9])
d.setUTCMilliseconds((p[8]*3600000+p[9]*60000)*(p[7]=="-"?1:-1));var timeDiff=curTime-d.getTime();var formattedDate="";if(timeDiff<172800000&&timeDiff>=0){if(timeDiff<86400000){var units,format;if(timeDiff<3600000){units=Math.round(timeDiff/60000);format=units==1?(formatConfig.withinHourSingular||formatConfig.withinHour):formatConfig.withinHour;}else{units=Math.round(timeDiff/3600000);format=units==1?(formatConfig.withinDaySingular||formatConfig.withinDay):formatConfig.withinDay;}
formattedDate=printf(formatConfig.today,printf(format,units));}else{formattedDate=formatConfig.yesterday;}}else{formattedDate=formatConfig.date.replace(/([a-zA-Z]+)/g,function(token){switch(token){case"yyyy":return d.getFullYear();case"M":return d.getMonth()+1;case"d":return d.getDate();default:return"?";}});}
node.text(formattedDate);node.show();});}
