function WaitShow() {
  document.getElementById('WaitMessage').style.display = 'block';
}
function WaitHide() {
  document.getElementById('WaitMessage').style.display = 'none';
}
function WaitConfirm(msg) {
  if(confirm(msg)) {
    WaitShow();
    return true;
  } else {
    return false;
  }
}
function Popup(url,width,height,target) {
  if(!target) {
    target = 'jidelnaPopup';
  }
  var x = window.open (url,target,"scrollbars=1, scrollable=1, resizable=1, status=0,toolbar=0,width="+width+",height="+height);
  if(x) {
    x.focus();
  }
  return x;
}
function PopupSelf(element,width,height,target) {
  var location = String(element.href);
  if(location.indexOf('?') > -1) {
    return Popup(location+'&popup=1',width,height,target);
  } else {
    return Popup(location+'?popup=1',width,height,target);
  }
}
function RedirectParent(location) {
  if(!window.opener) {
    return false;
  }
  try {
    window.opener.location = location;
    return true;
  } catch(err) {
    return false;
  }
}
function AddParam(url,paramName,paramValue) {
  if(url.indexOf('?') > -1) {
    return url+'&'+paramName+'='+paramValue;
  } else {
    return url+'?'+paramName+'='+paramValue;
  }
}
function filtruj(text) {
  e = document.getElementById('jidelna');
  f = document.getElementById('filtr');
  
  text = text.toLowerCase();
  var s = '';
  f.className = 'gfTextInput';
  if(text.length < 2) {
    for(i=1;i< e.length ; i++) {
      s = e.options[i].text.substr(0,text.length);
      s = s.toLowerCase();
      if(s==text) {        
        e.options[i].selected = true;
        return;          
      }
  
    }
  } else {
    for(i=1;i< e.length ; i++) {
      s = e.options[i].text.toLowerCase(); 
      if(s.search(text) > -1) {        
        e.options[i].selected = true;
        return;          
      }      
    }      
  }
  f.className = 'gfTextInput gfError';      
  
}
