function SymError()
	{
	return true;
	}
	window.onerror = SymError;

function pop(datei,name,breite,hoehe) { 
var posX=(screen.availWidth-breite)/2;
var posY=(screen.availHeight-hoehe)/2;
window.open(datei,name,"scrollbars=no,resizable=yes,width=" + breite + ",height=" + hoehe + "screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
}
function pop2(datei,name,breite,hoehe) { 
var posX=(screen.availWidth-breite)/2;
var posY=(screen.availHeight-hoehe)/2;
window.open(datei,name,"scrollbars=yes,width=" + breite + ",height=" + hoehe + "screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
}
function popup(datei,name,breite,hoehe) { 
var posX=(screen.availWidth-breite)/2;
var posY=(screen.availHeight-hoehe)/2;
window.open(datei,name,"scrollbars=yes,width=" + breite + ",height=" + hoehe + "screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
}

function download(datei,name,breite,hoehe) { 
var posX=(screen.availWidth-breite)/2;
var posY=(screen.availHeight-hoehe)/2;
window.open(datei,name,"toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,scrollbars=yes,width=" + breite + ",height=" + hoehe + "screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
}
function insert_smilie() {return;}
function DoSmilie(addSmilie) {var revisedMessage;var currentMessage = document.f.text.value;revisedMessage = currentMessage+addSmilie;document.f.text.value=revisedMessage;document.f.text.focus();
return;}



function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ 
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}


function popuptl(datei,name,breite,hoehe) { 
var posX=(screen.availWidth-breite)/0;
var posY=(screen.availHeight-hoehe)/0;
window.open(datei,name,"scrollbars=yes,width=" + breite + ",height=" + hoehe + "screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
}


function browser_max(win)
		{ 
    win.moveTo(0,0);
    win.resizeTo(screen.availWidth,screen.availHeight);
		}
function adminpop() {
  var w = screen.width-10;
  var l = 0;
  var h = screen.height - 60;
  var url = 'admin/login.php';
  var name = 'ADMINID';
  var features = 'scrollbars=no,status=no,toolbar=no,resizable=np,width='+w+',height='+h+',top=0,left='+l;
  var hwin = window.open(url,name,features);
  browser_max(hwin);
	
}

function gbild(name) {
  var winWidth = 640;
  var winHeight = 480;
  var w = (screen.width - winWidth)/2;
  var h = (screen.height - winHeight)/2 - 60;
  var url = 'engine/picview.php?pic='+name;
  var name = 'name';
  var features = 'scrollbars=yes,width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
  window.open(url,name,features);
}


function file(id,mirror) {
  var winWidth = 800;
  var winHeight = 600;
  var w = (screen.width - winWidth)/2;
  var h = (screen.height - winHeight)/2 - 60;
  var url = 'index.php?templateid=dl&dl='+id+'&mirror='+mirror;
  var name = 'id';
  var features = 'menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes,status=yes,location=yes,width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
  window.open(url,name,features);
}



	tag_prompt = "Bitte einen Text eingeben";
	font_formatter_prompt = "Geben Sie einen Text ein - ";
	link_text_prompt = "Email Adresse eingeben";
	poplink = "Adresse des Links";
	popimage = "Url des Bildes angeben";
	popemail = "Email Adesse eingeben";
	popurl= "Bitte URL angeben";
	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 = "cmscodemode="+modevalue+"; path=/; expires=Wed, 1 Jan 2100 00:00:00 GMT;";
	}
	
function normalmode(theform) {
	return true;
	}
	
function stat(thevalue) {
	document.bbform.status.value = eval(thevalue+"_text");
	}
	
function setfocus(theform) {
	theform.text.focus();
	}
	
var selectedText = "";
AddTxt = "";

function getActiveText(msg) {
	selectedText = (document.all) ? document.selection.createRange().text : document.getSelection();if (msg.createTextRange) msg.caretPos = document.selection.createRange().duplicate();return true;
	}
	
function AddText(NewCode,theform) {
	if (theform.text.createTextRange && theform.text.caretPos) {
		var caretPos = theform.text.caretPos;caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? NewCode + ' ' : NewCode;
		} else theform.text.value+=NewCode

AddTxt = "";setfocus(theform);
}

function cmscode(theform,cmscode,prompttext) {
	setfocus(theform);if ((normalmode(theform)) || (cmscode=="IMG")) {
		if (selectedText) var dtext=selectedText;
		else var dtext=prompttext;inserttext = prompt(tag_prompt+"\n["+cmscode+"] Text [/"+cmscode+"]",dtext);if ((inserttext != null) && (inserttext != ""))
		{ 
		AddTxt = "["+cmscode+"]"+inserttext+"[/"+cmscode+"]";AddText(AddTxt,theform);
		}
	} else {
			donotinsert = false;for (i = 0; i < tags.length; i++) {if (tags[i] == cmscode) donotinsert = true;}if (!donotinsert) {theform.text.value += "["+cmscode+"";arraypush(tags,cmscode);
			}
		}
		setfocus(theform);
	}

function namedlink(theform,thetype) {
	if (selectedText) { 
	var dtext=selectedText; 
	} else { 
	var dtext="http://";
	}
	
	linktext = prompt(popurl,dtext);
	var prompttext;
	prompt_text = popurl;
	prompt_contents = "http://";
	linkurl = "";
	
	if ((linktext != null) && (linktext != "")) {
	AddTxt = "[url]"+linktext+"[/url]";
	AddText(AddTxt,theform);
	} else { AddTxt = ""; AddText(AddTxt,theform);}
	}

function namedlink2(theform,thetype) {
	if (selectedText) { var dtext=selectedText; } else { var dtext="name@Domain.de"; }
	linktext = prompt(popurl,dtext);
	var prompttext;
	prompt_text = popurl;
	prompt_contents = "name@Domain.de";
	linkurl = "";
	if ((linktext != null) && (linktext != "")) {
	AddTxt = "[email]"+linktext+"[/email]";
	AddText(AddTxt,theform);
	} else { 
	AddTxt = ""; AddText(AddTxt,theform);
	}
}

function email(theform,thetype) {
		if (selectedText) { var dtext=selectedText; } else { var dtext=""; }
		linktext = prompt(link_text_prompt,dtext);
		var prompttext;
		prompt_text = popemail;
		prompt_contents = "";
		linkurl = "";
		if ((linktext != null) && (linktext != ""))
		{
			AddTxt = "[email]"+linktext+"[/email]";
			AddText(AddTxt,theform);
			} else{ 
			AddTxt = "[email]"+linktext+"[/email]"; AddText(AddTxt,theform);
			}
		}
		
		function makeimage(theform,cmscode,prompttext) {
			setfocus(theform);if ((normalmode(theform)) || (cmscode=="IMG"))
			{if (selectedText) var dtext=selectedText;
			else var dtext=prompttext;inserttext = prompt(popimage,dtext);if ((inserttext != null) && (inserttext != "")) { 
			AddTxt = "[img]"+inserttext+"[/img]\n";AddText(AddTxt,theform);
			}
		} else {
			donotinsert = false;for (i = 0; i < tags.length; i++) {if (tags[i] == cmscode) donotinsert = true;}if (!donotinsert) {theform.text.value += "<"+cmscode+"";arraypush(tags,cmscode);}}setfocus(theform);
			}

function smilie(thesmilie) {
	AddSmile = " "+thesmilie+" ";
	theform = f;
	AddText(AddSmile,theform);
}

var MessageMax  = "";
var Override    = "";
MessageMax      = parseInt(MessageMax);
if ( MessageMax < 0 ){
	MessageMax = 0;
	}

	
	var text_enter_url      = "Bitte die komplette URL angeben";
	var text_enter_url_name = "Bitte geben Sie den Titel der Webseite ein";
	var text_enter_image    = "Bitte geben Sie die komplette URL für das Bild an";
	var text_enter_email    = "Gib die E-Mail Adresse an";
	var text_code           = "Benutze: [CODE] Deinen Code hier.. [/CODE]";
	var text_quote          = "Benutze: [QUOTE] Dein Zitat hier.. [/QUOTE]";
	var error_no_url        = "Sie müssen eine URL eingeben";
	var error_no_title      = "Sie müssen einen Titel eingeben";
	var error_no_email      = "Sie müssen eine E-Mail Adresse eingeben";
	var error_no_width      = "Sie müssen eine Breite angeben";
	var error_no_height     = "Sie müssen eine Höhee angeben";
	var prompt_start        = "Bitte geben Sie den Text ein, welcher formatiert werden soll";
	
	var B_open = 0;
	var I_open = 0;
	var U_open = 0;
	var QUOTE_open = 0;
	var CODE_open = 0;
	var SQL_open = 0;
	var HTML_open = 0;

var bbtags   = new Array();



var myAgent   = navigator.userAgent.toLowerCase();
var myVersion = parseInt(navigator.appVersion);

var is_ie   = ((myAgent.indexOf("msie") != -1)  && (myAgent.indexOf("opera") == -1));
var is_nav  = ((myAgent.indexOf('mozilla')!=-1) && (myAgent.indexOf('spoofer')==-1)
                && (myAgent.indexOf('compatible') == -1) && (myAgent.indexOf('opera')==-1)
                && (myAgent.indexOf('webtv') ==-1)       && (myAgent.indexOf('hotjava')==-1));

var is_win   =  ((myAgent.indexOf("win")!=-1) || (myAgent.indexOf("16bit")!=-1));
var is_mac    = (myAgent.indexOf("mac")!=-1);



var allcookies = document.cookie;
var pos = allcookies.indexOf("bbmode=");

prep_mode();

function prep_mode()
{
	if (pos != 1) {
		var cstart = pos + 7;
		var cend   = allcookies.indexOf(";", cstart);
		if (cend == -1) { cend = allcookies.length; }
		cvalue = allcookies.substring(cstart, cend);
		
		if (cvalue == 'ezmode') {
			document.f.bbmode[0].checked = true;
		} else {
			document.f.bbmode[1].checked = true;
		}
	} 
	else {
	
		document.f.bbmode[1].checked = true;
	}
}

function setmode(mVal)
{
	document.cookie = "bbmode="+mVal+"; path=/; expires=Wed, 1 Jan 2020 00:00:00 GMT;";
}

function get_easy_mode_state()
{
	
	
	if (document.f.bbmode[0].checked) {
		return true;
	}
	else {
		return false;
	}
}



function hstat(msg){
	document.f.helpbox.value = eval( "help_" + msg );
	}


function cstat(){
	var c = stacksize(bbtags);
	
	if ( (c < 1) || (c == null) ) {
		c = 0;
	}
	
	if ( ! bbtags[0] ) {
		c = 0;
	}
	
	document.f.tagcount.value = c;
}


function stacksize(thearray)
{
	for (i = 0 ; i < thearray.length; i++ ) {
		if ( (thearray[i] == "") || (thearray[i] == null) || (thearray == 'undefined') ) {
			return i;
		}
	}
	
	return thearray.length;
}



function pushstack(thearray, newval)
{
	arraysize = stacksize(thearray);
	thearray[arraysize] = newval;
}



function popstack(thearray)
{
	arraysize = stacksize(thearray);
	theval = thearray[arraysize - 1];
	delete thearray[arraysize - 1];
	return theval;
}




function closeall()
{
	if (bbtags[0]) {
		while (bbtags[0]) {
			tagRemove = popstack(bbtags)
			document.f.text.value += "[/" + tagRemove + "]";
			

			
			if ( (tagRemove != 'FONT') && (tagRemove != 'SIZE') && (tagRemove != 'COLOR') )
			{
				eval("document.f." + tagRemove + ".value = ' " + tagRemove + " '");
				eval(tagRemove + "_open = 0");
			}
		}
	}
	

	document.f.tagcount.value = 0;
	bbtags = new Array();
	document.f.text.focus();
}



function emoticon(theSmilie)
{
	doInsert(" " + theSmilie + " ", "", false);
}

function add_code(NewCode)
{
    document.f.text.value += NewCode;
    document.f.text.focus();
}


function alterfont(theval, thetag)
{
    if (theval == 0)
    	return;
	
	if(doInsert("[" + thetag + "=" + theval + "]", "[/" + thetag + "]", true))
		pushstack(bbtags, thetag);
	
    document.f.ffont.selectedIndex  = 0;
    document.f.fsize.selectedIndex  = 0;
    document.f.fcolor.selectedIndex = 0;
	
}




function simpletag(thetag)
{
	var tagOpen = eval(thetag + "_open");
	
	if ( get_easy_mode_state() ) {
		inserttext = prompt(prompt_start + "\n[" + thetag + "]xxx[/" + thetag + "]");
		if ( (inserttext != null) && (inserttext != "") ) {
			doInsert("[" + thetag + "]" + inserttext + "[/" + thetag + "] ", "", false);
		}
	}
	else {
		if (tagOpen == 0) {
			if(doInsert("[" + thetag + "]", "[/" + thetag + "]", true)){
				eval(thetag + "_open = 1");
				eval("document.f." + thetag + ".value += '*'");
		
				pushstack(bbtags, thetag);
				cstat();
				hstat('click_close');
			}
		}
		else {
			lastindex = 0;
			
			for (i = 0 ; i < bbtags.length; i++ ) {
				if ( bbtags[i] == thetag ) {
					lastindex = i;
				}
			}
			
			while (bbtags[lastindex]) {
				tagRemove = popstack(bbtags);
				doInsert("[/" + tagRemove + "]", "", false)
				
				eval("document.f." + tagRemove + ".value = ' " + tagRemove + " '");
				eval(tagRemove + "_open = 0");
			}
			
			cstat();
		}
	}
}


function tag_list()
{
	var listvalue = "init";
	var thelist = "[LIST]\n";
	
	while ( (listvalue != "") && (listvalue != null) ) {
		listvalue = prompt(list_prompt, "");
		if ( (listvalue != "") && (listvalue != null) ) {
			thelist = thelist+"[*]"+listvalue+"\n";
		}
	}

	doInsert(thelist + "[/LIST]\n", "", false);
}

function tag_url()
{
    var FoundErrors = '';
    var enterURL   = prompt(text_enter_url, "http://");
    var enterTITLE = prompt(text_enter_url_name, "My Webpage");

    if (!enterURL) {
        FoundErrors += " " + error_no_url;
    }
    if (!enterTITLE) {
        FoundErrors += " " + error_no_title;
    }

    if (FoundErrors) {
        alert("Error!"+FoundErrors);
        return;
    }

	doInsert("[URL="+enterURL+"]"+enterTITLE+"[/URL]", "", false);
}

function tag_image()
{
    var FoundErrors = '';
    var enterURL   = prompt(text_enter_image, "http://");

    if (!enterURL) {
        FoundErrors += " " + error_no_url;
    }

    if (FoundErrors) {
        alert("Error!"+FoundErrors);
        return;
    }

	doInsert("[IMG]"+enterURL+"[/IMG]", "", false);
}

function tag_email()
{
    var emailAddress = prompt(text_enter_email, "");

    if (!emailAddress) { 
		alert(error_no_email); 
		return; 
	}

	doInsert("[EMAIL]"+emailAddress+"[/EMAIL]", "", false);
}

function doInsert(ibTag, ibClsTag, isSingle)
{
	var isClose = false;
	var obj_ta = document.f.text;

	if ( (myVersion >= 4) && is_ie && is_win) 
	{
		if(obj_ta.isTextEdit){ 
			obj_ta.focus();
			var sel = document.selection;
			var rng = sel.createRange();
			rng.colapse;
			if((sel.type == "Text" || sel.type == "None") && rng != null){
				if(ibClsTag != "" && rng.text.length > 0)
					ibTag += rng.text + ibClsTag;
				else if(isSingle)
					isClose = true;
	
				rng.text = ibTag;
			}
		}
		else{
			if(isSingle)
				isClose = true;
	
			obj_ta.value += ibTag;
		}
	}
	else
	{
		if(isSingle)
			isClose = true;

		obj_ta.value += ibTag;
	}

	obj_ta.focus();
	


	return isClose;
}	




function pnbox() {
  var winWidth = 580;
  var winHeight = 500;
  var w = (screen.width - winWidth)/2;
  var h = (screen.height - winHeight)/2 - 60;
  var url = 'index.php?templateid=pn';
  var name = 'id';
  var features = 'scrollbars=yes,toolbar=yes,resizable=yes,width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
  window.open(url,name,features);
}

function pnto(ato) {
  var winWidth = 580;
  var winHeight = 500;
  var w = (screen.width - winWidth)/2;
  var h = (screen.height - winHeight)/2 - 60;
  var url = 'index.php?templateid=pn&action=compose&an=' + ato;
  var name = 'id';
	location.href = url;
}

function emailto(ato) {
  var winWidth = 580;
  var winHeight = 400;
  var w = (screen.width - winWidth)/2;
  var h = (screen.height - winHeight)/2 - 60;
  var url = 'index.php?templateid=email&action=compose&an=' + ato;
  var name = 'id';
  location.href = url;

}

function checkpn()
{
if(document.f.betreff.value.length < 1){
alert("Bitte den Betreff eingeben");
document.f.betreff.focus();
return false;}

if(document.f.text.value.length < 1){
alert("Bitte Nachricht eingeben");
document.f.text.focus();
return false;}

}


function chkabo()
{
if(document.newsletter.nick.value==""){
alert("Bitte Name angeben");
document.newsletter.nick.focus();
return false;}

if(document.newsletter.nick.value.length < 3){
alert("Der Name muss mindestens 3 Zeichen lang sein");
document.newsletter.nick.focus();
return false;}

if(document.newsletter.mail.value==""){
alert("Bitte E-Mail angeben");
document.newsletter.mail.focus();
return false;}

if(document.newsletter.mail.value.indexOf('@') == -1){
alert("Bitte E-Mail angeben");
document.newsletter.mail.focus();
return false;}
}




function chks()
{
if(document.se.search.value.length < 4){
alert("Bitte mehr als 3 Zeichen in das Suchefeld eintragen");
document.se.search.focus();
return false;}

	if(document.se.search.value.indexOf('http://') != -1)
		{
				alert("Fehler!\nNach \"http://\" kann nicht gesucht werden.");
				document.se.search.focus();
				return false;
		}
		if(document.se.search.value.indexOf('www.') != -1)
		{
				alert("Fehler!\nNach \"www.\" kann nicht gesucht werden.");
				document.se.search.focus();
				return false;
		}
			if(document.se.search.value.indexOf('mailto') != -1)
		{
				alert("Fehler!\nNach \"mailto\" kann nicht gesucht werden.");
				document.se.search.focus();
				return false;
		}
}


function chks2()
{
if(document.sform.search.value.length < 4){
alert("Bitte mehr als 3 Zeichen in das Suchefeld eintragen");
document.sform.search.focus();
return false;}

	if(document.sform.search.value.indexOf('http://') != -1)
		{
				alert("Fehler!\nNach \"http://\" kann nicht gesucht werden.");
				document.sform.search.focus();
				return false;
		}
		if(document.sform.search.value.indexOf('www.') != -1)
		{
				alert("Fehler!\nNach \"www.\" kann nicht gesucht werden.");
				document.sform.search.focus();
				return false;
		}
			if(document.sform.search.value.indexOf('mailto') != -1)
		{
				alert("Fehler!\nNach \"mailto\" kann nicht gesucht werden.");
				document.sform.search.focus();
				return false;
		}
}




function checkbc()
{
if(document.bc.fupload.value.length <1){
alert("Das Feld darf nicht leer sein.");
document.bc.fupload.focus();
return false;}
}

function suchcheck()
{
if(document.f.search.value.length < 4){
alert("Bitte mehr als 3 Zeichen in das Suchefeld eintragen");
document.f.search.focus();
return false;}
}


function confirmLink(theLink, theSqlQuery)
{if (confirmMsg == '' || typeof(window.opera) != 'undefined') {return true;}
var is_confirmed = confirm(confirmMsg + '' + theSqlQuery);if (is_confirmed) {
theLink.href += '&is_js_confirmed=1';}return is_confirmed;}

function confirmLink2(theLink, theSqlQuery)
{if (confirmMsg2 == '' || typeof(window.opera) != 'undefined') {return true;}
var is_confirmed = confirm(confirmMsg2 + '' + theSqlQuery);if (is_confirmed) {
theLink.href += '&is_js_confirmed=1';}return is_confirmed;} 

function MM_callJS(jsStr) {
return eval(jsStr)
}

function SymError()
{return true;}
window.onerror = SymError;










