helpstat = false;
stprompt = true;
basic = false;

function thelp(swtch){
	if (swtch == 1){
		basic = false;
		stprompt = false;
		helpstat = true;
	} else if (swtch == 0) {
		helpstat = false;
		stprompt = false;
		basic = true;
	} else if (swtch == 2) {
		helpstat = false;
		basic = false;
		stprompt = true;
	}
}

function AddText(NewCode) {
document.form1.text.value+=NewCode
}

function email() {
	if (helpstat) {
		alert("*Parametro de Email \nFaça o seu próprio link de email." + "\n\n" + "*USE:" + "<a href=mailto:email>" + "*Endereço de email" + "</a>\n\n");
	} else if (basic) {
		AddTxt="<a href=mailto:></a>";
		AddText(AddTxt);
	} else { 
		txt2=prompt("*Texto que vai ser link." + "\n" + "*Deixe em branco se quiser o mesmo texto do link.",""); 
		if (txt2!=null) {
			txt=prompt("*Endereço de email.","alguem@algumlugar.com.br");
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="<a href=mailto:" + txt + ">"+txt+"</a>";
					AddText(AddTxt);
				} else {
					AddTxt="<a href=mailto:"+txt+">"+txt2+"</a>";
					AddText(AddTxt);
				}         
			} 
		}
	}
}
function showsize(size) {
	if (helpstat) {
		alert("*Código de tamanho determina o tamanho do texto. Valores devem ser entre 1 e 6." + "\n" + "*1 é para o menor tamanho e 6, o maior." + "\n\n" + "*USE:" + "[size="+size+"]" + "*Está e texto tamanho %s1%" + "[/size="+size+"]");
	} else if (basic) {
		AddTxt="[size="+size+"][/size="+size+"]";
		AddText(AddTxt);
	} else {                       
		txt=prompt("*Texto a modificar o tamanho %s1%" ,"Text"); 
		if (txt!=null) {             
			AddTxt="[size="+size+"]"+txt+"[/size="+size+"]";
			AddText(AddTxt);
		}        
	}
}

function bold() {
	if (helpstat) {
		alert("*O código para negrito  torna o texto contido nele negrito.\n\nUSE: <b>Texto em negrito</b>");
	} else if (basic) {
		AddTxt="<b></b>";
		AddText(AddTxt);
	} else {  
		txt=prompt("*Texto em NEGRITO.","Text");     
		if (txt!=null) {           
			AddTxt="<b>"+txt+"</b>";
			AddText(AddTxt);
		}       
	}
}

function italicize() {
	if (helpstat) {
		alert("*Para formatar o texto em itálico, use os códigos de itálico.\n\nUSE: <i>Texto em itálico</i>");
	} else if (basic) {
		AddTxt="<i></i>";
		AddText(AddTxt);
	} else {   
		txt=prompt("*Texto a formatar em itálico","Text");
		if (txt!=null) {           
			AddTxt="<i>"+txt+"</i>";
			AddText(AddTxt);
		}	        
	}
}

function quote() {
	if (helpstat){
		alert("*Usa-se o código de citação para referências a mensagens publicadas por outras pessoas.\n\nUSE: <quote>Esta é uma citação</quote>");
	} else if (basic) {
		AddTxt=" <quote> </quote>";
		AddText(AddTxt);
	} else {   
		txt=prompt("*Texto a ser formatado como citação","Text");     
		if(txt!=null) {          
			AddTxt=" <quote> "+txt+" </quote>";
			AddText(AddTxt);
		}	        
	}
}

function showcolor(color) {
	if (helpstat) {
		alert("*A cor do texto pode ser definida por código de cores. Qualquer cor nomeada pode ser usada." + "\n\n" + "*USE:" + "["+color+"]" + "*Texto em %s1%" + "[/"+color+"]");
	} else if (basic) {
		AddTxt="["+color+"][/"+color+"]";
		AddText(AddTxt);
	} else {  
     	txt=prompt("*Texto a ser %s1%","Text");
		if(txt!=null) {
			AddTxt="["+color+"]"+txt+"[/"+color+"]";
			AddText(AddTxt);        
		} 
	}
}

function center() {
 	if (helpstat) {
		alert("*Você pode centralizar texto com o código de centralizar." + "\n\n" + "*USE:" + "<center>" + "*Texto centralizado" + "</center>");
	} else if (basic) {
		AddTxt="<center></center>";
		AddText(AddTxt);
	} else {  
		txt=prompt("*Texto a ser centralizado","Text");
		if (txt!=null) {          
			AddTxt="<center>"+txt+"</center>";
			AddText(AddTxt);
		}	       
	}
}

function hyperlink() {
	if (helpstat) {
		alert("*Parametro de Hyperlink \nFaça o seu próprio link." + "\n\n" + "*USE:" + "<a href=link>" + "*http://www.site.com.br" + "</a>\n\n");
	} else if (basic) {
		AddTxt="<a href=></a>";
		AddText(AddTxt);
	} else { 
		txt2=prompt("*Texto que vai ser link." + "\n" + "*Deixe em branco se quiser o mesmo texto do link.",""); 
		if (txt2!=null) {
			txt=prompt("*URL para o link.","http://");
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="<a target=_new href=" + txt + ">"+txt+"</a>";
					AddText(AddTxt);
				} else {
					AddTxt="<a target=_new href=\""+txt+"\">"+txt2+"</a>";
					AddText(AddTxt);
				}         
			} 
		}
	}
}


function showcode() {
	if (helpstat) {
		alert("*A formatação de Código permite que você expresse comandos HTML dentro da página" + "\n" + "*USE:" + "<code>" + "*Texto formatado com code" + "</code>");
	} else if (basic) {
		AddTxt=" <code> </code>";
		AddText(AddTxt);
	} else {   
		txt=prompt("*Enter code","");
		if (txt!=null) {          
			AddTxt="<code>"+txt+"</code>";
			AddText(AddTxt);
		}	       
	}
}

function underline() {
  	if (helpstat) {
		alert("*Sublinhado." + "\n\n" + "*USE:" + "<u>" + "*Este texto está sublinhado" + "</u>");
	} else if (basic) {
		AddTxt="<u></u>";
		AddText(AddTxt);
	} else {  
		txt=prompt("*Texto para ser sublinhado","Text");     
		if (txt!=null) {           
			AddTxt="<u>"+txt+"</u>";
			AddText(AddTxt);
		}	        
	}
}

function showfont(font) {
 	if (helpstat){
		alert("*Font Tag Sets the font face for the enclosed text." + "\n\n" + "*USE:" +  "[font="+font+"]" + "*The font of this text is %s1%" + "[/font]");
	} else if (basic) {
		AddTxt="[font="+font+"][/font="+font+"]";
		AddText(AddTxt);
	} else {                  
		txt=prompt("*Text to be in %s1%","Text");
		if (txt!=null) {             
			AddTxt="[font="+font+"]"+txt+"[/font="+font+"]";
			AddText(AddTxt);
		}        
	}  
}
