var nc=false, ie=false, w3c=false, opera=false, ns6=false;
if((document.all) && (navigator.userAgent.toLowerCase().indexOf('msie')!=-1) ){
	nc=false;
	w3c=false;
	ie=true;
	opera=false;
}else if( (document.getElementById) && (!document.all) ) {
	nc=false;
	w3c=true;
	ie=false;
	opera=false;
}else if( (document.layers) || (navigator.userAgent.toLowerCase().indexOf('mozilla')!=-1) ) {
	nc=true;
	w3c=false;
	ie=false;
	opera=false;
}

if(navigator.userAgent.toLowerCase().indexOf('opera')!=-1){
	nc=false;
	w3c=true;
	var ie=false;
	opera=true;
}

if(navigator.userAgent.toLowerCase().indexOf('netscape6')!=-1){
	ns6=true;
}

// alert(navigator.userAgent.toLowerCase());
// alert("nc="+nc+"\n ie="+ie+"\n w3c="+w3c+"\n opera="+opera+"\n ns6="+ns6+"");
// var sid="";

var id,mid,posSet,Ypos,Lsize,Ltop;
var layerypos  = 28;
if(nc) layerypos=layerypos+5; // old Netscapes FIX
var layerwidth = 125;
var tolgreen = '#004938';
var tolred = '#990000';

if(ns6){ // Netscape 6 FIX for the onMouseOver Effect
	document.write('<style type="text/css"> .dropdownlink { font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #ffffff; font-weight: normal; text-decoration: none; display: block; line-height: 18px; padding-left: 5px; width: 120px} </style>');
}

var menues = new Array();
for (var n=0; n < 6; n++) {
  menues[n] = new Array();
}

var prefs = new Array();
prefs[0]="";


// Navigation
function init(){
	if((nc) || (w3c)){
		window.captureEvents(Event.MOUSEMOVE);
		window.onmousemove=moveHandler;
	}
	document.onmousemove = moveHandler;
}

function moveHandler(e){
	if(ie){
		Ypos = window.event.clientY;
		Xpos = window.event.clientX;
	}else if(nc){
		Ypos = e.pageY;
		Xpos = e.pageX;
	}else{
		Ypos = e.clientY;
		Xpos = e.clientX;
	}
	if((Ypos > Lsize) || (Ypos < Ltop)){
		navUp();
	}
	if((Xpos < posSet) || (Xpos > (posSet+layerwidth))){
		navUp();
	}
}

function navDown(id,pos) {
	if(prefs[0] != "") navUp();
	if(nc){
		posSet = pos;
		Lsize = document.layers[id].top + document.layers[id].clip.height;
		Ltop = document.layers[id].top - 18; // headimg height
		document.layers[id].left = posSet;
		document.layers[id].visibility = "show";
	}else if(w3c){
		posSet = pos; // Gives some space from left
		Lsize = parseInt(document.getElementById(id).style.top) + document.getElementById(id).offsetHeight;
		if(opera) { // OPERA FIX
			fixedElement = document.getElementById(id);
			Lsize = fixedElement.style.pixelHeight + parseInt(document.getElementById(id).style.top);
			posSet = pos +3;
		}
		if(!Lsize) Lsize=200;		
		Ltop = parseInt(document.getElementById(id).style.top) - 18; // headimg height
		document.getElementById(id).style.left = posSet;
		document.getElementById(id).style.visibility = "visible";
	}else if(ie){
		posSet =  pos;
		Lsize = document.all[id].style.posTop + document.all[id].offsetHeight;
		Ltop = document.all[id].style.posTop - 18; // headimg height
		document.all[id].style.left = posSet;
		document.all[id].style.visibility = "visible";
	}
	prefs[0] = id;
	window.setTimeout("navUp()",30000);
	return false;
}

function navUp(){
	if(nc){
		document.layers[prefs[0]].visibility = "hide";
	}else if(w3c){
		document.getElementById(prefs[0]).style.visibility = "hidden";
	}else if(ie){
		document.all[prefs[0]].style.visibility = "hidden";
	}
}

// TIROL
menues[0][0] = new Array();
menues[0][0]["name"] = "ÜBERSICHT";
menues[0][0]["href"] = "http://tirol.com/index.html";
menues[0][1] = new Array();
menues[0][1]["name"] = "Innsbruck";
menues[0][1]["href"] = "http://tirol.com/innsbruck/index.html";
menues[0][2] = new Array();
menues[0][2]["name"] = "Oberland";
menues[0][2]["href"] = "http://tirol.com/oberland/index.html";
menues[0][3] = new Array();
menues[0][3]["name"] = "Unterland";
menues[0][3]["href"] = "http://tirol.com/unterland/index.html";
menues[0][4] = new Array();
menues[0][4]["name"] = "Osttirol";
menues[0][4]["href"] = "http://tirol.com/osttirol/index.html";
menues[0][5] = new Array();
menues[0][5]["name"] = "Südtirol";
menues[0][5]["href"] = "http://tirol.com/suedtirol/index.html";
menues[0][6] = new Array();
menues[0][6]["name"] = "Leserbriefe";
menues[0][6]["href"] = "http://tirol.com/leserbriefe/index.html";

// NEWS
menues[1][0] = new Array();
menues[1][0]["name"] = "ÜBERSICHT";
menues[1][0]["href"] = "http://news.tirol.com/index.html";
menues[1][1] = new Array();
menues[1][1]["name"] = "Politik";
menues[1][1]["href"] = "http://news.tirol.com/politik/regional/index.html";
menues[1][2] = new Array();
menues[1][2]["name"] = "Wirtschaft";
menues[1][2]["href"] = "http://news.tirol.com/wirtschaft/regional/index.html";
menues[1][3] = new Array();
menues[1][3]["name"] = "Chronik";
menues[1][3]["href"] = "http://news.tirol.com/chronik/national/index.html";
menues[1][4] = new Array();
menues[1][4]["name"] = "Kultur";
menues[1][4]["href"] = "http://news.tirol.com/kultur/index.html";
menues[1][5] = new Array();
menues[1][5]["name"] = "Kommentare";
menues[1][5]["href"] = "http://news.tirol.com/kommentare/index.html";

// SPORT
menues[2][0] = new Array();
menues[2][0]["name"] = "ÜBERSICHT";
menues[2][0]["href"] = "http://sport.tirol.com/index.html";
menues[2][1] = new Array();
menues[2][1]["name"] = "Fußball";
menues[2][1]["href"] = "http://sport.tirol.com/fussball/regional/index.html";
menues[2][2] = new Array();
menues[2][2]["name"] = "Motor";
menues[2][2]["href"] = "http://sport.tirol.com/motor/index.html";
menues[2][3] = new Array();
menues[2][3]["name"] = "Rad";
menues[2][3]["href"] = "http://sport.tirol.com/rad/index.html";
menues[2][4] = new Array();
menues[2][4]["name"] = "Tennis";
menues[2][4]["href"] = "http://sport.tirol.com/tennis/index.html";
menues[2][5] = new Array();
menues[2][5]["name"] = "Sportmix";
menues[2][5]["href"] = "http://sport.tirol.com/sportmix/index.html";
menues[2][6] = new Array();
menues[2][6]["name"] = "Lauftreff";
menues[2][6]["href"] = "http://sport.tirol.com/lauftreff/index.html";

// JOURNAL
menues[3][0] = new Array();
menues[3][0]["name"] = "ÜBERSICHT";
menues[3][0]["href"] = "http://journal.tirol.com/index.html";
menues[3][1] = new Array();
menues[3][1]["name"] = "Computer";
menues[3][1]["href"] = "http://journal.tirol.com/computer/index.html";
menues[3][2] = new Array();
menues[3][2]["name"] = "Seitenblicke";
menues[3][2]["href"] = "http://journal.tirol.com/seitenblicke/event/index.html";
menues[3][3] = new Array();
menues[3][3]["name"] = "Magazin";
menues[3][3]["href"] = "http://journal.tirol.com/magazin/portraits/index.html";
menues[3][4] = new Array();
menues[3][4]["name"] = "Stargeflüster";
menues[3][4]["href"] = "http://journal.tirol.com/stargefluester/index.html";
menues[3][5] = new Array();
menues[3][5]["name"] = "Szene";
menues[3][5]["href"] = "http://journal.tirol.com/szene/index.html";

// FREIZEIT
menues[4][0] = new Array();
menues[4][0]["name"] = "ÜBERSICHT";
menues[4][0]["href"] = "http://freizeit.tirol.com/index.html";
menues[4][1] = new Array();
menues[4][1]["name"] = "Veranstaltungen";
menues[4][1]["href"] = "http://freizeit.tirol.com/veranstaltungen/index.html";
menues[4][2] = new Array();
menues[4][2]["name"] = "Chat";
menues[4][2]["href"] = "http://freizeit.tirol.com/chat/index.html";
menues[4][3] = new Array();
menues[4][3]["name"] = "Auto/Motor";
menues[4][3]["href"] = "http://freizeit.tirol.com/automotor/index.html";
menues[4][4] = new Array();
menues[4][4]["name"] = "Lokaltipps";
menues[4][4]["href"] = "http://freizeit.tirol.com/lokaltipps/index.html";
menues[4][5] = new Array();
menues[4][5]["name"] = "Volksbühnen";
menues[4][5]["href"] = "http://freizeit.tirol.com/volksbuehnen/index.html";
menues[4][6] = new Array();
menues[4][6]["name"] = "Tourentipp";
menues[4][6]["href"] = "http://freizeit.tirol.com/tourentipp/index.html";
menues[4][7] = new Array();
menues[4][7]["name"] = "Blasmusik";
menues[4][7]["href"] = "http://freizeit.tirol.com/blasmusik/index.html";
menues[4][8] = new Array();
menues[4][8]["name"] = "Tourismus";
menues[4][8]["href"] = "http://freizeit.tirol.com/tourismus/index.html";

// VERLAG
menues[5][0] = new Array();
menues[5][0]["name"] = "ÜBERSICHT";
menues[5][0]["href"] = "http://verlag.tt.com/impressum/index.html";
menues[5][1] = new Array();
menues[5][1]["name"] = "Kontakt/Impressum";
menues[5][1]["href"] = "http://verlag.tt.com/impressum/index.html";
menues[5][2] = new Array();
menues[5][2]["name"] = "Vertrieb";
menues[5][2]["href"] = "http://verlag.tt.com/vertrieb/index.html";
menues[5][3] = new Array();
menues[5][3]["name"] = "Anzeigen";
menues[5][3]["href"] = "http://verlag.tt.com/anzeigen/kleinanzeigen.html";
menues[5][4] = new Array();
menues[5][4]["name"] = "Marketing";
menues[5][4]["href"] = "http://verlag.tt.com/marketing/index.html";


for(var i=0; i < menues.length; i++){
	if(nc){
		document.write('<layer name="m'+(i+1)+'" visibility="hide" bgcolor="'+tolgreen+'" left="0" top="'+layerypos+'" z-index="255" width="'+layerwidth+'">');
	}else{
		document.write('<div id="m'+(i+1)+'" style="visibility: hidden; position: absolute; left: 0; top: '+layerypos+'; z-index: 255; width: '+layerwidth+'">');
    }

	document.write('<table cellpadding="0" cellspacing="0" bgcolor="'+tolgreen+'" border="0" width="'+layerwidth+'">');
	for(var j=0; j < menues[i].length; j++){
		 document.write('<tr><td width="'+layerwidth+'" onmouseover="bgColor=\''+tolred+'\'" onmouseout="bgColor=\''+tolgreen+'\'"><ilayer><layer onmouseover="bgColor=\''+tolred+'\'" onmouseout="bgColor=\''+tolgreen+'\'" width="100%"><a href="'+menues[i][j]["href"]+sid+'" class="dropdownlink" onmouseover="window.status=\''+menues[i][j]["href"]+'\'; return true;" onmouseout="window.status=\'\'; return true;" >'+menues[i][j]["name"]+'</a></layer></ilayer></td></tr>\n');
	}
	document.write('</table>');

	if(nc){
		document.write('</layer>');
	}else{
		document.write('</div>'); 
	}
}
