var timer=new Object();var ab=new Object();var bb=new Object();var cb=db();var eb=0;var auto_reload=1;var fb=new Object();var	is_opera=window.opera!==undefined;var	is_ie=document.all!==undefined&&window.opera===undefined;var is_ie6p=document.compatMode!==undefined&&document.all!==undefined&&window.opera===undefined;var is_ie7=document.documentElement!==undefined&&document.documentElement.style.maxHeight!==undefined;var is_ie6=is_ie6p&&!is_ie7;var is_ff2p=window.Iterator!==undefined;var is_ff3p=document.getElementsByClassName!==undefined;var is_ff2=is_ff2p&&!is_ff3p
function gb(){return hb('height');}
function ib(){return hb('width');}
function hb(jb){var kb=0,lb=0;if(typeof(window.innerWidth)=='number'){kb=window.innerWidth;lb=window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){kb=document.documentElement.clientWidth;lb=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){kb=document.body.clientWidth;lb=document.body.clientHeight;}
if(jb=='height')return lb;if(jb=='width')return kb;}
var gmwds=false;function start(){mb("l1");mb("l2");mb("l3");mb("l4");initCounter();if(typeof init_local=='function'){init_local();}
if(quest.number===null){qst_handle();}
if(gmwds){gmwd();}
}
function nb(){return new Date().getTime();}
function db(){return Math.round(nb()/1000);}
function ob(pb){p=pb.innerHTML.split(":");qb=p[0]*3600+p[1]*60+p[2]*1;return qb;}
function rb(s,sb){var tb,ub,vb;if(s>-2){tb=Math.floor(s/3600);ub=Math.floor(s/60)%60;vb=s%60;t=tb+":";if(ub<10){t+="0";}
t+=ub+":";if(vb<10){t+="0";}
t+=vb;}
else
{t=sb?'0:00:0?':"<a href=\"#\" onClick=\"return Popup(2,5);\"><span class=\"c0 t\">0:00:0</span>?</a>";}
return t;}
function initCounter(){for(var i=1;;i++){pb=document.getElementById("tp"+i);if(pb!=null){ab[i]=new Object();ab[i].node=pb;ab[i].counter_time=ob(pb);}
else{break;}
}
for(i=1;;i++){pb=document.getElementById("timer"+i);if(pb!=null){bb[i]=new Object();bb[i].node=pb;bb[i].counter_time=ob(pb);}
else{break;}
}
executeCounter();}
function executeCounter(){for(var i in ab){wb=db()-cb;xb=rb(ab[i].counter_time+wb);ab[i].node.innerHTML=xb;}
for(i in bb){wb=db()-cb;yb=bb[i].counter_time-wb
if(eb==0&&yb<1){eb=1;if(auto_reload==1){setTimeout("document.location.reload()",1000);}
else if(auto_reload==0){setTimeout("mreload()",1000);}
}
else{}
xb=rb(yb);bb[i].node.innerHTML=xb;}
if(eb==0){window.setTimeout("executeCounter()",1000);}
}
function mb(zb){pb=document.getElementById(zb);if(pb!=null){fb[zb]=new Object();var $b=pb.innerHTML.match(/(\d+)\/(\d+)/);element=$b[0].split("/");_b=parseInt(element[0]);ac=parseInt(element[1]);bc=pb.title;if(bc!=0){cc=nb();timer[zb]=new Object();timer[zb].start=cc;timer[zb].production=bc;timer[zb].start_res=_b;timer[zb].max_res=ac;timer[zb].ms=3600000/bc;dc=100;if(timer[zb].ms<dc){timer[zb].ms=dc;}
timer[zb].node=pb;executeTimer(zb);}
else
{timer[zb]=new Object();fb[zb].value=_b;}
}
}
function executeTimer(zb){wb=nb()-timer[zb].start;if(wb>=0){ec=Math.round(timer[zb].start_res+wb*(timer[zb].production/3600000));if(ec>=timer[zb].max_res){ec=timer[zb].max_res;}
else
{window.setTimeout("executeTimer('"+zb+"')",timer[zb].ms);}
fb[zb].value=ec;timer[zb].node.innerHTML=ec+'/'+timer[zb].max_res;}
}
var fc=new Array(0,0,0,0,0);function add_res(gc){hc=fb['l'+(5-gc)].value;ic=haendler*carry;fc[gc]=jc(fc[gc],hc,ic,carry);document.getElementById('r'+gc).value=fc[gc];}
function upd_res(gc,kc){hc=fb['l'+(5-gc)].value;ic=haendler*carry;if(kc){lc=hc;}
else
{lc=parseInt(document.getElementById('r'+gc).value);}
if(isNaN(lc)){lc=0;}
fc[gc]=jc(parseInt(lc),hc,ic,0);document.getElementById('r'+gc).value=fc[gc];}
function jc(mc,nc,oc,pc){qc=mc+pc;if(qc>nc){qc=nc;}
if(qc>oc){qc=oc;}
if(qc==0){qc='';}
return qc;}
function rc(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(var i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(var i=0;!x&&d.layers&&i<d.layers.length;i++)x=rc(n,d.layers[i].document);return x;}
function btm0(){var i,x,a=document.MM_sr;for(var i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function btm1(){var i,j=0,x,a=btm1.arguments;document.MM_sr=new Array;for(var i=0;i<(a.length-2);i+=3)if((x=rc(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}
}
function Popup(i,sc,tc){if(typeof tc=='undefined'){tc='s';}
pb=document.getElementById("ce");if(pb!=null){var uc='<div class="popup3">'+'<a href="#" onClick="Close(); return false;"><img src="img/x.gif" border="1" class="popup4" alt="Move"></a>'+'<iframe frameborder="0" id="Frame" src="manual.php?'+tc+'='+i+'&typ='+sc+'" width="412" height="440" border="0"></iframe>'+'</div>';pb.innerHTML=uc;vc();}
wc();if(!is_ie6&&!xc)return false;else return true;}
function vc(){if($('drag')){return;}
$$('.popup3')[0].grab(new Element('div',{'id':'drag'}
),'top').makeDraggable({'handle':'drag'}
);if($$('body')[0].getStyle('direction').toLowerCase()=='rtl'){$$('.popup3')[0].setStyle('direction','rtl').getParent().setStyle('direction','ltr');}
}
function wc(){if(gb()<700||ib()<700){document.getElementById("ce").style.position='absolute';xc=true;}
else{document.getElementById("ce").style.position='fixed';xc=false;}
}
function Close(){pb=document.getElementById("ce");if(pb!=null){pb.innerHTML='';}
if(quest.anmstep!==false){quest.anmstep=false;}
}
function Allmsg(){for(var x=0;x<document.msg.elements.length;x++){var y=document.msg.elements[x];if(y.name!='s10')y.checked=document.msg.s10.checked;}
}
function xy(){yc=screen.width+":"+screen.height;document.snd.w.value=yc;}
function my_village(){var zc=Math.round(0);var $c;var e=document.snd.dname.value;for(var i=0;i<dorfnamen.length;i++){if(dorfnamen[i].indexOf(e)>-1){zc++;$c=dorfnamen[i];}
}
if(zc==1){document.snd.dname.value=$c;}
}
var _c=document.getElementById?1:0;var ad=document.all?1:0;var bd=(navigator.userAgent.indexOf("Mac")>-1)?1:0;var cd=(ad&&(!bd)&&(typeof(window.offscreenBuffering)!='undefined'))?1:0;var dd=cd;var ed=cd&&(window.navigator.userAgent.indexOf("SV1")!=-1);function changeOpacity(fd,opacity){if(cd){fd.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+(opacity*100)+')';}
else if(_c){fd.style.MozOpacity=opacity;}
}
function gd(url,hd,id,jd){if(id===undefined){id='GET';}
var kd;if(window.XMLHttpRequest){kd=new XMLHttpRequest();}
else if(window.ActiveXObject){try{kd=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{kd=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}
}
}
else{throw'Can not create XMLHTTP-instance';}
kd.onreadystatechange=function(){if(kd.readyState==4){if(kd.status==200){var ld=kd.getResponseHeader('Content-Type');ld=ld.substr(0,ld.indexOf(';'));switch(ld){case'application/json':hd((kd.responseText==''?null:eval('('+kd.responseText+')')));break;case'text/plain':case'text/html':hd(kd.responseText);break;default:throw'Illegal content type';}
}
else{throw'An error has occurred during request';}
}
}
;kd.open(id,url,true);if(id=='POST'){kd.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=utf-8');var md=nd(jd);}
else{var md=null;}
kd.send(md);}
function nd(od){var pd='';var qd=true;for(var rd in od){pd+=(qd?'':'&')+rd+'='+window.encodeURI(od[rd]);if(qd){qd=false;}
}
return pd;}
function mreload(){param='reload=auto';url=window.location.href;if(url.indexOf(param)==-1){if(url.indexOf('?')==-1){url+='?'+param;}
else
{url+='&'+param;}
}
document.location.href=url;}
var sd={'index':0,'dir':0,'size':null,'fields':[],'cindex':0,'usealternate':false}
;var m_c=sd;var td;var ud;var vd;var wd;var xd;var yd;var zd;var $d;var _d;var ae=false;var be;var ce;var de;var ee=[];ee[38]=1;ee[39]=2;ee[40]=3;ee[37]=4;var fe={}
;var ge;var he;function map_init(){td=false;ud=false;vd=false;wd=false;yd=0;xd=0;ge=ie('karte2');je(['i','a','t']);if(null==m_c.az){throw'm_c.az muss seitenspezifisch initialisiert werden.';}
for(var p in m_c.az){document.getElementById('ma_'+p).onclick=ke;}
var le=['mcx','mcy','x','y','map_infobox'];for(var i=0;i<le.length;i++){fe[le[i]]=document.getElementById(le[i]);}
le=['mcx','mcy'];for(var i=0;i<le.length;i++){fe[le[i]].onfocus=function(){wd=true;}
;fe[le[i]].onblur=function(){wd=false;}
;}
fe.ibox_cells=[];fe.ibox_cells[0]=fe.map_infobox.firstChild.firstChild.lastChild;for(var i=1;i<=3;i++){fe.ibox_cells[i]=fe.map_infobox.firstChild.nextSibling.childNodes[i-1].lastChild}
document.onkeyup=me;document.onkeydown=ne;document.onkeypress=oe;document.map_coords.onsubmit=pe;fe.mx=[];fe.my=[];for(var i=0;i<mdim.x;i++){for(var j=0;j<mdim.y;j++){area=qe(i,j,'a');area.onmouseover=re;area.onmouseout=se;if(ge){area.onclick=te;}
ue(m_c.ad[i][j],area);}
fe.mx[i]=document.getElementById('mx'+i);fe.my[i]=document.getElementById('my'+i);}
var ve=document.getElementById('map_makelarge');if(ve){ve.onclick=we;}
if(mdim.x==13){document.getElementById('map_popclose').onclick=xe;}
}
function te(){opener.location=this.href;return false;}
function ye(ze){var $e=document.getElementById('map_makelarge');$e.className=ze?'loading':'';}
function _e(af){var bf;var cf;if(fe.map_infobox!=null){if(af.normal_field){var df=ef(af.nr*1);bf=[text_k.verlassenes_tal+': '+df.join('-')];cf='empty';}
else if(af.free_oasis&&!af.classic_oasis){bf=[text_k.freie_oase];cf='oasis_empty';}
else if(af.occupied_oasis&&!af.classic_oasis){bf=[text_k.besetztes_tal,af.name,af.ew,af.ally];cf='oasis';}
else if(af.village){var text='<span class="tribe tribe'+af.vid+'">'+af.dname+'</span>';bf=[text,af.name,af.ew,af.ally];cf='village';}
else{bf=[text_k.details];cf='default';}
}
for(var i=0;i<4;i++){fe.ibox_cells[i].innerHTML=(bf[i]===undefined||bf[i]==='')?'-':bf[i].replace(/\&/g,"&amp;");}
fe.map_infobox.className=cf;}
function ff(gf,hf){return((gf-1)*10)+hf
}
function jf(kf){fe.x.firstChild.nodeValue=kf.x;fe.y.firstChild.nodeValue=kf.y;}
function lf(kf){fe.mcx.value=kf.x;fe.mcy.value=kf.y;l=$$('div.cropfinder_icon a').set('href','cropfinder.php?x='+kf.x+'&y='+kf.y);}
function mf(x,y){return(400+x)+(400-y)*801+1;}
function we(){if(mmode){$d=window.open(this.href,"map","top=100,left=25,width=1007,height=585");$d.focus();}
else{ye(true);gd('ajax.php?f=kp&z='+mf(m_c.z.x,m_c.z.y),function(nf){ye(false);be=document.getElementsByTagName('body')[0];ce=document.getElementsByTagName('html')[0];be.parentNode.removeChild(be);de=document.createElement('body');de.innerHTML=nf.lm;de.style.backgroundColor='#ffffff';ce.appendChild(de);m_c=[];for(var rd in nf.dat.m_c){m_c[rd]=nf.dat.m_c[rd];}
m_c.fields=[];mdim=nf.dat.mdim;mmode=nf.dat.mmode;map_init();}
);}
return false;}
function xe(){if(ge){window.close();}
else{mdim={'x':7,'y':7,'rad':3}
;var of=[];for(var i=0;i<mdim.x;i++){of[i]=[];for(var j=0;j<mdim.y;j++){of[i][j]=qe(i+3,j+3,'a').details;}
}
ce.removeChild(de);ce.appendChild(be);map_init();var pf;var area;for(var i=0;i<mdim.x;i++){for(var j=0;j<mdim.y;j++){area=qe(i,j,'a');pf=qe(i,j,'i');area.details=of[i][j];area.details.fresh={}
;pf.className=of[i][j].img;qf(area,pf);}
}
jf(m_c.z);lf(m_c.z);}
return false;}
function ke(){var rf=1*this.id.substring(4,5);var sf=1*(this.id.substring(5,7)=='p7'?mdim.x:1);map_scroll(rf,sf);return false;}
function tf(z){var x=z.x-mdim.rad;var y=z.y-mdim.rad;var uf=z.x+mdim.rad;var vf=z.y+mdim.rad;return{'x':x,'y':y,'xx':uf,'yy':vf}
;}
function wf(rf,sf,xf){if(xf==null){xf=0;}
if(m_c.size==null){throw'Globale Variable m_c.size muss auf den Wert von $travian[map_prefetch_rows]) gesetzt werden.';}
var yf,zf;if(null===sf||1===sf){zf=m_c.size-1;}
else if(mdim.x==sf){yf=mdim.x;zf=-(mdim.x-1);}
else{throw'Parameter steps muss 1 oder Breite der Karte in Feldern sein.';}
var x,y,uf,vf,z;var z=m_c.z;switch(rf){case 1:x=z.x+mdim.rad;y=z.y+mdim.rad+xf;uf=z.x-mdim.rad;vf=y+zf;break;case 2:x=z.x+mdim.rad+xf;y=z.y-mdim.rad;uf=x+zf;vf=z.y+mdim.rad;break;case 3:x=z.x+mdim.rad;y=z.y-mdim.rad-xf;uf=z.x-mdim.rad;vf=y-zf;break;case 4:x=z.x-mdim.rad-xf;y=z.y-mdim.rad;uf=x-zf;vf=z.y+mdim.rad;break;}
return{'x':x,'y':y,'xx':uf,'yy':vf}
;}
function $f(_f){if(_f>400){_f-=801;}
if(_f<-400){_f+=801;}
return _f;}
function ag(_f){if(_f>400){_f=400;}
if(_f<-400){_f=-400;}
return _f;}
function bg(rf,sf){var z={}
;z.x=m_c.z.x*1;z.y=m_c.z.y*1;switch(rf){case 1:z.y+=sf;break;case 2:z.x+=sf;break;case 3:z.y-=sf;break;case 4:z.x-=sf;break;}
m_c.z.x=$f(z.x);m_c.z.y=$f(z.y);}
function cg(dg){return'ajax.php?f=k7&x='+dg.x+'&y='+dg.y+'&xx='+dg.xx+'&yy='+dg.yy;}
function map_scroll(rf,sf,eg){var dg,fg;if(td){return false;}
if(gg()){if(ud){return false;}
td=true;hg();m_c.usealternate=false;m_c.cindex=0;if(eg!==undefined){m_c.z.x=ag(eg.x);m_c.z.y=ag(eg.y);dg=tf(m_c.z);}
else{bg(rf,sf);dg=wf(rf,sf);}
ig=cg(dg);gd(ig,jg);}
else{if(kg()){if(ud){return false;}
ud=true;bg(rf,sf);dg=wf(rf,sf,2);ig=cg(dg);gd(ig,jg);}
else if(lg()){bg(rf,sf);mg();hg();}
else{bg(rf,sf);}
ng(rf,sf);}
function jg(og){var pg;if(kg()){pg=qg(m_c.cindex);m_c.usealternate=false;ud=false;}
else{pg=m_c.cindex;}
m_c.fields[pg]=og;if(gg()){if(eg!==undefined){ng(0,0,m_c.z);rg('x');rg('y');}
else{ng(rf,sf);rg(rf);}
td=false;}
}
function kg(){return m_c.usealternate;}
function gg(){return(rf!=m_c.dir||sf==mdim.x||(sf==1&&sf!=m_c.steps)||eg!==undefined);}
function lg(){return(m_c.index==m_c.size);}
}
function sg(rf,sf){m_c.dir=rf;m_c.steps=sf;}
function hg(){m_c.index=0;}
function tg(){m_c.index++;if(m_c.index==m_c.size-2){m_c.usealternate=true;}
}
function mg(){m_c.cindex=qg(m_c.cindex);}
function ng(rf,sf,eg){var ug=document.getElementById('map_content');var vg=ug.parentNode;if(1==sf){wg(rf);xg(m_c.fields[m_c.cindex],rf,sf);rg(rf);tg();}
else if(mdim.x==sf||eg!==undefined){yg(m_c.fields[m_c.cindex]);}
if(xd==0){lf(m_c.z);}
jf(m_c.z);sg(rf,sf);}
function qg(pg){return(pg==0?1:0);}
function yg(og){for(var i=0;i<mdim.x;i++){for(var j=0;j<mdim.y;j++){zg(i,j,og[i][j]);}
}
}
function $g(_g,ah){ah.details.href=_g;}
function zg(bh,ch,af){var pf=qe(bh,ch,'i');var area=qe(bh,ch,'a');ue(af,area);pf.className=area.details.img;qf(area,pf);}
function qf(area,pf){if(area.details.atyp){if(!pf.firstChild){pf.appendChild(document.createElement('span'));}
pf.firstChild.className='m'+area.details.atyp;}
else{if(pf.firstChild){pf.removeChild(pf.firstChild);}
}
}
function ue(af,area){area.details={}
;var dh=['x','y','nr','typ','querystring','img','dname','name','ew','ally','vid','atyp','atime'];for(var i=0;i<af.length;i++){area.details[dh[i]]=af[i];}
area.details.normal_field=area.details.name===undefined&&area.details.typ==0;area.details.free_oasis=area.details.name===undefined&&area.details.typ!=0;area.details.occupied_oasis=area.details.name!==undefined&&area.details.typ!=0;area.details.village=area.details.name!==undefined&&area.details.typ==0;area.details.fresh={}
;area.details.classic_oasis=area.details.querystring==='';}
function ef(eh){switch(eh){case 1:return[3,3,3,9];case 2:return[3,4,5,6];case 3:return[4,4,4,6];case 4:return[4,5,3,6];case 5:return[5,3,4,6];case 6:return[1,1,1,15];case 7:return[4,4,3,7];case 8:return[3,4,4,7];case 9:return[4,3,4,7];case 10:return[3,5,4,6];case 11:return[4,3,5,6];case 12:return[5,4,3,6];default:return false;}
}
function pe(){var x=parseInt(this.xp.value);var y=parseInt(this.yp.value);if(!isNaN(x)&&!isNaN(y)){map_scroll(0,0,{'x':x,'y':y}
);}
return false;}
function oe(e){if(wd){return true;}
var rd=(window.event)?event.keyCode:e.keyCode;var rf=fh(rd);if(rf!=0){return false;}
}
function re(){ae=true;jf(this.details);_e(this.details);gh(this);he=this;}
function gh(area){if(!area.details.fresh.href){if(area.details.classic_oasis){area.removeAttribute('href');area.style.cursor='default';}
else{area.href='karte.php?'+area.details.querystring;area.style.cursor='pointer';}
area.details.fresh.href=true;}
if(!area.details.fresh.title){area.details.fresh.title=hh(area);}
}
function hh(area){if(area.details.normal_field){area.title='';}
else if(area.details.free_oasis&&!area.details.classic_oasis){area.title=text_k.freie_oase;}
else if(area.details.occupied_oasis&&!area.details.classic_oasis){area.title=text_k.besetztes_tal;}
else if(area.details.village){if(area.details.atime!==undefined){area.title=area.details.dname+' '+rb(area.details.atime-Math.floor(new Date().getTime()/1000),true);return false;}
else{area.title=area.details.dname;}
}
else{area.title='';}
return true;}
function se(){var area=this;window.setTimeout(function(){if(he==area){ae=false;jf(m_c.z);ih();}
}
,50);}
function xg(og,rf){var jh,kh;for(var i=0;i<mdim.x;i++){switch(rf){case 1:jh=i;kh=mdim.x-1;af=og[i][m_c.index];break;case 2:jh=mdim.x-1;kh=i;af=og[m_c.index][i];break;case 3:jh=i;kh=0;af=og[i][m_c.size-m_c.index-1];break;case 4:jh=0;kh=i;af=og[m_c.size-m_c.index-1][i];break;}
zg(jh,kh,af);}
}
function lh(x,y,uf,vf){var pf=qe(x,y,'i');var mh=qe(uf,vf,'i');nh(pf,mh);if(pf.firstChild){if(!mh.firstChild){mh.appendChild(document.createElement('span'))}
mh.firstChild.className=pf.firstChild.className;}
else{if(mh.firstChild){mh.removeChild(mh.firstChild);}
}
oh(x,y,uf,vf);}
function oh(x,y,uf,vf){af=qe(x,y,'a');ph=qe(uf,vf,'a');ph.details=af.details;ph.details.fresh={}
;}
function nh(pf,mh){mh.className=pf.className;}
function wg(rf){for(var i=0;i<mdim.x;i++){for(var j=1;j<mdim.x;j++){switch(rf){case 1:lh(i,j,i,j-1);break;case 2:lh(j,i,j-1,i);break;case 3:lh(i,mdim.x-1-j,i,mdim.x-j);break;case 4:lh(mdim.x-1-j,i,mdim.x-j,i);break;}
}
}
}
function fh(rd){if(ee[rd]!==undefined){return ee[rd];}
return 0;}
function me(e){if(wd){return true;}
var rd=((window.event)?event.keyCode:e.keyCode);if(16==rd){vd=false;}
var rf=fh(rd);if(rf==xd&&xd!=0){xd=0;lf(m_c.z);qh();}
}
function m_r(rf,rh){if(xd==rf&&rh==yd){window.setTimeout(function(){m_r(rf,rh)}
,100);map_scroll(rf,1);}
}
function rg(sh){var jb;switch(sh){case 2:case 4:case'x':jb='x';break;case 1:case 3:case'y':jb='y';break;}
var th='m'+jb;var uh;var vh;var wh=0;var xh=0;for(var i=0;i<mdim.x;i++){if(jb=='x'){wh=i;}
else{xh=i;}
if(fe[th][i]){uh=qe(wh,xh,'a').details[jb];fe[th][i].firstChild.nodeValue=uh;}
}
}
function ne(e){if(wd){return true;}
var rd=(window.event)?event.keyCode:e.keyCode;if(rd==16){vd=true;}
var rf=fh(rd);if(rf!=0&&rf!=xd){var sf=(vd?mdim.x:1);map_scroll(rf,sf);var rh=new Date().getTime();if(sf==1){window.setTimeout(function(){m_r(rf,rh)}
,500);}
yd=rh;xd=rf;qh();}
if(rf!=0){return false;}
}
function qh(){window.setTimeout(function(){if(ae){_e(he.details);}
}
,60);}
var yh={}
;function qe(bh,ch,zh){if(yh){return yh[zh][bh][ch];}
}
function je($h){var zh;for(var i=0;i<$h.length;i++){zh=$h[i];yh[zh]=[];for(var bh=0;bh<mdim.x;bh++){yh[zh][bh]=[];for(var ch=0;ch<mdim.y;ch++){yh[zh][bh][ch]=document.getElementById(zh+'_'+bh+'_'+ch);}
}
}
}
function ih(){_e({_h:'',name:'',ai:'',bi:'',x:m_c.z.x,y:m_c.z.y}
);}
var quest={'anmstep':false}
;function ci(length,di){if(length===undefined){length=8;}
if(di===undefined){di=0.5;}
var ei='0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';var ci='';for(var i=0;i<length;i++){var fi=Math.floor((Math.random()+di)*0.5*ei.length);ci+=ei.substring(fi,fi+1);}
return ci;}
function gi(){var hi='ajax.php?f=qst';var di=(Math.abs(quest.number)+1)/(Math.abs(quest.last)+1);return hi+'&cr='+ci(4,di);}
function ii(){document.getElementById('ce').innerHTML='';var step;if(quest.anmstep===false){step={'step':{}
,'source':{}
,'current':{}
,'target':{'width':448,'height':482,'top':-1}
,'fps':50,'n':10,'i':0,'anm':{}
}
;step.target[quest.rtl?'right':'left']='-502';}
else{step=quest.anmstep;ji(false);}
step.anm=document.getElementById('anm');for(var ki in step.target){step.source[ki]=Number(step.anm.style[ki].substr(0,step.anm.style[ki].length-2));step.current[ki]=step.source[ki];step.step[ki]=Math.round((step.target[ki]-step.source[ki])/step.n);}
step.timeout=1000/step.fps;quest.cstep=step;quest.anmlock=true;window.setTimeout(anm_step,step.timeout);}
function li(step){for(var ki in step.target){step.anm.style[ki]=step.current[ki]+'px';}
}
function mi(step){step.i++;if(step.i==2){step.anm.style.visibility='visible';}
for(var ki in step.target){step.current[ki]+=step.step[ki];}
return step;}
function ji(ni){if(ni===undefined){ni==false;}
var oi=document.getElementById('ce');if(ni){var pi='<div class="popup3 quest"><a href="#" onClick="qst_handle()"><img src="img/x.gif" border="1" class="popup4" alt="Close"></a><div id="popup3"</div></div>';oi.innerHTML=pi;qi();qst_wfm();wc();ri(true);vc();}
else{oi.innerHTML='';ri(false);}
}
function ri(vis){if(!is_ie6){return;}
var si=vis?'hidden':'visible';var ti=document.getElementsByTagName('select');var n=ti.length;for(var i=0;i<n;i++){ti[i].style.visibility=si;}
}
function anm_step(){step=mi(quest.cstep);li(step);if(step.i<step.n){window.setTimeout('anm_step()',step.timeout);}
else{step.anm.style.visibility='hidden';quest.anmlock=false;quest.cstep=false;if(quest.anmstep===false){step.current=step.target;step.target=step.source;step.source=step.current;li(step);step.i=0;ji(true);quest.anmstep=step;}
else{quest.anmstep=false;if(quest.number>=quest.last||quest.altstep==9){document.getElementById('qge').innerHTML='';}
}
}
}
function ui(){var timer=document.getElementById('qst_timer');if(timer&&timer.parentNode.style.display!='none'){if(!timer.timestamp){timer.timestamp=db()+ob(timer);}
else{var vi=timer.timestamp-db();if(vi<0){timer.parentNode.style.display='none';document.getElementById('qst_reshere').style.display='block';}
else{timer.innerHTML=rb(vi);}
}
window.setTimeout(ui,1000);}
}
function qst_fhandle(){jd={'val':1}
;gd(gi(),function(nf){}
,'POST',jd
);qst_handle();}
function qst_handle(){if(quest.anmlock){return false;}
quest.markup=false;if(quest.anmstep===false){gd(gi(),function(nf){for(var rd in nf){quest[rd]=nf[rd];}
}
);}
ii();if(quest.ar){auto_reload=quest.ar;quest.ar=undefined;}
}
function qst_wfm(){var wi=document.getElementById('popup3');if(!quest.markup||!wi){if(!quest.anmlock){window.setTimeout('qst_wfm(true)',50);}
}
else{xi(quest);wi.innerHTML=quest.markup;vc();yi=false;if(quest.reward.finish&&window.bld){var zi=document.getElementById('building_contract');if(bld.length<2&&bld[0].gid==1){zi.innerHTML='';yi=0;}
else{for(var i in bld){if(bld[i].stufe==1&&bld[i].gid==1){zi.getElementsByTagName('table')[0].deleteRow(i);yi=i;break;}
}
}
if(yi!==false){var $i=$$('#t3 .rf'+bld[yi].aid)[0];if($i){$i.removeClass('rf'+bld[yi].stufe);$i.addClass('rf'+bld[yi].stufe+1);}
else{$$('.f3')[0].appendChild(new Element('img',{'class':('reslevel rf'+bld[yi].aid+' level'+bld[yi].stufe),'src':'img/x.gif'}
));}
}
quest.ar=auto_reload;auto_reload=-1;}
if(quest.reward.plus){var pf=document.getElementById('logo').className='plus';}
quest.markup=false;quest.msg=false;}
}
function qst_weiter(){qi();gd(gi(),function(nf){document.getElementById('popup3').innerHTML=nf.markup;var _i=document.getElementById('qgei');_i.className=nf.qgsrc;xi(nf);vc();}
);}
function qi(){document.getElementById('popup3').innerHTML='<img src="img/x.gif" class="xlo" />';}
function qst_enter(kf){if(kf===undefined){kf=false;}
var jd;if(kf){jd={'x':document.getElementById('qst_val_x').value,'y':document.getElementById('qst_val_y').value}
;}
else{jd={'val':document.getElementById('qst_val').value}
;}
qi();gd(gi(),function(nf){for(var rd in nf){quest[rd]=nf[rd];}
}
,'POST',jd
);qst_wfm();}
function qst_enter_coords(){qst_enter(true);}
function xi(aj){var _i=document.getElementById('qgei');if(_i&&aj.qgsrc){_i.className=aj.qgsrc;}
var bj=document.getElementById('n5');if(bj&&aj.msrc){bj.className=aj.msrc;}
if(aj.cookie){var date=new Date();date.setTime(date.getTime()+300000);document.cookie='t3fw=1; expires='+date.toUTCString()+';';}
if(aj.fest&&ie('dorf2')){document.getElementById('content').innerHTML+=aj.fest;}
window.setTimeout(ui,30);}
function ie(cj){return window.location.href.indexOf(cj+'.php')!=-1;}
function vil_levels_toggle(){var dj=$('levels'),ej=$('lswitch');dj.toggleClass('on');ej.toggleClass('on');if(dj.hasClass('on')){document.cookie='t3l=1; expires=Wed, 1 Jan 2020 00:00:00 GMT';}
else{document.cookie='t3l=1; expires=Thu, 01-Jan-1970 00:00:01 GMT';}
}
function gmwd(){if(is_ff2&&document.getElementById("gmwi").offsetWidth<50){document.cookie="a3=2; expires=Wed, 1 Jan 2020 00:00:00 GMT";}
else{document.cookie="a3=1; expires=Wed, 1 Jan 2020 00:00:00 GMT";}
}
function gmc(){document.getElementById("gmw").style.display="none";document.cookie="a3=3; expires=Wed, 1 Jan 2020 00:00:00 GMT";}

