function btn_disable (element, formular, text) {	element.disabled=true;	element.value=text;	document.forms[formular].submit();}function FormImagePreview (action) {	var img = CSGetImage(action[3]);	var field = document.forms[action[1]].elements[action[2]];	if (img && field && field.value != '') {		var image_types = ','+action[5]+',';		var extension = ','+(field.value.substr(field.value.lastIndexOf(".")+1)).toLowerCase()+',';		if (image_types.indexOf (extension) >= 0)			img.src = "file://"+field.value;		else			img.src = action[4];	}}function cookie_write (n, w, e) {	var a = new Date();	a = new Date(a.getTime() +e);	document.cookie = n+'='+w+';path=/;expires='+a.toGMTString()+';';}function cookie_read(n) {	a = document.cookie;	res = '';	while (a != '') {		while (a.substr(0,1) == ' ') {			a = a.substr(1,a.length);		}		cookiename = a.substring(0,a.indexOf('='));		if (a.indexOf(';') != -1) {			cookiewert = a.substring(a.indexOf('=')+1,a.indexOf(';'));		}		else {			cookiewert = a.substr(a.indexOf('=')+1,a.length);		}		if (n == cookiename) {			res = cookiewert;		}		i = a.indexOf(';')+1;		if (i == 0) {			i = a.length		}		a = a.substring(i,a.length);	}	return(res)}// blink when new messagefunction message_blink () {	if (typeof(blink) == "undefined")		blink = 1;	if (blink == 1) {		 		$("nav_message").style.color = "#FF3333";		blink = 0;	}	else {		$("nav_message").style.color = "#000000";		blink = 1;	}}function insert_emoticon (emoticon) {	doc = document;	f = doc.getElementById('message');		if (f==null) {		doc = opener.document;		f = doc.getElementById('message');	}	if (f==null) {		doc = opener.document;		f = doc.getElementById('chat_message_box');	}		if (f!=null) {		if (doc.all) { // IE			f.focus();			doc.selection.createRange().text = doc.selection.createRange().text + emoticon;		}		else { // OTHER			var s = f.selectionStart;			var e = f.selectionEnd;				var selection = emoticon + f.value.substring(s, e);				f.value = f.value.substring(0, s) + selection + f.value.substring(e);			f.focus();			f.selectionStart = f.selectionEnd = s + emoticon.length;		}	}}// edit_threadfunction format_text (textarea, tag, param, unclose) {	f = $(textarea);	if (param)		param = "='"+param+"'";	else		param = "";	if (document.all) { // IE		f.focus();				if (!unclose)			document.selection.createRange().text='['+tag+param+']'+document.selection.createRange().text+'[/'+tag+']';		else			document.selection.createRange().text='['+tag+param+' /]'+document.selection.createRange().text;	}	else { // NS		var s = f.selectionStart;		var e = f.selectionEnd;			if (!unclose) {			var selection = '['+tag+param+']' + f.value.substring(s, e)+'[/'+tag+']';			new_sel_tag = (tag.length*2+5);		}		else {			var selection = '['+tag+param+' /]' + f.value.substring(s, e);			new_sel_tag = (tag.length+4);		}					f.value = f.value.substring(0, s) + selection + f.value.substring(e);		f.focus();		f.selectionStart = s;		f.selectionEnd = e + new_sel_tag + param.length;	}}	function add_url (textarea) {	input = window.prompt("Bitte gebe eine URL ein.", "http://");	if (input && input!='http://')		format_text (textarea, "URL", input);}// ========== CHAT =============function getHTTPObject() {	var xmlHttp = false;		//... Internet Explorer	try {		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");	} catch(e) {		try {			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");		} catch(e) {			xmlHttp = false;		}	}	//... Mozilla, Opera, Safari etc.	if (!xmlHttp  && typeof(XMLHttpRequest) != 'undefined') {		xmlHttp = new XMLHttpRequest();	}return xmlHttp;}function scrollDown() {	$("chat_textbox").scrollTop = $("chat_textbox").scrollHeight - $("chat_textbox").offsetHeight;}function loadChatData(action) {	if (chat_stat == true || action == 'get_user') {		var date = new Date();		var xmlHttpChat = getHTTPObject();		if (xmlHttpChat) {			if (action == "get_chat_small") {				xmlHttpChat.open("GET", "/public/chat/small.html?cache="+date.getTime(), true);			}			else if (action == "get_chat_big") { 				xmlHttpChat.open("GET", "/public/chat/big.html?cache="+date.getTime(), true);			}			else if (action == "get_user") {				xmlHttpChat.open("GET", "/public/chat/online.html?cache="+date.getTime(), true);			}			xmlHttpChat.onreadystatechange = function () {				if (xmlHttpChat.readyState == 4 && xmlHttpChat.responseText) {					text = xmlHttpChat.responseText;										if (action == "get_user") {						if (last_userlist != text) {							$("userlist").innerHTML = text;							last_userlist = text;						}					}					else if (action == "get_chat_small" || action == "get_chat_big") { 						//if (last_chat_textbox != text) {							$("chat_textbox").innerHTML = text;							last_chat_textbox = text;						//}					}				}			}			xmlHttpChat.send(null);		}	}}function saveChatData(text_elem) {	if (chat_stat == true) {		if ($(text_elem).value) {			var xmlHttpSave = getHTTPObject();			if (xmlHttpSave) {				xmlHttpSave.open('POST', "/chatdata");				xmlHttpSave.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');				xmlHttpSave.send("text="+$(text_elem).value.replace(/\&/,"[AND]")+"&action=set_chat");			}			$(text_elem).value = '';			$(text_elem).focus();		}	}}function displayChatArea (showhide) {	if ($('chat_area') != undefined) {		if (showhide == false)			$('chat_area').style.display = 'none';		else			$('chat_area').style.display = '';	}}function saveChatStatus(checkbox) { 	var xmlHttpSave = getHTTPObject();	if (xmlHttpSave) {		xmlHttpSave.open('POST', "/chatdata");		xmlHttpSave.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		chat_stat = checkbox.checked;		displayChatArea(chat_stat);		xmlHttpSave.send("status="+chat_stat+"&action=set_chat_status");		window.setTimeout("loadChatData('get_user')", 100);	}}function announceChat() { 	var xmlHttpSave = getHTTPObject();	if (xmlHttpSave) {		xmlHttpSave.open('POST', "/chatdata");		xmlHttpSave.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		xmlHttpSave.send("action=announce");	}}function initChat (chattype, chatstatus) {	last_chat_textbox = "";	last_userlist = "";	chat_stat = chatstatus;		get_user_interval = 10*1000;	get_chat_interval = 2*1000;	get_announce_interval = 4*60*1000;		window.setInterval("loadChatData('get_user')", get_user_interval);	//window.setInterval("loadChatData('get_chat_"+chattype+"')", get_chat_interval);	window.setInterval("announceChat()", get_announce_interval);}//MESSAGE_DEL_CONFORMfunction del_message(id) {	check_confirm = confirm("Sind Sie sicher, dass Sie diese Nachricht entfernen wollen?");	if(check_confirm == true)		location.href="/messages/?confirm_delete=true&id="+id;}function del_sent_message(id) {	check_confirm = confirm("Sind Sie sicher, dass Sie diese Nachricht entfernen wollen?");	if(check_confirm == true)		location.href="/messages/sent/?confirm_delete=true&id="+id;}//GUESTBOOK_DEL_CONFORMfunction del_guestbook(id) {	check_confirm = confirm("Sind Sie sicher, dass Sie diesen Eintrag entfernen wollen?");	if(check_confirm == true)		location.href="/profile/?confirm_delete=true&del_id="+id;}// QUEST_EDITOR DEL_QUESTfunction del_quest(id) {	check_confirm = confirm("Soll die Frage wirklich entfernt werden?");	if(check_confirm == true)		location.href="/questions/?confirm_delete="+id;}function searchfield_color(field) {	if ($(field).value != "" && $(field).value != "0") {		$(field).style.background="#0b8fe8";		$(field).style.color="white";	}}function switch_quest_type (type) {	if (type == 3) {		$("bonus_image1").style.display='';		$("bonus_image2").style.display='';		$("bonus_audio1").style.display='none';		$("bonus_audio2").style.display='none';	}	else if (type == 2) {		$("bonus_image1").style.display='none';		$("bonus_image2").style.display='none';		$("bonus_audio1").style.display='';		$("bonus_audio2").style.display='';	}	else {		$("bonus_image1").style.display='none';		$("bonus_image2").style.display='none';		$("bonus_audio1").style.display='none';		$("bonus_audio2").style.display='none';	}}	// IEFLASHFIXfunction ieflashfix (code) {	document.write (code);}// cat check allfunction cat_check_init () {	count_checked = 0;		count_all = 0;	for (i=0; $("cat_"+i)!=null; i++)		count_all++;}function cat_check_all (element) {	if (typeof(count_checked)=='undefined' || typeof(count_all)=='undefined')		cat_check_init();		for (i=0; $("cat_"+i)!=null; i++) {				if (eval(element).checked == true) {			$("cat_"+i).checked = true;			count_checked++;		}		else			$("cat_"+i).checked = false;	}}function cat_check_one (element) {	if (undefined===count_checked || undefined===count_all)		cat_check_init();			if (eval(element).checked == true)		count_checked++;	else		count_checked--;		if (count_checked == count_all)		$("cat_all").checked = true;	else		$("cat_all").checked = false;}function youtube_preload (id) {	elem = $('movieholder');	elem.innerHTML = '<object width="230" height="195"><param name="movie" value="http://www.youtube.com/v/'+id+'&hl=de&fs=1&rel=0&color1=0xe1600f&color2=0xfebd01&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+id+'&hl=de&fs=1&rel=0&color1=0xe1600f&color2=0xfebd01&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="230" height="195"></embed></object>';}function youtube_display (type) {	elem = $('movieholder');	if (type=='hide') {		elem.innerHTML = '';		elem.style.visibility='hidden';	}	else if (type=='show') {		elem.style.visibility='visible';	}}function change_css(stylesheet) {	$('style_css').href = '/public/styles/'+stylesheet+'/style.css';}/*function subnav_roll (elem) {	if (typeof(roll_status)=='undefined') {		roll_status = new Array();		roll_status[1] = roll_status[2] = roll_status[3] = roll_status[4] = false;	}		for (i=1;i<=4;i++) {		if (roll_status[i] == true && i != elem) {			Effect.BlindUp('nav_'+i, {duration: 0.3});			roll_status[i] = false;		}	}		if (roll_status[elem] != true) {		setTimeout("Effect.BlindDown('nav_"+elem+"', {duration: 0.3})", 350);		roll_status[elem] = true;	}}*/function subnav_load () {	elem_old = 0;	if	(elem_cookie = cookie_read('nav_elem')) {		elem_old = elem_cookie;		//Effect.Appear('nav_'+elem_old, {duration: 0});	} }function subnav_roll (elem) {	if (elem != elem_old) {		Effect.Appear('nav_'+elem, {duration: 0.2});		for (i=1;i<=4;i++) {			if (i != elem) {				Effect.Fade('nav_'+i, {duration: 0.1});			}		}				elem_old = elem;		cookie_write('nav_elem', elem_old, 1000*60*60*24*365);	}}