//PLEASE FILL OUT THE FOLLOWING CUSTOMIZATION VARIABLES
//------------------------------------------------------------------------------------------

//ENTER THE LOCATION OF YOUR CLIPART DIRECTORY:
//EXAMPLE: var clipart_dir = "http://www.turismoitinerante.com.com/forum/clipart"
//DO -NOT- ADD A SLASH "/" AFTER THE WORD clipart!

var clipart_dir = "http://www.turismoitinerante.com/forum/clipart";

//SET THE WIDTH OF YOUR PANEL HERE
//USE EITHER PERCENTAGE OF PAGE WIDTH (95%, 50%, ETC) OR PIXELS (600px, 250px, etc)

var panel_width = "95%";

//SET THE BACKGROUND AND TEXT COLORS FOR YOUR PANEL HERE
//ACCEPTABLE VALUES ARE EITHER HEX CODE (#0080FF, 72EA2F, ETC) OR COMMON COLOR NAMES (BLACK, WHITE, ETC)

//BACKGROUND COLOR FOR WHOLE TABLE CONTAINING ALL SECTIONS OF THE PANEL
//NOTE - IT IS ONLY VISIBLE IN INTERNET EXPLORER
var bgc1 = "#3FBFFF";

//BACKGROUND AND TEXT COLORS FOR THE "PANEL MODE" RADION BUTTON SECTION
var bgc2 = "#DFEFFF";
var fnt2 = "RED";

//BACKGROUND AND TEXT COLORS FOR THE "SMILEY FACES" SECTION
var bgc3 = "#CFE5FF";
var fnt3 = "RED";

//BACKGROUND COLOR FOR THE CLICKABLE BUTTONS SECTION 
var bgc4 = "#80C0FF";

//BACKGROUND COLOR FOR THE DROP-DOWN LIST SECTION 
var bgc5 = "#DFEFFF";

//ENTER THE DEFAULT FONT FACE AND FONT COLOR FOR YOUR BOARD (FOUND IN 'BOARD MANAGER' IN ADMIN)

var d_face = "Comic Sans MS";
var d_color = "white";

//THIS VARIABLE WILL MAKE THE 'RAINBOW' TEXT LOOK BRIGHTER OR DARKER:
//IF YOUR BOARD BACKGROUND IS DARK, ENTER A VALUE BETWEEN 5 AND 8.
//IF YOUR BOARD BACKGROUND IS LIGHT, ENTER A NUMBER BETWEEN 1 AND 5.

var color_adjust = "5";

//END CUSTOMIZATION SECTION ----------------------------------------------------------------

//Format Panel SECTIONS:

//HEADER:
var f_header = 
         "<table border=0 cellpadding=5 cellspacing=2 width=" + panel_width + " bgcolor="+bgc1+"><tr bgcolor=" + bgc2 + "><td align=center>" + 
         "<font face="+d_face+" size=2 color="+fnt2+"><b>Modalita'&nbsp;&nbsp;&nbsp;</b>" + 
         
         "<input type='radio' name='mode' value='help' onClick='thelp(1)'>&nbsp;Help&nbsp;&nbsp;" + 
         "<input type='radio' name='mode' value='prompt' checked onClick='thelp(2)'>&nbsp;Full&nbsp;&nbsp;" + 
         "<input type='radio' name='mode' value='basic'  onClick='thelp(0)'>&nbsp;Basic&nbsp;&nbsp;" + 
         "<input type='radio' name='mode' value='nest'  onClick='thelp(4)'>&nbsp;Expert" +
	 "</td></tr>";
      
var smiley_list =
//SMILEY SECTION - ADD DESIRED SMILEY FACES HERE:

"<TR bgcolor=" + bgc3 + "><TD align='center'>" +
"<font face="+d_face+" size=2 color="+fnt3+"><b>Inserisci &nbsp;le &nbsp;faccine:</b><BR>" +

"<INPUT TYPE='radio' NAME='SF' VALUE='happy' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/happy.gif'>" +
"&nbsp;&nbsp;<INPUT TYPE='radio' NAME='SF' VALUE='sad' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/sad.gif'>" +
"&nbsp;&nbsp;<INPUT TYPE='radio' NAME='SF' VALUE='wink' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/wink.gif'>" +
"&nbsp;&nbsp;<INPUT TYPE='radio' NAME='SF' VALUE='lame' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/lame.gif'>" +
"&nbsp;&nbsp;<INPUT TYPE='radio' NAME='SF' VALUE='angry' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/angry.gif'>" +
"&nbsp;&nbsp;<INPUT TYPE='radio' NAME='SF' VALUE='crazy' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/crazy.gif'>" +
"&nbsp;&nbsp;<INPUT TYPE='radio' NAME='SF' VALUE='proud' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/proud.gif'>" +
"&nbsp;&nbsp;<INPUT TYPE='radio' NAME='SF' VALUE='confused' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/confused.gif'>" +
"&nbsp;&nbsp;<INPUT TYPE='radio' NAME='SF' VALUE='dead' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/dead.gif'>" +
"&nbsp;&nbsp;<INPUT TYPE='radio' NAME='SF' VALUE='cry' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/cry.gif'>" +
"&nbsp;&nbsp;<INPUT TYPE='radio' NAME='SF' VALUE='hyper' onClick='addsmiley(this.value)'><IMG src='" + clipart_dir + "/hyper.gif'>" +
"<BR>" +
"</td></tr>";

var f_panel =
//USE THIS SECTION TO ADD OR DELETE IMAGES AND THEIR FUNCTIONS:
         
         "<TR bgcolor="+bgc4+"><TD align='center'>" +

    	"<img src='" + clipart_dir + "/buttons/panel_left.gif'>" +
        "<img src='" + clipart_dir + "/buttons/panel.gif'>" +
         "<a href='javascript:center()' onMouseOver=\"window.status='Centered Text'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/center.gif' height=22 alt='Centered' border=0></a>" + 

         "<a href='javascript:bold()' onMouseOver=\"window.status='Bold Text'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/bold.gif' height=22 alt='Bold' border=0></a>" + 

         "<a href='javascript:italics()' onMouseOver=\"window.status='Italicized Text'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/italicize.gif' height=22 alt='Italics' border='0'></a>" + 

         "<a href='javascript:underline()' onMouseOver=\"window.status='Underlined Text'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/underline.gif' height=22 alt='Underline' border=0></a>" +

         "<a href='javascript:rgb()' onMouseOver=\"window.status='Color Text with RGB Value'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/rgb.gif' height=22 alt='Colora caratteri' border=0></a>" + 

         "<a href='javascript:link()' onMouseOver=\"window.status='Insert Hyperlink'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/url.gif' height=22 alt='Link' border=0></a>" + 

         "<a href='javascript:list()' onMouseOver=\"window.status='Insert List'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/list.gif' height='22' alt='Lista' border=0></a>" +

         "<a href='javascript:table()' onMouseOver=\"window.status='Insert Table'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/table.gif' height=22 alt='Tabella' border=0></a>" +

         "<a href='javascript:image()' onMouseOver=\"window.status='Insert an Image File'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/image.gif' height=22 alt='Immagine' border=0></a>" +

         "<a href='javascript:attach()' onMouseOver=\"window.status='Attach a File'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/attach.gif' height=22 alt='Allegato' border='0' ></a>" +

         "<a href='javascript:quote()' onMouseOver=\"window.status='Insert a Quote'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/quote.gif' height=22 alt='Citazione' border=0 ></a>" +

         "<a href='javascript:bracket()' onMouseOver=\"window.status='Insert Closing Bracket'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/bracket.gif' height=22 alt='Chiude parentesi' border='0'></a>" +

         "<a href='javascript:codecount()' onMouseOver=\"window.status='Check your formatting codes'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/codecheck.gif' height=22 alt='Check codice' border=0></a>" +

         "<a href='javascript:undo()' onMouseOver=\"window.status='Undo Last Action'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/undo.gif' height=22 alt='Annulla' border=0 ></a>" +

         "<a href='javascript:redo()' onMouseOver=\"window.status='Redo the Undone Action'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/redo.gif' height=22 alt='Ripristina' border=0 ></a>" +
   
         "<a href='javascript:fp_info()' onMouseOver=\"window.status='Get info on the Format Panel'; return true\" onMouseOut=\"window.status=''; return true\"><img src='" + clipart_dir + "/buttons/info.gif' alt='Info' border=0 height=22></a>" +
         "<img src='" + clipart_dir + "/buttons/panel.gif'>" +
         "<img src='" + clipart_dir + "/buttons/panel_right.gif'>" +
         "<br>" +   
    
//USE THIS SECTION TO ADD OR REMOVE FONT FACE OPTIONS:
	 "<TR bgcolor=" + bgc5 + "><TD align='center'>" +
         "<select name='font' onChange='fontface(this.options[this.selectedIndex].value)'>" + 
         "<option value='" + d_face + "' selected>Tipo di carattere</option>" + 
         "<option value='Arial'>Arial</option>" + 
         "<option value='Arial Black'>Arial Black</option>" + 
         "<option value='Book Antiqua'>Book Antiqua</option>" + 
         "<option value='Century Gothic'>Century Gothic</option>" + 
         "<option value='Comic Sans MS'>Comic Sans MS</option>" + 
         "<option value='Courier New'>Courier New</option>" + 
         "<option value='Impact'>Impact</option>" + 
         "<option value='Tahoma'>Tahoma</option>" + 
         "<option value='Times New Roman'>Times New Roman</option>" + 
         "<option value='Verdana'>Verdana</option>" + 
         "<option value='Lucida Console'>Lucida Console</option></select>&nbsp;&nbsp;&nbsp;" + 
//USE THIS SECTION TO ADD OR REMOVE FONT SIZE OPTIONS:
         "<select name='size' onChange='fontsize(this.options[this.selectedIndex].value)'>" + 
         "<option value='0' selected>Dimensione carattere</option>" +
         "<option value='-2'>-2 (molto piccolo)</option>" + 
         "<option value='-1'>-1 (piccolo)</option>" + 
         "<option value='0'>0 (medio)</option>" + 
         "<option value='1'>1 (grande)</option>" + 
         "<option value='2'>2 (molto grande)</option></select>&nbsp;&nbsp;&nbsp;" + 
//USE THIS SECTION TO ADD OR REMOVE FONT COLOR OPTIONS:
         "<select name='color' onChange='fontcolor(this.options[this.selectedIndex].value)'>" + 
         "<option value='default' selected>Colore carattere</option>" + 
         "<option value='black'>Nero</option>" + 
         "<option value='red'>Rosso</option>" + 
         "<option value='yellow'>Giallo</option>" +
         "<option value='green'>Verde</option>" + 
         "<option value='orange'>Arancio</option>" + 
         "<option value='purple'>Porpora</option>" + 
         "<option value='blue'>Blu</option>" +
         "<option value='cyan'>Ciano</option>" + 
         "<option value='white'>Bianco</option>" + 
         "<option value='gray'>Grigio</option>" +
	   "</select>" + 
         "<br>" + 
         "</TD></TR></table>";
      
//END FORMAT PANEL HTML OUTPUT SECTION.

//COMBINE HEADER, SMILEYS, AND BODY FOR OUTPUT:

var wholepanel = f_header + smiley_list + f_panel;

//SCRIPT FUNCTIONS ::  DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING!!
//IF YOU MESS THESE UP YOUR PANEL WILL NOT WORK!
//--------------------------------------------------------------------------------------

function fp_info() { 
if (helpstat) {
      alert("View Panel Info\nOpens a new window with a brief tutorial\non how to use the Format Panel functions.");
   } else {
var infowindir = clipart_dir+"/buttons/panel_info.html";
var InfoWin = window.open(infowindir,"Info_win","toolbar=no,location=no,menubar=no,scrollbars=yes,width=500,height=400,left=100,top=5,resizeable=no,status=no");
}
}

var helpstat = false;
var stprompt = true;
var basic = false;
var nest = false;
function thelp(swtch){
        if (swtch == 1){
                basic = false;
                stprompt = false;
                helpstat = true;
                nest = false;
        } else if (swtch == 0) {
                helpstat = false;
                stprompt = false;
                basic = true;
                nest = false;
        } else if (swtch == 2) {
                helpstat = false;
                basic = false;
                stprompt = true;
                nest = false;
        } else if (swtch == 4) {
                helpstat = false;
                basic = false;
                stprompt = false;
                nest = true;
        } else {
                helpstat = false;
                basic = false;
                stprompt = false;
                nest = false;
        }
}


function addcode(NewCode) {
	if (document.userpass) formid=document.userpass.message;
	else if (document.MF) formid=document.MF.message;
	else formid=document.forms[0].message;
mssg = formid.value;
formid.value+=NewCode;
formid.focus();
}

function addsmiley(sfname) {
    if (helpstat) {
      alert("Smiley Faces tag\nInserts code for desired smiley face.\nUSA: \\clipart{Name of Smiley}");
   } else {
      AddTxt="\\clipart{"+sfname+"}";
      addcode(AddTxt);
   }
}
function center() {
    if (helpstat) {
      alert("Centered tag\nCenters the enclosed text.\nUSA: \\c{Questo testo è centrato}");
   } else if (basic) {
      AddTxt="\\c{}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\c{";
      addcode(AddTxt);
   } else {  
      txt=prompt("Testo da centrare","Testo");     
      if (txt!=null) {          
         AddTxt="\\c{"+txt+"}";
         addcode(AddTxt);
      }          
   }
}
function bold() {
   if (helpstat) {
      alert("Bold Tag\nMakes the enlosed text bold.\nUSA: \\b{Questo è un testo grassetto}");
   } else if (basic) {
      AddTxt="\\b{}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\b{";
      addcode(AddTxt);
   } else {  
      txt=prompt("Testo da porre in grassetto.","Testo");     
      if (txt!=null) {           
         AddTxt="\\b{"+txt+"}";
         addcode(AddTxt);
      }       
   }
}
function italics() {
   if (helpstat) {
      alert("Italicize Tag\nMakes the enlosed text italicized.\nUSA: \\i{Questo è un testo in corsivo}");
   } else if (basic) {
      AddTxt="\\i{}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\i{";
      addcode(AddTxt);
   } else {   
      txt=prompt("Testo da porre in corsivo","Testo");     
      if (txt!=null) {           
         AddTxt="\\i{"+txt+"}";
         addcode(AddTxt);
      }           
   }
}
function underline() {
     if (helpstat) {
      alert("Underline Tag\nUnderlines the enclosed text.\nUSE: \\u{Questo testo è sottolineato}");
   } else if (basic) {
      AddTxt="\\u{}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\u{";
      addcode(AddTxt);
   } else {  
      txt=prompt("Testo da sottolineare.","Testo");     
      if (txt!=null) {           
         AddTxt="\\u{"+txt+"}";
         addcode(AddTxt);
      }           
   }
}
function bracket() {
   if (helpstat) {
      alert("Bracket Tag\nUsed with the Nesting function.\nCloses brackets when tags inserted into each other \nUSE: \\CODE{TEXT\\MORECODE{Brackets will follow->}}");
   } else if (basic) {
      AddTxt="}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="}";
      addcode(AddTxt);
   } else {   
      AddTxt="}";
      addcode(AddTxt);
   }
}
function quote() {
   if (helpstat){
      alert("Quote tag\nQuotes the enclosed text to reference something specific that someone has posted.\nUSE: \\quote{This is a quote}");
   } else if (basic) {
      AddTxt="\\quote{}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\quote{";
      addcode(AddTxt);
   } else {   
      txt=prompt("Testo da evidenziare","Testo");     
      if(txt!=null) {          
         AddTxt="\\quote{"+txt+"}";
         addcode(AddTxt);
      }           
   }
}
function rgb() {
   if (helpstat) {
      alert("RGB Tag\nCodici per colorare il testo.\nUSA: \\rgb{codice RGB, testo}");
   } else if (basic) {
      AddTxt="\\rgb{,}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\rgb{,";
      addcode(AddTxt);
   } else { 
      txt2=prompt("Text to be colored using rgb scale.\nLeave blank if you want to fill out the text later.",""); 
      if (txt2!=null) {
         txt=prompt("RGB Value for font.","");      
         if (txt!=null) {
            if (txt2=="") {
               AddTxt="\\rgb{"+txt+",}";
               addcode(AddTxt);
            } else {
               AddTxt="\\rgb{"+txt+","+txt2+"}";
               addcode(AddTxt);
            }         
         } 
      }
   }
}
function link() {
   if (helpstat) {
      alert("Hyperlink Tag\nTurns an url into a hyperlink.\nUSE: \\link{http://www.anywhere.com, descripton}");
   } else if (basic) {
      AddTxt="\\link{,}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\link{,";
      addcode(AddTxt);
   } else { 
      txt2=prompt("Text to be shown for the link.\nLeave blank if you want the url to be shown for the link.",""); 
      if (txt2!=null) {
         txt=prompt("URL for the link.","http://");      
         if (txt!=null) {
            if (txt2=="") {
               AddTxt="\\link{"+txt+","+txt+"}";
               addcode(AddTxt);
            } else {
               AddTxt="\\link{"+txt+","+txt2+"}";
               addcode(AddTxt);
            }         
         } 
      }
   }
}
function mail() {
   if (helpstat) {
      alert("Email Tag\nTurns an email address into a mailto hyperlink.\nUSE: \\mail{someone@anywhere.com, description}");
   } else if (basic) {
      AddTxt="\\mail{,}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\mail{,";
      addcode(AddTxt);
   } else { 
      txt2=prompt("Text to be shown for the link.\nLeave blank if you want the email address to be shown for the link.",""); 
      if (txt2!=null) {
         txt=prompt("Email address.","name@domain.com");      
         if (txt!=null) {
            if (txt2=="") {
               AddTxt="\\mail{"+txt+","+txt+"}";
            } else {
               AddTxt="\\mail{"+txt+","+txt2+"}";
            } 
            addcode(AddTxt);           
         }
      }
   }
}
function image() {
   if (helpstat){
      alert("Image Tag\nInserisce una immagine nel testo.\nUSA: \\image{nome immagine}");
   } else if (basic) {
      AddTxt="\\image{}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\image{";
      addcode(AddTxt);
   } else {  
      txt=prompt("Image description","-My Image-");    
      if(txt!=null) {            
         AddTxt="\\image{"+txt+"}";
         addcode(AddTxt);
      }   
   }
}
function attach() {
   if (helpstat){
      alert("Attach Tag\nInserisce un allegato al messaggio.\nUSA: \\attach{nome allegato}");
   } else if (basic) {
      AddTxt="\\attach{}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\attach{";
      addcode(AddTxt);
   } else {  
      txt=prompt("Attachment description","-My Attachment-");    
      if(txt!=null) {            
         AddTxt="\\attach{"+txt+"}";
         addcode(AddTxt);
      }   
   }
}

function fontface(font) {
    if (helpstat){
      alert("Font Tag\nIndica il tipo di carattere.\nUSA: \\font{La dimensione di questao carattere è "+font+"}");
   } else if (basic) {
      AddTxt="\\font{"+font+",}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\font{"+font+",";
      addcode(AddTxt);
   } else {                  
      txt=prompt("Text to be in "+font,"Text");
      if (txt!=null) {             
         AddTxt="\\font{"+font+","+txt+"}";
         addcode(AddTxt);
      }        
   }  
}
function fontsize(size) {
   if (helpstat) {
      alert("Size Tag\nIndica le dimensioni del carattere.\nValori da -2 a 2.\n -2 è molto piccolo e 2 molto grande.\nUSE: \\"+size+"{This is size "+size+" text}");
   } else if (basic) {
      AddTxt="\\"+size+"{}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\"+size+"{";
      addcode(AddTxt);
   } else {                       
      txt=prompt("Text to be size "+size,"Text"); 
      if (txt!=null) {             
         AddTxt="\\"+size+"{"+txt+"}";
         addcode(AddTxt);
      }        
   }
}
function fontcolor(color) {
   if (helpstat) {
      alert("Color Tag\nIndica il colore.  Nessuno dei colori indicati può essere usato.\nUSA: \\"+color+"{Questo è un colore "+color+" text}");
   } else if (basic) {
      if (color == "default") {
          AddTxt="\\rgb{"+d_color+",}";
          addcode(AddTxt);
          } else {
      AddTxt="\\"+color+"{}";
      addcode(AddTxt);
          }
   } else if (nest) {
      if (color == "default") {
          AddTxt="\\rgb{"+d_color+",";
          addcode(AddTxt);
          } else {
      AddTxt="\\"+color+"{";
      addcode(AddTxt);
          }
   } else {  
        txt=prompt("Text to be "+color,"Text");
      if(txt!=null) {
            if (color == "default") {
            AddTxt="\\rgb{"+d_color+","+txt+"}";
            addcode(AddTxt);
            } else {
         AddTxt="\\"+color+"{"+txt+"}";
         addcode(AddTxt);
            }       
      } 
   }
}
function table() {
   if (helpstat) {
      alert("Insert Table\nInizia il codice per inserire una tabella.\nUsa la virgola per separare le colonne.\nPremi Avvio per inserire una Riga.\nUSE: \\table{Questa è una colonna, altra colonna, ecc.}");
   } else if (basic) {
      AddTxt="\\table{}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\table{";
      addcode(AddTxt);
   } else {   
      alert("Inserisci Tabella non è disponibile in questa modalità.\nUsa la modalità Basic o Expert per inserire una tabella.");
      } 
   }
function list() {
   if (helpstat) {
      alert("Insert List\nBegins the code for inserting a list..\nPremi Invio per creare una nuova lista.\nUSE: \\list{text of list}");
   } else if (basic) {
      AddTxt="\\list{}";
      addcode(AddTxt);
   } else if (nest) {
      AddTxt="\\list{";
      addcode(AddTxt);
   } else {   
      alert("Insesci Lista non è disponibile in questa modalità.\nUsa Basic o Expert mode per inserire una lista.");
      } 
   }

var undone = "";
var mssg = "";

function undo() {

	if (document.userpass) formid=document.userpass.message;
	if (document.MF) formid=document.MF.message;
	else formid=document.forms[0].message;

   if (helpstat){
      alert("Undo Last\nRemoves last fomatting tag inserted with the Format Panel\nAND all text which follows it.");
   } else  {
   undone = formid.value;
      formid.value = mssg;          
   }
}
function redo() {

	if (document.userpass) formid=document.userpass.message;
	if (document.MF) formid=document.MF.message;
	else formid=document.forms[0].message;

   if (helpstat){
      alert("Redo Last\nRipristina l'ultimo codice inserito ed il relativo testo rimossi con la funzione Rimuovi.");
   } else  {
      formid.value = undone;          
   }
}

function rainbow() {

	if (document.userpass) formid=document.userpass.message;
	if (document.MF) formid=document.MF.message;
	else formid=document.forms[0].message;

if (helpstat) {
      alert("Rainbow Text\nColora ogni parola di un testo non formattato con un colore differente e casuale");
   } else {
rainfuller = formid.value;
rainbroke = rainfuller.indexOf("\\");
if (rainbroke != -1) {
alert("ARCOBALENO può essere usato solo con testo non formattato. \nIl tuo messaggio contiene testo formattato. \nARCOBALENO è stato annullato. \nPer usare RAINBOW, Rimuovi ogni formattazione \ndal tuo messaggio e riprova.");
}
else {
mssg = formid.value;
parts = mssg.split(" ");
verbose = parts.length;
restoredpost = "";
pass = 0;
n = 0;
ca = color_adjust;
while (pass != verbose) {
  R = Math.floor(Math.random() * 15) + ca;
      if (R == 10) R = "a";
      if (R == 11) R = "b";
      if (R == 12) R = "c";
      if (R == 13) R = "d";
      if (R == 14) R = "e";
      if (R == 15) R = "f";
  r = Math.floor(Math.random() * 15) + 1;
      if (r == 10) r = "a";
      if (r == 11) r = "b";
      if (r == 12) r = "c";
      if (r == 13) r = "d";
      if (r == 14) r = "e";
      if (r == 15) r = "f";
  G = Math.floor(Math.random() * 15) + ca;
      if (G == 10) G = "a";
      if (G == 11) G = "b";
      if (G == 12) G = "c";
      if (G == 13) G = "d";
      if (G == 14) G = "e";
      if (G == 15) G = "f";
  g = Math.floor(Math.random() * 15) + 1;
      if (g == 10) g = "a";
      if (g == 11) g = "b";
      if (g == 12) g = "c";
      if (g == 13) g = "d";
      if (g == 14) g = "e";
      if (g == 15) g = "f";
  B = Math.floor(Math.random() * 15) + ca;
      if (B == 10) B = "a";
      if (B == 11) B = "b";
      if (B == 12) B = "c";
      if (B == 13) B = "d";
      if (B == 14) B = "e";
      if (B == 15) B = "f";
  b = Math.floor(Math.random() * 15) + 1;
      if (b == 10) b = "a";
      if (b == 11) b = "b";
      if (b == 12) b = "c";
      if (b == 13) b = "d";
      if (b == 14) b = "e";
      if (b == 15) b = "f";
  color = "\\rgb{" + R + r + G + g + B + b + ",";
  restoredpost+= color + parts[n] + "} ";
  n++;
  pass++;
  }
formid.value = restoredpost;
  }
}
}
function codecount() {

	if (document.userpass) formid=document.userpass.message;
	if (document.MF) formid=document.MF.message;
	else formid=document.forms[0].message;

if (helpstat) {
      alert("Code Check\nScans your post for formatting elements, \nthen counts and lists them. \nUse as a quick check of your formatting.");
   } else {

   fuller = formid.value;
   flong = fuller.length;
   lastslash = fuller.lastIndexOf("\\");
   lastopen = fuller.lastIndexOf("{");
   lastclose = fuller.lastIndexOf("}");
   var stotal = 0;
   var ototal = 0;
   var ctotal = 0;
   var broke = -1;
   endln = "\n";
   spacer = "... ";
   stomper = 0;
   listing = "";
   count = 0;
   slash = 0;
   nm = 0;
   
   while (broke != lastslash) {
      broke = fuller.indexOf("\\",(broke + 1));
      stotal++;
      }
   broke = -1;
   while (broke != lastopen) {
      broke = fuller.indexOf("{",(broke + 1));
      ototal++;
      }
   broke = -1;
   while (broke != lastclose) {
      broke = fuller.indexOf("}",(broke + 1));
      ctotal++;
      }
   broke = -1;
   while (broke != lastslash) {
      broke = fuller.indexOf("\\",(broke + 1));
      stomper = broke + 10;
      if (stomper >= flong) {
         stomper = flong;
         }
	nm++;
	nn = nm + ".";
      code1 = fuller.substring(broke,stomper);
	code2 = nn + code1;
      code = code2 + "... ";
      count++;
      listing+=code;
   }
   if (count == 0) {
      listing = "NO CODES FOUND";
   }   
   alert("In your post:\nThere are " + stotal + " opening slashes '\\'.\nThere are " + ototal + " opening brackets '{'.\nThere are " + ctotal + " closing brackets '}'.\nThe following is a list of all format codes in your post:\n" + listing);
}
}


