function zaslat(url, prvek, uspech, chyba) {
  document.getElementById(prvek).innerHTML = uspech;
  try {
    httpp = new XMLHttpRequest(); 
  }
  catch(e){
    try {
      httpp = new ActiveXObject('Msxml2.XMLHTTP');  
    }
    catch(e) {
      try {
        httpp = new ActiveXObject('Microsoft.XMLHTTP'); 
      }
      catch(e) {
        httpp = false;
      } 
    } 
  }
     
  httpp.onreadystatechange = function() { vraceno(prvek, chyba); };
  httpp.open('POST','pridat.php',true);
  httpp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  httpp.send(url);
  document.getElementById('zprava').value='';
}

function vraceno(prvek, chyba){
  var vystup = '';
    if(httpp.readyState == 4) {
      if(httpp.status == 200) {
        vystup = httpp.responseText;
        document.getElementById(prvek).innerHTML = vystup;
      }
      else {
        document.getElementById(prvek).innerHTML = chyba+'\n'+vystup;
      }
    }
}

function zpracuj(tab, l, sho){
  if(l == 0){
    document.getElementById('shoutb').style.display='none';
    document.getElementById('skryt').style.display='none';
  }
  
  if(tab){
    jmeno = document.getElementById('jmeno').value;
    zprava = document.getElementById('zprava').value
    zaslat('content='+tab+'&jmeno='+jmeno+'&zprava='+zprava+'&l='+l+'&sho='+sho, 'shoutboard', '<h3 id="load">nacitam</h3>', '<h3>chyba</h3>');
  }
  return false;
}

function ukaz(){
  u = document.getElementById('shoutb');     
  s = document.getElementById('skryt');
  z = document.getElementById('zob');
     
  if(u.style.display == 'none'){
    u.style.display = 'inline';
    s.style.display='inline';
    z.style.display='none';
  }
  else {
    u.style.display = 'none';
    s.style.display='none';
    z.style.display='inline';
  }
}

