<!--

//muuttujia
	d=document;
	ns4=d.layers?true:false;
	ie4=d.all&&!d.getElementById?true:false;
	ie5=d.all&&d.getElementById?true:false;
	dom=d.getElementById&&!d.all?true:false;
	opera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;
	docIsReady = false; 
	onResize = initDoc;
	visited = false;
	
//tyylimääritykset

	marginLft = pageWidth / 2;
	
	if(docIsCentered){
		menuLft = '50%';
	}
	else{
		menuLft = marginLft;
	}
	
	if(ns4){
		docWidth = window.innerWidth;
		var docCenter = docWidth / 2;
		
		for (var i=1; i < menus.length; i++){
			menus[i] += docCenter-(pageWidth/2)-10;
		}
	}
	

	document.writeln("<style type='text/css'>");
	document.writeln(".mainMenu {position:absolute;left:"+menuLft+";width:"+pageWidth+"px;height:0px;top:0px;margin-left:-"+marginLft+"px;}");
	document.writeln(".dropDown					{ "+cssMenu+"}");
	document.writeln(".menuObj					{ "+cssMenuObj+" }");
	document.writeln("A.menuObj:link			{ "+cssMenuObjLink+" }");
	document.writeln("A.menuObj:hover			{ "+cssMenuObjLinkH+" }");
	document.writeln("A.menuObj:visited			{ "+cssMenuObjLinkV+" }");
	document.writeln("A.menuObj:visited:hover	{ "+cssMenuObjLinkHV+" }");
	document.writeln("</style>");
		


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function showMenu(menu){

	if(docIsReady){
	clearTimeout(timedMenus);

	for (var i=1; i < menus.length; i++){
		var menuObj = MM_findObj('L'+i);
		if(!ns4) var mainMenuObj = MM_findObj('navMenu');
		if ( menuObj ) {
		
			if(i == menu){
				
				if(!ns4){
		
					if((parseInt(mainMenuObj.style.left) + menus[i] + menuWidth - marginLft) > docWidth){
						menuObj.style.left = (docWidth-menuWidth);
					}
					else{
						menuObj.style.left = menus[i];
					}
					
					menuObj.style.visibility = 'visible';
				}
				else{	
					menuObj.visibility = 'visible';
				}
			}
			else{
				if(!ns4){
					menuObj.style.visibility = 'hidden';
				}
				else{
					menuObj.visibility = 'hidden';
				}
			}
		}

	}
	}
}

function hideMenus(){
	if(docIsReady){
		timedMenus = setTimeout('hideAll()', timerLatency);
	}
}

function hideAll(){
	clearTimeout(timedMenus);
	
	for (var i=1; i < menus.length; i++){
		var menuObj = MM_findObj('L'+i);
		if ( menuObj ) {
			if(!ns4){
				menuObj.style.visibility = 'hidden';
			}
			else{
				menuObj.visibility = 'hidden';
			}
		}
	}	
}

function showCurMenu(){
		var lName = this.id+"";
		var menuN = parseInt(lName.replace('L',''));
		showMenu(menuN);
}

function setBG(obj){
	obj.style.backgroundImage = "url("+menuImageOver+")";
}

function restoreBG(obj){
	obj.style.backgroundImage = "url("+menuImageOrig+")";
}

function goToPage(pageUrl, target){
	
	if(target != "_self"){
		window.open(pageUrl,target);	
	}
	else{
		document.location.href = pageUrl;
	}

}



function initDoc(){
	
	timedMenus = setTimeout('', 0);
	
	if(ie5 || ie4) docWidth = document.body.clientWidth;
	if(dom || ns4) docWidth = window.innerWidth;
	

	if(!ns4){
		var mainMenuObj = MM_findObj('navMenu');
		
		if((docWidth <= pageWidth) || !docIsCentered){
			mainMenuObj.style.left = marginLft;
		}
		else{
			mainMenuObj.style.left = '50%';
		}

	}

	for (var i=1; i < menus.length; i++){
		var menuObj = MM_findObj('L'+i);
		if ( menuObj ) {
			menuObj.onmouseover = showCurMenu;
			menuObj.onmouseout = hideMenus;	
		}
		if(!ns4){	
			
			//var tableObj = MM_findObj('T'+i);
			//for (n=0; n < tableObj.rows.length; n++){
			//	tableObj.rows.item(n).cells.item(0).style.backgroundImage = "url("+menuImageOrig+")";
			//	tableObj.rows.item(n).cells.item(0).height = menuObjHeight;
		    //}
    	}

	}
	
	docIsReady = true;
}

// -->
