function SwitchLng(lngID){nURL="/"+lngID+"/index.htm";window.document.location.href = nURL;return true;}
function SwitchLngEx(lngID){var sURL=window.document.location.href;nURL=new String(sURL);aURL=nURL.split("/");nURL=nURL.replace("/"+aURL[3]+"/","/"+lngID+"/");window.document.location.href = nURL;return true;}
function resizeDiv(a,b,h){if(a!=0) b1 = document.getElementById(a).offsetHeight; else b1 = 0; b2 = document.getElementById(b).offsetHeight; if((b1 + b2) < h) { k = h - (b1 + b2); document.getElementById(b).style.height = (b2 + k) + "px"; } }
function getColMh() {mh=0;ch=0;for(i=1;i<5;i++) {if(document.getElementById("col"+i)!=undefined) {document.getElementById("col"+i).style.height="auto"; ch = document.getElementById("col"+i).offsetHeight; if(ch>mh) mh = ch;}}return mh;}



var MSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false; 
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox')>=0?true:false; 
var navigatorVersion = navigator.appVersion.replace(/.*?MSIE ([0-9]\.[0-9]).*/g,'$1')/1; 
var exceptMenus = new Array(); 

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function menuHover(oE,eV,idm) {
  isrc = new String(oE.src);
  if(eV.type=="mouseover") {
    oE.src = isrc.replace(".gif","_hover.gif");
    var x = getposOffset(oE, "left");
    var y = getposOffset(oE, "top") + oE.height;
    var offsetContainer = getposOffset(document.getElementById('heading'),"left");
    
//    if(!MSIE) x = x - 40;
//		else x = x - offsetContainer - 20;
		x = x - offsetContainer - 20;
    
    ShowDiv(idm,x,y);
  }
  if(eV.type=="mouseout") { 
    oE.src = isrc.replace("_hover","");
    setTimeout("HideDiv('"+idm+"')",99);
  }
}

function ShowDiv(idm,x,y){
  var el;
  el = document.getElementById(idm);
  if(el!=undefined){ el.style.left = x+"px"; el.style.top = y+"px"; el.style.display = 'block';}
}

function HideDiv(idm){
  if(array_in(exceptMenus,idm)) return; 
  var el;
  el = document.getElementById(idm);
  if(el!=undefined) el.style.display = '';
}

function array_in(arr,idm) {
  var found = false;
  for(var no=0;no<arr.length;no++){
    if(arr[no]==idm) {
      found = true;
    }
  }
  return found;
}

function array_add(arr,idm){
 arr.push(idm);
}

function moo(idm) {
  if(!array_in(exceptMenus,idm)) array_add(exceptMenus,idm);
}
function mii(idm) {
  exceptMenus = new Array();
  setTimeout("HideDiv('"+idm+"')",300);
}
 
activateMenu = function(nav) {

/* currentStyle restricts the Javascript to IE only */
	if (document.all &&
 document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */

        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
            
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {   
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}

window.onload= function(){
    activateMenu('vertnav'); 
}


