function gid(co) { return document.getElementById(co);  }

function ajax(stranka, kam) {   // alert(stranka);
 var httpRequest;
 if (typeof window.ActiveXObject != 'undefined') {
   httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
 } else {
   httpRequest = new XMLHttpRequest();
 }
 httpRequest.open("GET", stranka, true);
 httpRequest.onreadystatechange= function () {
   processRequest(httpRequest, kam)
 };
 httpRequest.send(null);
}

function processRequest(httpRequest, kam) {
 if (httpRequest.readyState == 4) {
   if(httpRequest.status == 200) {
     if (typeof kam == 'string') {
       document.getElementById(kam).innerHTML = httpRequest.responseText;
     }
     if (typeof kam == 'function') {
       kam(httpRequest.responseText);
     }
   } else {
     alert("Chyba pri nacitani stanky " + httpRequest.status +" : "+ httpRequest.statusText);
   }
 } else {
   if (typeof kam == 'string' && kam != '') {
    document.getElementById(kam).innerHTML = 'načítám ...';
   }
 }
}


function onoff (ax) {
 if (document.getElementById(ax).style.display=='none')
   { document.getElementById(ax).style.display='block'; }
 else
   { document.getElementById(ax).style.display='none'; };
}

function policko(id) {
  if (gid(id).value=='') {
      gid(id).style.backgroundColor='#ff5555';
      ok=false;
    } else {
      gid(id).style.backgroundColor='#ffffff';
      ok=true;
    }
  return ok;
}

function kontrola_prihlasky() {
  var ok=true;

  if (!policko('f4')){ok=false;}
  if (!policko('f5')){ok=false;}
  if (!policko('f7')){ok=false;}
  if (!policko('f8')){ok=false;}
  if (!policko('f9')){ok=false;}
  if (!policko('f10')){ok=false;}
  if (!policko('f11')){ok=false;}
  if (!policko('f13')){ok=false;}
  if (!policko('f14')){ok=false;}

  if ((!gid('f1').checked) && (!gid('f2').checked)) {
      gid('pohl').style.backgroundColor='#ff5555';
      ok=false;
    } else {
      gid('pohl').style.backgroundColor='#ffffff';
    }

  if (!gid('f15').checked) {
      gid('f16').style.backgroundColor='#ff5555';
      ok=false;
    } else {
      gid('f16').style.backgroundColor='#ffffff';
    }

  return ok;
}
function kontrola_aj_adr() {
  var ok=true;

  if (!policko('nove_cp')){ok=false;}
  if (!policko('nove_obec')){ok=false;}
  if (!policko('nove_psc')){ok=false;}

  return ok;
}

function kontrola_zalozeni_minitymu() {
  var ok=true;

  if (!policko('f1')){ok=false;}
  if (!policko('f2')){ok=false;}

  return ok;
}




