document.write('<div onmouseover="menuOut(1,1)" onmouseout="menuOut(1,0)" id="menu1" class="navimenu" style="width: 150px; margin-left: -1px; margin-top: 3px;">');
document.write('<table id="metallnavi2">');
for(i=0;i<menu1_link.length;i++ )
{
document.write('<tr><td>'+menu1_link[i]+'</td></tr>');
}
document.write('</table></div>');



document.write('<div onmouseover="menuOut(2,1)" onmouseout="menuOut(2,0)" id="menu2" class="navimenu" style="width: 150px; margin-left: -1px; margin-top: 3px;">');
document.write('<table id="metallnavi2">');
for(i=0;i<menu2_link.length;i++ )
{
document.write('<tr><td>'+menu2_link[i]+'</td></tr>');
}
document.write('</table></div>');



document.write('<div onmouseover="menuOut(3,1)" onmouseout="menuOut(3,0)" id="menu3" class="navimenu" style="width: 150px; margin-left: -1px; margin-top: 3px;">');
document.write('<table id="metallnavi2">');
for(i=0;i<menu3_link.length;i++ )
{
document.write('<tr><td>'+menu3_link[i]+'</td></tr>');
}
document.write('</table></div>');



document.write('<div onmouseover="menuOut(4,1)" onmouseout="menuOut(4,0)" id="menu4" class="navimenu" style="width: 150px; margin-left: -1px; margin-top: 3px;">');
document.write('<table id="metallnavi2">');
for(i=0;i<menu4_link.length;i++ )
{
document.write('<tr><td>'+menu4_link[i]+'</td></tr>');
}
document.write('</table></div>');






var menuArray;
var activeMenu=1;
var oldWidth=window.innerWidth;
var oldHeight=window.innerHeight;
var trigger_init=0;

function init(){

	var i,menuLabel,h;
	menuArray=new Array();
	
		
	for(i=1;i<=4;++i){
		menuLabel=document.getElementById('menuLabel'+i); 

		menuArray[i]=document.getElementById('menu'+i);
		menuArray[i].menuIn=0;

		menuArray[i].menuLabel=menuLabel;
		menuArray[i].menuLabel.labelIn=0;

	}
	
	pos();

	
	if(navigator.userAgent.toLowerCase().indexOf('opera')!=-1){
		ResizeEvent();
	}
	else{
	window.onresize = pos;
	}
   
	trigger_init=1;
}

setTimeout("init()",1);



function ResizeEvent(){

	if(oldWidth!=window.innerWidth || oldHeight!=window.innerHeight){
		setTimeout("pos()",100);
		//location.replace(location.href);
		oldWidth=window.innerWidth;
		oldHeight=window.innerHeight;
	}
	setTimeout("ResizeEvent()",250);
}



function pos(){

	var kt=-5;
	var kl=0;

	if(navigator.userAgent.toLowerCase().indexOf('opera')!=-1){
		kt=kt-4;
		kl=kl-1;
	}

	if(menuArray[1].menuLabel.offsetParent.tagName != 'BODY'){

		kt=kt+4;
		kl=kl+1;

		parenttag1 = menuArray[1].menuLabel.offsetParent;
		parenttag2 = menuArray[2].menuLabel.offsetParent;

		hoehe1 = menuArray[1].menuLabel.offsetTop;
		hoehe2 = menuArray[2].menuLabel.offsetTop;

		do {
	
   			hoehe1=hoehe1+parenttag1.offsetTop;
        		parenttag1=parenttag1.offsetParent;
   		}
		while(parenttag1.tagName != 'BODY');
   	
   		do {
		
	 	  	hoehe2=hoehe2+parenttag2.offsetTop;
	 	       	parenttag2=parenttag2.offsetParent;
   		}
		while(parenttag2.tagName != 'BODY');

 
 	
		if(hoehe1<hoehe2){
			h=hoehe1+menuArray[1].menuLabel.offsetHeight+kt;
		}
		else{
			h=hoehe2+menuArray[2].menuLabel.offsetHeight+kt;
		}
	
		for(i=1;i<=4;++i){
		
			off_left=menuArray[i].menuLabel.offsetLeft
			parenttag=menuArray[i].menuLabel.offsetParent;

   				do {
		
	   				off_left=off_left+parenttag.offsetLeft;
	        			parenttag=parenttag.offsetParent;
   				}
				while(parenttag.tagName != 'BODY');
   		
   			menuArray[i].menuLabel.off_left=off_left;

			with (menuArray[i]){
				style.left=menuLabel.off_left+kl;
				style.top=h;
			}
		}
 	}
 
  	else{

 		kt=kt+0;

		if(menuArray[1].menuLabel.offsetTop<menuArray[2].menuLabel.offsetTop){
			h=menuArray[1].menuLabel.offsetTop+menuArray[1].menuLabel.offsetHeight+kt;
		}
		else{
			h=menuArray[2].menuLabel.offsetTop+menuArray[2].menuLabel.offsetHeight+kt;
		}
	
		for(i=1;i<=4;++i){
			with (menuArray[i]){
				style.left=menuLabel.offsetLeft+kl;
				style.top=h;
			}
		}
	}
	
	
	pos_ip(h);
}



function pos_ip(h){
	var h=h;
	var k=0;
  	var bw=document.body.offsetWidth/2-395;
  	if(bw<10){bw=10}


 	if(document.getElementById('sky1')){

  		var sky1=document.getElementById('sky1');
  		var applets=document.getElementById('applets');
		var appletsSky=document.getElementById('appletsSky');

		if(applets.offsetParent.tagName != 'BODY'){
			appletsParent = applets.offsetParent;
			appletsTop = applets.offsetTop;
			appletsLeft = applets.offsetLeft;

			do {
   				appletsTop=appletsTop+appletsParent.offsetTop;
   				appletsLeft=appletsLeft+appletsParent.offsetLeft;
        			appletsParent=appletsParent.offsetParent;
   			}
			while(appletsParent.tagName != 'BODY');
		}
		else{
			appletsTop = applets.offsetTop;
			appletsLeft = applets.offsetLeft;
		}

  		appletsDisable();
		//if(ip_widesky=='true'){
		if(ip_widesky){
  			sky1.style.left=appletsLeft+5;
		}
		else{
  			sky1.style.left=appletsLeft+22;
		}
   		sky1.style.top=appletsTop+9;
		sky1.style.visibility="visible";

		appletsSky.style.top=appletsTop+sky1.offsetHeight+20;
		//appletsSky.style.top=appletsTop+800;
		appletsSky.style.left=appletsLeft;
		appletsSky.style.visibility="visible";
  	}


	if(document.getElementById('ad1')){
	if(ip_PosLinks){ip_PosLinks1=ip_PosLinks}
		var ad=document.getElementById('ad1');
		ad.style.left=bw+ip_PosLinks1;
  		ad.style.visibility="visible";
 	}

	if(document.getElementById('ad2')){
		var ad=document.getElementById('ad2');
		ad.style.left=bw+ip_PosLinks2;
  		ad.style.visibility="visible";
 	}

	if(document.getElementById('ad3')){
		var ad=document.getElementById('ad3');
		ad.style.left=bw+ip_PosLinks3;
  		ad.style.visibility="visible";
 	}

	if(document.getElementById('ad4')){
		var ad=document.getElementById('ad4');
		ad.style.left=bw+ip_PosLinks4;
  		ad.style.visibility="visible";
 	}

	if(document.getElementById('ad5')){
		var ad=document.getElementById('ad5');
		ad.style.left=bw+ip_PosLinks5;
  		ad.style.visibility="visible";
 	}

}


function menuShow(n){
	if(trigger_init==1){
		menuArray[activeMenu].style.visibility="hidden";
		menuArray[n].style.visibility="visible";
		menuArray[n].menuLabel.labelIn=1;
		activeMenu=n;
	}
}




function menuHide(){

	for(i=1;i<=4;++i){

		if(menuArray[i].menuLabel.labelIn==0 && menuArray[i].menuIn==0){
			menuArray[i].style.visibility="hidden";
		}
	}
}




function labelOut(n) {
	if(trigger_init==1){
		menuArray[n].menuLabel.labelIn=0;
		aktiv=window.setTimeout("menuHide()",150);
	}
}


function menuOut(n,s) {

	if(s==0){
		menuArray[n].menuIn=0;
		aktiv=window.setTimeout("menuHide()",150);
	}

	if(s==1){
		menuArray[n].menuIn=1;
		window.clearTimeout(aktiv);
	}
}

