/*
 * inicializace globalnich promennych
 */
var IE    = document.all?true:false
var tempX = 0
var tempY = 0
document.onmousemove = getMouseXY;//priradime event handler

/**
 * Funkce, ktera je spustena pri onLoad na body
 */
function start_script()
{
  if (!IE) {
    document.captureEvents(Event.MOUSEMOVE)
  }
  
  if (navigator.userAgent.indexOf("Opera") == -1)
    processElement(document.documentElement);

  Hall();
}

/**
 * Podle ID najde odpovidajici objekt.
 */
function najdiID(n, d) 
{
  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=najdiID(n,d.layers[i].document);
  }
  
  if((!x)&&(document.getElementById)) {
    x=document.getElementById(n); 
  }
  
  return x;
}
  
/**
 * Zobrazeni menu.
 */
function SHmenu() 
{
  var i,p,v,obj,args=SHmenu.arguments;
  
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=najdiID(args[i]))!=null) { 
      v=args[i+2];
      if (obj.style) { 
	obj = obj.style; 
	v = (v=='show')?'visible':(v='hide')?'hidden':v; 
      }
      obj.visibility=v; 
    }
  }
}
  
/**
 * Schovani vsech menu
 */
function Hall()
{
  SHmenu('menu01','','hide');
  SHmenu('menu02','','hide');
  SHmenu('menu03','','hide');
  SHmenu('menu04','','hide');
  SHmenu('menu05','','hide');
}

/**
 * Getne mysi XY.
 */
function getMouseXY(e)
{
  if (IE) {// souradnice mysi pro IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {// souradnice mysi pro ostatni
    tempX = e.pageX
    tempY = e.pageY
  }
  
  if (tempX < 0) {
    tempX = 0
  }
  if (tempY < 0) {
    tempY = 0
  }

  // schovani vsech menu
  if ((tempX < 10)||(tempY < 120)||(tempX > 600)||(tempY > 400)) {
    Hall();
  }
  
  return true
}
