/* PRELOAD IMAGES */
var imgArray = new Array();
var imgCounter = 0;

function preload(src){
	imgCounter++;
	var img = new Image();
	img.src = src;
	imgArray[imgCounter] = img;
}

function preloadImages() {
	preload('/bilder/home1.jpg');	
	preload('/bilder/home2.jpg');
	preload('/bilder/leistung1.jpg');
	preload('/bilder/leistung2.jpg');
	preload('/bilder/profil1.jpg');
	preload('/bilder/profil2.jpg');
	preload('/bilder/projektschau1.jpg');	
	preload('/bilder/projektschau2.jpg');
		
	preload('/bilder/verlauf.jpg');
	preload('/bilder/schatten.gif');
	preload('/bilder/mainmenue0.gif');
	preload('/bilder/mainmenue1.gif');	
}


/* Highlight Active Menue */
var home ='00';
var kontakt ='02';
var impressum ='04';
var feuermelder ='01';
var partner ='03';
var profil = '10';
var vita = '11';
var qualifikation = '12';
var referenzen = '13';
var leistungen = '20';
var informationsarchitektur = '21';
var interfacedesign = '22';
var frontendengineering = '23';
var projektschau = '30';
var p1 = '31';
var p2 = '32';
var p3 = '33';
var p4 = '34';
var p5 = '35';
var p6 = '36';
var p7 = '37';

function HighLight(item) {
	expression = /(.)(.)/;
	var id = item.match(expression);
		if (id[1] == '1') { 
			document.getElementById('bereich').style.background='#EC2A2E url(/bilder/profil1.jpg) top right no-repeat'; 
			document.getElementById('subcontent').style.background='#EEF5EE url(/bilder/profil2.jpg) top no-repeat';
		} else if (id[1] == '2') { 
			document.getElementById('bereich').style.background='#EC2A2E url(/bilder/leistung1.jpg) top right no-repeat';
			document.getElementById('subcontent').style.background='#EEF5EE url(/bilder/leistung2.jpg) top no-repeat';
		} else if (id[1] == '3') { 
			document.getElementById('bereich').style.background='#EC2A2E url(/bilder/projektschau1.jpg) top right no-repeat';
			document.getElementById('subcontent').style.background='#EEF5EE url(/bilder/projektschau2.jpg) top no-repeat';
		} else {
			document.getElementById('bereich').style.background='#EC2A2E url(/bilder/home1.jpg) top right no-repeat';
			document.getElementById('subcontent').style.background='#EEF5EE url(/bilder/home2.jpg) top no-repeat';
		}
		if (id[1] > 0) {
			document.getElementById("um"+id[1]+'0').style.display='block';
			document.getElementById("m"+id[1]+'0').style.background='white url(/bilder/mainmenue1.gif) bottom';
		}		
		if (id[2] > 0) {
			if (id[1] == 0) {
				document.getElementById("m"+id[0]).style.color='#EC2A2E';
			} else {
				document.getElementById("m"+id[0]).style.background='#EC2A2E url(/bilder/verlauf.gif) top left repeat-y';
			}
		}
}


/* GET WINDOW (BODY) HEIGHT */
function getWindowHeight() {
	var windowHeight=0;
	if (self.innerHeight != null) {
		windowHeight=parent.self.innerHeight; // all except Explorer
	} else if (parent.document.documentElement && parent.document.documentElement.clientHeight) {
		windowHeight=parent.document.documentElement.clientHeight; // Explorer 6 Strict Mode
	} else if (parent.document.body && parent.document.body.clientHeight) {
		windowHeight=parent.document.body.clientHeight; // other Explorer
	}
	return windowHeight;	
}
/* GET WINDOW (BODY) WIDTH */
function getWindowWidth() {
	var windowWidth=0;
	if (self.innerWidth != null) {
		windowWidth=parent.self.innerWidth; // all except Explorer
	} else if (parent.document.documentElement && parent.document.documentElement.clientWidth) {
		windowWidth=parent.document.documentElement.clientWidth; // Explorer 6 Strict Mode
	} else if (parent.document.body && parent.document.body.clientWidth) {
		windowWidth=parent.document.body.clientWidth; // other Explorer
	}
	return windowWidth;
}

/* RESIZE CONTENT TO BODY HEIGHT & WIDTH */
function contentHW() {
	var windowHeight=getWindowHeight();
	var windowWidth=getWindowWidth();
	parent.document.getElementById("content").style.height=(windowHeight-170)+"px"; /* content ["position-top"+"position-bottom"+"padding-bottom"+"padding-top"]*/
	parent.document.getElementById("subcontent").style.height=(windowHeight-91)+"px";
	parent.document.getElementById("nav").style.height=(windowHeight-60)+"px";
	parent.document.getElementById("content").style.width=(windowWidth-440)+"px"; /* */
	parent.document.getElementById("footer").style.width=(windowWidth-440)+"px";
	parent.document.getElementById("bereich").style.width=(windowWidth-440)+"px";
}
function contentHW_H() {
	var windowHeight=getWindowHeight();
	var windowWidth=getWindowWidth();
	if ( windowHeight > 500 ) {
		parent.document.getElementById("content").style.height=(windowHeight-381)+"px"; /* content ["position-top"+"position-bottom"+"padding-bottom"+"padding-top"]*/
		parent.document.getElementById("subcontent").style.height=(windowHeight-321)+"px";
		parent.document.getElementById("nav").style.height=(windowHeight-60)+"px";
		parent.document.getElementById("content").style.width=(windowWidth-440)+"px"; /* */
		parent.document.getElementById("footer").style.width=(windowWidth-440)+"px";
		parent.document.getElementById("bereich").style.width=(windowWidth-440)+"px";
		parent.document.getElementById("bereich").style.top="320px";
		parent.document.getElementById("content").style.top="380px";
		parent.document.getElementById("subcontent").style.top="320px";
	} else {
		parent.document.getElementById("content").style.height=(windowHeight-151)+"px"; /* content ["position-top"+"position-bottom"+"padding-bottom"+"padding-top"]*/
		parent.document.getElementById("subcontent").style.height=(windowHeight-91)+"px";
		parent.document.getElementById("nav").style.height=(windowHeight-60)+"px";
		parent.document.getElementById("content").style.width=(windowWidth-440)+"px"; /* */
		parent.document.getElementById("footer").style.width=(windowWidth-440)+"px";
		parent.document.getElementById("bereich").style.width=(windowWidth-440)+"px";
		parent.document.getElementById("bereich").style.top="90px";
		parent.document.getElementById("content").style.top="150px";
		parent.document.getElementById("subcontent").style.top="90px";
	}
}

/* Container aufklappen */
function container(id, zustand) {
	if (zustand == 1) {
		document.getElementById('cont'+id).style.display='block';
	} else if (zustand == 0) {
		document.getElementById('cont'+id).style.display='none';
	}
}


/*Highlight Button*/
function button(Boton,state){
   var nav = (document.layers) ? true : false
   if (!nav && Boton && state==1) Boton.className = 'button_h';
   if (!nav && Boton && state==0) Boton.className = 'button';
   if (!nav && Boton && state==2) Boton.className = 'button_c'
}


/* Stylesheet wechsel */
function changeCSS(myDo) { 
	//alert ('Diese Funktion ist noch nicht implementiert. Bitte demnächst nochmal probieren.');
	{
	if (!document.styleSheets) return;
	var theRules = new Array();
	if (document.styleSheets[1].cssRules)
		theRules = document.styleSheets[1].cssRules
	else if (document.styleSheets[1].rules)
		theRules = document.styleSheets[0].rules
	else return;
	//alert(parseFloat(theRules[theRules.length-1].style.fontSize));
	if (myDo == 'inc') myWert=parseFloat(theRules[theRules.length-1].style.fontSize)+2+"px"
	else if (myDo == 'dec') myWert=parseFloat(theRules[theRules.length-1].style.fontSize)-2+"px";
	theRules[theRules.length-1].style.fontSize = myWert;	
	}
}