/**
 * Functions added an modiefied by
 * Stefanie Zeiger <s.zeiger@trio-group.de>
 * with friendly support of
 * Dominik Hertel <dhertel@gmail.com>
 */

function minit(){

if (navigator.appName == "Microsoft Internet Explorer") {
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	if ( version == 6 || version == 5.5 ) {
		document.getElementById('header').style.backgroundImage = 'none';
		document.getElementById('projectHeader').style.backgroundImage = 'url(images/frame/header_ie6.gif)';
		document.getElementById('content').style.backgroundImage = 'url(images/frame/frame_ie6.gif)';
		document.getElementById('footer').getElementsByTagName('img')[0].src = 'images/frame/footer_ie6.gif';
	}
}
	
box = document.getElementById('infoBox');
box.style.position = 'absolute';
box.style.display = 'none';

startSizeW = 120; // starting icon size
endSizeW = 120; // ending icon size
		
startSizeH = 1; // starting icon size
endSizeH = 30; // ending icon size

xoff = 20;
yoff = -20;

animElements = box;

cursorElements = document.getElementById('headImage').getElementsByTagName('a');

animElements.style.display = '';
animElements.style.width = startSizeW+'px';
animElements.style.height = startSizeH+'px';
}

function gocont(text,x,y){
xpos = x-150;
ypos = y;
box.innerHTML = '<span> ' + text + ' </span>';
box.style.left = xpos + "px";
box.style.top = ypos + "px";
changeSize(xpos,ypos);
}

function init( text, link ) {
	cursorElements[link].onmouseover = changeSize;
	cursorElements[link].onmouseout = restoreSize; 
}

function changeSize(x,y) {
	//if (!animElements[0].currentWidth)
	animElements.currentWidth = startSizeW;
	//if (!animElements[0].currentHeight)
	animElements.currentHeight = startSizeH;
	animElements.style.display = '';
	resizeAnimation(animElements,animElements.currentWidth,endSizeW,animElements.currentHeight,endSizeH,45,20,0.333,x,y);
}

function restoreSize(x,y) {
	if (!animElements.currentWidth) return;
	if (!animElements.currentHeight) return;
	resizeAnimation(animElements,animElements.currentWidth,startSizeW,animElements.currentHeight,startSizeH,45,20,0.5,x,y);
}
	
function resizeAnimation(elem,startWidth,endWidth,startHeight,endHeight,steps,intervals,powr,x,y) {
	if (elem.widthChangeMemInt) window.clearInterval(elem.widthChangeMemInt);
	var actStep = 0;
	elem.widthChangeMemInt = window.setInterval(
		function() {
			elem.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
			elem.style.width = elem.currentWidth+"px";
			actStep++;
			if (actStep > steps) window.clearInterval(elem.widthChangeMemInt);
		}
		,intervals)
	if (elem.heightChangeMemInt) window.clearInterval(elem.heightChangeMemInt);
	elem.heightChangeMemInt = window.setInterval(
		function() {
			elem.currentHeight = easeInOut(startHeight,endHeight,steps,actStep,powr);
			elem.style.height = elem.currentHeight + "px";
			if ( elem.style.height == "1px" ) {
				elem.style.display = "none";
			}
			//topnow = box.style.top;
			heightnow = elem.style.height;
			//topnum = topnow.substring(0,topnow.indexOf('p'));
			heightnum = heightnow.substring(0,heightnow.indexOf('p'));
			//alert(y + " - "+ heightnum +" = "+ eval(y - heightnum));
			box.style.top = eval(y - heightnum)+"px";//alert(box.style.top);
			actStep++;
			if (actStep > steps) {
				window.clearInterval(elem.heightChangeMemInt);
			}
		}	
		,intervals)
}

function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) {
//Generic Animation Step Value Generator By www.hesido.com
	var delta = maxValue - minValue;
	var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
	return Math.ceil(stepp)	
}
