function Toggle(item){
	obj=document.getElementById(item);
	visible=(obj.style.display!="none")
	key=document.getElementById("x" + item);
	if (visible){
		obj.style.display="none";
		key.innerHTML="[+] " + item;
	} 
	else{
		obj.style.display="block";
		key.innerHTML="[-] " + item;
	}
}

function clearValue(name){
	document.getElementById(name).value="";
}

function fillValue(name, wert){
	if (document.getElementById(name).value==""){
		document.getElementById(name).value=wert;
	}
}

function addSmilie(smilie){
	area=document.getElementById("msg");
	area.focus();
	if(document.selection){
		document.selection.createRange().text = smilie;
	}
	else if(window.getSelection) {
		area.value = area.value.slice(0,area.selectionStart) +" "+ smilie +" "+	area.value.slice(area.selectionEnd, area.textLength);
	}
	else{
		area.value+=smilie+" ";
	}
}

function addForumTag(bbcode){
	var textarea = document.getElementById("msg");
	var	selection = textarea.value.substring(textarea.selectionStart, textarea.selectionEnd);
	var	text = "[" + bbcode + "]" + selection + "[/" + bbcode + "]";
	  
	textarea.value = textarea.value.substring(0, textarea.selectionStart) + text + textarea.value.substring(textarea.selectionEnd);
	  
	textarea.focus();
}

function addForumTagColor(color){
	var textarea = document.getElementById("msg");
	var	selection = textarea.value.substring(textarea.selectionStart, textarea.selectionEnd);
	var	text = "[color=" + color + "]" + selection + "[/color]";
	  
	textarea.value = textarea.value.substring(0, textarea.selectionStart) + text + textarea.value.substring(textarea.selectionEnd);
	  
	textarea.focus();
}

function showTagHint(hint){
	document.getElementById("taghint").value=hint;
}

function showColorHint(){
	document.getElementById("taghint").value="Schriftfarbe: [color=red]Text[/color]  Tipp: Du kannst auch color=#FF0000 benutzen";
}

function removeTagHint(){
	document.getElementById("taghint").value="Formatierungstipp";
}
