
var init_text = "003399";
var init_back = "FFFFFF";
var init_border = "CC0000";

var text_r = init_text.substring(0,2);
var text_g = init_text.substring(2,4);
var text_b = init_text.substring(4,6);
var text_rgb = "" + text_r + text_g + text_b;

var back_r = init_back.substring(0,2);
var back_g = init_back.substring(2,4);
var back_b = init_back.substring(4,6);
var back_rgb = "" + back_r + back_g + back_b;

var border_r = init_border.substring(0,2);
var border_g = init_border.substring(2,4);
var border_b = init_border.substring(4,6);
var border_rgb = "" + border_r + border_g + border_b;

var link_underline = "";
var font_size = "";
var font_family = "";
var font_weight = "";
var font_style = "";

var hexcode_array = new Array('00','11','22','33','44','55','66','77','88','99','AA','BB','CC','DD','EE','FF');




function colorsAll(RGB)
{
   var RR = RGB.substring(0,2);
   var GG = RGB.substring(2,4);
   var BB = RGB.substring(4,6);

   //text
   if(window.document.pickerform.chooser[0].checked == true)
   {
      text_r = RR; text_g = GG; text_b = BB;
      text_rgb = "" + text_r + text_g + text_b;
      window.document.pickerform.colorbox_text.value = text_rgb;
      //window.document.getElementById("sbbyinformer").style.color = "#" + text_rgb;
   }

   //border
   else if(window.document.pickerform.chooser[1].checked == true)
   {
      border_r = RR; border_g = GG; border_b = BB;
      border_rgb = "" + border_r + border_g + border_b;
      window.document.pickerform.colorbox_border.value = border_rgb;
      //window.document.getElementById("sbbyinformer").style.borderŅolor = "#" + border_rgb;
   }

   //back
   else if(window.document.pickerform.chooser[2].checked == true)
   {
      back_r = RR; back_g = GG; back_b = BB;
      back_rgb = "" + back_r + back_g + back_b;
      window.document.pickerform.colorbox_back.value = back_rgb;
      //window.document.getElementById("sbbyinformer").style.backgroundColor = "#" + back_rgb;
   }   
   
}


function colorsOne(RGorB,XX)
{
   //text
   if(window.document.pickerform.chooser[0].checked == true)
   {
      if(RGorB == "R") { text_r = XX; }
      else if(RGorB == "G") { text_g = XX; }
      else if(RGorB == "B") { text_b = XX; }
      text_rgb = "" + text_r + text_g + text_b;
      window.document.pickerform.colorbox_text.value = text_rgb;
      //window.document.getElementById("sbbyinformer").style.color = "#" + text_rgb;
   }

   //border
   else if(window.document.pickerform.chooser[1].checked == true)
   {
      if(RGorB == "R") { border_r = XX; }
      else if(RGorB == "G") { border_g = XX; }
      else if(RGorB == "B") { border_b = XX; }
      border_rgb = "" + border_r + border_g + border_b;
      window.document.pickerform.colorbox_border.value = border_rgb;
      //window.document.getElementById("sbbyinformer").style.borderColor = "#" + border_rgb;
   }

   //back
   else if(window.document.pickerform.chooser[2].checked == true)
   {
      if(RGorB == "R") { back_r = XX; }
      else if(RGorB == "G") { back_g = XX; }
      else if(RGorB == "B") { back_b = XX; }
      back_rgb = "" + back_r + back_g + back_b;
      window.document.pickerform.colorbox_back.value = back_rgb;
      //window.document.getElementById("sbbyinformer").style.backgroundColor = "#" + back_rgb;
   }

}



function chooserMode(MODE)
{
   if(MODE == "text") { var RGB = text_rgb; }
   else if(MODE == "border") { var RGB = border_rgb; }
   else if(MODE == "background") { var RGB = back_rgb; }
   else if(MODE == "back") { var RGB = back_rgb; }

   var RR = RGB.substring(0,2);
   var GG = RGB.substring(2,4);
   var BB = RGB.substring(4,6);
}

function liteLinkOn(MYLINK)
{
   window.document.getElementById(MYLINK).style.color = "#" + hover_rgb;
}
function liteLinkOff(MYLINK)
{
   if(MYLINK == "link2")
   {
      window.document.getElementById(MYLINK).style.color = "#" + border_rgb;
   }
   else
   {
      window.document.getElementById(MYLINK).style.color = "#" + eval(MYLINK + "_rgb");
   }
}





function fillColorBoxes()
{
   window.document.pickerform.colorbox_text.value = text_rgb;
   window.document.pickerform.colorbox_border.value = border_rgb;
   window.document.pickerform.colorbox_back.value = back_rgb;
}


function setInitialColors()
{
   //window.document.getElementById("sbbyinformer").style.color = "#" + text_rgb;
   //window.document.getElementById("sbbyinformer").style.backgroundColor = "#" + back_rgb;
   //window.document.getElementById("sbbyinformer").style.borderColor = "#" + border_rgb;
}



function doBold()
{
   if(window.document.pickerform.boldbox.checked == true)
   {
      window.document.getElementById("allspans").style.fontWeight = "bold";
      font_weight = "<br>&nbsp\;&nbsp\;&nbsp\;font-weight:bold\;";
   }
   else
   {
      window.document.getElementById("allspans").style.fontWeight = "normal";
      font_weight = "";
   }

   
}

function doItalic()
{
   if(window.document.pickerform.italicbox.checked == true)
   {
      window.document.getElementById("allspans").style.fontStyle = "italic";
      font_style = "<br>&nbsp\;&nbsp\;&nbsp\;font-style:italic\;";
   }
   else
   {
      window.document.getElementById("allspans").style.fontStyle = "normal";
      font_style = "";
   }

   
}



function doFontSize(PX)
{
   if(PX == "default")
   {
      //window.document.getElementById("sbbyinformer").style.fontSize = "";
      font_size = "";
   }
   else
   {
      //window.document.getElementById("sbbyinformer").style.fontSize = PX + "px";
      font_size = "<br>&nbsp\;&nbsp\;&nbsp\;font-size:" + PX + "px\;";
   }

   
}

function doFontFamily(FONT)
{
   if(FONT == "default")
   {
      FONT = "";
      font_family = "";
   }
   else
   {
      font_family = "<br>&nbsp\;&nbsp\;&nbsp\;font-family:" + FONT + "\;";
   }

   //window.document.getElementById("sbbyinformer").style.fontFamily = FONT;

   
}


function doUnderlineLinks()
{
   if(window.document.pickerform.underlinelinksbox.checked == true)
   {
      link_underline = "";
      window.document.getElementById("link").style.textDecoration = "underline";
      window.document.getElementById("link2").style.textDecoration = "underline";
      window.document.getElementById("vlink").style.textDecoration = "underline";
      window.document.getElementById("alink").style.textDecoration = "underline";
   }
   else
   {
      link_underline = " text-decoration:none\;";
      window.document.getElementById("link").style.textDecoration = "none";
      window.document.getElementById("link2").style.textDecoration = "none";
      window.document.getElementById("vlink").style.textDecoration = "none";
      window.document.getElementById("alink").style.textDecoration = "none";
   }

   
}




function backHelp()
{
   alert("Enter the full URL of an image.\nSomething like: http://www.mydomain.com/myback.jpg\n\nYou can of course use a relative URL, but make sure that your web page can find the image.");
}

function startMeUp()
{
   fillColorBoxes();
   chooserMode('back');
   setInitialColors();
   
   doFontSize("default");
}


