var smtel=0;

function sm(welk){
  smtel++;
  if(smtel < 46)
  {
    document.fo.ttxt.value=document.fo.ttxt.value+welk;
    document.fo.ttxt.focus();
  }
  else
  {
    alert("Je kunt maximaal 45 smilies gebruiken\nYou cannot use more than 45 smilies");
  }
}


function wubb(w, bes){
  
  if(w == "url" || w == "img")
  {
    if(w == "url")
    {
      var sit = prompt("Wat is de URL van de link die je wilt maken?\nWhat's the URL of the link you want to add?", "http://");
      if(sit == "http://" || sit == "")
      {
        alert("Je hebt niets ingevuld\nYout haven't filled in anything");
        wubb("url", "no");
      }
      else
      {
        if(sit != null)
        {
          var su = sit.substring(0, 7);
          if(su != "http://")
          {
            sit = "http://" + sit;
            document.fo.ttxt.value = document.fo.ttxt.value + '[url='+sit+'] Text [/url]';
            document.fo.ttxt.focus();
          }
          else
          {
            document.fo.ttxt.value=document.fo.ttxt.value+'[url='+sit+'] Text [/url]';
            document.fo.ttxt.focus();
          }
        }
      }
    }
    
    if(w == "img")
    {
      var im = prompt("Wat is de URL van het plaatje dat je wilt invoegen?\nWhat's the URL of the image you want to add?", "http://");
      if(im == "http://" || im == "")
      {
        alert("Je hebt niets ingevuld\nYout haven't filled in anything");
        wubb("img", "no");
      }
      else
      {
        if(im != null)
        {
          var imgh = im.substring(0, 7);
          if(imgh != "http://")
          {
            im = "http://"+im;
            document.fo.ttxt.value=document.fo.ttxt.value+'[img]'+im+'[/img]';
            document.fo.ttxt.focus();
          }
          else
          {
            document.fo.ttxt.value=document.fo.ttxt.value+'[img]'+im+'[/img]';
            document.fo.ttxt.focus();
          }
       }
      }
    }
  }
  else
  {
    document.fo.ttxt.value = document.fo.ttxt.value + "["+w+"] Text [/"+w+"]";
    document.fo.ttxt.focus();
  }
}
