function getkey(e) {
  var code;

  if (!e){e = window.event;} // nastaveni pro IE

  if (e.keyCode){
    code = e.keyCode; // IE a Mozilla
  } else {
    if (e.which){code = e.which;} // NN4
	}
  return code;
}

function checkNumeric(eX) {
  var test=getkey(eX);

  if (test<48 || test>57){
    return false;
  }
  return true;
}

var lastMenuClass = "";

//promenna urcuje, zda ma napoveda zustat otevrena i pri opusteni okna

function changeMenu(obj,className) {
	lastMenuClass = obj.className;
	obj.className = className;
}

function revertMenu(obj) {
	obj.className = lastMenuClass;
}

function showHelpWnd(path) {
    window.open(path,"popup");
}

function showCalendarWnd(path) {
    window.open(path,"popup");
}

function showIt( obename ) {
     var x = ap_getObj( obename );

     x.display = "block";
     x.top = mouseY-35;
     x.left = mouseX;
}

function hideIt( obename ) {
     var x = ap_getObj( obename );
     x.display = "none";
}

// funkce zajištující kompatibilitu práce s objekty v ruzných browserech
function ap_getObj( name )
{
  if (document.getElementById){
    return document.getElementById(name).style;
  } else {
    if (document.all) {
      return document.all[name].style;
    } else {
    	if (document.layers){
        return document.layers[name];
      }
    }
  }
 	return null;
}


// konstruktor //
function zj_prohlizec()
{
	this.ver=navigator.appVersion;
	this.dom=document.getElementById ? 1:0;

	this.ns4 = (document.layers && !this.dom) ? 1:0;
	this.ns6 = (this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.minIE4 = (document.all) ? 1 : 0;
}

//Nový objekt pro zjištení prohlížeče
var prohlizec = new zj_prohlizec()

var mouseX = 0;
var mouseY = 0;

// Nastavení zachytávání pro Netscape a Mozillu.
if (prohlizec.ns4 | prohlizec.ns6)
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = souradniceKurzoru; // inicializace události jak pro NN, tak pro IE

function souradniceKurzoru(e)
{
  // Uložení pozice kurzoru.
  if (prohlizec.ns4 | prohlizec.ns6)
  {
    mouseX = e.pageX;
    mouseY = e.pageY;
  }

  if (prohlizec.minIE4)
  {
    mouseX = event.clientX + document.body.scrollLeft;
    mouseY = event.clientY + document.body.scrollTop;
  }

  //window.status = mouseX + "," + mouseY; // Zobrazení souradnic.
  return true;
}

function changeCheckedRowsCount(chkbox) {
  if (document.getElementById("_checkedRowsCount") != undefined) {
    var checkedRowsCount = document.getElementById("_checkedRowsCount").innerHTML;

    if (chkbox.checked) {
      checkedRowsCount++;
    }
    else {
      checkedRowsCount--;
    }

    document.getElementById("_checkedRowsCount").innerHTML = checkedRowsCount;

    if (document.getElementById("_checkedRowsInfo") != undefined) {
      var checkedRowsInfo = document.getElementById("_checkedRowsInfo");

      if ((checkedRowsCount > 0) && (checkedRowsInfo.style.display == "none")) {
        checkedRowsInfo.style.display = "";
      }
    }
  }
}

var lastClass = "";

function changeStyle(obj) {
	lastClass = obj.className;
	obj.className = "tableOver";
}

function revertStyle(obj) {
	obj.className = lastClass;
}

