var bNavigator = false;
var bIE = false;
var bDOM = false;

if( document.getElementById ){
  bDOM = true;
} else {
  if( document.all ){
    bIE = true;
  }
}

if( !bDOM && !bIE ){
  bNavigator = true;
}

function getImg(id, frame) {
  if (!frame) { 
    if( bNavigator) {
      myImg = document[id];
    }
    if (bIE) {
      myImg = document.all[id];
    }
    if (bDOM) {
      //myImg = document.getElementById(id);
      myImg = document.images[id];
    }
  }
  else {
    if( bNavigator) {
      myImg = window.top.frames[frame].document[id];
    }
    if (bIE) {
      myImg = window.top.frames[frame].document.all[id];
    }
    if (bDOM) {
      //myImg = window.top.frames[frame].document.getElementById(id);
      myImg = window.top.frames[frame].document.images[id];
    }
  }

  return myImg;
}

function showObject( object, bShow ){
  if( object ){
    if( bShow == 0){
      if (bNavigator) {
	object.visibility = "hide";
      }else{
        if( bIE || bDOM ){
          object.style.visibility = "hidden";
	}
      }
    }else{
      if (bNavigator) {
	object.visibility = "show";
      }
      else {
	if( bIE || bDOM ){
          object.style.visibility = "visible";
	}
      }
    }
  }
}

function menuOver (menuNr, lang) {
  myMenu = getImg('menu'+menuNr);
  showObject (myMenu, 0);
  myMenu.src = '/images/menu/menu'+menuNr+'_a.'+lang+'.gif'; 
  showObject (myMenu, 1);
}

function menuOut (menuNr, lang) {
  myMenu = getImg('menu'+menuNr);
  showObject (myMenu, 0);
  myMenu.src = '/images/menu/menu'+menuNr+'.'+lang+'.gif'; 
  showObject (myMenu, 1);
}

function setMenu(lang) {
  var filename = /(.*)\/(\w.+)_/;
  filename.exec(location.href);
  var myinfourl = RegExp.$1+'/'+RegExp.$2;

//if (window.top.frames.length > 1) {
if (window.top.frames['menuframe']) {
//alert("Menuframe");
  filename.exec(window.top.frames['menuframe'].document.location.href);
  var mymenuurl = RegExp.$1+'/'+RegExp.$2;

  if (myinfourl != mymenuurl) {
    window.top.frames['menuframe'].location.href = myinfourl+'_m.'+lang+'.html';
    window.top.frames['infoframe'].frames['pictureframe'].location.href = myinfourl+'_p.'+lang+'.html';
    //window.top.location.href = myinfourl+'.'+lang+'.html';
  }
} else {
  var domain = myinfourl.replace(/195\.253\.20\.8/,"www.habermann-gmbh.de");
  window.top.location.href = domain+'.'+lang+'.html';
  //window.top.location.href = myinfourl+'.'+lang+'.html';
}
}
