<!--
// *******************************************************
// Sprache ***********************************************
// *******************************************************
tag_prompt = "Gebe einen Text ein:";
font_formatter_prompt = "Gebe einen Text ein - ";
link_text_prompt = "Gebe einen Linknamen ein (optional).";
link_url_prompt = "Gebe die volle Adresse des Links ein.";
email_name_prompt = "Gebe hier einen (Nick-)Namen für die E-Mail-Adresse ein (optional).";
emailadress_prompt = "Gebe hier die volle E-Mail-Adresse OHNE WWW ein.";
img_align_prompt = "Gebe hier an, an welcher Stelle das Bild für einen Textumlauf platziert werden soll (optional).\nMÖGLICHKEITEN: left = links, right = rechts";
img_url_prompt = "Gebe die volle Adresse zu dem Bild an.";
wiki_text_prompt = "Gebe hier den Namen/Titel des Begriffes an der bei Wikipedia erklärt werden soll.\nACHTUNG: Der Artikel mit diesem Namen/Titel muss bei Wikipedia vorhanden sein!";
wiki_text2_prompt = "Gebe hier den Namen/Titel des Wikipedia-Artikels ein, wenn er nicht zum zu verlinkenden Begriff passt oder bei Wikipedia anders heißt. (optional)";
quote_name_prompt = "Gebe hier den Namen des Verfassers an, den Du zitieren willst.";
quote_text_prompt = "Gebe hier den zu zitierenden Text des Verfassers ein.";
link_email_prompt = "Gebe eine Email Adesse ein";
list_type_prompt = "Gebe das jeweilige Zeichen (ohne Anführungszeichen) für die Listenart an, die Du möchtest.\nListenarten: '1' = Nummerierte Liste, 'a' o. 'A' = Alphabetische Liste, 'i' o. 'I' Römisch nummerische Liste.\n\nHINWEIS: Wenn Du keinen der oben geführten Zeichen eingibst, so wird nur eine normale punktierte Liste angezeigt.";
list_item_prompt = "Gebe hier den Text für einen Listenpunkt ein.\nDurch die keine Eingabe von Text oder drücken von 'Cancel/Abbrechen' wird die Liste fertiggestellt.";
// *******************************************************

tags = new Array();

function getarraysize(thearray) 
{
	for (i = 0; i < thearray.length; i++) 
	{
  		if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null)) 
		{
			return i;
		}
 	}
 	
	return thearray.length;
}

function arraypush(thearray,value) 
{
	thearraysize = getarraysize(thearray);
 	thearray[thearraysize] = value;
}

function arraypop(thearray)
{
	thearraysize = getarraysize(thearray);
 	retval = thearray[thearraysize - 1];
 	delete thearray[thearraysize - 1];
 	return retval;
}

// *******************************************************

function setmode(modevalue) 
{
	document.cookie = "bbcodemode="+modevalue+"; path=/; expires=Wed, 1 Jan 2020 00:00:00 GMT;";
}

function stat(thevalue) 
{
	document.bbform.status.value = eval(thevalue+"_text");
}

function setfocus(bbform) 
{
	bbform.message.focus();
}

function closetag(bbform) 
{
	if (tags[0]) 
	{
		bbform.message.value += "[/"+ arraypop(tags) +"]";
	}
 
 	setfocus(bbform);
}

function closeall(bbform) 
{
	if (tags[0]) 
	{
   		while (tags[0]) 
		{
    		bbform.message.value += "[/"+ arraypop(tags) +"]";
   		}
   
   		bbform.message.value += " ";
  	}
 	
	setfocus(bbform);
}

// *******************************************************
var selectedText = "";
AddTxt = "";

function getActiveText(msg) 
{ 
 	selectedText = (document.all) ? document.selection.createRange().text : window.getSelection();
 	
	if (msg.createTextRange) 
	{
		msg.caretPos = document.selection.createRange().duplicate();
	}
	
	return true;
}

function AddText(NewCode,bbform) 
{
	if (bbform.message.createTextRange && bbform.message.caretPos) 
	{
  		var caretPos = bbform.message.caretPos;
  		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? NewCode + ' ' : NewCode;
 	} 
	else 
	{
		bbform.message.value+=NewCode
 		AddTxt = "";
 		setfocus(bbform);
	}
}

function bbcode(bbform,bbcode,prompttext) 
{
	setfocus(bbform);
  	
	if (selectedText) 
	{
		var dtext = selectedText;
	}
  	else
	{
		var dtext = prompttext;
	}
  
  	inserttext = prompt(tag_prompt+"\n["+bbcode+"]xxx[/"+bbcode+"]",dtext);
  	
	if ((inserttext != null) && (inserttext != "")) 
	{ 
   		AddTxt = "["+bbcode+"]"+inserttext+"[/"+bbcode+"] ";
   		AddText(AddTxt,bbform);
 	}
 	else 
	{
  		donotinsert = false;
  		
		for (i = 0; i < tags.length; i++) 
		{
   			if (tags[i] == bbcode) donotinsert = true;
  		}
  
  		if (!donotinsert) 
		{
   			bbform.message.value += "["+bbcode+"]";
   			arraypush(tags,bbcode);
  		}
 	}

	setfocus(bbform);
}

// *******************************************************

function fontformat(bbform,thevalue,thetype) 
{
	setfocus(bbform);
  	
	if (thevalue != 0) 
	{
   		if (selectedText) 
		{
			var dtext=selectedText;
		}
	}
	else
	{
		var dtext="";
	}
   	
	inserttext = prompt(font_formatter_prompt+" "+thetype,dtext);
   	
	if ((inserttext != null) && (inserttext != "")) 
	{
    	AddTxt = "["+thetype+"=\""+thevalue+"\"]"+inserttext+"[/"+thetype+"] ";
    	AddText(AddTxt,bbform);
 	}
 	else 
	{
  		bbform.message.value += "["+thetype+"="+thevalue+"]";
  		arraypush(tags,thetype);
 	}
 	
	bbform.sizeselect.selectedIndex = 0;
 	bbform.fontselect.selectedIndex = 0;
 	bbform.colorselect.selectedIndex = 0;
 	setfocus(bbform);
}

// *******************************************************

function namedlink(bbform,thetype) 
{
	if (selectedText) 
	{ 
		var dtext = selectedText; 
	} 
	else 
	{ 
		var dtext=""; 
	}
	
	linktext = prompt(link_text_prompt,dtext);
	var prompttext;
	
	if (thetype == "URL") 
	{
		prompt_text = link_url_prompt;
		prompt_contents = "http://";
	}
	else 
	{
		prompt_text = link_email_prompt;
		prompt_contents = "";
	}
	
	linkurl = prompt(prompt_text,prompt_contents);
	
	if ((linkurl != null) && (linkurl != "")) 
	{
		if ((linktext != null) && (linktext != "")) 
		{
			AddTxt = "["+thetype+"=\""+linkurl+"\"]"+linktext+"[/"+thetype+"] ";
			AddText(AddTxt,bbform);	
		}
		else
		{
			AddTxt = "["+thetype+"]"+linkurl+"[/"+thetype+"] ";
			AddText(AddTxt,bbform);
		}
	}
}

// *******************************************************

function namedemail(bbform,thetype) 
{
	if (selectedText) 
	{ 
		var dmail = selectedText; 
	} 
	else 
	{ 
		var dmail=""; 
	}
	
	emailname = prompt(email_name_prompt,dmail);
	var prompttext;
	
	prompt_text = emailadress_prompt;
	prompt_contents = "";
	
	emailadress = prompt(prompt_text,prompt_contents);
	
	if ((emailadress != null) && (emailadress != "")) 
	{
		if ((emailname != null) && (emailname != "")) 
		{
			AddTxt = "["+thetype+"=\""+emailadress+"\"]"+emailname+"[/"+thetype+"] ";
			AddText(AddTxt,bbform);	
		}
		else
		{
			AddTxt = "["+thetype+"]"+emailadress+"[/"+thetype+"] ";
			AddText(AddTxt,bbform);
		}
	}
}

// *******************************************************

function quote(bbform,thetype)
{
	quotename = prompt(quote_name_prompt);
	var prompttext;
	
	prompt_text = quote_text_prompt;
	prompt_contents = "";
	
	quotetext = prompt(prompt_text,prompt_contents);
	
	if ((quotename != null) && (quotename != "") && (quotetext != null) && (quotetext != ""))
	{
		AddTxt = "["+thetype+"=\""+quotename+"\"]"+quotetext+"[/"+thetype+"] ";
		AddText(AddTxt,bbform);
	}
}

// *******************************************************

function dolist(bbform) 
{
	listtype = prompt(list_type_prompt, "");
	
	if ((listtype == "a") || (listtype == "1")) 
	{
		thelist = "[list=\""+listtype+"\"]\n";
		listend = "[/list=\""+listtype+"\"] ";
	}
	else 
	{
		thelist = "[list]\n";
		listend = "[/list] ";
	}
	
	listentry = "initial";
	
	while ((listentry != "") && (listentry != null)) 
	{
		listentry = prompt(list_item_prompt, "");
	
		if ((listentry != "") && (listentry != null)) 
		{
			thelist = thelist+"[*]"+listentry+"[/*]\n";
		}
	}
	
	AddTxt = thelist+listend;
	AddText(AddTxt,bbform);
}

// *******************************************************

function smilie(thesmilie)
{
	AddSmile = " "+thesmilie+" ";
	bbform = document.bbform;
	AddText(AddSmile,bbform);
}

// *******************************************************

function wikipedia(bbform,thetype)
{
	if (selectedText) 
	{ 
		var dtext = selectedText; 
	} 
	else 
	{ 
		var dtext = ""; 
	}
	
	wikitext = prompt(wiki_text_prompt,dtext);
	var prompttext;
	
	prompt_text = wiki_text_prompt;
	prompt_text2 = wiki_text2_prompt;
	prompt_contents = "";
	
	wikitext2 = prompt(prompt_text2,prompt_contents);
	
	if ((wikitext != null) && (wikitext != "")) 
	{
		if ((wikitext2 != null) && (wikitext2 != "")) 
		{
			AddTxt = "["+thetype+"=\""+wikitext2+"\"]"+wikitext+"[/"+thetype+"] ";
			AddText(AddTxt,bbform);
			
		}
		else
		{
			AddTxt = "["+thetype+"]"+wikitext+"[/"+thetype+"] ";
			AddText(AddTxt,bbform);
		}
	}
}

// *******************************************************

function zoomarea(size)
{
	document.bbform.message.rows = document.bbform.message.rows + size;
}

// *******************************************************

function alignimage(bbform,thetype) 
{
	var dimg = "";
	
	imgalign = prompt(img_align_prompt,dimg);
	var prompttext;
	
	prompt_text = img_url_prompt;
	prompt_contents = "http://";
	
	imgurl = prompt(prompt_text,prompt_contents);
	
	if ((imgurl != null) && (imgurl != "")) 
	{
		if ((imgalign != null) && (imgalign != "")) 
		{
			AddTxt = "["+thetype+"=\""+imgalign+"\"]"+imgurl+"[/"+thetype+"] ";
			AddText(AddTxt,bbform);	
		}
		else
		{
			AddTxt = "["+thetype+"]"+imgurl+"[/"+thetype+"] ";
			AddText(AddTxt,bbform);
		}
	}
}

// *******************************************************

function reloadCaptcha()
{
	var capObj = document.getElementById('captcha');

	if (capObj)
	{
		capObj.src = capObj.src + (capObj.src.indexOf('?') > -1 ? '&' : '?') + Math.random();
	}
}

//-->

