
  function naKoncu(name) {
    name.focus();
  }

  function storeCaret(text) { 
    if (text.createTextRange) {
      text.caretPos = document.selection.createRange().duplicate();
    }
  }

  function DodajBesedilo(name, besedilo) {
    if (name.createTextRange && name.caretPos) {      
      var caretPos = name.caretPos;    
      caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? besedilo + ' ' : besedilo;
    }  else    name.value += besedilo;  
  }

  function kurzivno(name) {
    ax1 = (prompt("Besedilo ki naj bo posevno ", "Vnesite tukaj"))
    if(ax1!=null) {DodajBesedilo(name, '<i>' + ax1 + '</i>')}
    naKoncu(name);
  }

  function debelo(name) {
    ax2 = (prompt("Besedilo ki naj bo odebeljeno ", "Vnesite tukaj"))
    if(ax2!=null) {DodajBesedilo(name, '<b>' + ax2 + '</b>')}
    naKoncu(name);
  }

  function podcrt(name) {
    ax3 = (prompt("Besedilo ki naj bo podcrtano ", "Vnesite tukaj"))
    if(ax3!=null) {DodajBesedilo(name, '<u>' + ax3 + '</u>')}
    naKoncu(name);
  }

  function slist(name) {
    ax4 = (prompt("Besedilo ki naj bo v seznamu ", "Vnesite tukaj"))
    if(ax4!=null) {DodajBesedilo(name, '<li>' + ax4 + '</li>')}
    naKoncu(name);
  }

  function squote(name) {
    ax4 = (prompt("Dobesedni navedek ", "Vnesite tukaj"))
    if(ax4!=null) {DodajBesedilo(name, '<blockquote>' + ax4 + '</blockquote>')}
    naKoncu(name);
   }

  function crta(name) {
    DodajBesedilo(name, '<HR WIDTH="80%" SIZE="1" noshade>');
    naKoncu(name);
  }

  function povezava(name) {
    ax6 = (prompt("URL naslov povezave", "Vnesite tukaj")) 
    if (ax6!=null) {
      ab6 = (prompt("Besedilo ki naj bo v povezavi", "Vnesite tukaj"))
      if(ab6!=null) {DodajBesedilo(name, '<A target="_blank" HREF=\"'+ax6+'\">' + ab6 + '</A>');}
    }
    naKoncu(name);
  }

  function mail(name) {
    ax7 = (prompt("Elektronski naslov", "Matej.Spiller@siol.net"))
    if (ax7!=null) { 
      ab7 = (prompt("Besedilo, ki naj bo v povezavi na elektronski naslov", "Matej.Spiller@siol.net"))
      if(ab7!=null) {DodajBesedilo(name, '<A HREF="mailto:'+ax7+'">' + ab7 + '</A>')}
      naKoncu(name);
    }
  }
 
  function slika(name) {
    ax8 = (prompt("Nahajališče slike ", "http://"))
    if(ax8!=null) {DodajBesedilo(name, '<img src="' + ax8 + '" border="0">');}
    naKoncu(name);
  }

  function slikanovica(name) {
    ax9 = (prompt("ID slike", "Vnesite tukaj")) 
    if (ax9!=null) {
      DodajBesedilo(name, '<p style="text-align:center"><table class="naslovtabele" align="center"><tr><td><a href="/slike/'+ax9+'.jpg"><img src="/slike/'+ax9+'sm.jpg"></a></td></tr></table></p> ');
    }
    naKoncu(name);
  }

  function smesko(name, x) {
    DodajBesedilo(name, x);
    naKoncu(name);
  }

  function slikaB(name, x) {
    DodajBesedilo(name, '<img src="' + x + '" border="0">');
    naKoncu(name);
  }

  function prelom(name) { 
    DodajBesedilo(name, '<br/>');
    naKoncu(name);
  }

  function doLeft(name) { 
    DodajBesedilo(name, '<p align="left" class="besedilo"></p>');
    naKoncu(name);
  }
  
  function doCenter(name) { 
    DodajBesedilo(name, '<p align="center" class="besedilo"></p>');
    naKoncu(name);
  }

  function doRight(name) { 
    DodajBesedilo(name, '<p align="right" class="besedilo"></p>');
    naKoncu(name);
  }


var WinNum = 0;
 
function OdpriOkno(Url,x,y) {
 var String;
 String = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,";
 String +="width=";
 String += x;
 String +=",height=";
 String +=y;
 WinPic=window.open(Url,WinNum++,String);
}
