var NS = (document.layers) ? 1 : 0;
var IE = (document.all && document.getElementById) ? 1 : 0;
var N6 = (!document.all && document.getElementById) ? 1 : 0;

function MM_findObj(n, d) { //v3.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); return x;
}
/* Functions that swaps images. */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function loadImage(){
  MM_preloadImages(
  '/kea/images/menu_home_off.gif','/kea/images/menu_home_on.gif','/kea/images/menu_home_curr.gif',
  '/kea/images/menu_overview_off.gif','/kea/images/menu_overview_on.gif','/kea/images/menu_overview_curr.gif',
  '/kea/images/menu_services_off.gif','/kea/images/menu_services_on.gif','/kea/images/menu_services_curr.gif',
  '/kea/images/menu_media_off.gif','/kea/images/menu_media_on.gif','/kea/images/menu_media_curr.gif',
  '/kea/images/menu_contact_off.gif','/kea/images/menu_contact_on.gif','/kea/images/menu_contact_curr.gif',
  '/kea/images/submenu_overview_overview_off.gif','/kea/images/submenu_overview_overview_on.gif',
  '/kea/images/submenu_overview_business_off.gif','/kea/images/submenu_overview_business_on.gif',
  '/kea/images/submenu_overview_products_off.gif','/kea/images/submenu_overview_products_on.gif',
  '/kea/images/submenu_services_alternative_off.gif','/kea/images/submenu_services_alternative_on.gif',
  '/kea/images/submenu_services_idea_off.gif','/kea/images/submenu_services_idea_on.gif',
  '/kea/images/submenu_services_direct_off.gif','/kea/images/submenu_services_direct_on.gif',
  '/kea/images/submenu_services_early_off.gif','/kea/images/submenu_services_early_on.gif'
  );
}

function GetStyle(name) {
   if (document.getElementById)
      return document.getElementById(name).style;
   else if (document.all)
      return document.all[name].style;
   else {
      var el = document.layers[name];
      if (el != null)   return el;
      for (var i=0; i<document.layers.length; i++) {
         el = document.layers[i].document.layers[name];
         if (el != null)   return el;
      }//end-for-i
   }//end-if  
}//end-func-GetStyle

function styleRoll(span, vis) {
   var el = GetStyle(span);
   var state = vis? 'visible':'hidden';
   el.visibility = state;
}//end-func-styleRoll

function imageSwap3On(theImage, theSrc, span) {
   imageSwap2(theImage, theSrc);
   styleRoll(span, true);
}//end-func-imageSwap3On

function imageSwap3Off(theImage, theSrc, span) {
   imageSwap2(theImage, theSrc);
   styleRoll(span, false);
}//end-func-imageSwap3Off

function imageSwap2(theImage, theSrc) {
   if (document.images) {
      var img = document.images[theImage];
      if (img)   img.src = theSrc;
      else {
         for (var i=0; i<document.images.length; i++) {
            if (document.images[i].name == theSrc) {
               document.images[i].src = theSrc;
               return;
            }//end-if
         }//end-for-i
      }//end-if-img
   }//end-if-document.images
}//end-func-imageSwap2

