var useDom = (document.getElementById) ? 1:0;
var isNS = (document.layers) ? 1:0;

/////////////////////////////////////

var inMenu = 0;
var waitingToShow = 0;
var waitingToShowTimer;
var shownMenu = '';


function showMenu (menuId) {
  if (inMenu) {
	showMenu2 (menuId);
  }
  else {
    waitingToShow = 1;
    waitingToShowTimer = setTimeout('showMenu2("' + menuId + '")',200);	  
  }
}

function showMenu2 (menuId) {
    waitingToShow = 0;
    inMenu = 1;
    if ( shownMenu != menuId) {
      if (useDom) {
	var obj = document.getElementById(shownMenu);
	if (obj) 
	  obj.style.visibility = 'hidden'
      }
      if (isNS) {
	obj = eval ("document." + shownMenu);
	if (obj) {
	  obj.visibility='hide';
	}
      }
    }
    shownMenu = menuId;
    if (useDom) {
      var obj = document.getElementById(menuId);
      obj.style.visibility = 'visible';
    }
    else if (isNS) {
      obj = eval ("document." + menuId);
      if (obj) {
	obj.visibility='show';
      }
    }
}

function hideMenu (menuId) {
  if (waitingToShow) {
    clearTimeout(waitingToShowTimer);
    waitingToShow = 0;

  } else {
    setTimeout('hideMenuReally("' + menuId + '")',1000);
  }
  inMenu = 0;
}

function hideMenuReally (menuId) {
  if (inMenu) {
    setTimeout('hideMenuReally("' + menuId + '")',1000);
    return;
  }
  if (useDom) {
    var obj = document.getElementById(menuId);
    obj.style.visibility = 'hidden'
  }
  if (isNS) {
    obj = eval ("document." + menuId);
    if (obj) {
      obj.visibility='hide';
    }
  }
}

function menuIn(menuId) {
  inMenu = 1;
}

function menuOut(menuId) {
  hideMenu(menuId);
}

function itemIn (id) {
  if (useDom) {
    var obj = document.getElementById(id);
    obj.style.backgroundColor = "#eeeeee";
  }
}

function itemOut (id) {
  if (useDom) {
    var obj = document.getElementById(id);
    obj.style.backgroundColor = '';
  }
}

function showHideSearch (id) {
  if (useDom) {
    var obj = document.getElementById(id);
    if (obj.style.display == 'none')
	obj.style.display = '';
    else
		obj.style.display = 'none';
  }
  else if (isNS) {
    obj = eval ("document." + id);
    if (obj) {
      obj.visibility='show';
    }
  }
}


//////////////////////////////

function printversion (url) {
var args = 'height=600,width=600,scrollbars=yes,resizable=yes,status=no,menubar=yes,';
  var url = url + "?print=true";
  var x = this.screenLeft + 10;
  var y = this.screenTop + 10;
  args += 'left='+x+',top='+y;
  var newwin = window.open(url,'popup',args);
  newwin.creator = self;
  return false;
}

function view_image (url, width, height) {
	width += 50;
	height += 50;
var args = 'height=' + height + ',width=' + width + ',scrollbars=yes,resizable=yes,status=no,menubar=no,';
  var x = this.screenLeft + 10;
  var y = this.screenTop + 10;
  args += 'left='+x+',top='+y;
  var newwin = window.open(url,'popup',args);

}

//////////////////////////////

var down = new Image();
down.src = '/_gfx/corporate/graytonedown.gif';

function menuOverMenu(id, division) {
  if(document.getElementById) {
    var c = document.getElementById("cc" + id);

    var l = document.getElementById("ll" + id);

    l.style.backgroundSaved = l.style.background;
    l.style.colorSaved = l.style.color;

    l.style.color = "#ffffcc";
	return;

   l.style.background = "#fcfcfc";

    if (division == 10) {
      l.style.background = "#eed0d0";
    } else if (division == 20) {
      l.style.background = "#dbdbdb";
    } else if (division == 40) {
      l.style.background = "#ccd5db";
    } else if (division == 50) {
      l.style.background = "#d1e0e2";
    } else {
      l.style.background = "#dbdbdb";
    }

	return;

    if (division == 10) {
      l.style.color = "#a91313";
    } else if (division == 20) {
      l.style.color = "#4b4b4b";
    } else if (division == 40) {
      l.style.color = "#002f4b";
    } else if (division == 50) {
      l.style.color = "#186570";
    } else {
      l.style.color = "#000000";
    }
	return;

  }
}

function menuOutMenu(id) {
  if(document.getElementById) {
    var c = document.getElementById("cc" + id);
    var l = document.getElementById("ll" + id);


    l.style.color = l.style.colorSaved;
    l.style.background = l.style.backgroundSaved;
    return;

  }
}

function video_large (video, title,layout,lukvindue) {
  var args = 'height=298,width=325,scrollbars=no,resizable=no,status=no,menubar=no,';
  var url = "/video/video.asp?v=" + escape(video) + "&t=" + escape(title) + "&l=" + layout + '&w=' + escape(lukvindue); 
  var x = this.screenLeft + 10;
  var y = this.screenTop + 10;
  args += 'left='+x+',top='+y;
  var newwin = window.open(url,'popup',args);
  return true;	
}