function getOffset(node)
{
	if(node.nodeName == "BODY")
		return [0,-18];
	var pos = getOffset(node.parentNode)
	return [node.offsetLeft + pos[0],node.offsetTop + pos[1]];
}

var thirdMenuTimer = null;
function removeThirdMenuTimer(){
	if( thirdMenuTimer != null)
		window.clearTimeout(thirdMenuTimer); 
}
function showThirdMenu(obj,data){
	removeThirdMenuTimer();
	
	var o 		= document.getElementById("thirdMenu");			
	var pos	 	= getOffset(obj)
	var html 	= "";
	var item;
	var divName;

	for ( var k in data.items)
	{
		if(isNaN(k))
			continue;
		
		divName = 'dddd'+ k;
		item = data.items[k];
		html += '<tr>'
			+ '<td style="background-color:#ffffff; height:20px; cursor:pointer; " '
			+ ' onmouseover="this.style.backgroundColor=\''+data.colorOver+'\';document.getElementById(\''+divName+'\').style.color=\'#000000\'"' 
			+ ' onmouseout="this.style.backgroundColor=\'#FFFFFF\';document.getElementById(\''+divName+'\').style.color=\'#828284\'"' 
			+ ' onclick="location.href=\'' +data.url+'/'+ item[0] + '\'"><div id="'+ divName +'" style="padding-left:9px; color:#828284; padding-right:9px; padding-top:3px;padding-bottom:4px">'
			+ item[1]
			+ '</div></td>'
			+ '</tr>'
			+ '<tr><td style="height:1px"></td></tr>';
	}
	html = '<table style="margin-right:1px;	margin-top: 1px;">'+html+'</table>'		
	
	o.innerHTML = html;
	o.style.display = "";
	o.style.left 	= (obj.offsetWidth 	+ pos[0]+1) + "px";
	o.style.top 	= (pos[1]-208) + "px";		
}
function hideThirdMenu(){
	removeThirdMenuTimer();
	thirdMenuTimer = window.setTimeout(function(){
		var o = document.getElementById("thirdMenu");
		o.style.display = "none";
	}, 200)
}

function swapObjectsByIDs(show,hide){
	document.getElementById(show).style.display = "";
	document.getElementById(hide).style.display = "none";
}


window.onload = function(){
	
	var flashVersion = deconcept.SWFObjectUtil.getPlayerVersion();
	if(flashVersion.major >= 9){
		document.getElementById("bannerSlogan").style.display = "none";
		so = new SWFObject("/Flash/banner.swf","flash","581","144");
		so.write("flashBanner");
	}else{
		var miliSecAniSwitch = 3000;
		
		var switchImageRandom = function(){
			var currentImage = parseInt(Math.random()*headImages.length-1);
			blendimage('blenddiv','blendimage', headImages[currentImage],miliSecAniSwitch);
			return;
		
		};
		switchImageRandom();
		
		var imageSwitchTimerID =  window.setInterval(switchImageRandom,miliSecAniSwitch);
	}

}

function getGlobalCoord(e)
{
	var e;
	if (!e)	{
		window.MouseX = top.event.clientX + document.body.scrollLeft;
		window.MouseY = top.event.clientY + document.body.scrollTop;	
	} else {
		window.MouseX = e.pageX;
		window.MouseY = e.pageY;	
	}
	return ;
}

document.onmousemove 	= getGlobalCoord;

function showInfoText(id)
{
	var InfoContent = document.getElementById("InfoContent");
	var InfoTag = document.getElementById("InfoTag");
	
	if(id==2){
		 document.getElementById("infoInformationenAnfordern").style.display = "";
		 document.getElementById("infoDatenblattAnfordern").style.display = "none";
		 
	}else{
		 document.getElementById("infoInformationenAnfordern").style.display = "none";
		 document.getElementById("infoDatenblattAnfordern").style.display = "";
	}
	
	//InfoContent.innerHTML = "Loading...";
	
	if ( ( window.MouseX +200 ) < top.document.documentElement.offsetWidth)
		InfoTag.style.left 	= (window.MouseX +10) + "px";
	else
		InfoTag.style.left 	= (window.MouseX-150) + "px";
		
	InfoTag.style.top 	= (window.MouseY + 20) + "px";
	
	//loadDynamic('InfoContent', {action:'ABCD', abcID: id});
	
	return; 
}

function hideInfoText()
{
	var InfoContent = document.getElementById("InfoContent");
	var InfoTag = document.getElementById("InfoTag");
	
	InfoTag.style.left 	= "-1000px";
	InfoTag.style.top 	== "-1000px";
	
	//InfoContent.innerHTML = "";
	
	return; 
}
