window.onload=initAll;
window.onresize=resetLayoutOnResize;

function submitit(mode,val) {
	if ((mode) && (val)) {
		if (mode==2) {
			// submition nur mit den übergebenen variablen
			document.location="index.php?"+val;
		} else if (mode==3) {
			document.location="index.php?&consume=1&"+val;
		} else {
			// submition mit allen anderen Variablen
			var myvars=val.split('&');
			for (var i=0; i<myvars.length; i++) {
				var myvars1=myvars[i].split('=');
				document.getElementById('additionalinputs').innerHTML+= "<input type='hidden' name='" + myvars1[0] + "' value='"+myvars1[1]+"'/>";
			}
			document.myform.submit();
		}
		return true;
	}
}

function zeigen(id) {
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('menu'+i)) {document.getElementById('menu'+i).style.display='none';}
	}
	if (d) {d.style.display='block'; }
	
}

function initAll() {

	var allLinks=document.getElementsByTagName("a");
	for (var i=0; i<allLinks.length; i++) {

		// Behandlung der More-Links bei Klicken nichts tun, bei Maus over toggleMenu aufrufen
		if (allLinks[i].className.indexOf('morelink')>-1) {
			allLinks[i].onclick=showMore;
		}
		
	}
	zeigen('');
	resetLayoutOnResize();
	rotate();	
}	


function resetLayoutOnResize() {
	var currWindowWidth=document.body.clientWidth;
	if (document.getElementById('processcontent')) {
		if (currWindowWidth-190-20<20) {
			document.getElementById('processcontent').style.width=parseInt(20)+"px";
		} else {
			document.getElementById('processcontent').style.width=parseInt(currWindowWidth)+"px";
		}
	}

	if (document.getElementById('headerapplicationlanguages')) {
		if (currWindowWidth-590-20<20) {
			document.getElementById('headerapplicationlanguages').style.width=parseInt(20)+"px";
		} else {
			document.getElementById('headerapplicationlanguages').style.width=parseInt(currWindowWidth-600)+"px";
		}
	}
	
	if (document.getElementById('logininfo2')) {
		if (currWindowWidth-590-20<20) {
			document.getElementById('logininfo2').style.width=parseInt(20)+"px";
		} else {
			document.getElementById('logininfo2').style.width=parseInt(currWindowWidth-590-20)+"px";
		}
	}

}

function showMore() {
	var startMenu=this.href.lastIndexOf("#")+1;
	var thisMenuName='more'+this.href.substring(startMenu,startMenu+1);

	if (document.getElementById(thisMenuName).style.display=="block") {
		document.getElementById(thisMenuName).style.display="none";
	} else {
		document.getElementById(thisMenuName).style.display="block";
	};
	return false;
}



var newwindow;
function popit(url,name,options) {
	newwindow=window.open(url,name,options);
	if (window.focus) {newwindow.focus();}
}

var adImages=new Array('graphics/Fotolia_3406263_XS.jpg','graphics/Fotolia_2911086_XS.jpg','graphics/Fotolia_5430702_XS.jpg','graphics/Fotolia_1291522_XS.jpg');
var thisAd=-1;

function rotate() {
	thisAd++;
	if (thisAd==adImages.length) {
		thisAd=0;
	}
	if (document.getElementById('adBanner')) {
		document.getElementById('adBanner').src=adImages[thisAd];
		setTimeout('rotate()',21*1000);
	}
}
