// kontrola formuláøù
var http = false;

if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  http = new XMLHttpRequest();
}

function kosik(pole, pocet, idzbozi, kod, cena, dph) {
  http.abort();
  http.open("GET", "ajax/scripty.php?druh=kosik&pocet=" + pocet + "&kod=" + kod + "&id_zbozi=" + idzbozi + "&cena=" + cena +"&dph=" + dph, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
	 var a= http.responseText;
	 var b= a.split('#'); //pole
  
	 document.getElementById('obsahkosik').innerHTML = b[1];   
      document.getElementById(pole).innerHTML = b[0];
    }
  }
  http.send(null);
}

function loginkontrola(login) {
  http.abort();
  http.open("GET", "ajax/scripty.php?druh=login&login=" + login, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('infologin').innerHTML = http.responseText;
    }
  }
  http.send(null);
}

function posta(psc, pole) {
  http.abort();
  http.open("GET", "ajax/scripty.php?druh=psc&psc=" + psc, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
	 var a= http.responseText;
	 var b= a.split('#'); //pole
      document.getElementById(pole).value = b[1];
    }
  }
  http.send(null);
}

function heslokontrola(heslo, heslo2) {
  if (heslo!=heslo2) { 
  	document.getElementById('hesloinfo').innerHTML = '<span class=ko>Hesla se neshodují.</span>';
	document.getElementById('zakheslo2').style.background = '#ff9f9f';
  } else {
	document.getElementById('hesloinfo').innerHTML = '<span class=ok>Hesla se shodují.</span>'; 
	document.getElementById('zakheslo2').style.background = '#b8f5b1';
  }
}


	

