

function showHide(id)
{
  var obj = document.getElementById(id);  
  if (obj.style.display == "block") obj.style.display = "none";
  else
    obj.style.display = "block"; 
}

var smilyes = [
	" :-) "," ;-) "," :-D "," :-O "," :-| "," :-? "," :-( "," :beer: "," :bum: "," :coffee: "," :-p "," :smoke: "," :cool: "," :love: "," O-) "," :-X "," :applause: "," :rolleyes: "," :omg: "," :redface: "," :fire: ",];

function smilie(index) {
	document.forms['enter']['kobsah'].value+=smilyes[index];
	document.forms['enter']['kobsah'].focus();
}

function zobraz_novinky(add)         
{
  var novinky = document.getElementById('novinky');  
  var index = novinky.getAttribute('index');    
  index = parseInt(index)+parseInt(add);
  if (index < 0) index = 0; 
  doAjax(novinky_loading,novinky_done,index,"newsAjax.php?index="+index);
  //novinky.setAttribute('index',index);  
}

function novinky_loading(state,param)
{
  if (state == 1) document.getElementById('novinky').innerHTML = "<span> Loading... </span>" ; 
}

function novinky_done(xmlHttp,param)
{
  funct = function() 
  { 
     
     var xmlDoc=xmlHttp.responseXML;        
     var novinky = xmlDoc.getElementsByTagName("novinka");
     var news = xmlDoc.getElementsByTagName("news");
     if (news[0].getAttribute('zaciatok') == "true") param = 0; // kontrola pred pretocenim     
     document.getElementById('novinky').setAttribute('index',param);
     var out = "";
             
     for (var i = 0; i < novinky.length; i++)
     {
     
       var novinka = novinky[i];                           
       var datum = novinka.getElementsByTagName('datum')[0].childNodes[0].data;                    
       var titulek = novinka.getElementsByTagName('titulek')[0].childNodes[0].data;             
       var informace = novinka.getElementsByTagName('informace')[0].childNodes[0].data;                                                  
       out += "<span class=\"nov-datum\"> "+datum+":</span> ";
       out += "<span class=\"nov-titulek\" onclick=\"showHide('newsBlokInformace_"+i+"')\" > "+titulek+"</span> ";
       out += "<div id=\"newsBlokInformace_"+i+"\" class=\"nov-text\"> "+informace+"</div>";
       out +="<br />";         
     }
     document.getElementById('novinky').innerHTML = out;
  } 
  
  setTimeout(funct,500);        
}







