//Prüfen, ob Deutsch oder andere Sprache (Stammverzeichnis feststellen)
var rootfolder = "";
function checkRoot() {
if (isNaN(document.getElementById('german'))) {
	rootfolder = '.'; //Deutsch
} else {
	rootfolder = '..'; //andere Sprache
}
}

var divopacity = 0;

if(typeof(fadeInterval) == 'interval') {
	window.clearInterval(fadeInterval);
}

//Bild einfaden
function divFadeIn(dividtofade, actualfadingvalue, actualdelay) {
thisdiv = dividtofade;
thisvalue = actualfadingvalue;
thisdelay = actualdelay;
window.setTimeout("startFadeIn(thisdiv, thisvalue)", thisdelay);
}

//Interval neu starten
function startFadeIn(divtofadein, divfadingvalue) {
divopacity = 0;
actualdiv = divtofadein;
actualfadingvalue = divfadingvalue;
fadeInterval=window.setInterval("dofadeinstep(actualdiv, actualfadingvalue)",1);
return(true);
}

//Schrittweises Hereinfaden des DIVs
function dofadeinstep(divid, fadingvalue) {
if (divopacity >= 1) {
	document.getElementById(divid).style.opacity="1";
	document.getElementById(divid).style.filter="alpha(opacity=100)";
	window.clearInterval(fadeInterval);
} else {
	document.getElementById(divid).style.opacity=divopacity;
	document.getElementById(divid).style.filter="alpha(opacity="+divopacity*100+")";
	divopacity = divopacity+fadingvalue;
}
}


//Highlight fuer gewaehlten Menuepunkt setzen und andere Menuepunkte zuruecksetzen
function setHighlight(linkid) {
	menulength = document.getElementById('leftmenu').getElementsByTagName('li').length;
	for (i=1; i<(menulength+1); i++) {
		document.getElementById('leftmenu_link_'+i).selected='false';
		document.getElementById('leftmenu_link_'+i).style.backgroundImage='url('+rootfolder+'/img/btn_leftmenu_n.gif)';
	}
	document.getElementById(linkid).selected='true';
	document.getElementById(linkid).style.backgroundImage='url('+rootfolder+'/img/btn_leftmenu_h.gif)';
}


//linkes Menue re-initialisieren
function reInitLeftMenu() {
	menulength = document.getElementById('leftmenu').getElementsByTagName('li').length;
	for (j=1; j<(menulength+1); j++) {
		if (document.getElementById('leftmenu_link_'+j).selected != 'true') {
			document.getElementById('leftmenu_link_'+j).style.backgroundImage='url('+rootfolder+'/img/btn_leftmenu_n.gif)';
		}
		else {
			document.getElementById('leftmenu_link_'+j).style.backgroundImage='url('+rootfolder+'/img/btn_leftmenu_h.gif)';
		}
	}
}


//linkes Menue initialisieren
function initLeftMenu(menuid) {
//	document.getElementById('leftmenu_link_'+menuid).selected = 'true';
	menulength = document.getElementById('leftmenu').getElementsByTagName('li').length;
	for (j=1; j<(menulength+1); j++) {
		if (document.getElementById('leftmenu_link_'+j).selected != 'true') {
			document.getElementById('leftmenu_link_'+j).style.backgroundImage='url('+rootfolder+'/img/btn_leftmenu_n.gif)';
		}
		else {
			document.getElementById('leftmenu_link_'+j).style.backgroundImage='url('+rootfolder+'/img/btn_leftmenu_h.gif)';
		}
	}
}


//Image preloader
function preloadImages()
{
document.preload = new Array();
if(document.images)
{
	for(var i = 0; i < preloadImages.arguments.length; i++) {
			document.preload[i] = new Image();
			document.preload[i].src = preloadImages.arguments[i];
	}
}
}


//Fenster fuer Flash oeffnen
function openwindow(page, width, height) {
LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
mainwin = window.open(""+page+"","","width="+width+",height="+height+",scrollbars=yes,toolbar=no,directories=no,status=no,resize=yes,menubar=no,left="+LeftPosition+",top="+TopPosition+"");
if (mainwin.opener == null) mainwin.opener = window;
mainwin.opener.name = "opener";
}

//highlighting fuer sprachauswahl
function toggleMapHighlight(targetCountry, hlMode) {
if (hlMode == 'highlight') {
	document.getElementById('map').src='./img/europe_map/'+targetCountry+'.gif';
	document.getElementById('intro_link_'+targetCountry).style.backgroundImage='url(./img/intro_flag_'+targetCountry+'_h.png)';
	document.getElementById('intro_link_'+targetCountry).style.color='#ff7425';
} else {
	document.getElementById('map').src='./img/europe_map/europe.gif';
	document.getElementById('intro_link_'+targetCountry).style.backgroundImage='url(./img/intro_flag_'+targetCountry+'_n.png)';
	document.getElementById('intro_link_'+targetCountry).style.color='#000000';
}
}