var color = 1;
var CodeMode = "ubb";

function clearForm()
{
   document.forms[0].reset();
}

function BlackBack(lines)
{
   if (color == 1)
   {
      for (i=0 ; i<lines ; i++)
      {
         document.getElementById(i).bgColor="#000000";
         document.images["BlaBa"].src = "./menu/blackback_off.gif";
         document.images["BlaBa"].alt = alt_c2;
      }
      color = 2;
   }
   else if (color == 2)
   {
      for (i=0 ; i<lines ; i++)
      {
         document.getElementById(i).bgColor="#FFFFFF";
         document.images["BlaBa"].src = "./menu/blackback_on.gif";
         document.images["BlaBa"].alt = alt_c1;
      }
      color = 1;
   }
}

function ShowImgCode(url)
{
   if (CodeMode == "html")
   {
      document.forms[0].pfad.value = "<img src=\""+url+"\" alt=\"\">";
   }
   else
   {
      document.forms[0].pfad.value = "[img]"+url+"[/img]";
   }
   document.forms[0].pfad.select();
}

function CodeChange(newMode)
{

   if (CodeMode == "html")
   {
      if (newMode == "ubb")
      {
         document.images["CodeUBB"].src = "./menu/code_ubb_on.gif";
         document.images["CodeUBB"].alt = "";
         document.images["CodeHTM"].src = "./menu/code_html_off.gif";
         document.images["CodeHTM"].alt = alt_b1;
         CodeMode="ubb";

         wert = document.forms[0].pfad.value.replace(/<img src=./,"[img]");
         document.forms[0].pfad.value = wert.replace(/gif.*$/,"gif[/img]");
      }
   }
   else
   {
      if (newMode == "html")
      {
         document.images["CodeUBB"].src = "./menu/code_ubb_off.gif";
         document.images["CodeUBB"].alt = alt_b2;
         document.images["CodeHTM"].src = "./menu/code_html_on.gif";
         document.images["CodeHTM"].alt = "";
         CodeMode="html";

         wert = document.forms[0].pfad.value.replace(/\Wimg\W/,"<img src=\"");
         document.forms[0].pfad.value = wert.replace(/\W\Wimg\W/,"\" alt=\"\">");
      }  
   }
   document.forms[0].pfad.select();
}