function check()
  {
    if (document.prispevok.Text.value=='')
    {
      alert('Musíte vyplniť text príspevku');
      return false;
    } else if ((document.prispevok.antispam) && (document.prispevok.antispam.value=='')){
      alert('Musíte vyplniť antispam ochranu');
      return false;
    } else return true;
  }
function smile(sm){
 return tag('{*'+sm+'*}');
}

function tag(tag){
if(document.prispevok){
 obj=document.prispevok.Text;
 if(document.all){
  if(obj.createTextRange && obj.caretPos){ 
   var caretPos=obj.caretPos; 
   caretPos.text=tag+caretPos.text;
  }else{
   obj.value=obj.value+tag;
  }
 }else if(document.getElementById){
  tag=unescape(tag);
  var selLength=obj.textLength;
  var selStart=obj.selectionStart;
  var selEnd=obj.selectionEnd;
  if(selEnd==1||selEnd==2){selEnd=selLength;}
  var s1=(obj.value).substring(0,selStart);
  var s2=(obj.value).substring(selStart,selEnd)
  var s3=(obj.value).substring(selEnd,selLength);
  obj.value=s1+tag+s2+s3;
 }
 obj.focus();
}
}


function addlink()
{
 tx=prompt("Zadajte cestu","http://");
 ti=prompt("Nazov :","");
 if(ti=="") {ti=tx;}
 if (tx !=null)
 //document.prispevok.Text.value=document.prispevok.Text.value+("[URL "+tx+"]"+tx+"[/URL]");
 return tag('[url='+tx+']'+ti+'[/url]');
}

function addpic()
{
 tx=prompt("Zadajte cestu","http://");
 if (tx !=null)
 //document.prispevok.Text.value=document.prispevok.Text.value+("[URL "+tx+"]"+tx+"[/URL]");
 //ip=getip();
 return tag('[img]'+tx+'[/img]');
}

function addtext(txt)
{
//document.prispevok.Text.value=document.prispevok.Text.value+txt;
return tag(txt);
}
function addbold()
{
 tx=prompt("Zadajte Text","");
 if (tx !=null)
 //document.prispevok.Text.value=document.prispevok.Text.value+("[b]"+tx+"[/b]");
 return tag('[b]'+tx+'[/b]');
}
function additalic()
{
 tx=prompt("Zadajte Text","");
 if (tx !=null)
 //document.prispevok.Text.value=document.prispevok.Text.value+("[i]"+tx+"[/i]");
 return tag('[i]'+tx+'[/i]');
}

function addnick(id)
{
 return tag('{|'+id+'|}');
}
