    
    

function skryjform(){
   if(document.getElementById){
        elm=document.getElementById('kniha_formular')
        elm.style.display="none";
    }
}

function zobraz(co){
            document.getElementById(co).style.display='block';
            
}
function skryj(co){
            document.getElementById(co).style.display='none';
}
 
function zobrazokno(e,num, prispevek, kniha)
{
	document.delform.delidprispevku.value=prispevek;

    if (num=='helpokno') kam=0;
    else kam=-200;
    
    if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+
      {
       
       elm=document.getElementById(num)
       if (document.all && !window.opera) {
          x = event.clientX + document.body.scrollLeft + kam;
          y = event.clientY + document.body.scrollTop + 20;  
        }  
        else {
          x = e.pageX + kam;
          y = e.pageY + 20;   
         }
        if (document.all && !window.opera) {
          elm.style.pixelLeft = x;
          elm.style.pixelTop = y;
         }
         else {
          elm.style.left = x + "px";
          elm.style.top = y + "px";
         }
        

       elm.style.display = "block"
      }
}


function PrehodObsah(odkud, kam)
{
    if (document.getElementById(odkud).innerHTML!='' && odkud!=kam)
    {
        document.getElementById(kam).innerHTML = document.getElementById(odkud).innerHTML ;
        document.getElementById(odkud).innerHTML ='';
        
        
    }
}

  
function NastavOdpovedniForm(aktualniID, minuleID) // odpovedi  -jestli je zapnuta moznost odpovedi jen pro chranena
{
    //alert('-' + aktualniID + '-' + minuleID + '-');
    if (minuleID == '')  
    {
        
        PrehodObsah('kniha_formular','odpo-' + aktualniID); 
        zobraz('odpovidate-' + aktualniID);
    }
    else if (aktualniID != minuleID) 
    {
        PrehodObsah('odpo-' + minuleID,'odpo-' + aktualniID); 
        zobraz('odpovidate-' + aktualniID);
        skryj('odpovidate-' + minuleID);
        
    }

   //if (odpovedi == 'a') show_hide();  // pokud jsou odpovedi jen pro chranena, zobraz policko pro heslo
    
    return aktualniID;
}

// IE only - wraps selected text with lft and rgt
  function WrapIE(lft, rgt) {
    strSelection = document.selection.createRange().text;
    if (strSelection!="") {
      document.selection.createRange().text = lft + strSelection + rgt;
    }
  }

// Moz only - wraps selected text with lft and rgt
  function wrapMoz(txtarea, lft, rgt) {
    var selLength = txtarea.textLength;
    var selStart = txtarea.selectionStart;
    var selEnd = txtarea.selectionEnd;
    if (selEnd==1 || selEnd==2) selEnd=selLength;
    var s1 = (txtarea.value).substring(0,selStart);
    var s2 = (txtarea.value).substring(selStart, selEnd)
    var s3 = (txtarea.value).substring(selEnd, selLength);
    txtarea.value = s1 + lft + s2 + rgt + s3;
  }
  
// Chooses technique based on browser
  function wrapTag(txtarea, lft, rgt) {
    lft = unescape(lft);
    rgt = unescape(rgt);
    if (document.all) {
      WrapIE(lft, rgt);
    }
    else if (document.getElementById) {
      wrapMoz(txtarea, lft, rgt);
    }
  }  
  
// IE only - Insert text at caret position or at start of selected text
  function insertIE (txtarea, text) {
    if (txtarea.createTextRange && txtarea.caretPos) { 
      var caretPos = txtarea.caretPos; 
      caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text+caretPos.text + ' ' : text+caretPos.text;
    } else {
      txtarea.value = txtarea.value + text; 
    }
    return;
  } 

// Moz only - Insert text at caret position or at start of selected text
  function insertMoz(txtarea , lft) {
    var rgt="";
    wrapTag(txtarea, lft, rgt);
    return;
  }

// Switch function based on browser - Insert text at caret position or at start of selected text
  function insertTag(txtarea , lft) {
    if (document.all) {
      insertIE(txtarea, lft);
    }
    else if (document.getElementById) {
      insertMoz(txtarea, lft);
    }
  }

// IE only - stores the current cursor position on any textarea activity
  function storeCaret (txtarea) { 
    if (txtarea.createTextRange) { 
      txtarea.caretPos = document.selection.createRange().duplicate();
    } 
  }

function smajlikytaw(what)
{
    //document.shoutform.text.value = document.shoutform.text.value + ' ' + what + ' ';
	//document.shoutform.text.focus();
	insertTag (document.diskuzeadd.textovepole,what);
	document.diskuzeadd.textovepole.focus();
}

