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.inpost.inpost.value+=NewCode
}

function meiler() {
	if (helpstat) {
		alert("Email Tag\nTurns an email address into a mailto hyperlink.\nUSE: [email]someone@anywhere.com[/email]\nUSE: [email=someone@anywhere.com]link text[/email]");
	} else if (basic) {
		AddTxt="[email][/email]";
		AddText(AddTxt);
	} else { 
		txt2=prompt("Welcher Name soll angezeigt werden\nTragt Ihr hier nichts ein, steht dann direkt die email Adresse da",""); 
		if (txt2!=null) {
			txt=prompt("Bitte gebe Deine eMail Adresse ein.","name@domain.com");      
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="[email]"+txt+"[/email]";
                
				} else {
					AddTxt="[email="+txt+"]"+txt2+"[/email]";
				} 
				AddText(AddTxt);	        
			}
		}
	}
}


function showsize(size) {
	if (helpstat) {
		alert("Size Tag\\nSets the text size.\\nPossible values are 1 to 6.\\n 1 being the smallest and 6 the largest.\\nUSE: [size="+size+"]This is size "+size+" text[/size]");
	} else if (basic) {
		AddTxt="[size="+size+"][/size]";
		AddText(AddTxt);
	} else {                       
		txt=prompt("Text to be size "+size,"Text"); 
		if (txt!=null) {             
			AddTxt="[size="+size+"]"+txt+"[/size]";
			AddText(AddTxt);
		}        
	}
}

function showfont(font) {
 	if (helpstat){
		alert("Font Tag\\nSets the font face for the enclosed text.\\nUSE: [font="+font+"]The font of this text is "+font+"[/font]");
	} else if (basic) {
		AddTxt="[font="+font+"][/font]";
		AddText(AddTxt);
	} else {                  
		txt=prompt("Text to be in "+font,"Text");
		if (txt!=null) {             
			AddTxt="[font="+font+"]"+txt+"[/font]";
			AddText(AddTxt);
		}        
	}  
}


function bold() {
	if (helpstat) {
		alert("Bold Tag\nMakes the enlosed text bold.\nUSE: [b]This is some bold text[/b]");
	} else if (basic) {
		AddTxt="[b][/b]";
		AddText(AddTxt);
	} else {  
		txt=prompt("Bitte gebe den Text ein, der Fett geschrieben werden soll.","Text");     
		if (txt!=null) {           
			AddTxt="[b]"+txt+"[/b]";
			AddText(AddTxt);
		}       
	}
}

function italicize() {
	if (helpstat) {
		alert("Italicize Tag\nMakes the enlosed text italicized.\nUSE: [i]This is some italicized text[/i]");
	} else if (basic) {
		AddTxt="[i][/i]";
		AddText(AddTxt);
	} else {   
		txt=prompt("Bitte gebe den Text ein, der Kursiv geschrieben werden soll.","Text");     
		if (txt!=null) {           
			AddTxt="[i]"+txt+"[/i]";
			AddText(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[/quote]");
	} else if (basic) {
		AddTxt="\r[quote]\r[/quote]";
		AddText(AddTxt);
	} else {   
		txt=prompt("Gebe hier den zu zitierenden Text ein.","Text");     
		if(txt!=null) {          
			AddTxt="\r[quote]\r"+txt+"\r[/quote]";
			AddText(AddTxt);
		}	        
	}
}

function showcolor(color) {
	if (helpstat) {
		alert("Color Tag\nSets the text color.  Any named color can be used.\nUSE: [color="+color+"]This is some "+color+" text[/color]");
	} else if (basic) {
		AddTxt="[color="+color+"][/color]";
		AddText(AddTxt);
	} else {  
     	txt=prompt("Text to be "+color,"Text");
		if(txt!=null) {
			AddTxt="[color="+color+"]"+txt+"[/color]";
			AddText(AddTxt);        
		} 
	}
}

function move() {
	if (helpstat) {
		alert("Move Tag\\nMakes the enlosed text move.\\nUSE: [move]This is some bold text[/move]");
	} else if (basic) {
		AddTxt="[move][/move]";
		AddText(AddTxt);
	} else {  
		txt=prompt("Gebe hier den sich selbst bewegenden Text ein","Text");     
		if (txt!=null) {           
			AddTxt="[move]"+txt+"[/move]";
			AddText(AddTxt);
		}       
	}
}

function shadow() {
	if (helpstat) {
               alert("Shadow Tag\\nMakes the enclosed text shadowed.\\nUSE: [SHADOW=blue,225]This is the same shadowed text[/SHADOW=blue,225,400]");
	} else if (basic) {
		AddTxt="[glow][/glow]";
		AddText(AddTxt);
	} else { 
		txt2=prompt("What color,border and width should the text have ?","blue,255,400"); 
		if (txt2!=null) {
			txt=prompt("Gebe hier den zu schattierten Text ein","Text");
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="[SHADOW=blue,255]"+txt+"[/SHADOW]";
					AddText(AddTxt);
				} else {
					AddTxt="[SHADOW="+txt2+"]"+txt+"[/SHADOW]";
					AddText(AddTxt);
				}         
			} 
		}
	}
}

function glow() {
	if (helpstat) {
		alert("Glow Tag\\nMakes the enclosed text glowed.\\nUSE: [GLOW=red,2]This is the same shadowed [glow]text[/GLOW=red,2,400]");
	} else if (basic) {
		AddTxt="[glow][/glow]";
		AddText(AddTxt);
	} else { 
		txt2=prompt("What color,border and width should the text have ?","red,2,400"); 
		if (txt2!=null) {
			txt=prompt("Gebe hier den Text ein, der gluehen soll.","Text");      
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="[glow=red,2,400]"+txt+"[/glow]";
					AddText(AddTxt);
				} else {
					AddTxt="[glow="+txt2+"]"+txt+"[/glow]";
					AddText(AddTxt);
				}         
			} 
		}
	}
}

function center() {
 	if (helpstat) {
		alert("Centered tag\nCenters the enclosed text.\nUSE: [center]This text is centered[/center]");
	} else if (basic) {
		AddTxt="[center][/center]";
		AddText(AddTxt);
	} else {  
		txt=prompt("Gebe hier den zu zentrierenden Text ein.","Text");     
		if (txt!=null) {          
			AddTxt="\r[center]"+txt+"[/center]";
			AddText(AddTxt);
		}	       
	}
}

function hyperlink() {
	if (helpstat) {
		alert("Hyperlink Tag\nTurns an url into a hyperlink.\nUSE: [url]http://www.anywhere.com[/url]\nUSE: [url=http://www.anywhere.com]link text[/url]");
	} else if (basic) {
		AddTxt="[url][/url]";
		AddText(AddTxt);
	} else { 
		txt2=prompt("Welcher Name soll die Url haben ?\n Bleibt die Eingabe der, steht die URL da",""); 
		if (txt2!=null) {
			txt=prompt("Gebe nun die URL ein.","http://");      
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="[url]"+txt+"[/url]";
					AddText(AddTxt);
				} else {
					AddTxt="[url="+txt+"]"+txt2+"[/url]";
					AddText(AddTxt);
				}         
			} 
		}
	}
}

function image() {
	if (helpstat){
		alert("Image Tag\nGebe hier die URL fuer ein Bild ein.\nUSE: [img]http:\www.anywhere.comimage.gif[/img]");
	} else if (basic) {
		AddTxt="[img][/img]";
		AddText(AddTxt);
	} else {  
		txt=prompt("Insert the URL to the Image.","http://");    
		if(txt!=null) {            
			AddTxt="\r[img]"+txt+"[/img]";
			AddText(AddTxt);
		}	
	}
}

function showcode() {
	if (helpstat) {
		alert("Code Tag\nBlockquotes the text you reference and preserves the formatting.\nUsefull for posting code.\nUSE: [code]This is formated text[/code]");
	} else if (basic) {
		AddTxt="\r[code]\r[/code]";
		AddText(AddTxt);
	} else {   
		txt=prompt("Gebe hier einen Teil Rohcode ein.","");     
		if (txt!=null) {          
			AddTxt="\r[code]"+txt+"[/code]";
			AddText(AddTxt);
		}	       
	}
}

function flash() {
	if (helpstat) {
		alert("Flash Tag\\n [flash=200,50]urlzumfilm[/flash]");
	} else if (basic) {
		AddTxt="[flash][/flash]";
		AddText(AddTxt);
	} else { 
		txt2=prompt("Flash Tag\\n [flash=200,50]urlzumfilm[/flash]","breite,höhe"); 
		if (txt2!=null) {
			txt=prompt("Geb hier die URL zum FlashVideo ein ","URL");      
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="[flash]"+txt+"[/flash]";
                
				} else {
					AddTxt="[flash="+txt2+"]"+txt+"[/flash]";
				} 
				AddText(AddTxt);	        
			}
		}
	}
}

function list() {
	if (helpstat) {
		alert("List Tag\nBuilds a bulleted, numbered, or alphabetical list.\nUSE: [list]\n[*]item1\n[*]item2\n[*]item3\n[/list]");
	} else if (basic) {
		AddTxt="\r[list]\r[*]\r[*]\r[*]\r[/list]";
		AddText(AddTxt);
	} else {  
		txt=prompt("List type\n ('A' - alphabetisch, '1' - numerisch) Du kannst die Eingabe auch leer lassen","");               
		while ((txt!="") && (txt!="A") && (txt!="a") && (txt!="1") && (txt!=null)) {
			txt=prompt("ERROR!\nFalsche Eingabe, es geht nur 'leer', 'A' und '1'.","");               
		}
		if (txt!=null) {
			if (txt=="") {
				AddTxt="\r[list]\r\n";
			} else {
				AddTxt="\r[list="+txt+"]\r";
			} 
			txt="1";
			while ((txt!="") && (txt!=null)) {
				txt=prompt("Listen Eintrag:\nUm die Liste zu beenden, bitte leer lassen",""); 
				if (txt!="") {             
					AddTxt+="[*]"+txt+"\r"; 
				}                   
			} 
			AddTxt+="[/list]\r\n";
			AddText(AddTxt); 
		}
	}
}

function underline() {
  	if (helpstat) {
		alert("Underline Tag\nUnderlines the enclosed text.\nUSE: [u]This text is underlined[/u]");
	} else if (basic) {
		AddTxt="[u][/u]";
		AddText(AddTxt);
	} else {  
		txt=prompt("Gebe den zu unterstreichenden Text ein.","Text");     
		if (txt!=null) {           
			AddTxt="[u]"+txt+"[/u]";
			AddText(AddTxt);
		}	        
	}
}