function ValidateForum()
{
return true;
}

function fnSearch() {
             if (document.getElementById('SearchBox').value.length<3 && document.getElementById('SearchBox').value!='hledej...')  {
                  alert('Uveďte minimálně 3 znaky.');return false;
                  }
            /*else {
                   SetForm('/hledani/default.aspx?catId=18&txbSearch=' + document.getElementById('SearchBox').value,true);
                 } */
                 return true;
            }
            
            

function EnterPress()
{	
	if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) 
	 	return true;
	 	}

function AddOnKeyPressX(a, nID, sLabel)
{
  var elBody = document.getElementById('Body');
  if (elBody)
  {
    var idTBL = document.getElementById('editor');
    var childs;
    debugger;
    if(doxument.all) // IE..x
    {
      childs = idTBL.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild;
    }
    else
    {
      childs = idTBL.childNodes[1].childNodes[1].childNodes[1].childNodes[1].childNodes[1].childNodes[1].childNodes[1].childNodes[1]
    }
    childs.innerHTML = sLabel;
    ViewQuoteX(nID);
    elBody.onkeypress=body_keypress;
  }
  else
  {
    if ( a < 2 )
    {
      a++;
      setTimeout('AddOnKeyPressX(' + a + ', ' + nID + ', ' + sLabel + ')', 1000);
    }
  }
}


function ViewQuoteX(nID)
{
 var el = document.getElementById('checkQuote_' + nID);
 el.style.display = (el.style.display=='none' ? '' : '');
}

function Quoting(nID, a)
{
  var elBody = document.getElementById('Body');
  if (elBody)
  {
    var el_body=document.getElementById('Body_'+nID);
    var sBody = el_body.innerHTML;
    /*var re = new RegExp(/<BR\b[^>]*>(.*?)/g);
    sBody = sBody.replace(re, '\n>> ');*/
    var inc = 0;
    var br = '\n<br>';
    var max = 57;
    if (sBody.toLowerCase().indexOf(br) == -1 )
    {
      max = 58;
      br = '<br>';
    }
    var l = sBody.length;
    if ( l > max - 1 )
    {
      inc+= Math.round(l/max)+1;
    }
    var pos = sBody.toLowerCase().indexOf(br);
    var first = 0;
    var count = 0;
    //debugger;
    while( pos  > -1 )
    {
      count = pos - first;
      if ( count > max )
      {
        inc++;
      }
      first = pos;
      sBody = sBody.toLowerCase().replace(br, '\n>> ');
      inc++;
      pos = sBody.toLowerCase().indexOf(br);
    }
    var h = elBody.style.height ;
    h = h.replace('px', '')*1;
    elBody.style.height = (0 + (inc*18)) + 'px' ;
    sBody = sBody.replace(/&gt;/g, '>');
    sBody = sBody.replace(/&lt;/g, '<');
    elBody.value = '>> ' + sBody;
    
    /*roztahovani*/
    elBody.onkeypress=body_keypress;
  }
  else
  {
    if ( a < 2 )
    {
      a++;
      setTimeout('QuotingX(' + nID + ', ' + a + ')', 1000);
    }
  }
}


function body_keypressX(e)
{
  var elBody = document.getElementById('Body');
  var keynum;
  var keychar;
  var numcheck;
  
  if(window.event) // IE
  {
    keynum = window.event.keyCode;
  }
  else if(e.which) // Netscape/Firefox/Opera
  {
    keynum = e.which;
  }
  if ( keynum == 13 )
  {
    var h = elBody.style.height ;
    h = h.replace('px', '')*1;
    elBody.style.height = (h+18) + 'px' ;
  }
  else
  {
    document.getElementById('checkQuote').style.display = 'none';
  }
}

function CheckedLastNotReaded(sCookies)
{
  var savedCookies = GetCookie('LastReaded');
  sCookies = sCookies.replace(/##/g, '#;#');
  alert(sCookies);

  var arr = sCookies.split(';');
  var sID;
  var nID;
  var el;
  for( a = 0; a < arr.length; a++ )
  {
    if ( savedCookies.indexOf(arr[a]) == -1 )
    {
      sID = arr[a];
      nID = sID.replace(/#/g, '');
      el = document.getElementById('comm_' + nID);
      if (el){
        el.style.background = '#54A640';
      }
    }
  }
}
