window.onerror = function(message, source, lineno, colno, error) { var errimg = new Image(), w = window, d = document, e = d.documentElement, g = d.getElementsByTagName('body')[0], x = w.innerWidth || e.clientWidth || g.clientWidth, y = w.innerHeight|| e.clientHeight|| g.clientHeight; errimg.src = "/js-error?message=" + escape(message) + "&source=" + escape(source) + "&lineno=" + escape(lineno) + "&colno=" + escape(colno) + "&error=" + escape(error) + "&referer=" + escape(document.referrer) + "&screenRes=" + escape(x + "x" + y) + "&userAgent=" + escape(navigator.userAgent) + "&appVersion=" + escape(navigator.appVersion) + "&platform=" + escape(navigator.platform); }; var ingame = true; var alive = true; var map; var spell = null; var todoList = null; var seconds = 0; var countDownTimer = null; var onLoadRun = null; var focusFlasher = null; var documentTitle = document.title; function openMap(event) { if(event) { if(event.shiftKey || event.ctrlKey) { // We want to open up in a new window or tab, so assign map to the new window map = window.open("map.asp"); return false; } else { // No control key pressed. Do default action return true; } } else { // Open the map in a new window map = window.open("map.asp"); return false; } } function Mscroll(x, y) { if(map) { map.lookAt(x, y); map.focus(); } else { todoList = "map.lookAt(" + x + ", " + y + ")"; openMap(); } } function setWaypoint() { if(map) { setWaypoint2() } else { openMap(); todoList = "setWaypoint2()" } } function setWaypoint2() { map.bygg="waypoint"; map.focus(); } function todo() { if(todoList) { //alert("Executing todo list: " + todoList); eval(todoList); todoList = null; } else { //alert("nothing in todo list"); } } function castSpell(theSpell) { spell = theSpell; if(map) { //alert("map it is"); castSpell2(spell); } else { todoList = "castSpell2()" openMap(); } } function castSpell2() { map.spell=spell; map.focus(); } function scrollToFlag(world, x, y) { if(window.opener) frame = window.opener else if(map) frame = map else frame = null; if(frame) { if(frame.document.pos.world.value==world) { frame.lookAt(x, y); frame.focus(); } } else { //alert("hmm"); todoList = "map.lookAt(" + x + ", " + y + ")"; openMap(); } } function go(sUrl) { var vuid = getSessionFromAddress(document.location.href, 'vuid'); if(vuid) { if(sUrl.indexOf('vuid') == -1) { if(sUrl.indexOf('?') == -1) sUrl+='?vuid=' + vuid else sUrl+='&vuid=' + vuid; } } self.location=sUrl; return false; } function getSessionFromAddress(strAddr, strName) { var intPos = strAddr.indexOf(strName); if(intPos > 0) { intPos += strName.length + 1; if(strAddr.indexOf('translate.google.com') > 0) intPos+=2; var strRight = strAddr.substring(intPos, strAddr.length); if(strRight.indexOf('&') > -1) return strAddr.substring(intPos, intPos + strRight.indexOf('&')) else if(strRight.indexOf('%3D') > -1) return strAddr.substring(intPos, intPos + strRight.indexOf('&')) else return strRight; } else { return false; } } function Fade(object, destOp, rate, delta){ if (!document.all) { if(destOp<100) object.style.opacity=.6 else object.style.opacity=1; return; } if (object != "[object]"){ setTimeout("Fade("+object+","+destOp+","+rate+","+delta+")",0); return; } clearTimeout(FadeTimers[object.sourceIndex]); try { diff = destOp-object.filters.alpha.opacity; } catch(err) { return; } direction = 1; if (object.filters.alpha.opacity > destOp){ direction = -1; } delta=Math.min(direction*diff,delta); object.filters.alpha.opacity+=direction*delta; if (object.filters.alpha.opacity != destOp){ FadeObjects[object.sourceIndex]=object; FadeTimers[object.sourceIndex]=setTimeout("Fade(FadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate); } } function Sell(vad) { var sPage; if(popup) { var sPage = popup.location.href; if(sPage.indexOf('market') > -1 && sPage.indexOf('option=sell') > -1 ) { if(popup) { popup.focus(); popup.document.sell.amount.value = StringToInt(vad.innerHTML) popup.document.sell.vad.selectedIndex = ResourceToIndex(vad.id); } else { top.poppis.document.sell.amount.value = StringToInt(vad.innerHTML); top.poppis.document.sell.vad.selectedIndex = ResourceToIndex(vad.id); } } } } function ResourceToIndex(resource) { switch (resource) { case 'food': { return 0; break } case 'tree': { return 1; break } case 'stone': { return 2; break } case 'slaves': { return 3; break } } } function StringToInt(s) { return parseInt(s.replace(/\,/g, '')); } function closeWindow() { self.close(); } function reply(obj) { var html = obj.parentNode.parentNode.innerHTML; // Find name and text var name = html.substring( html.indexOf("") + 3, html.indexOf("") ); var txt = html.substring( html.indexOf('