basic = false;
stprompt = true;
helpstat = false;

function AddText(NewCode) {
document.info.dettaglio.value+=NewCode
}

function grassetto() {
	if (helpstat) {
		alert("Bold Tag Makes the enlosed text bold.\n\nUSE: [b]This is some bold text[/b]");
	} else if (basic) {
		AddTxt="<b></b>";
		AddText(AddTxt);
	} else {  
		txt=prompt("Inserisci il testo che vuoi formattato in grassetto","testo");     
		if (txt!=null) {           
			AddTxt="<b>"+txt+"</b>";
			AddText(AddTxt);
		}       
	}
}

function italicize() {
	if (helpstat) {
		alert("Italicize Tag Makes the enlosed text italicized.\n\nUSE: [i]This is some italicized text[/i]");
	} else if (basic) {
		AddTxt="<i></i>";
		AddText(AddTxt);
	} else {   
		txt=prompt("Inserisci il testo che vuoi formattato in corsivo","testo");     
		if (txt!=null) {           
			AddTxt="<i>"+txt+"</i>";
			AddText(AddTxt);
		}	        
	}
}

function quote() {
	if (helpstat){
		alert("Quote tag Quotes the enclosed text to reference something specific that someone has posted.\n\nUSE: [quote]This is a quote[/quote]");
	} else if (basic) {
		AddTxt=" <quote> </quote>";
		AddText(AddTxt);
	} else {   
		txt=prompt("Inserisci il testo che vuoi formattato come citazione","testo");     
		if(txt!=null) {          
			AddTxt=" <quote> "+txt+" </quote>";
			AddText(AddTxt);
		}	        
	}
}

function showcolor(color) {
	if (helpstat) {
		alert("Color Tag Sets the text color. Any named color can be used.\n\nUSE: ["+color+"]This is some "+color+" text[/"+color+"]");
	} else if (basic) {
		AddTxt="["+color+"][/"+color+"]";
		AddText(AddTxt);
	} else {  
     	txt=prompt("Inserisci il testo che vuoi formattato con il colore selezionato","testo");
		if(txt!=null) {
			AddTxt="<font color="+color+">"+txt+"</font>";
			AddText(AddTxt);        
		} 
	}
}


function showsize(px) {
	if (helpstat) {
		alert("Color Tag Sets the text color. Any named color can be used.\n\nUSE: ["+color+"]This is some "+color+" text[/"+color+"]");
	} else if (basic) {
		AddTxt="["+color+"][/"+color+"]";
		AddText(AddTxt);
	} else {  
     	txt=prompt("Inserisci il testo che vuoi formattato con il carattere selezionato","testo");
		if(txt!=null) {
			AddTxt="<font size="+px+">"+txt+"</font>";
			AddText(AddTxt);        
		} 
	}
}

function center() {
 	if (helpstat) {
		alert("Centered tag Centers the enclosed text.\n\nUSE: [center]This text is centered[/center]");
	} else if (basic) {
		AddTxt="<center></center>";
		AddText(AddTxt);
	} else {  
		txt=prompt("Inserisci il testo che vuoi formattato al centro","testo");     
		if (txt!=null) {          
			AddTxt="<center>"+txt+"</center>";
			AddText(AddTxt);
		}	       
	}
}

function acapo() {
 	if (helpstat) {
		alert("Centered tag Centers the enclosed text.\n\nUSE: [center]This text is centered[/center]");
	} else if (basic) {
		AddTxt="<center></center>";
		AddText(AddTxt);
	} else {  
			AddTxt="<br>";
			AddText(AddTxt);
	}
}


function hyperlink() {
	if (helpstat) {
		alert("Hyperlink Tag \nTurns an url into a hyperlink.\n\nUSE: [url]http://www.anywhere.com[/url]\n\nUSE: [url=http://www.anywhere.com]link text[/url]");
	} else if (basic) {
		AddTxt="[url][/url]";
		AddText(AddTxt);
	} else { 
		txt2=prompt("Inserisci il testo da collegare.",""); 
		if (txt2!=null) {
			txt=prompt("Inserisci l'indirizzo dove collegarsi ","http://");      
			if (txt!=null) {
				if (txt2=="") {
					AddTxt=txt;
					AddText(AddTxt);
				} else {
					AddTxt="<a target=_blank href="+txt+" target=_blank>"+txt2+"</a>";
					AddText(AddTxt);
				}         
			} 
		}
	}
}

function email() {
	if (helpstat) {
		alert("Hyperlink Tag \nTurns an url into a hyperlink.\n\nUSE: [url]http://www.anywhere.com[/url]\n\nUSE: [url=http://www.anywhere.com]link text[/url]");
	} else if (basic) {
		AddTxt="[url][/url]";
		AddText(AddTxt);
	} else { 
		txt2=prompt("Inserisci il testo da collegare.",""); 
		if (txt2!=null) {
			txt=prompt("Inserisci l'indirizzo dove inviare l'email ","");      
			if (txt!=null) {
				if (txt2=="") {
					AddTxt=txt;
					AddText(AddTxt);
				} else {
					AddTxt="<a href=mailto:"+txt+">"+txt2+"</a>";
					AddText(AddTxt);
				}         
			} 
		}
	}
}


function image() {
	if (helpstat){
		alert("Image Tag Inserts an image into the post.\n\nUSE: [img]http://www.anywhere.com/image.gif[/img]");
	} else if (basic) {
		AddTxt="[img][/img]";
		AddText(AddTxt);
	} else {  
		txt=prompt("Inserisci l'indirizzo dell'immagine web","http://");    
		if(txt!=null) {            
			AddTxt="<img src="+txt+">";
			AddText(AddTxt);
		}	
	}
}


function list() {
	if (helpstat) {
		alert("List Tag Builds a bulleted, numbered, or alphabetical list.\n\nUSE: [list] [*]item1[/*] [*]item2[/*] [*]item3[/*] [/list]");
	} else if (basic) {
		AddTxt=" [list][*]  [/*][*]  [/*][*]  [/*][/list]";
		AddText(AddTxt);
	} else {  
		type=prompt("Scrivi \'A\' per elenco Alfabetico, \'1\' per elenco numerico, invio per non ordinato.","");               
		while ((type!="") && (type!="A") && (type!="a") && (type!="1") && (type!=null)) {
			txt=prompt("ERROR! The only possible values for type of list are blank 'A' and '1'.","");               
		}
		if (type!=null) {
			if (type=="") {
				AddTxt="<ul>";
			} else {
				AddTxt="<ul="+type+">";
			} 
			txt="1";
			while ((txt!="") && (txt!=null)) {
				txt=prompt("Scrivi punto dell'elenco, per terminare invio senza testo",""); 
				if (txt!="") {             
					AddTxt+="<li>"+txt+"</li>"; 
				}                   
			} 
			if (type=="") {
				AddTxt+="</ul> ";
			} else {
				AddTxt+="</ul>";
			} 
			AddText(AddTxt); 
		}
	}
}

function underline() {
  	if (helpstat) {
		alert("Underline Tag Underlines the enclosed text.\n\nUSE: [u]This text is underlined[/u]");
	} else if (basic) {
		AddTxt="<u></u>";
		AddText(AddTxt);
	} else {  
		txt=prompt("Inserisci il testo che vuoi sottolineato","testo");     
		if (txt!=null) {           
			AddTxt="<u>"+txt+"</u>";
			AddText(AddTxt);
		}	        
	}
}