var ie;
					if (navigator.appName == "Microsoft Internet Explorer"){
						ie = true;
					}else{
						ie = false;
					}
					
					function txt2bb(Formular,Action){
					var selected = '';
					selected = getSelected(Formular);
			
					switch (Action){
						case "url":
							if (selected == ''){
								selected = prompt('Gib einen Namen für den Link ein.','');
								selected2 = prompt('Gib die Link-Adresse ein.','http://');
								selected = "[url="+selected2+"]"+selected+"[/url]";
								if (selected2 != "" && selected2 != null){
									insertText(Formular,selected);
								}
								return;
							}
							
							if (selected){
								selected = "[url]"+selected+"[/url]";
								insertText(Formular,selected);
							}
						break;
						case "email":
							if (selected == ''){
								selected = prompt('Gib einen Namen für den Email-Link ein.','');
								selected2 = prompt('Gib die Email-Adresse ein.','');
								selected = "[email="+selected2+"]"+selected+"[/email]";
								if (selected2 != "" && selected2 != null){
									insertText(Formular,selected);
								}
								return;
							}
							
							if (selected){
								selected = "[email]"+selected+"[/email]";
								insertText(Formular,selected);
							}
						break;
						case "list":
							var list_array = new Array();
							var item = true;
							
							while (item != "" && item != null){
								item = prompt('Gib einen Listenpunkt ein.','');
								if (item != "" && item != null){
									list_array.push('[li]' + item + '[/li]\n');
								}
							}
							insertText(Formular,'[ul]\n' + list_array.join('') + '[/ul]\n');
						break;
						default:
							if (selected == ''){
								selected = prompt('['+Action+'] ... [/'+Action+']','');
							}
							
							if (selected){
								selected = '['+Action+']'+selected+'[/'+Action+']';
								insertText(Formular,selected);
							}
						break;			
					}
				}
				
				function smilie2bb(Formular,Action){
					insertText(Formular,Action);
				}
				
				function insertText (Formular,str){
					selected = '';
					msg = Formular.message;
					msg.focus();
					
					if (ie){
						var sel = document.selection;
						var rng = sel.createRange();
						rng.colapse;
						
						rng.text = str;		
					}else{
						msg.focus();
						start=msg.selectionStart;
						end=msg.textLength;
						endtext=msg.value.substring(msg.selectionEnd,end);
						starttext=msg.value.substring(0,start);
						msg.value=starttext + str + endtext;
						msg.selectionStart=start;
						msg.selectionEnd=start;
						
						msg.selectionStart = msg.selectionStart + str.length;
					}
				}
				function getSelected(Formular){
					selected = '';
					msg = Formular.message;
					
					if (ie){
						msg.focus();
						var sel = document.selection;
						var rng = sel.createRange();
						rng.colapse;
						
						if((sel.type == 'Text' || sel.type == "None") && rng != null){
							if(rng.text.length > 0) selected = rng.text;
						}
					}else{
						selected = msg.value.substring(msg.selectionStart,msg.selectionEnd);
					}
					return(selected);
				}
				
				function maxChars(Formular,intval){
					var msg = Formular.message;
					var chars = msg.value.length;
					
					if (chars > intval){
						document.getElementById("counter").innerHTML = "<span style=\"color: red;\">" + chars + "</span>";
					}else{
						document.getElementById("counter").innerHTML = chars;
					}
					return;
				}
