window=this;this.urlVars={};this.userVars={};this.ajaxTarget="";this.ajaxFunctions={};ajaxFunctions.onLoaded_standard=function(a){$("#"+ajaxTarget).html(a)};ajaxFunctions.onLoaded_clear=function(a){$("#"+ajaxTarget).html("")};ajaxFunctions.onLoaded_sheet=function(a){$("#"+ajaxTarget).html(a);doLocalisation();doTablesorter('#sheet')};ajaxFunctions.onLoaded_infoWindow=function(a){if(a!="0"){$("#div_infoWindow").html(a);$("#div_infoWindow").fadeIn('fast');doLocalisation("#div_infoWindow")}else{$("#div_infoWindow").hide()}};ajaxFunctions.preSend_standard=function(){$("#"+ajaxTarget).html('<div align="center" style="margin:50px auto; width:100%;"><img src="img/ajax.gif" /><br />Loading...</div>');doLocalisation()};ajaxFunctions.preSend_sheet=function(){$("#div_sheetReload").css("display","block")};ajaxFunctions.preSend_miningTimer=function(){$("#div_miningTimer").html('<div align="right"><img src="img/ajax.gif" /><br />Loading...</div>');doLocalisation()};ajaxFunctions.onError_standard=function(a,b,c){var d="";if(a.status===0){d="Internet Connection Timeout or other unkown HTTP Problem."}else{d="HTTP-Status: "+a.status}$("#"+ajaxTarget).html("<b><u>AJAX Error!</u></b><br /> "+d+"<br /><br />If you keep getting this message,<br />please post it on the forums.")};function parseUrlVars(){var a=window.location.hash;if(a!=""&&a!==undefined&&a!="#"){var b=a.substr(1).split(';');for(var i=0;i<b.length;i++){variable=b[i].split(':');urlVars[variable[0]]=variable[1]}}else{urlVars={"site":"ore"};window.location.hash="#site:ore"}}function getUrlVars(){return window.location.hash}function setUrlVars(a){for(var b in a){urlVars[a[b][0]]=a[b][1]}var c="";for(var d in urlVars){if(urlVars[d]!=undefined){c+=';'+d+':'+urlVars[d]}}c="#"+c.substr(1);window.location.hash=c;try{if(piwikTracker){piwikTracker.setCustomUrl(window.location);piwikTracker.trackPageView();piwikTracker.enableLinkTracking()}}catch(err){}}function ajaxLoad(a,b,c,d,e,f){var g="";if(b===undefined||$(b)===undefined){b="content"}ajaxTarget=b;if((c===undefined&&a=="ore")||(c===undefined&&a=="ice")||(c===undefined&&a=="alloy")){c=ajaxFunctions.onLoaded_sheet}else if(c===undefined){c=ajaxFunctions.onLoaded_standard}if(d===undefined){d=ajaxFunctions.preSend_standard}if(e===undefined){e=ajaxFunctions.onError_standard}if(f===undefined){f="html"}$.ajax({url:"load.php",data:"l="+a,timeout:10000,dataType:f,type:"POST",beforeSend:d,error:e,success:c})}function jsonEncode(a){var b=[];for(var c in a){var d=a[c];var e='"'+c+'":';if(typeof d=="number"){e+=d}else if(typeof d=="object"){e+=jsonEncode(d)}else if(d===false){e+='false'}else if(d===true){e+='true'}else{e+='"'+d+'"'}b.push(e)}var f=b.join(",");return'{'+f+'}'}function toggleTabs(a,b,c){$(b+' tr[class=tabsrow] td').removeClass("tabsactive");$(a).addClass("tabsactive");if(c!==undefined){c()}}function loadSite(a){if(!$('#menu_'+a).hasClass("tabsactive")){toggleTabs('#menu_'+a,'#menu');ajaxLoad(a,"content");setUrlVars([["site",a]])}}var userSettings_iid;function changeUserSettings(a,b){for(var i=0;i<a.length;i++){userVars[a[i][0]]=a[i][1]}if(b===undefined||b==''){b=1}b=parseInt(b);userSettings_iid=setTimeout(saveUserSettings,b)}function loadUserSettings(){$.ajax({url:"load.php",data:"l=user&a=get",dataType:"json",timeout:10000,type:"POST",success:function(a){userVars=a;if(userVars.userName!="!TEMP"){toggleLogin(true)}else{$('#div_userInfo').html('<a href="javascript:void(0);" onClick="toggleLogin();">Access Profile</a>')}}})}function saveUserSettings(){if(userVars.userName!="!TEMP"){$.ajax({url:"load.php",data:"l=user&a=set&d="+encodeURI(jsonEncode(userVars)),dataType:"json",timeout:10000,type:"POST",beforeSend:ajaxFunctions.preSend_sheet,success:function(a){userVars=a;ajaxLoad(urlVars.site+"&sheetOnly=true","div_sheet",ajaxFunctions.onLoaded_sheet,ajaxFunctions.preSend_sheet)},error:function(a,b,c){alert("saveUserSettings: "+b)}})}else{alert("Attention: You have to be logged in with a profile\nin order to save user settings.")}}function userChangeTableSort(d){if(userVars.userName!="!TEMP"){var e={};userVars['sortTable_'+String(urlVars.site)]=e['sortTable_'+String(urlVars.site)]=Object(d);$.ajax({url:"load.php",data:"l=user&a=changeTableSort&d="+encodeURI(jsonEncode(e)),dataType:"json",timeout:10000,type:"POST",error:function(a,b,c){alert("saveUserSettings: "+b)}})}}function toggleLogin(a){if(a){$('#div_userInfo').html('Profile: <b>'+userVars.userName+'</b> - <a href="javascript:void(0);" onClick="loginUser(\'!TEMP\');">Logout</a>')}else{$('#div_userInfo').html('<input type="text" id="login_userName" value="Profilename" onclick="if(this.value == \'Profilename\'){this.value=\'\'; this.style.fontStyle=\'normal\'; this.style.color=\'#000\';}" style="font-style:italic; width:120px; color:#888;" /> <input type="button" value="Access" onClick="loginUser($(\'#login_userName\').val());" />')}}function loginUser(d){$.ajax({url:"load.php",data:"l=user&a=login&u="+escape(d),timeout:10000,type:"POST",error:function(a,b,c){alert("Error: "+b)},success:function(a){if(a=="false"){alert("ERROR #lU")}else{loadUserSettings();ajaxLoad(urlVars.site+"&sheetOnly=true","div_sheet",ajaxFunctions.onLoaded_sheet,ajaxFunctions.preSend_sheet)}}})}function preParseFormula(a){var b={'Arkonor':'Ak','Bistot':'Bs','[(Crok|Crokite)]':'Ck','[(Ochre|Dark Ochre)]':'Do','Gneiss':'Gn','[(Hed|Hedbergite)]':'Hb','[(Hem|Hemorphite)]':'Hm','Jaspet':'Js','Kernite':'Kn','Mercoxit':'Mx','Omber':'Om','[(Plag|Plagioclase)]':'Pg','[(Pyro|Pyroxeres)]':'Py','[(Scor|Scordite)]':'Sc','[(Spod|Spodumain)]':'Sp','[(Veld|Veldspar)]':'Vd'};var c='2*275000 * dark ochre';var d='';for(var i in ores){var e=new RegExp(i,'ig');if(c.match(e)){d=c.replace(e,ores[i])}}alert(d);var f="2 * Arko ";var g=[/[\s]*(ar[.^\s]*)[\s]*/ig];var h=["A"];alert(f.replace(g[0],h[0]))}function parseFormula(a){}function doLocalisation(a){}function doTablesorter(a){if(urlVars.site=="ore"){$(a).tablesorter({headers:{0:{sorter:'text'},1:{sorter:'mineralvalue'},2:{sorter:'mineralvalue'},3:{sorter:'mineralvalue'},4:{sorter:'mineralvalue'},5:{sorter:'mineralvalue'},6:{sorter:'mineralvalue'},7:{sorter:'mineralvalue'},8:{sorter:'mineralvalue'},9:{sorter:'orePrice'},10:{sorter:'security'}},sortList:[userVars['sortTable_ore']||[0,0]]})}else if(urlVars.site=="alloy"){$(a).tablesorter({headers:{0:{sorter:'text'},1:{sorter:'digit'},2:{sorter:'digit'},3:{sorter:'digit'},4:{sorter:'digit'},5:{sorter:'digit'},6:{sorter:'digit'},7:{sorter:'digit'},8:{sorter:'digit'},9:{sorter:'orePrice'}},sortList:[userVars['sortTable_alloy']||[0,0]]})}else if(urlVars.site=="ice"){$(a).tablesorter({headers:{0:{sorter:'text'},1:{sorter:'digit'},2:{sorter:'digit'},3:{sorter:'digit'},4:{sorter:'digit'},5:{sorter:'digit'},6:{sorter:'digit'},7:{sorter:'digit'},8:{sorter:'orePrice'},9:{sorter:'security'}},sortList:[userVars['sortTable_alloy']||[0,0]]})}}var mT_afterSeconds=180;var mT_currentSeconds=0;var mT_iid=0;var mT_alarmJustHappened=false;function toggleMiningTimer(a){if($('#div_miningTimer').hasClass("show")&&a===undefined){$('#div_miningTimer').removeClass("show");$('#div_miningTimer').html('<a href="javascript:void(0);" onClick="toggleMiningTimer();" rel="localize[lng.miningtimer.show]">Show Miningtimer</a>')}else{$('#div_miningTimer').addClass("show");ajaxLoad('miningTimer','div_miningTimer',undefined,ajaxFunctions.preSend_miningTimer);doLocalisation()}}function initMiningTimer(a){mT_afterSeconds=a;mT_currentSeconds=0;mT_alarmJustHappened=false;mT_iid=window.clearInterval(mT_iid);mT_iid=window.setInterval("doMiningTimer()",1000);doMiningTimer()}function killMiningTimer(a){mT_iid=window.clearInterval(mT_iid);mT_iid=window.clearTimeout(mT_iid);if(a){$('#mT_text').html('Alarm stopped.')}else{mT_iid=window.setTimeout("killMiningTimer(true)",2000)}}function doMiningTimer(){if(mT_currentSeconds<mT_afterSeconds){mT_currentSeconds++;if(mT_alarmJustHappened){mT_alarmJustHappened=false}else{$('#mT_text').html('<span rel="localize[lng.miningtimer.alarmin]">Alarm in</span> '+(mT_afterSeconds-mT_currentSeconds+1)+' <span rel="localize[lng.miningtimer.seconds]">seconds</span>!')}}else{$('#mT_text').html('<span rel="localize[lng.miningtimer.alarm]">ALARM!</span> <embed src="img/miningtimer.swf?playalarm=yes" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="1" height="1"></embed>');if($('#mT_loop').attr('checked')){mT_currentSeconds=0;mT_alarmJustHappened=true}else{killMiningTimer()}}}$(document).ready(function(){parseUrlVars();loadUserSettings();$('#div_miningTimer').addClass("show");if(String(userVars.miningTimer_show)=="true"){toggleMiningTimer(true)}else{toggleMiningTimer()}ajaxLoad('infoWindow','div_infoWindow',ajaxFunctions.onLoaded_infoWindow,ajaxFunctions.preSend_infoWindow);loadSite(((urlVars.site=="ice"||urlVars.site=="alloy"||urlVars.site=="trend"||urlVars.site=="about")?urlVars.site:"ore"),$('#menurow > td').get(0))});  setTimeout(function(){ $('#goog').addClass("showBg"); }, 3000);
