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,j){pb=document.getElementById("ce");if(pb!=null){var sc='<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?s='+i+'&typ='+j+'" width="412" height="440" border="0"></iframe>'+'</div>';pb.innerHTML=sc;tc();}
uc();if(!is_ie6&&!vc)return false;else return true;}
function tc(){if($('drag')){return;}
$$('.popup3')[0].grab(new Element('div',{'id':'drag'}
),'top').makeDraggable({'handle':'drag'}
);}
function uc(){if(gb()<700||ib()<700){document.getElementById("ce").style.position='absolute';vc=true;}
else{document.getElementById("ce").style.position='fixed';vc=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(){wc=screen.width+":"+screen.height;document.snd.w.value=wc;}
function my_village(){var xc=Math.round(0);var yc;var e=document.snd.dname.value;for(var i=0;i<dorfnamen.length;i++){if(dorfnamen[i].indexOf(e)>-1){xc++;yc=dorfnamen[i];}
}
if(xc==1){document.snd.dname.value=yc;}
}
var zc=document.getElementById?1:0;var $c=document.all?1:0;var _c=(navigator.userAgent.indexOf("Mac")>-1)?1:0;var ad=($c&&(!_c)&&(typeof(window.offscreenBuffering)!='undefined'))?1:0;var bd=ad;var cd=ad&&(window.navigator.userAgent.indexOf("SV1")!=-1);function changeOpacity(dd,opacity){if(ad){dd.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+(opacity*100)+')';}
else if(zc){dd.style.MozOpacity=opacity;}
}
function ed(url,fd,gd,hd){if(gd===undefined){gd='GET';}
var id;if(window.XMLHttpRequest){id=new XMLHttpRequest();}
else if(window.ActiveXObject){try{id=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{id=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}
}
}
else{throw'Can not create XMLHTTP-instance';}
id.onreadystatechange=function(){if(id.readyState==4){if(id.status==200){var jd=id.getResponseHeader('Content-Type');jd=jd.substr(0,jd.indexOf(';'));switch(jd){case'application/json':fd((id.responseText==''?null:eval('('+id.responseText+')')));break;case'text/plain':case'text/html':fd(id.responseText);break;default:throw'Illegal content type';}
}
else{throw'An error has occurred during request';}
}
}
;id.open(gd,url,true);if(gd=='POST'){id.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=utf-8');var kd=ld(hd);}
else{var kd=null;}
id.send(kd);}
function ld(md){var nd='';var od=true;for(var pd in md){nd+=(od?'':'&')+pd+'='+window.encodeURI(md[pd]);if(od){od=false;}
}
return nd;}
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 qd={'index':0,'dir':0,'size':null,'fields':[],'cindex':0,'usealternate':false}
;var m_c=qd;var rd;var sd;var td;var ud;var vd;var wd;var xd;var yd;var zd;var $d=false;var _d;var ae;var be;var ce=[];ce[38]=1;ce[39]=2;ce[40]=3;ce[37]=4;var de={}
;var ee;var fe;function map_init(){rd=false;sd=false;td=false;ud=false;wd=0;vd=0;ee=ge('karte2');he(['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=ie;}
var je=['mcx','mcy','x','y','map_infobox'];for(var i=0;i<je.length;i++){de[je[i]]=document.getElementById(je[i]);}
je=['mcx','mcy'];for(var i=0;i<je.length;i++){de[je[i]].onfocus=function(){ud=true;}
;de[je[i]].onblur=function(){ud=false;}
;}
de.ibox_cells=[];de.ibox_cells[0]=de.map_infobox.firstChild.firstChild.lastChild;for(var i=1;i<=3;i++){de.ibox_cells[i]=de.map_infobox.firstChild.nextSibling.childNodes[i-1].lastChild}
document.onkeyup=ke;document.onkeydown=le;document.onkeypress=me;document.map_coords.onsubmit=ne;de.mx=[];de.my=[];for(var i=0;i<mdim.x;i++){for(var j=0;j<mdim.y;j++){area=oe(i,j,'a');area.onmouseover=pe;area.onmouseout=qe;if(ee){area.onclick=re;}
se(m_c.ad[i][j],area);}
de.mx[i]=document.getElementById('mx'+i);de.my[i]=document.getElementById('my'+i);}
var te=document.getElementById('map_makelarge');if(te){te.onclick=ue;}
if(mdim.x==13){document.getElementById('map_popclose').onclick=ve;}
}
function re(){opener.location=this.href;return false;}
function we(xe){var ye=document.getElementById('map_makelarge');ye.className=xe?'loading':'';}
function ze($e){var _e;var af;if(de.map_infobox!=null){if($e.normal_field){var bf=cf($e.nr*1);_e=[text_k.verlassenes_tal+': '+bf.join('-')];af='empty';}
else if($e.free_oasis&&!$e.classic_oasis){_e=[text_k.freie_oase];af='oasis_empty';}
else if($e.occupied_oasis&&!$e.classic_oasis){_e=[text_k.besetztes_tal,$e.name,$e.ew,$e.ally];af='oasis';}
else if($e.village){_e=[$e.dname,$e.name,$e.ew,$e.ally];af='village';}
else{_e=[text_k.details];af='default';}
}
for(var i=0;i<4;i++){de.ibox_cells[i].innerHTML=(_e[i]===undefined||_e[i]==='')?'-':_e[i].replace(/\&/g,"&amp;");}
de.map_infobox.className=af;}
function df(ef){de.x.firstChild.nodeValue=ef.x;de.y.firstChild.nodeValue=ef.y;}
function ff(ef){de.mcx.value=ef.x;de.mcy.value=ef.y;}
function gf(x,y){return(400+x)+(400-y)*801+1;}
function ue(){if(mmode){yd=window.open(this.href,"map","top=100,left=25,width=1007,height=585");yd.focus();}
else{we(true);ed('ajax.php?f=kp&z='+gf(m_c.z.x,m_c.z.y),function(hf){we(false);_d=document.getElementsByTagName('body')[0];ae=document.getElementsByTagName('html')[0];_d.parentNode.removeChild(_d);be=document.createElement('body');be.innerHTML=hf.lm;be.style.backgroundColor='#ffffff';ae.appendChild(be);m_c=[];for(var pd in hf.dat.m_c){m_c[pd]=hf.dat.m_c[pd];}
m_c.fields=[];mdim=hf.dat.mdim;mmode=hf.dat.mmode;map_init();}
);}
return false;}
function ve(){if(ee){window.close();}
else{mdim={'x':7,'y':7,'rad':3}
;var jf=[];for(var i=0;i<mdim.x;i++){jf[i]=[];for(var j=0;j<mdim.y;j++){jf[i][j]=oe(i+3,j+3,'a').details;}
}
ae.removeChild(be);ae.appendChild(_d);map_init();var kf;var area;for(var i=0;i<mdim.x;i++){for(var j=0;j<mdim.y;j++){area=oe(i,j,'a');kf=oe(i,j,'i');area.details=jf[i][j];area.details.fresh={}
;kf.className=jf[i][j].img;lf(area,kf);}
}
df(m_c.z);ff(m_c.z);}
return false;}
function ie(){var mf=1*this.id.substring(4,5);var nf=1*(this.id.substring(5,7)=='p7'?mdim.x:1);map_scroll(mf,nf);return false;}
function of(z){var x=z.x-mdim.rad;var y=z.y-mdim.rad;var pf=z.x+mdim.rad;var qf=z.y+mdim.rad;return{'x':x,'y':y,'xx':pf,'yy':qf}
;}
function rf(mf,nf,sf){if(sf==null){sf=0;}
if(m_c.size==null){throw'Globale Variable m_c.size muss auf den Wert von $travian[map_prefetch_rows]) gesetzt werden.';}
var tf,uf;if(null===nf||1===nf){uf=m_c.size-1;}
else if(mdim.x==nf){tf=mdim.x;uf=-(mdim.x-1);}
else{throw'Parameter steps muss 1 oder Breite der Karte in Feldern sein.';}
var x,y,pf,qf,z;var z=m_c.z;switch(mf){case 1:x=z.x+mdim.rad;y=z.y+mdim.rad+sf;pf=z.x-mdim.rad;qf=y+uf;break;case 2:x=z.x+mdim.rad+sf;y=z.y-mdim.rad;pf=x+uf;qf=z.y+mdim.rad;break;case 3:x=z.x+mdim.rad;y=z.y-mdim.rad-sf;pf=z.x-mdim.rad;qf=y-uf;break;case 4:x=z.x-mdim.rad-sf;y=z.y-mdim.rad;pf=x-uf;qf=z.y+mdim.rad;break;}
return{'x':x,'y':y,'xx':pf,'yy':qf}
;}
function vf(wf){if(wf>400){wf-=801;}
if(wf<-400){wf+=801;}
return wf;}
function xf(wf){if(wf>400){wf=400;}
if(wf<-400){wf=-400;}
return wf;}
function yf(mf,nf){var z={}
;z.x=m_c.z.x*1;z.y=m_c.z.y*1;switch(mf){case 1:z.y+=nf;break;case 2:z.x+=nf;break;case 3:z.y-=nf;break;case 4:z.x-=nf;break;}
m_c.z.x=vf(z.x);m_c.z.y=vf(z.y);}
function zf($f){return'ajax.php?f=k7&x='+$f.x+'&y='+$f.y+'&xx='+$f.xx+'&yy='+$f.yy;}
function map_scroll(mf,nf,_f){var $f,ag;if(rd){return false;}
if(bg()){if(sd){return false;}
rd=true;cg();m_c.usealternate=false;m_c.cindex=0;if(_f!==undefined){m_c.z.x=xf(_f.x);m_c.z.y=xf(_f.y);$f=of(m_c.z);}
else{yf(mf,nf);$f=rf(mf,nf);}
dg=zf($f);ed(dg,eg);}
else{if(fg()){if(sd){return false;}
sd=true;yf(mf,nf);$f=rf(mf,nf,2);dg=zf($f);ed(dg,eg);}
else if(gg()){yf(mf,nf);hg();cg();}
else{yf(mf,nf);}
ig(mf,nf);}
function eg(jg){var kg;if(fg()){kg=lg(m_c.cindex);m_c.usealternate=false;sd=false;}
else{kg=m_c.cindex;}
m_c.fields[kg]=jg;if(bg()){if(_f!==undefined){ig(0,0,m_c.z);mg('x');mg('y');}
else{ig(mf,nf);mg(mf);}
rd=false;}
}
function fg(){return m_c.usealternate;}
function bg(){return(mf!=m_c.dir||nf==mdim.x||(nf==1&&nf!=m_c.steps)||_f!==undefined);}
function gg(){return(m_c.index==m_c.size);}
}
function ng(mf,nf){m_c.dir=mf;m_c.steps=nf;}
function cg(){m_c.index=0;}
function og(){m_c.index++;if(m_c.index==m_c.size-2){m_c.usealternate=true;}
}
function hg(){m_c.cindex=lg(m_c.cindex);}
function ig(mf,nf,_f){var pg=document.getElementById('map_content');var qg=pg.parentNode;if(1==nf){rg(mf);sg(m_c.fields[m_c.cindex],mf,nf);mg(mf);og();}
else if(mdim.x==nf||_f!==undefined){tg(m_c.fields[m_c.cindex]);}
if(vd==0){ff(m_c.z);}
df(m_c.z);ng(mf,nf);}
function lg(kg){return(kg==0?1:0);}
function tg(jg){for(var i=0;i<mdim.x;i++){for(var j=0;j<mdim.y;j++){ug(i,j,jg[i][j]);}
}
}
function vg(wg,xg){xg.details.href=wg;}
function ug(yg,zg,$e){var kf=oe(yg,zg,'i');var area=oe(yg,zg,'a');se($e,area);kf.className=area.details.img;lf(area,kf);}
function lf(area,kf){if(area.details.atyp){if(!kf.firstChild){kf.appendChild(document.createElement('span'));}
kf.firstChild.className='m'+area.details.atyp;}
else{if(kf.firstChild){kf.removeChild(kf.firstChild);}
}
}
function se($e,area){area.details={}
;var $g=['x','y','nr','typ','querystring','img','dname','name','ew','ally','atyp','atime'];for(var i=0;i<$e.length;i++){area.details[$g[i]]=$e[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 cf(_g){switch(_g){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 ne(){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 me(e){if(ud){return true;}
var pd=(window.event)?event.keyCode:e.keyCode;var mf=ah(pd);if(mf!=0){return false;}
}
function pe(){$d=true;df(this.details);ze(this.details);bh(this);fe=this;}
function bh(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=ch(area);}
}
function ch(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 qe(){var area=this;window.setTimeout(function(){if(fe==area){$d=false;df(m_c.z);dh();}
}
,50);}
function sg(jg,mf){var eh,fh;for(var i=0;i<mdim.x;i++){switch(mf){case 1:eh=i;fh=mdim.x-1;$e=jg[i][m_c.index];break;case 2:eh=mdim.x-1;fh=i;$e=jg[m_c.index][i];break;case 3:eh=i;fh=0;$e=jg[i][m_c.size-m_c.index-1];break;case 4:eh=0;fh=i;$e=jg[m_c.size-m_c.index-1][i];break;}
ug(eh,fh,$e);}
}
function gh(x,y,pf,qf){var kf=oe(x,y,'i');var hh=oe(pf,qf,'i');ih(kf,hh);if(kf.firstChild){if(!hh.firstChild){hh.appendChild(document.createElement('span'))}
hh.firstChild.className=kf.firstChild.className;}
else{if(hh.firstChild){hh.removeChild(hh.firstChild);}
}
jh(x,y,pf,qf);}
function jh(x,y,pf,qf){$e=oe(x,y,'a');kh=oe(pf,qf,'a');kh.details=$e.details;kh.details.fresh={}
;}
function ih(kf,hh){hh.className=kf.className;}
function rg(mf){for(var i=0;i<mdim.x;i++){for(var j=1;j<mdim.x;j++){switch(mf){case 1:gh(i,j,i,j-1);break;case 2:gh(j,i,j-1,i);break;case 3:gh(i,mdim.x-1-j,i,mdim.x-j);break;case 4:gh(mdim.x-1-j,i,mdim.x-j,i);break;}
}
}
}
function ah(pd){if(ce[pd]!==undefined){return ce[pd];}
return 0;}
function ke(e){if(ud){return true;}
var pd=((window.event)?event.keyCode:e.keyCode);if(16==pd){td=false;}
var mf=ah(pd);if(mf==vd&&vd!=0){vd=0;ff(m_c.z);lh();}
}
function m_r(mf,mh){if(vd==mf&&mh==wd){window.setTimeout(function(){m_r(mf,mh)}
,100);map_scroll(mf,1);}
}
function mg(nh){var jb;switch(nh){case 2:case 4:case'x':jb='x';break;case 1:case 3:case'y':jb='y';break;}
var oh='m'+jb;var ph;var qh;var rh=0;var sh=0;for(var i=0;i<mdim.x;i++){if(jb=='x'){rh=i;}
else{sh=i;}
if(de[oh][i]){ph=oe(rh,sh,'a').details[jb];de[oh][i].firstChild.nodeValue=ph;}
}
}
function le(e){if(ud){return true;}
var pd=(window.event)?event.keyCode:e.keyCode;if(pd==16){td=true;}
var mf=ah(pd);if(mf!=0&&mf!=vd){var nf=(td?mdim.x:1);map_scroll(mf,nf);var mh=new Date().getTime();if(nf==1){window.setTimeout(function(){m_r(mf,mh)}
,500);}
wd=mh;vd=mf;lh();}
if(mf!=0){return false;}
}
function lh(){window.setTimeout(function(){if($d){ze(fe.details);}
}
,60);}
var th={}
;function oe(yg,zg,uh){if(th){return th[uh][yg][zg];}
}
function he(vh){var uh;for(var i=0;i<vh.length;i++){uh=vh[i];th[uh]=[];for(var yg=0;yg<mdim.x;yg++){th[uh][yg]=[];for(var zg=0;zg<mdim.y;zg++){th[uh][yg][zg]=document.getElementById(uh+'_'+yg+'_'+zg);}
}
}
}
function dh(){ze({wh:'',name:'',xh:'',yh:'',x:m_c.z.x,y:m_c.z.y}
);}
var quest={'anmstep':false}
;function zh(length,$h){if(length===undefined){length=8;}
if($h===undefined){$h=0.5;}
var _h='0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';var zh='';for(var i=0;i<length;i++){var ai=Math.floor((Math.random()+$h)*0.5*_h.length);zh+=_h.substring(ai,ai+1);}
return zh;}
function bi(){var ci='ajax.php?f=qst';var $h=(Math.abs(quest.number)+1)/(Math.abs(quest.last)+1);return ci+'&cr='+zh(4,$h);}
function di(){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;ei(false);}
step.anm=document.getElementById('anm');for(var fi in step.target){step.source[fi]=Number(step.anm.style[fi].substr(0,step.anm.style[fi].length-2));step.current[fi]=step.source[fi];step.step[fi]=Math.round((step.target[fi]-step.source[fi])/step.n);}
step.timeout=1000/step.fps;quest.cstep=step;quest.anmlock=true;window.setTimeout(anm_step,step.timeout);}
function gi(step){for(var fi in step.target){step.anm.style[fi]=step.current[fi]+'px';}
}
function hi(step){step.i++;if(step.i==2){step.anm.style.visibility='visible';}
for(var fi in step.target){step.current[fi]+=step.step[fi];}
return step;}
function ei(ii){if(ii===undefined){ii==false;}
var ji=document.getElementById('ce');if(ii){var ki='<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>';ji.innerHTML=ki;li();qst_wfm();uc();mi(true);tc();}
else{ji.innerHTML='';mi(false);}
}
function mi(vis){if(!is_ie6){return;}
var ni=vis?'hidden':'visible';var oi=document.getElementsByTagName('select');var n=oi.length;for(var i=0;i<n;i++){oi[i].style.visibility=ni;}
}
function anm_step(){step=hi(quest.cstep);gi(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;gi(step);step.i=0;ei(true);quest.anmstep=step;}
else{quest.anmstep=false;if(quest.number>=quest.last||quest.altstep==9){document.getElementById('qge').innerHTML='';}
}
}
}
function pi(){var timer=document.getElementById('qst_timer');if(timer&&timer.parentNode.style.display!='none'){if(!timer.timestamp){timer.timestamp=db()+ob(timer);}
else{var qi=timer.timestamp-db();if(qi<0){timer.parentNode.style.display='none';document.getElementById('qst_reshere').style.display='block';}
else{timer.innerHTML=rb(qi);}
}
window.setTimeout(pi,1000);}
}
function qst_fhandle(){hd={'val':1}
;ed(bi(),function(hf){}
,'POST',hd
);qst_handle();}
function qst_handle(){if(quest.anmlock){return false;}
quest.markup=false;if(quest.anmstep===false){ed(bi(),function(hf){for(var pd in hf){quest[pd]=hf[pd];}
}
);}
di();if(quest.ar){auto_reload=quest.ar;quest.ar=undefined;}
}
function qst_wfm(){var ri=document.getElementById('popup3');if(!quest.markup||!ri){if(!quest.anmlock){window.setTimeout('qst_wfm(true)',50);}
}
else{si(quest);ri.innerHTML=quest.markup;tc();ti=false;if(quest.reward.finish&&window.bld){var ui=document.getElementById('building_contract');if(bld.length<2&&bld[0].gid==1){ui.innerHTML='';ti=0;}
else{for(var i in bld){if(bld[i].stufe==1&&bld[i].gid==1){ui.getElementsByTagName('table')[0].deleteRow(i);ti=i;break;}
}
}
if(ti!==false){var vi=$$('#t3 .rf'+bld[ti].aid)[0];if(vi){vi.removeClass('rf'+bld[ti].stufe);vi.addClass('rf'+bld[ti].stufe+1);}
else{$('f3').appendChild(new Element('img',{'class':('reslevel rf'+bld[ti].aid+' level'+bld[ti].stufe),'src':'img/x.gif'}
));}
}
quest.ar=auto_reload;auto_reload=-1;}
if(quest.reward.plus){var kf=document.getElementById('logo').className='plus';}
quest.markup=false;quest.msg=false;}
}
function qst_weiter(){li();ed(bi(),function(hf){document.getElementById('popup3').innerHTML=hf.markup;var wi=document.getElementById('qgei');wi.className=hf.qgsrc;si(hf);tc();}
);}
function li(){document.getElementById('popup3').innerHTML='<img src="img/x.gif" class="xlo" />';}
function qst_enter(ef){if(ef===undefined){ef=false;}
var hd;if(ef){hd={'x':document.getElementById('qst_val_x').value,'y':document.getElementById('qst_val_y').value}
;}
else{hd={'val':document.getElementById('qst_val').value}
;}
li();ed(bi(),function(hf){for(var pd in hf){quest[pd]=hf[pd];}
}
,'POST',hd
);qst_wfm();}
function qst_enter_coords(){qst_enter(true);}
function si(xi){var wi=document.getElementById('qgei');if(wi&&xi.qgsrc){wi.className=xi.qgsrc;}
var yi=document.getElementById('n5');if(yi&&xi.msrc){yi.className=xi.msrc;}
if(xi.cookie){var date=new Date();date.setTime(date.getTime()+300000);document.cookie='t3fw=1; expires='+date.toUTCString()+';';}
if(xi.fest&&ge('dorf2')){document.getElementById('content').innerHTML+=xi.fest;}
window.setTimeout(pi,30);}
function ge(zi){return window.location.href.indexOf(zi+'.php')!=-1;}
function vil_levels_toggle(){var $i=$('levels'),_i=$('lswitch');$i.toggleClass('on');_i.toggleClass('on');if($i.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 aj(){var bj=$('vlist');var cj=$('vlswitch');bj.toggleClass('hide');cj.toggleClass('off');if(bj.hasClass('hide')){document.cookie='t3vl=1; expires=Wed, 1 Jan 2020 00:00:00 GMT';}
else{document.cookie='t3vl=1; expires=Thu, 01-Jan-1970 00:00:01 GMT';}
}
function dj(){var ej=$('llist');var fj=$('llswitch');ej.toggleClass('hide');fj.toggleClass('off');if(ej.hasClass('hide')){document.cookie='t3ll=1; expires=Wed, 1 Jan 2020 00:00:00 GMT';}
else{document.cookie='t3ll=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";}
