function getRefTo(objID) {
  var objRef=null;
  var dc=document;
  if(dc.getElementById && dc.getElementById(objID) != null) objRef = dc.getElementById(objID);
    else if(dc.layers && dc.layers[objID] != null) objRef= dc.layers[objID];
      else if(dc.all) objRef=dc.all[objID];
  return objRef;
}

function getElementSize(obj) {
  var width, height;
  if(obj.clip) {
    width  = obj.clip.width; 
    height = obj.clip.height;
  } else if(obj.offsetWidth) {
    width  = obj.offsetWidth; 
    height = obj.offsetHeight;
  } else {
    width  = obj.style.pixelWidth; 
    height = obj.style.pixelHeight;
  }
  return { width:parseInt(width), height:parseInt(height) };
}

function getElementPosition(obj) {
	for(var lx=0,ly=0; obj!=null; lx += obj.offsetLeft, ly += obj.offsetTop, obj = obj.offsetParent);
	return {x:lx, y:ly}
}


function redir(scr,vars) {
  var frm = document.redir;
	if(frm) {
	  frm.action = scr;
	  frm.vars.value = vars;
	  frm.submit();
	}   
}

function redirConfirm(str,scr,vars) {
  if( !window.confirm(str) ) return void(0); 
  var frm = document.redir;
	if(frm) {
	  frm.action = scr;
	  frm.vars.value = vars;
	  frm.submit();
	}   
}

function predejRok(url,ref,params) {
  var obj = getRefTo(ref);
  var idskola = ref.substr( ref.indexOf("_") + 1 );
  redir(url,"rok=" + obj.value + params);
}

