function wechsel(bildname,bildsrc){
	if (document.images) {
	bildquelle=eval('document.' + bildname);
	bildquelle.src = bildsrc;
	}
}

function sync(zeit,gold,gold_eink,eisen2,eisen_eink2,eisen,eisen_eink,stein2,stein_eink2,stein,stein_eink,holz2,holz_eink2,holz,holz_eink,pferde,pferde_eink,essen2,essen_eink2,essen3,essen_eink3,essen,essen_eink,kohle,kohle_eink,waffen,waffen_eink,rang,runde,punkte,ehre,titel,username){
	if(parent.goben){
			if(parent.goben.nexttick){
				parent.goben.nexttick = zeit;
				parent.goben.update(gold,gold_eink,eisen2,eisen_eink2,eisen,eisen_eink,stein2,stein_eink2,stein,stein_eink,holz2,holz_eink2,holz,holz_eink,pferde,pferde_eink,essen2,essen_eink2,essen3,essen_eink3,essen,essen_eink,kohle,kohle_eink,waffen,waffen_eink,rang,runde,punkte,ehre,titel,username);
			}
	}
	var ie = (document.all) ? true : false;	
	if(!ie){
		var wert = "fixed";
	}else{
		var wert = "absolute";
	}
	if(document.getElementById('linkerrand')) document.getElementById('linkerrand').style.position = wert;
	if(document.getElementById('rechterrand')) document.getElementById('rechterrand').style.position = wert;
}
function frame(){
	var ie = (document.all) ? true : false;	
	if(!ie){
		var wert = "fixed";
	}else{
		var wert = "absolute";
	}
	if(document.getElementById('linkerrand')) document.getElementById('linkerrand').style.position = wert;
	if(document.getElementById('rechterrand')) document.getElementById('rechterrand').style.position = wert;
}
function screen(){
	var ie = (document.all) ? true : false;
	if(!ie){
		document.forms['demo'].screen.value = 1;
	}else{
		document.forms['demo'].screen.value = 0;
	}
}
function Nachrichten(i){
	if(i==1){
		c = "#ff0000";
	}else{
		c = "#3C3115";
	}
	if(parent.links){
		if(parent.links.document.getElementById("NR")){
			parent.links.document.getElementById("NR").style.color = c;
			parent.links.document.Nachrichtenlink = c;
		}
	}
}

function Forum(i){
	if(i==1){
		c = "#ff0000";
	}else{
		c = "#3C3115";
	}
	if(parent.links){
		if(parent.links.document.getElementById("FR")){
			parent.links.document.getElementById("FR").style.color = c;
			parent.links.document.Forumlink = c;
		}
	}
}

function Bonus(i){
	if(i==1){
		c = "#ff0000";
	}else{
		c = "#3C3115";
	}
	if(parent.links){
		if(parent.links.document.getElementById("BR")){
			parent.links.document.getElementById("BR").style.color = c;
			parent.links.document.Bonuslink = c;
		}
	}
}

var himmelsrichtung = new Array();

himmelsrichtung[0] = new Array();
himmelsrichtung[0]['N'] = "N";
himmelsrichtung[0]['S'] = "S";
himmelsrichtung[0]['W'] = "W";
himmelsrichtung[0]['O'] = "O";
himmelsrichtung[0]['NO'] = "NO";
himmelsrichtung[0]['SO'] = "SO";
himmelsrichtung[0]['NW'] = "NW";
himmelsrichtung[0]['SW'] = "SW";
himmelsrichtung[0]['-'] = "-";

himmelsrichtung[1] = new Array();
himmelsrichtung[1]['N'] = "N";
himmelsrichtung[1]['S'] = "S";
himmelsrichtung[1]['W'] = "W";
himmelsrichtung[1]['O'] = "E";
himmelsrichtung[1]['NO'] = "NE";
himmelsrichtung[1]['SO'] = "SE";
himmelsrichtung[1]['NW'] = "NW";
himmelsrichtung[1]['SW'] = "SW";
himmelsrichtung[1]['-'] = "-";

if(document.getElementById) {
    window.confirm = function(form,txt,title,heroe) {
        createCustomAlert(form,txt,title,heroe);
    }
}

function createCustomAlert(form,txt,strTitle,heroe) {
    // constants to define the title of the alert and button text.
    var ALERT_TITLE = strTitle;
    var ALERT_BUTTON_TEXT = "Ok";
    var ALERT_BUTTON_TEXT2 = "Cancel";

    // shortcut reference to the document object
    d = document;

    // if the modalContainer object already exists in the DOM, bail out.
    if(d.getElementById("modalContainer")) return;

    // create the modalContainer div as a child of the BODY element
    mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
    mObj.id = "modalContainer";
     // make sure its as tall as it needs to be to overlay all the content on the page
    mObj.style.height = document.documentElement.scrollHeight + "px";

    // create the DIV that will be the alert 
    alertObj = mObj.appendChild(d.createElement("div"));
    alertObj.id = "alertBox";
    // MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
	var scrollPos;
	if (typeof window.pageYOffset != 'undefined') {
	   scrollPos = window.pageYOffset;
	}
	else if (typeof document.compatMode != 'undefined' &&
		 document.compatMode != 'BackCompat') {
	   scrollPos = document.documentElement.scrollTop;
	}
	else if (typeof document.body != 'undefined') {
	   scrollPos = document.body.scrollTop;
	}   
	if(d.all && !window.opera) alertObj.style.top = scrollPos + "px";
    // center the alert box
    alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 - 50 + "px";

    // create an H1 element as the title bar
    h1 = alertObj.appendChild(d.createElement("h1"));
    h1.id = "h1Alert";
    h1.appendChild(d.createTextNode(ALERT_TITLE));

    // create a paragraph element to contain the txt argument
    msg = alertObj.appendChild(d.createElement("p"));
    msg.appendChild(d.createTextNode(txt));

    // create an anchor element to use as the confirmation button. - OK
    btn = alertObj.appendChild(d.createElement("a"));
    btn.id = "okBtn";
    btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
    btn.href = "#";
	if(heroe==1){
		btn.onclick = function() { removeCustomAlert();opener.location.href=form; window.close(); return true;}
	}else if(typeof(form)=='string'){
		btn.onclick = function() { removeCustomAlert();d.location.href=form; return true;}
	}else{
		btn.onclick = function() { removeCustomAlert();form.submit(); return true;}
	}
    // create an anchor element to use as the confirmation button. - Cancel
    btn2 = alertObj.appendChild(d.createElement("a"));
    btn2.id = "closeBtn";
    btn2.appendChild(d.createTextNode(ALERT_BUTTON_TEXT2));
    btn2.href = "#";
    btn2.onclick = function() { removeCustomAlert();return false; }
}

// removes the custom alert from the DOM
function removeCustomAlert() {
    document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}  
