function checkAll(oForm, cbName, checked)
  {
  for (var i=0; i < oForm[cbName].length; i++) oForm[cbName][i].checked = checked;
  }

var xmlHttp = false;
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

function callServerLogin(pl,login,pass) {
  login=encodeURI(login);
  pass=encodeURI(pass);
  var zapros = "sub=Login&pl=" + pl + "&login=" + login + "&pass=" + pass;
  var url = "/login.php"; 
  xmlHttp.open("POST", url, true);
  xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=windows-1251"); 
  xmlHttp.send(zapros);
  xmlHttp.onreadystatechange = updatePageLogin;
  xmlHttp.send(null);
 }

function updatePageLogin() {
  if (xmlHttp.readyState == 4) {    
    var response = xmlHttp.responseText;
    document.getElementById('login').innerHTML = response;
  }
}

function callServerReLogin(pl) {
  var zapros = "&pl=" + pl;
  var url = "/enter.php"; 
  xmlHttp.open("POST", url, true);
  xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=windows-1251"); 
  xmlHttp.send(zapros);
  xmlHttp.onreadystatechange = updatePageReLogin;
  xmlHttp.send(null);
 }

function updatePageReLogin() {
  if (xmlHttp.readyState == 4) {    
    var response = xmlHttp.responseText;
    document.getElementById('login').innerHTML = response;
  }
}

function callServerSelect(idit) {
  idt=encodeURI(idit)
  var zapros = "idit=" + idit 
  var url = "/additem.php"
  xmlHttp.open("POST", url, true);
  xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=windows-1251"); 
  xmlHttp.send(zapros);
  xmlHttp.onreadystatechange = updatePageSelect;
  xmlHttp.send(null);
 }

function updatePageSelect() {
  if (xmlHttp.readyState == 4) {    
    var response = xmlHttp.responseText;
    //alert (response);
    if (response>0)
      {
      document.getElementById('sel').src="/images/sel2.gif";
      document.getElementById('sel').title=otmvib;
      }
    else
      {
      document.getElementById('sel').src="/images/sel1.gif";
      document.getElementById('sel').title=vib;
      }
    document.getElementById('select').innerHTML = Math.abs(response);
  }
}
