PageRenderTime 62ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/armory/js/armory.js

https://bitbucket.org/ekynox/tcweb1
JavaScript | 1553 lines | 1088 code | 256 blank | 209 comment | 317 complexity | 35c59ceb0d957e83ff997d68b7d31bc0 MD5 | raw file
Possible License(s): AGPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. // armory.js
  2. //
  3. // This is the master include file for any armory-specific javascript files.
  4. //
  5. // requires:
  6. // sarissa.js
  7. //
  8. //sets a default ? to the begining of the url
  9. var right = 0;
  10. //begin UTF8
  11. var Utf8 = {
  12. // public method for url encoding
  13. encode : function (string) {
  14. string = string.replace(/\r\n/g,"\n");
  15. var utftext = "";
  16. var sLength = string.length;
  17. for (var n = 0; n < sLength; n++) {
  18. var c = string.charCodeAt(n);
  19. if (c < 128) {
  20. utftext += String.fromCharCode(c);
  21. } else if((c > 127) && (c < 2048)) {
  22. utftext += String.fromCharCode((c >> 6) | 192);
  23. utftext += String.fromCharCode((c & 63) | 128);
  24. } else {
  25. utftext += String.fromCharCode((c >> 12) | 224);
  26. utftext += String.fromCharCode(((c >> 6) & 63) | 128);
  27. utftext += String.fromCharCode((c & 63) | 128);
  28. }
  29. }
  30. return utftext;
  31. },
  32. // public method for url decoding
  33. decode : function (utftext) {
  34. var string = "";
  35. var i = 0;
  36. var c = c1 = c2 = 0;
  37. var textLength = utftext.length;
  38. while ( i < textLength) {
  39. c = utftext.charCodeAt(i);
  40. if (c < 128) {
  41. string += String.fromCharCode(c);
  42. i++;
  43. } else if((c > 191) && (c < 224)) {
  44. c2 = utftext.charCodeAt(i+1);
  45. string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
  46. i += 2;
  47. } else {
  48. c2 = utftext.charCodeAt(i+1);
  49. c3 = utftext.charCodeAt(i+2);
  50. string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
  51. i += 3;
  52. }
  53. }
  54. return string;
  55. }
  56. }
  57. //end UTF8
  58. var IS_ENABLED_XSLT=is_moz;
  59. /*var pathnameParse=document.location.href.split(window.location.protocol + "/")[1].split("index.php")[1];
  60. var hashParse=pathnameParse.split("#")[1];
  61. pathnameParse=pathnameParse.split("#")[0];*/
  62. //if a hash url is present but this is not an XSLT enabled browser, interpret the hash and send the browser to the correct page
  63. /*if(!IS_ENABLED_XSLT && hashParse && hashParse.indexOf(".xml")>-1){
  64. document.location.hash="";
  65. document.location=hashParse;
  66. }
  67. if(IS_ENABLED_XSLT && is_ie){
  68. if(!pathnameParse && !hashParse){//if url path is blank
  69. setcookie("currentPage","index.php","session");
  70. setcookie("historyStorage","","session")
  71. document.location.href=document.location.href+'?';
  72. }
  73. }*/
  74. function PageQuery(q) {
  75. // we want to store everything to the right of the ? in a key value pair array
  76. var qSplit = q.split("?");
  77. if (qSplit.length > 1)
  78. this.q = qSplit[qSplit.length - 1]; // use the right-most element since there may be ? chars in a hash
  79. else
  80. this.q = null;
  81. this.keyValuePairs = new Array();
  82. if(this.q) {
  83. for(var i=0; i < this.q.split("&").length; i++) {
  84. this.keyValuePairs[i] = this.q.split("&")[i];
  85. }
  86. }
  87. this.getKeyValuePairs = function() { return this.keyValuePairs; }
  88. this.getValue = function(s) {
  89. for(var j=0; j < this.keyValuePairs.length; j++) {
  90. if(this.keyValuePairs[j].split("=")[0] == s)
  91. return this.keyValuePairs[j].split("=")[1];
  92. }
  93. return false;
  94. }
  95. this.getParameters = function() {
  96. var a = new Array(this.getLength());
  97. for(var j=0; j < this.keyValuePairs.length; j++) {
  98. a[j] = this.keyValuePairs[j].split("=")[0];
  99. }
  100. return a;
  101. }
  102. this.getLength = function() { return this.keyValuePairs.length; }
  103. }
  104. function queryString(key, defaultValue){
  105. // try extracting query params from a hash first
  106. //alert('window.location.hash = ' + window.location.hash);
  107. var theHash;
  108. var pageHash;
  109. var queryValueHash
  110. if(IS_ENABLED_XSLT && !window.location.search){
  111. if(is_ie6)
  112. theHash = window.location.href.split('#')[1];
  113. else
  114. theHash = window.location.hash;
  115. if(!theHash)
  116. theHash = window.historyStorage.getCurrentPage();
  117. pageHash = new PageQuery(theHash);
  118. queryValueHash = pageHash.getValue(key);
  119. }
  120. if (queryValueHash) {
  121. return (decodeURI(queryValueHash));
  122. } else {
  123. // there weren't any query params in the hash so try again without the hash
  124. var page = new PageQuery(window.location.search);
  125. var queryValue = page.getValue(key);
  126. //alert("window.location.search = " + window.location.search);
  127. //alert("failed to get value for hash key = " + key + ", non-hash value = " + queryValue);
  128. if (queryValue)
  129. return (decodeURI(queryValue));
  130. else
  131. return defaultValue;
  132. }
  133. }
  134. function setSelectIndexToValue(selectObject, optionValue) {
  135. if ((selectObject != "") && (optionValue != "") && (selectObject.selectedIndex > -1) && (selectObject[selectObject.selectedIndex].value != optionValue)) {
  136. var newIndex = 0;
  137. var objectLength = selectObject.length;
  138. for (var i = 0; i < objectLength; i++) {
  139. if (selectObject[i].value == optionValue) {
  140. newIndex = i;
  141. break;
  142. }
  143. }
  144. selectObject.selectedIndex = newIndex;
  145. }
  146. }
  147. function appendUrlParam(source, paramName, paramValue) {
  148. var result = "";
  149. if (source != "")
  150. result = source + '&';
  151. result = result + paramName + "=" + encodeURI(paramValue);
  152. return result;
  153. }
  154. function appendUrlMapParam(source, mapName, paramName, paramValue) {
  155. var result = "";
  156. if (source != "")
  157. result = source + '&';
  158. result = result + mapName + "[" + paramName + "]=" + encodeURI(paramValue);
  159. return result;
  160. }
  161. function insertUrlParam(source, paramName, paramValue) {
  162. var tempUrl = "";
  163. var anchorArray = source.split("#");
  164. var queryArray = anchorArray[0].split("?");
  165. tempUrl = queryArray[0] + "?";
  166. if (queryArray.length > 1)
  167. tempUrl = tempUrl + queryArray[1] + "&";
  168. tempUrl = tempUrl + paramName + "=" + escape(paramValue);
  169. if (anchorArray.length > 1)
  170. tempUrl = tempUrl + "#" + anchorArray[1];
  171. return tempUrl;
  172. }
  173. var armoryJSLoaded=1;
  174. //begin cookies section
  175. function getexpirydate(nodays){
  176. var UTCstring;
  177. Today = new Date();
  178. nomilli=Date.parse(Today);
  179. Today.setTime(nomilli+nodays*24*60*60*1000);
  180. UTCstring = Today.toUTCString();
  181. return UTCstring;
  182. }
  183. function getcookie2(cookiename) {
  184. var cookiestring=""+document.cookie;
  185. var index1=cookiestring.indexOf(cookiename);
  186. if (index1==-1 || cookiename=="") return "";
  187. var index2=cookiestring.indexOf(';',index1);
  188. if (index2==-1) index2=cookiestring.length;
  189. return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
  190. }
  191. function setcookie(name,value,expire){
  192. var expireString="EXPIRES="+ getexpirydate(365)+";"
  193. if(expire=="session")
  194. expireString="";
  195. cookiestring=name+"="+escape(value)+";"+expireString+"PATH=/";
  196. document.cookie=cookiestring;
  197. }
  198. // this deletes the cookie when called
  199. function deletecookie( name, path, domain ) {
  200. if ( getcookie2( name ) ) document.cookie = name + "=" +
  201. ( ( path ) ? ";path=" + path : "") +
  202. ( ( domain ) ? ";domain=" + domain : "" ) +
  203. ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
  204. }
  205. //end cookies section
  206. //begin functions section
  207. var region="";
  208. if(document.location.href.indexOf("www.wowarmory.com")!=-1){//change by akim (add KR)
  209. region="US";
  210. } 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) //Checking for Europe settings
  211. region="EU"
  212. else if(document.location.href.indexOf("armory.worldofwarcraft.co.kr")!=-1 || document.location.href.indexOf("kr.wowarmory.com")!=-1){//change by akim (add KR)
  213. region="KR";
  214. } else if(document.location.href.indexOf("armory.wowtaiwan.com.tw")!=-1 || document.location.href.indexOf("tw.wowarmory.com")!=-1){//change by akim (add KR)
  215. region="TW";
  216. } else if(document.location.href.indexOf("armory.wowtaiwan.com.cn")!=-1 || document.location.href.indexOf("cn.wowarmory.com")!=-1){//change by akim (add KR)
  217. region="CN";
  218. } else
  219. region="US"
  220. function truncateString (theString, maxChars) {
  221. if (theString.length > maxChars && maxChars)
  222. return theString.substring(0, maxChars - 3) + "...";
  223. else
  224. return theString;
  225. }
  226. function sortNumberRightAs(a, b) {
  227. a = a[0][0] + a[1];
  228. b = b[0][0] + b[1];
  229. return a == b ? 0 : (a < b ? -1 : 1)
  230. }
  231. function selectLang(theDisplay, cookieValue) {
  232. document.getElementById("dropdownHiddenLang").style.display = "none";
  233. document.getElementById("displayLang").innerHTML = theDisplay;
  234. setcookie("cookieLangId", cookieValue);
  235. document.location.reload();
  236. }
  237. function selectRealm(theRealm) {
  238. document.getElementById("dropdownHiddenRealm").style.display = "none";
  239. document.getElementById("displayRealm").innerHTML = theRealm;
  240. document.formSearch.realm.value = theRealm;
  241. }
  242. var Url = {
  243. // public method for url encoding
  244. encode : function (string) {
  245. return escape(this._utf8_encode(string));
  246. },
  247. // public method for url decoding
  248. decode : function (string) {
  249. return this._utf8_decode(unescape(string));
  250. },
  251. // private method for UTF-8 encoding
  252. _utf8_encode : function (string) {
  253. string = string.replace(/\r\n/g,"\n");
  254. var utftext = "";
  255. for (var n = 0; n < string.length; n++) {
  256. var c = string.charCodeAt(n);
  257. if (c < 128) {
  258. utftext += String.fromCharCode(c);
  259. }
  260. else if((c > 127) && (c < 2048)) {
  261. utftext += String.fromCharCode((c >> 6) | 192);
  262. utftext += String.fromCharCode((c & 63) | 128);
  263. }
  264. else {
  265. utftext += String.fromCharCode((c >> 12) | 224);
  266. utftext += String.fromCharCode(((c >> 6) & 63) | 128);
  267. utftext += String.fromCharCode((c & 63) | 128);
  268. }
  269. }
  270. return utftext;
  271. },
  272. // private method for UTF-8 decoding
  273. _utf8_decode : function (utftext) {
  274. var string = "";
  275. var i = 0;
  276. var c = c1 = c2 = 0;
  277. while ( i < utftext.length ) {
  278. c = utftext.charCodeAt(i);
  279. if (c < 128) {
  280. string += String.fromCharCode(c);
  281. i++;
  282. }
  283. else if((c > 191) && (c < 224)) {
  284. c2 = utftext.charCodeAt(i+1);
  285. string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
  286. i += 2;
  287. }
  288. else {
  289. c2 = utftext.charCodeAt(i+1);
  290. c3 = utftext.charCodeAt(i+2);
  291. string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
  292. i += 3;
  293. }
  294. }
  295. return string;
  296. }
  297. }
  298. function getCopyUrl() {
  299. if (is_ie && IS_ENABLED_XSLT) {
  300. theUrl = "http://";
  301. theUrl += window.location.hostname;
  302. theUrl += "./"+ window.historyStorage.getCurrentPage();
  303. theUrl = theUrl.replace("?#", "");
  304. } else {
  305. theUrl = location.href;
  306. theUrl = theUrl.replace("#", "");
  307. }
  308. document.formCopyUrl.inputCopyUrl.value = theUrl;
  309. }
  310. function toggleCopyUrl() {
  311. if (document.getElementById("divCopyUrl").style.display == "block")
  312. document.getElementById("divCopyUrl").style.display = "none";
  313. else
  314. document.getElementById("divCopyUrl").style.display = "block";
  315. getCopyUrl();
  316. }
  317. function setDualTooltipCookie() {
  318. if (document.getElementById('checkboxDualTooltip').checked)
  319. setcookie("armory.cookieDualTooltip", 1);
  320. else
  321. setcookie("armory.cookieDualTooltip", 0);
  322. }
  323. function setCharCookie(charName, realm, guild, guildUrl, faction, race, clazz, team2, team3, team5) {
  324. setcookie("armory.cookieCharProfileUrl", "cmpn="+charName+"&cmpr="+realm);
  325. setcookie("armory.cookieCharProfileName", charName);
  326. setcookie("armory.cookieCharProfileRealm", realm);
  327. setcookie("armory.cookieCharProfileGuildName", guild);
  328. setcookie("armory.cookieCharProfileGuildUrl", guildUrl);
  329. setcookie("armory.cookieCharProfileFaction", faction);
  330. setcookie("armory.cookieCharProfileTeam2", team2);
  331. setcookie("armory.cookieCharProfileTeam3", team3);
  332. setcookie("armory.cookieCharProfileTeam5", team5);
  333. if (!guild) {
  334. setcookie("armory.cookieCharProfileRace", race);
  335. setcookie("armory.cookieCharProfileClass", clazz);
  336. }
  337. showPin();
  338. document.getElementById('checkboxDualTooltip').checked = 1;
  339. setDualTooltipCookie();
  340. }
  341. function showPin() {
  342. document.getElementById('showHidePin').style.display = "block";
  343. var charName = getcookie2("armory.cookieCharProfileName")
  344. document.getElementById('replacePinCharName1').innerHTML = charName;
  345. document.getElementById('replacePinCharName2').innerHTML = "<a href = \"character-sheet.php@r="+ encodeURI(getcookie2("armory.cookieCharProfileRealm")) +"&n="+ encodeURI(getcookie2("armory.cookieCharProfileName")) +"\">"+ charName + "</a>";
  346. var guildName = getcookie2("armory.cookieCharProfileGuildName");
  347. if (guildName != "" && guildName != ";") {
  348. document.getElementById('replacePinGuildName1').innerHTML = "&lt; "+ guildName +" &gt;";
  349. document.getElementById('replacePinGuildName2').innerHTML = "<a href = \"guild-info.php?"+ getcookie2("armory.cookieCharProfileGuildUrl") +"\">&lt; "+ guildName +" &gt;</a>";
  350. } else {
  351. var cookieRace = getcookie2("armory.cookieCharProfileRace");
  352. var cookieClass = getcookie2("armory.cookieCharProfileClass");
  353. document.getElementById('replacePinGuildName1').innerHTML = cookieRace +' '+ cookieClass;
  354. document.getElementById('replacePinGuildName2').innerHTML = '<span style = "color: #cecece">'+ cookieRace +' '+ cookieClass + '</span>';
  355. }
  356. if (getcookie2("armory.cookieCharProfileFaction") == "1")
  357. document.getElementById('changeClassFaction').className = "hord";
  358. else
  359. document.getElementById('changeClassFaction').className = "alli";
  360. var team2Url = getcookie2("armory.cookieCharProfileTeam2");
  361. if (team2Url != "" && team2Url != ";")
  362. document.getElementById('replaceTeam2').innerHTML = "<a class='at2' href=\"team-info.php?"+ team2Url +"\"></a>";
  363. else
  364. document.getElementById('replaceTeam2').innerHTML = "<span class='at20'></span>";
  365. var team3Url = getcookie2("armory.cookieCharProfileTeam3");
  366. if (team3Url != "" && team3Url != ";")
  367. document.getElementById('replaceTeam3').innerHTML = "<a class='at3' href=\"team-info.php?"+ team3Url +"\"></a>";
  368. else
  369. document.getElementById('replaceTeam3').innerHTML = "<span class='at30'></span>";
  370. var team5Url = getcookie2("armory.cookieCharProfileTeam5");
  371. if (team5Url != "" && team5Url != ";")
  372. document.getElementById('replaceTeam5').innerHTML = "<a class='at5' href=\"team-info.php?"+ team5Url +"\"></a>";
  373. else
  374. document.getElementById('replaceTeam5').innerHTML = "<span class='at50'></span>";
  375. document.getElementById('idPinNavArrow').className = "pdown";
  376. }
  377. function showPin2(profileName) {
  378. document.getElementById('pinprofile').style.visibility = 'hidden';
  379. document.getElementById('idPinNavArrow').className = "pdown0";
  380. document.getElementById('replaceTeam2').innerHTML = "<span class='at20'></span>";
  381. document.getElementById('replaceTeam3').innerHTML = "<span class='at30'></span>";
  382. document.getElementById('replaceTeam5').innerHTML = "<span class='at50'></span>";
  383. document.getElementById('changeClassFaction').className = "non";
  384. document.getElementById('replacePinCharName1').innerHTML = profileName;
  385. document.getElementById('replacePinCharName2').innerHTML = "<a>"+ profileName +"</a>";
  386. document.getElementById('replacePinGuildName1').innerHTML = "&lt; "+ textInformation +" &gt;";
  387. document.getElementById('replacePinGuildName2').innerHTML = "<a href = 'index.php?searchType=login' onMouseOver = \"javascript: showTip(textInformationHover);\" onMouseOut = 'hideTip();'>&lt; "+ textInformation +" &gt;</a>";
  388. }
  389. function hidePin(showRegistration) {
  390. document.getElementById('pinprofile').style.visibility = 'hidden';
  391. document.getElementById('idPinNavArrow').className = "pdown0";
  392. document.getElementById('replaceTeam2').innerHTML = "<span class='at20'></span>";
  393. document.getElementById('replaceTeam3').innerHTML = "<span class='at30'></span>";
  394. document.getElementById('replaceTeam5').innerHTML = "<span class='at50'></span>";
  395. document.getElementById('changeClassFaction').className = "non";
  396. if (!window.theCharUrl) {
  397. document.getElementById('replacePinCharName1').innerHTML = textNone;
  398. document.getElementById('replacePinCharName2').innerHTML = "<a>"+ textNone +"</a>";
  399. if (showRegistration == 1){
  400. document.getElementById('replacePinGuildName1').innerHTML = "&lt; "+ textLearnMore +" &gt;";
  401. document.getElementById('replacePinGuildName2').innerHTML = "<a href = '"+ registrationLink +"' onMouseOver = \"javascript: showTip(textLearnMoreHover);\" onMouseOut = 'hideTip();'>&lt; "+ textLearnMore +" &gt;</a>";
  402. } else {
  403. document.getElementById('replacePinGuildName1').innerHTML = "&lt; "+ textCannotRegister +" &gt;";
  404. document.getElementById('replacePinGuildName2').innerHTML = "<a href = '#' onMouseOver = \"javascript: showTip(textCannotRegisterHover);\" onMouseOut = 'hideTip();'>&lt; "+ textCannotRegister +" &gt;</a>";
  405. }
  406. } else {
  407. setPinThisChar();
  408. }
  409. }
  410. function setPinThisChar() {
  411. if (is_moz)
  412. var thePosition = "1";
  413. else
  414. var thePosition = "-1";
  415. document.getElementById('replacePinCharName1').innerHTML = "";
  416. document.getElementById('replacePinCharName2').innerHTML = "";
  417. document.getElementById('replacePinGuildName1').innerHTML = "";
  418. document.getElementById('replacePinGuildName2').innerHTML = "<a href=\"javascript: ajaxPinChar('character-sheet.php?', theCharUrl);\" style = 'font-weight: bold; top: "+ thePosition +"px; position: relative;'>"+ tClickPinBreak +"</a>";
  419. }
  420. function hoverPinOption() {
  421. if (getcookie2("armory.cookieCharProfileUrl") !=0) {
  422. document.getElementById('pinprofile').style.visibility = 'visible';
  423. }
  424. }
  425. function unsetCharCookie() {
  426. setcookie("armory.cookieCharProfileUrl", 0);
  427. setcookie("armory.cookieDualTooltip", 0);
  428. hidePin();
  429. }
  430. function addEvent(obj, evType, fn) {
  431. if (obj.addEventListener) {
  432. obj.addEventListener(evType, fn, false);
  433. return true;
  434. } else if (obj.attachEvent) {
  435. var r = obj.attachEvent("on"+evType, fn);
  436. return r;
  437. } else {
  438. return false;
  439. }
  440. }
  441. function dropdownMenuToggle(whichOne){
  442. theStyle = document.getElementById(whichOne).style;
  443. if (theStyle.display == "none") {
  444. theStyle.display = "block";
  445. } else
  446. theStyle.display = "none";
  447. }
  448. //flash detection
  449. var MM_contentVersion = 8;
  450. var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  451. if ( plugin ) {
  452. var words = navigator.plugins["Shockwave Flash"].description.split(" ");
  453. var wordsLength = words.length;
  454. for (var i = 0; i < wordsLength; ++i)
  455. {
  456. if (isNaN(parseInt(words[i])))
  457. continue;
  458. var MM_PluginVersion = words[i];
  459. }
  460. var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
  461. }
  462. else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
  463. && (navigator.appVersion.indexOf("Win") != -1)) {
  464. document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
  465. document.write('on error resume next \n');
  466. document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
  467. document.write('</SCR' + 'IPT\> \n');
  468. }
  469. function showNoflashMessage(){
  470. document.getElementById("noflash-message").style.display="block";
  471. }
  472. var flashString;
  473. var tempObj;
  474. var flashCount=1;
  475. //printFlash uses innerHTML to render flash objs to get around the IE flash rendering issue
  476. function printFlash(id, src, wmode, menu, bgcolor, width, height, quality, base, flashvars, noflash){
  477. if(MM_FlashCanPlay){
  478. 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>';
  479. if(base){
  480. flashString+='<param name="base" value="' + base + '"/>';
  481. }
  482. 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>';
  483. }else{
  484. flashString=noflash;
  485. }
  486. if(id=="loader" && !is_moz)
  487. flashString=noflash;
  488. document.getElementById(id).innerHTML = flashString;
  489. document.getElementById(id).style.display="block";
  490. }
  491. //Begin Martin's Tooltip Code
  492. mouseY = false;
  493. windowWidth = false;
  494. isShowing = false;
  495. visibilityOverride = false;
  496. var defaultWidth=300;
  497. function showTip(toolTipContent,defaultWidthOverride) {
  498. windowHeight = elemDoc.clientHeight;
  499. windowWidth = elemDoc.clientWidth;
  500. elemtb1.innerHTML = toolTipContent;
  501. elemttc.style.display = "block";
  502. if(elemt1c.offsetWidth > 299) {
  503. elemt1c.style.width="300px";
  504. }
  505. //if(is_ie || _SARISSA_IS_SAFARI || window.opera) elemttc.style.width = "300px";
  506. if (!visibilityOverride) elemttc.style.visibility = "visible";
  507. //adjustTooltipPosition();
  508. isShowing = true;
  509. }
  510. function adjustTooltipPosition() {
  511. if(!mouseY) return false;
  512. else
  513. {
  514. var varYoffset = window.pageYOffset;
  515. var ttipOvershoot = (!is_safari) ? elemttc.offsetHeight + mouseY + 10 : elemttc.offsetHeight + mouseY + 10 - varYoffset;
  516. var ttipSideOvershoot = elemttc.offsetWidth + mouseX + 10;
  517. if(ttipOvershoot > windowHeight) {
  518. elemttc.style.top = (!is_safari) ? windowHeight - elemttc.offsetHeight + elemDoc.scrollTop + 2 + "px" : windowHeight - elemttc.offsetHeight + varYoffset + "px";
  519. } else {
  520. elemttc.style.top = (!is_safari) ? mouseY+10+elemDoc.scrollTop+"px" : mouseY+5+"px";
  521. }
  522. if(ttipSideOvershoot > windowWidth) {
  523. elemttc.style.left = windowWidth - elemttc.offsetWidth+"px";
  524. } else {
  525. elemttc.style.left = mouseX+10+"px";
  526. }
  527. }
  528. }
  529. function showTipTwo(toolTipContent) {
  530. elemtb2.innerHTML = textCurrentlyEquipped + toolTipContent;
  531. elemt2c.style.display = "block";
  532. if(elemt2c.offsetWidth > 299) {
  533. elemt2c.style.width="300px";
  534. }
  535. }
  536. function showTipThree(toolTipContent) {
  537. elemtb3.innerHTML = textCurrentlyEquipped + toolTipContent;
  538. elemt3c.style.display = "block";
  539. if(elemt3c.offsetWidth > 299) {
  540. elemt3c.style.width="300px";
  541. }
  542. }
  543. function emergencyPurge() {
  544. elemt1c.style.width = "auto";
  545. elemt2c.style.width = "auto";
  546. }
  547. function hideTip() {
  548. isShowing = false;
  549. elemttc.style.display = "none";
  550. elemt1c.style.width = "auto";
  551. elemt2c.style.display = "none";
  552. elemt3c.style.display = "none";
  553. elemttc.style.width = "auto";
  554. }
  555. function tipPosition(callingEvent) {
  556. if (!callingEvent) callingEvent = window.event;
  557. mouseX = callingEvent.clientX;
  558. mouseY = callingEvent.clientY-1;
  559. if (isShowing) {
  560. var ttipSideOvershoot = elemttc.offsetWidth + mouseX + 10;
  561. var varYoffset = window.pageYOffset;
  562. var ttipOvershoot = (!is_safari) ? elemttc.offsetHeight + mouseY + 10 : elemttc.offsetHeight + mouseY + 10 - varYoffset;
  563. if(ttipOvershoot > windowHeight) {
  564. elemttc.style.top = (!is_safari && !is_chrome) ? windowHeight - elemttc.offsetHeight + elemDoc.scrollTop + 2 + "px" : windowHeight - elemttc.offsetHeight + varYoffset + "px";
  565. } else {
  566. elemttc.style.top = (!is_safari) ? mouseY+10+elemDoc.scrollTop+"px" : mouseY+5+"px";
  567. if(is_chrome) elemttc.style.top = varYoffset + mouseY + "px";
  568. }
  569. if(ttipSideOvershoot > windowWidth) {
  570. elemttc.style.left = mouseX-elemttc.offsetWidth-20+"px";
  571. //elemttc.style.left = windowWidth - elemttc.offsetWidth +"px";
  572. } else {
  573. elemttc.style.left = mouseX+20+"px";
  574. }
  575. }
  576. }
  577. document.onmousemove = tipPosition;
  578. //End Martin's Tooltip Code
  579. var resultsSideState="middle";
  580. function resultsSideRight(){
  581. if(resultsSideState=="middle"){
  582. document.getElementById("results-side-switch").className = "results-side-collapsed";
  583. resultsSideState="right";
  584. }
  585. }
  586. function resultsSideLeft(redirectUrl){
  587. if(resultsSideState=="right"){
  588. document.getElementById("results-side-switch").className = "results-side-expanded";
  589. resultsSideState="middle";
  590. } else {
  591. if (redirectUrl) {
  592. window.location.href = redirectUrl;
  593. }
  594. }
  595. }
  596. function thisMovie(movieName) {
  597. // IE and Netscape refer to the movie object differently.
  598. // This function returns the appropriate syntax depending on the browser.
  599. if (navigator.appName.indexOf ("Microsoft") !=-1) {
  600. return window[movieName]
  601. } else {
  602. return document[movieName]
  603. }
  604. }
  605. function popIconLarge(movieName,mcName) {
  606. if(MM_FlashCanPlay){
  607. try {
  608. if(is_ie)
  609. try {thisMovie(movieName).TGotoFrame(mcName,1);}catch(e){throw e;}
  610. else if(!is_opera && thisMovie(movieName) && thisMovie(movieName).TGotoFrame) //exclude opera
  611. thisMovie(movieName).TGotoFrame(mcName,1);
  612. }catch(e){
  613. throw e;
  614. }
  615. }
  616. }
  617. function popIconSmall(movieName,mcName) {
  618. if(MM_FlashCanPlay){
  619. try {
  620. if(is_ie)
  621. try {thisMovie(movieName).TGotoFrame(mcName,2);}catch(e){throw e;}
  622. else
  623. if(!is_opera && thisMovie(movieName) && thisMovie(movieName).TGotoFrame) //exclude opera
  624. thisMovie(movieName).TGotoFrame(mcName,2);
  625. }catch(e){
  626. throw e;
  627. }
  628. }
  629. }
  630. var prevRightSideImage;
  631. var rightSideImage;
  632. var rightSideImageReady=0;
  633. function changeRightSideImage(theImage){
  634. if(rightSideImageReady){
  635. if(rightSideImage!=prevRightSideImage){
  636. document.getElementById('imageLeft').className = theImage+'-image';
  637. document.getElementById('imageRight').className = 'section-'+theImage;
  638. }
  639. prevRightSideImage=rightSideImage;
  640. }
  641. }
  642. var pageChangerXsltProcessor;
  643. function initXsltProcessor(xsltProc, xslUrl) {
  644. var xslDoc = Sarissa.getDomDocument();
  645. xslDoc.async = true;
  646. if(is_ie)
  647. xslDoc.async = false;
  648. xslDoc.load(xslUrl);
  649. xsltProc.importStylesheet(xslDoc);
  650. }
  651. function xmlDataLoadSarissa(xmlSource, xslSource, container){
  652. pageChangerXsltProcessor = new XSLTProcessor();
  653. initXsltProcessor(pageChangerXsltProcessor, xslSource);
  654. //code added to apend the language of the xml request. Use to fight rouge caching.
  655. if(xmlSource.indexOf('?')==-1)
  656. xmlSource+='?';
  657. xmlSource+="&lang="+getcookie2("cookieLangId");
  658. fetchXmlData(xmlSource, container, pageChangerXsltProcessor);
  659. //move the search box if it's the index
  660. var urlSplit = xmlSource.split('?');
  661. var xmlName = urlSplit[0].split('.')[0];
  662. if(xmlName.indexOf("index")>-1 && !document.location.hash)
  663. document.getElementById('indexChange1').className="home";
  664. else
  665. document.getElementById('indexChange1').className="other";
  666. }
  667. var ajaxOverride=false;
  668. function initialize() {
  669. /*
  670. dhtmlHistory.initialize();
  671. dhtmlHistory.addListener(historyChange);
  672. */
  673. /*
  674. // initialize the DHTML History
  675. var urlObj=parseXMLurl(document.location.href);
  676. if(!pathnameParse || pathnameParse=="?"){
  677. dhtmlHistory.initialize();
  678. // subscribe to DHTML history change
  679. // events
  680. dhtmlHistory.addListener(historyChange);
  681. // if this is the first time we have
  682. // loaded the page...
  683. if(!dhtmlHistory.isFirstLoad()){
  684. //do nothing
  685. }else{
  686. // start adding history
  687. var initKey = document.location.href;
  688. if(initKey.lastIndexOf('/')!=initKey.length-1 && initKey.lastIndexOf('?')!=initKey.length-1){
  689. initKey = initKey.substring(initKey.lastIndexOf('/'),initKey.length)
  690. initKey = initKey.split('?')[0];
  691. }else
  692. initKey = "index.xml";
  693. addHistory(initKey)
  694. }
  695. }else{
  696. ajaxOverride=true;
  697. window.historyStorage.setCurrentPage(urlObj.escapeUrl);
  698. }*/
  699. }
  700. /** Our callback to receive history change
  701. events. */
  702. var historyChangeBool=0;
  703. function historyChange(newLocation) {
  704. /*
  705. if (right == 0)
  706. window.location.href = "./" + newLocation;
  707. */
  708. if((!historyChangeBool && window.historyStorage.getCurrentPage() == parseXMLurl(document.location.href).escapeUrl) || (!document.location.hash && historyChangeBool==1) || (window.historyStorage.getCurrentPage()=="index.php")){
  709. //DO NOTHING
  710. }else{
  711. if(!newLocation)
  712. newLocation=window.historyStorage.getCurrentPage();
  713. var urlObj=parseXMLurl(newLocation);
  714. window.historyStorage.setCurrentPage(urlObj.url);
  715. xmlDataLoadSarissa(newLocation,urlObj.xsl,'dataElement')
  716. }
  717. }
  718. function parseXMLurl(xmlUrl, xslUrl, escapeBool){
  719. if(xmlUrl.lastIndexOf('/')>=0)
  720. xmlUrl=xmlUrl.substring(xmlUrl.lastIndexOf('/')+1,xmlUrl.length)
  721. var urlSplit = xmlUrl.split('?');
  722. xmlUrl = urlSplit[0];
  723. xml=xmlUrl;
  724. if (xslUrl) {
  725. xsl = xslUrl;
  726. } else {
  727. xsl = 'layout/' + xml.split('.')[0] + '-ajax.xsl';
  728. }
  729. query = urlSplit[1];
  730. var pageObject = new Object();
  731. pageObject.xml = xml;
  732. pageObject.xsl = xsl;
  733. pageObject.query=query;
  734. pageObject.url = xml;
  735. if(query)pageObject.url+="?"+query;
  736. pageObject.escapeUrl=xml;
  737. pageObject.escapeQuery="";
  738. if (query){
  739. var queryConstructor = new PageQuery("?"+query);
  740. var queryParams = queryConstructor.getParameters();
  741. var queryParamsLength = queryParams.length;
  742. for(i=0; i<queryParamsLength; i++){
  743. if(is_ie || escapeBool || is_opera)
  744. pageObject.escapeQuery += queryParams[i] + "=" + encodeURI(Utf8.decode(queryConstructor.getValue(queryParams[i])));
  745. else{
  746. pageObject.escapeQuery += queryParams[i] + "=" + encodeURI(queryConstructor.getValue(queryParams[i]));//alert(pageObject.escapeQuery);
  747. }
  748. /*
  749. if(region == 'KR'){
  750. var krValue = queryConstructor.getValue(queryParams[i]);
  751. if(is_ie || escapeBool)
  752. pageObject.escapeQuery = pageObject.escapeQuery.replace(queryParams[i] + "=" + escape(krValue), queryParams[i] + "=" + escape(krValue));
  753. else
  754. pageObject.escapeQuery = pageObject.escapeQuery.replace(queryParams[i] + "=" + escape(Utf8.encode(krValue)), queryParams[i] + "=" + encodeURI(krValue));
  755. }
  756. */
  757. if(i!=queryParams.length-1)
  758. pageObject.escapeQuery += "&";
  759. }
  760. pageObject.escapeQuery = pageObject.escapeQuery.replace("'","%27");//escape single quote
  761. pageObject.escapeQuery = pageObject.escapeQuery.replace("%25","%");
  762. pageObject.escapeQuery = pageObject.escapeQuery.replace("%20","+");
  763. pageObject.escapeUrl += "?" + pageObject.escapeQuery;
  764. }
  765. return pageObject;
  766. }
  767. //initialize current page cookie and call DHTML init on page load
  768. /*if(IS_ENABLED_XSLT){
  769. if(!hashParse){
  770. var urlObj=parseXMLurl(document.location.href);
  771. setcookie("currentPage",urlObj.escapeUrl,"session");
  772. }
  773. addEvent(window, 'load', initialize);
  774. }*/
  775. //function which takes xml, xsl, and query params and transforms them into a format the dhtml history library can understand
  776. function addHistory(url){
  777. dhtmlHistory.add(url,"a");
  778. window.historyStorage.setCurrentPage(url);
  779. }
  780. function ajaxLink(xmlUrl, xslUrl, appendRandomNumber){
  781. if (is_safari && region == "TW") {
  782. theUrl = xmlUrl;
  783. theUrl = encodeURI(theUrl);
  784. window.location.href = theUrl;
  785. } else if (!is_moz && region == "TW") {
  786. theUrl = Url.decode(xmlUrl);
  787. theUrl = encodeURI(theUrl);
  788. window.location.href = theUrl;
  789. } else if (is_safari && region == "KR") {
  790. theUrl = xmlUrl;
  791. theUrl = encodeURI(theUrl);
  792. window.location.href = theUrl;
  793. } else if (!is_moz && region == "KR") {
  794. theUrl = Url.decode(xmlUrl);
  795. theUrl = encodeURI(theUrl);
  796. window.location.href = theUrl;
  797. /*
  798. } else if (is_ie && region == "KR") {
  799. theUrl = Url.decode(xmlUrl);
  800. theUrl = encodeURI(theUrl);
  801. window.location.href = theUrl;
  802. */
  803. } else
  804. window.location.href = xmlUrl;
  805. }
  806. var ajaxXmlUrl;
  807. var ajaxDataElementName;
  808. var ajaxXsltProcessor;
  809. function fetchXmlData(xmlUrl, dataElementName, xsltProcessor) {
  810. historyChangeBool=1;
  811. ajaxXmlUrl = xmlUrl;
  812. ajaxDataElementName = dataElementName;
  813. ajaxXsltProcessor = xsltProcessor;
  814. showLoader();
  815. window.setTimeout("fetchXmlData2()",50);
  816. }
  817. function fetchXmlData2() {
  818. // window.location.replace(ajaxXmlUrl);
  819. if (!IS_ENABLED_XSLT) {
  820. window.location.replace(ajaxXmlUrl);
  821. showLoader();
  822. return;
  823. }
  824. isItems = 0;
  825. isArenaTeams = 0;
  826. updateDataContent(ajaxXmlUrl, document.getElementById(ajaxDataElementName), ajaxXsltProcessor);
  827. }
  828. function ieFix(){
  829. var tempDiv = document.createElement("div");
  830. tempDiv.style.position="absolute";
  831. tempDiv.style.top="-100px";
  832. document.body.appendChild(tempDiv);
  833. }
  834. var head;
  835. var numHeadNodes=0;
  836. function initHead(){
  837. head = document.getElementsByTagName("head");
  838. numHeadNodes = head[0].childNodes.length;
  839. }
  840. addEvent(window, 'load', initHead);
  841. var jsLoaded=true;
  842. var jsLoadCount=1;
  843. var tempString;
  844. var jsArrayLength;
  845. function checkJSLoad(){
  846. while(jsLoadCount<jsArrayLength && jsLoaded){
  847. scriptString=tempArray[jsLoadCount].split('</SCRIPT>')[0];
  848. theSrc="";
  849. theScript="";
  850. srcStartLoc=scriptString.substring(0,6).indexOf(" src=");//look for a src attribute in the script tag within the first 7 characters
  851. scriptTagEndLoc=scriptString.indexOf(" type=text/javascript>");
  852. if(srcStartLoc!=-1)
  853. theSrc=scriptString.substring(srcStartLoc+6,scriptTagEndLoc-1)
  854. theScript=scriptString.substring(scriptTagEndLoc+22,scriptString.length);
  855. script = document.createElement("script");
  856. head[0].appendChild(script);
  857. if(theSrc)jsLoaded=false;
  858. script.type = "text/javascript";
  859. if(theSrc)script.src = theSrc;
  860. if(theScript)script.text = theScript;
  861. jsLoadCount++;
  862. if(theSrc)
  863. return false;
  864. }
  865. if(jsLoadCount>=jsArrayLength){
  866. jsLoaded=true;
  867. jsLoadCount=1;
  868. hideLoader();
  869. rePosition(); //reposition menu after contents change
  870. clearInterval(checkLoadInterval)
  871. }
  872. }
  873. var checkLoadInterval;
  874. function updateDataContent(sFromUrl, oTargetElement, xsltproc) {
  875. try {
  876. if(!loadingObj || loadingObj.style.display=="none"){
  877. showLoader();
  878. }
  879. oTargetElement.style.cursor = "wait";
  880. var xmlhttp = new XMLHttpRequest();
  881. xmlhttp.open("GET", sFromUrl, true);
  882. function sarissa_dhtml_loadHandler() {
  883. if (xmlhttp.readyState == 4) {
  884. oTargetElement.style.cursor = "auto";
  885. if (xmlhttp.responseXML != null) {
  886. var procer = xsltproc;
  887. if(is_ie){
  888. //purge any scripts that have been loaded into Head via ajax
  889. while(numHeadNodes!=head[0].childNodes.length)
  890. head[0].removeChild(head[0].lastChild)
  891. }
  892. var newFrag = procer.transformToFragment(xmlhttp.responseXML,window.document);
  893. oTargetElement.innerHTML="";
  894. oTargetElement.appendChild(newFrag);
  895. if(is_ie){
  896. //load any new embedded stylesheets into head
  897. embeddedStyles=oTargetElement.getElementsByTagName("link");
  898. embeddedStylesLength = embeddedStyles.length;
  899. for(count=0;count<embeddedStylesLength;count++){
  900. embeddedStyle = document.createElement("link");
  901. head[0].appendChild(embeddedStyle);
  902. embeddedStyle.type = embeddedStyles[count].type
  903. embeddedStyle.rel = embeddedStyles[count].rel;
  904. embeddedStyle.href = embeddedStyles[count].href;
  905. embeddedStyle.media = embeddedStyles[count].media;
  906. }
  907. tempString=document.getElementById("dataElement").innerHTML;
  908. tempArray=tempString.split('<SCRIPT');
  909. jsArrayLength=tempArray.length;
  910. window.setTimeout("ieFix()",100)
  911. checkLoadInterval=window.setInterval("checkJSLoad()",100)
  912. } else {
  913. hideLoader();
  914. rePosition(); //reposition menu after contents change
  915. }
  916. } else {
  917. //xml load failed. May want to add code here to remove latest history change.
  918. hideLoader();
  919. }
  920. }
  921. }
  922. xmlhttp.onreadystatechange = sarissa_dhtml_loadHandler;
  923. xmlhttp.send(null);
  924. oTargetElement.style.cursor = "auto";
  925. } catch(e) {
  926. oTargetElement.style.cursor = "auto";
  927. throw e;
  928. }
  929. }
  930. var loadingObj;
  931. function showLoader() {
  932. }
  933. function hideLoader(){
  934. loadingObj.style.visibility="hidden";
  935. loadingObj.style.height="0px";
  936. var dataElementObj = document.getElementById("dataElement");
  937. }
  938. function arenaLadderLink(battlegroup, teamSize) {
  939. var URL_XML = "arena-ladder.xml";
  940. var URL_BATTLEGROUP_SELECT = "battlegroups.xml";
  941. var XSL_URL_BATTLEGROUP_SELECT = "layout/battlegroups-ajax.xsl";
  942. var URL_TEAMSIZE_SELECT = "select-team-type.xml";
  943. var selectedBG;
  944. if (battlegroup) {
  945. selectedBG = battlegroup;
  946. setcookie("armory.cookieBG", battlegroup);
  947. } else {
  948. selectedBG = getcookie2("armory.cookieBG");
  949. }
  950. var selectedTS;
  951. if (teamSize) {
  952. selectedTS = teamSize;
  953. setcookie("armory.cookieTS", teamSize);
  954. } else {
  955. selectedTS = getcookie2("armory.cookieTS");
  956. }
  957. if (!selectedBG) {
  958. window.location.href = URL_BATTLEGROUP_SELECT;
  959. return;
  960. }
  961. if (!selectedTS) {
  962. window.location.href = URL_TEAMSIZE_SELECT;
  963. return;
  964. }
  965. var arenaLadderUrl = URL_XML + "@b=" + escape(selectedBG) + "&ts=" + selectedTS;
  966. if(region == "KR"){//change by akim (encoding UTF-8)
  967. selectedBG = Url.encode(selectedBG);
  968. arenaLadderUrl = URL_XML + "@b=" + selectedBG + "&ts=" + selectedTS;
  969. } else if (region == "TW") {
  970. selectedBG = Url.encode(selectedBG);
  971. arenaLadderUrl = URL_XML + "@b=" + selectedBG + "&ts=" + selectedTS;
  972. }
  973. window.location.href = arenaLadderUrl;
  974. }
  975. //Icon validity testing
  976. function IsImageOk(img) {
  977. // During the onload event, IE correctly identifies any images that
  978. // weren't downloaded as not complete. Others should too. Gecko-based
  979. // browsers act like NS4 in that they report this incorrectly.
  980. if(!is_safari){
  981. if (!img || !img.complete) {
  982. return false;
  983. }
  984. // However, they do have two very useful properties: naturalWidth and
  985. // naturalHeight. These give the true size of the image. If it failed
  986. // to load, either of these should be zero.
  987. if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) {
  988. return false;
  989. }
  990. }
  991. // No other way of checking: assume it's ok.
  992. return true;
  993. }
  994. function checkImage(thisImage,iconSize){
  995. thisImage=document.getElementById(thisImage)
  996. fileType=".jpg";
  997. if(iconSize=="21x21" || iconSize=="43x43")
  998. fileType=".png";
  999. if(!IsImageOk(thisImage))
  1000. thisImage.src="images/icons/"+iconSize+"/inv_misc_questionmark"+fileType;
  1001. }
  1002. function replaceLink(siteUrl){
  1003. var replaceUrl="";
  1004. if(IS_ENABLED_XSLT)
  1005. replaceUrl=siteUrl+"/"+window.historyStorage.getCurrentPage();
  1006. else
  1007. replaceUrl=document.location.href;
  1008. document.getElementById("reportLink").href=document.getElementById("reportLink").href.replace("REPLACEURL",replaceUrl.replace('&','%26')).replace("REPLACEBROWSER",agt+" - "+appVer)
  1009. }
  1010. function guildLink() {
  1011. window.location.href = guildUrl;
  1012. }
  1013. function forumLink(forumName, lang){
  1014. var forumsUrl="";
  1015. if(region=="EU")
  1016. forumsUrl="../forums.wow-europe.com/default.htm";
  1017. else if (region == "US")
  1018. forumsUrl="../forums.worldofwarcraft.com/default.htm";
  1019. else if (region == "TW")
  1020. forumsUrl="../forum.wowtaiwan.com.tw/default.htm";
  1021. window.open(forumsUrl+"board.html@forumName="+forumName)
  1022. }
  1023. function styleLoader(cssHref){
  1024. newStyle = document.createElement("link");
  1025. newStyle.type = "text/css";
  1026. newStyle.rel = "stylesheet";
  1027. newStyle.href = cssHref;
  1028. newStyle.media = "screen, projection";
  1029. document.getElementsByTagName("head")[0].appendChild(newStyle);
  1030. }
  1031. //end functions section
  1032. //start searchbox
  1033. function menuSelect(textDisplay, menuKey) {
  1034. document.getElementById('replaceSearchOption').innerHTML = textDisplay;
  1035. document.getElementById('searchCat').style.display='none';
  1036. setcookie('cookieMenu', menuKey);
  1037. setcookie('cookieMenuText', textDisplay);
  1038. document.formSearch.searchType.value = menuKey;
  1039. }
  1040. function checkClear() {
  1041. if (document.formSearch.searchQuery.value == textSearchTheArmory) {
  1042. document.formSearch.searchQuery.value = "";
  1043. }
  1044. }
  1045. function checkBlur() {
  1046. if (document.formSearch.searchQuery.value == "")
  1047. document.formSearch.searchQuery.value = textSearchTheArmory;
  1048. }
  1049. function menuCheckLength(formReference) {
  1050. /*if (formReference.searchType.value == "all" && globalSearch == "0") {
  1051. document.getElementById('errorSearchType').innerHTML = '<div class="error-container2"><div class="error-message" style = "position: relative; left: -400px; top: -33px; white-space: nowrap;"><p></p>'+ tScat +'</div></div>';
  1052. return false;
  1053. } else
  1054. document.getElementById('errorSearchType').innerHTML = ""; */
  1055. if ((formReference.searchQuery.value).length <= 1 || formReference.searchQuery.value == textSearchTheArmory || formReference.searchQuery.value == textEnterGuildName || formReference.searchQuery.value == textEnterCharacterName || formReference.searchQuery.value == textEnterTeamName) {
  1056. document.getElementById(formReference.name + '_errorSearchLength').innerHTML = '<div class="error-container2"><div class="error-message" style = "position: relative; left: -245px; top: -33px; white-space: nowrap;"><p></p>'+ tStwoChar +'</div></div>';
  1057. return false;
  1058. }
  1059. if(IS_ENABLED_XSLT){
  1060. var theSearch=formReference.searchQuery.value;
  1061. if(is_ie)//escape the entry
  1062. theSearch=Utf8.encode(theSearch)
  1063. // MFS HACK: appending a random number to search.xml in order to avoid grabbing a cached version of the
  1064. // search page...this really needs to be fixed on the backend
  1065. //ajaxLink("search.xml@searchQuery="+theSearch+"&searchType="+formReference.searchType.value, null, true);
  1066. window.location.href = "index.php?searchQuery="+theSearch+"&searchType="+formReference.searchType.value+"&realm="+formReference.realm.value;
  1067. document.getElementById(document.formSearch.name + '_errorSearchLength').style.visibility = "hidden"; //clear the error box if it is visible
  1068. document.formSearch.searchQuery.value=formReference.searchQuery.value;//set the main search box value to the last search
  1069. return false;
  1070. }else{
  1071. //formReference.searchQuery.value=theSearch=Utf8.encode(formReference.searchQuery.value);
  1072. formReference.submit();
  1073. showLoader();
  1074. }
  1075. }
  1076. //end searchbox
  1077. function funcAjaxTalents(theXml, theXsl, nonAjaxXml, theDiv) {
  1078. /*
  1079. var jsArray = new Array();
  1080. jsArray[0] = 'shared/global/talents/includes/variables-live.js';
  1081. jsArray[1] = 'shared/global/talents/includes/functions.js';
  1082. jsArray[2] = 'shared/global/talents/priest/en/data.js';
  1083. jsArray[3] = 'shared/global/talents/priest/donotlocalize.js';
  1084. jsArray[4] = 'shared/global/talents/includes/en/localize.js';
  1085. jsArray[5] = 'shared/global/talents/includes/arraysFill.js';
  1086. jsArray[6] = 'shared/global/talents/includes/printOutTop.js';
  1087. */
  1088. funcAjax(theXml, theXsl, nonAjaxXml, theDiv);
  1089. /* if (!is_moz) {
  1090. variableIsSite = 0;
  1091. query = "234324";
  1092. for(var i = 0; i < jsArray.length; i++) {
  1093. node=document.createElement("script")
  1094. node.setAttribute("type","text/javascript")
  1095. node.setAttribute("src", jsArray[i])
  1096. // document.getElementsByTagName("HEAD")[0].appendChild(node)
  1097. document.getElementById('containerJavascript').appendChild(node)
  1098. }
  1099. document.getElementById('containerJavascript').innerHTML = "";
  1100. }
  1101. */
  1102. }
  1103. function funcAjax(theXml, theXsl, nonAjaxXml, theDiv) {
  1104. right = 0;
  1105. nonAjaxXml = "character-sheet.php@r=Tichondrius&n=Avin";
  1106. if (!theDiv)
  1107. theDiv = "replaceMain";
  1108. if(!(_SARISSA_IS_SAFARI || window.opera)) {
  1109. ttipXsltProcessor = new XSLTProcessor();
  1110. var xslDoc = Sarissa.getDomDocument();
  1111. xslDoc.async = false;
  1112. xslDoc.load(theXsl);
  1113. ttipXsltProcessor.importStylesheet(xslDoc);
  1114. ttipXslProcessorIsReady = true;
  1115. }
  1116. var safariXmlRequest = new XMLHttpRequest;
  1117. function safariReadystateHandler() {
  1118. if(safariXmlRequest.readyState == 4) {
  1119. if(_SARISSA_IS_SAFARI || window.opera) {
  1120. document.getElementById(theDiv).innerHTML = safariXmlRequest.responseText;
  1121. } else {
  1122. var newItemHtml = ttipXsltProcessor.transformToFragment(safariXmlRequest.responseXML,window.document);
  1123. elementDiv = document.getElementById(theDiv);
  1124. elementDiv.innerHTML = "";
  1125. elementDiv.appendChild(newItemHtml);
  1126. if (is_ie) {
  1127. elementHead = document.getElementById('containerJavascript');
  1128. theInner = elementDiv.innerHTML;
  1129. while ((blah = theInner.search("<SCRIPT")) != -1) {
  1130. theInner = theInner.substr(blah + 7);
  1131. indexSrc = theInner.search("src");
  1132. indexEndTag = theInner.search("type=text/javascript>");
  1133. if (indexSrc > indexEndTag) {
  1134. indexEndScript = theInner.search('</SCRIPT>');
  1135. node=document.createElement("script")
  1136. node.setAttribute("type","text/javascript")
  1137. node.setAttribute("text", theInner.substr(indexEndTag+21, indexEndScript - indexEndTag - 1-21));
  1138. elementHead.appendChild(node);
  1139. } else {
  1140. indexJs = theInner.search(".js");
  1141. node=document.createElement("script")
  1142. node.setAttribute("type","text/javascript")
  1143. node.setAttribute("src", theInner.substr(indexSrc+5, indexJs - indexSrc - 2))
  1144. if(theInner.substr(indexSrc+5, indexJs -

Large files files are truncated, but you can click here to view the full file