	function hellsms(from, to, titel, text) {
		var height = 324;
		var width = 660;

		if (!from) {
			height = 470;
		}
		if (text) {
			height += 30;
		}

		var left = (screen.availWidth / 2) - (width / 2);
		var top = (screen.availHeight / 2) - (height / 2);

		window.open("/hellsms.php?site[1]=send&from="+ from +"&to=" + to +"&title="+ titel +"&text="+ text,"hellsms","width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + ",resizable=no,scrollbars=no");
	}


	function fileinfo(id) {
		var height = 312;
		var width = 660;
		var left = (screen.availWidth / 2) - (width / 2);
		var top = (screen.availHeight / 2) - (height / 2);

		window.open("/files.php?id="+ id, "File Infos", "width="+ width +", height="+ height +", top="+ top +", left="+ left +", resizable=no, scrollbars=yes");
	}


	function faq(id) {
		var height = 405;
		var width = 660;
		var left = (screen.availWidth / 2) - (width / 2);
		var top = (screen.availHeight / 2) - (height / 2);

		window.open("/faq.php?id="+ id, "FAQ", "width="+ width +", height="+ height +", top="+ top +", left="+ left +", resizable=no, scrollbars=yes");
	}





	function showHideElement(BoxId) {
		var element = $('swap_'+ BoxId);
		var pic = $('swap_pic_'+ BoxId);

		if(element) {
			if (element.style.display == 'none') {
				Effect.SlideDown(element, {duration: 0.5});
				pic.src = '/pics/-.gif';
			} else {
				Effect.SlideUp(element, {duration: 0.5});
				pic.src = '/pics/+.gif';
			}

			// Effect.toggle(element,'blind');
			/* if(Element.style.visibility == 'hidden') {
				Element.style.visibility = 'visible';
				Element.style.display = 'block';
			} else {
				Element.style.visibility = 'hidden';
				Element.style.display = 'none';
			} */
		}
	}




	function startdate(value) {
		var Element = document.getElementById("startdate");
		if (Element) {
			Element.value = value;
		}
	}




	function languageHover(name, pic) {
		document.images['lang_'+ name].src = '/pics/language/'+ pic;
		return;
	}




	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_setTextOfTextfield(objName, x, newText) {
		var obj = MM_findObj(objName);
		if (obj) {
			obj.value = newText;
		}
	}







	var x,y;

	Xoffset=10; // modify these values to...
	Yoffset=10; // change the popup position
	var skn=null;
	var hidden=true;
	var t;

	function popup_delayed(msg, bak, delay) {
		t = setTimeout("popup('"+ msg +"', '"+ bak +"')", delay);
	}

	function popup(msg,bak) {
		//msg = Base64.decode(msg);

		set_content("<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=1 "+
		"BGCOLOR="+bak+"><TD ALIGN=left id=welcome>"+msg+"</TD></TABLE>");
	}
	function set_content(content) {
		if (!skn) {
			return;
		}
		move_to(x,y);
		if (n4) {
			skn.document.write(content);
			skn.document.close();
			skn.visibility = "show";
		}
		else {
			skn.innerHTML=content;
			skn.style.visibility = "visible";
		}
		hidden = false;
	}
	function get_mouse(e) {
		if (!skn) {
			return;
		}
		x = ie?event.x+document.body.scrollLeft:e.pageX;
		y = ie?event.y+document.body.scrollTop:e.pageY;
		if (!hidden) {
			move_to(x,y);
		}
	}
	function kill() {
		clearTimeout(t);
		if (!skn) {
			return;
		}
		if (n4) {
			skn.visibility = "hide";
		}
		else {
			skn.style.visibility = "hidden";
		}
		hidden = true;
		move_to(-10000,-10000);
	}
	function move_to(x,y) {
		if (n4) {
			skn.left = x+Xoffset;
		}
		else {
			skn.style.left = (x+Xoffset)+"px";
		}
		if (n4) {
			skn.top = y+Yoffset;
		}
		else {
			skn.style.top = (y+Yoffset)+"px";
		}
	}

	var dom = document.getElementById&&document.captureEvents;
	var ie = document.all;
	var n4 = document.layers;

	if (dom || ie || n4) {
		if (ie){
			skn = document.all["hover"];
		} else if (n4){
			skn = document.layers["hover"];
		} else {
			skn = document.getElementById("hover");
		}
		if (dom || n4) {
			document.captureEvents(Event.MOUSEMOVE);
		}
		document.onmousemove = get_mouse;
	}







	function checkFilledComm(id){
		checkOk = true;

		//check Com dropDown
		com_tmpAr = document.getElementsByName("com_"+id);
		if(com_tmpAr.length > 0){
			com_dropDown = com_tmpAr[0];
			com_dropDown.setAttribute("class","");
			if(com_dropDown.value == "" || com_dropDown.value == null){
				checkOk = false;
				com_dropDown.setAttribute("class","wrongValue");
			}
		}else{
			checkOk = false;
		}

		//check comValue Textfield
		value_com_tmpAr = document.getElementsByName("value_com_"+id);
		if(value_com_tmpAr.length > 0){
			value_com_text = value_com_tmpAr[0];
			value_com_text.setAttribute("class","");
			if(value_com_text.value == "" || value_com_text.value == null){
				checkOk = false;
				value_com_text.setAttribute("class","wrongValue");
			}
		}else{
			checkOk = false;
		}

		//check show dropDown
		show_tmpAr = document.getElementsByName("show_"+id);
		if(show_tmpAr.length > 0){
			show_dropDown = show_tmpAr[0];
			show_dropDown.setAttribute("class","");
			if(show_dropDown.value == "" || show_dropDown.value == null){
				checkOk = false;
				show_dropDown.setAttribute("class","wrongValue");
			}
		}else{
			checkOk = false;
		}

		if(checkOk){
			addCommSel();
		}
	}

	function firstElementChild(child){
		child = child.firstChild;
		//runs thru the childs while type != 1 (element)
		for(tmpChild = child; tmpChild != null && tmpChild.nodeType != 1; tmpChild = tmpChild.nextSibling){
			//do nothing.
		}
		return tmpChild;
	}

	function addCommSel(){
		lastDiv = null;
		mainCommDiv = document.getElementById("communication_selection");
		if(mainCommDiv.lastChild.nodeType == 1){
			lastDiv = mainCommDiv.lastChild;
		}else if(mainCommDiv.lastChild.previousSibling.nodeType == 1){
			lastDiv = mainCommDiv.lastChild.previousSibling;
		}
		if(lastDiv != null){
			firstDropDown = firstElementChild(firstElementChild(lastDiv));
			id = firstDropDown.name.substr(firstDropDown.name.indexOf("_")+1,firstDropDown.name.length);
			newId = parseInt(id)+1;
			value_com_tmpAr = document.getElementsByName("value_com_"+id);
			if(value_com_tmpAr.length > 0){
				value_com_text = value_com_tmpAr[0];
				if(value_com_text.value != "" && value_com_text.value != null){

					//Prepare the new Line
					newFullDiv = document.createElement("div");
					newFullDiv.setAttribute("class","form_left_100");
					newLeftDiv = document.createElement("div");
					newLeftDiv.setAttribute("class","form_left_40");
					newRightDiv = document.createElement("div");
					newRightDiv.setAttribute("class","form_left_60");
						//generate com_ select
						newComSel = document.createElement("select");
						newComSel.setAttribute("name","com_"+newId);
						newComSel.setAttribute("onChange","checkFilledComm("+newId+");");
						newComSel.appendChild(document.createElement("option"));
						for(i = 0; i < commId.length; i++){
							newComOption = document.createElement("option");
							newComOption.setAttribute("value",commId[i]);
							newComOption.appendChild(document.createTextNode(commName[i]));
							newComSel.appendChild(newComOption);
						}
						newLeftDiv.appendChild(newComSel);

					newFullDiv.appendChild(newLeftDiv);
						//generate input
						newComInput = document.createElement("input");
						newComInput.setAttribute("type","text");
						newComInput.setAttribute("name","value_com_"+newId);
						newComInput.setAttribute("onChange","checkFilledComm("+newId+");");
						newRightDiv.appendChild(newComInput);
						//generate show_ select
						newShowSel = document.createElement("select");
						newShowSel.setAttribute("name","show_"+newId);
						newShowSel.setAttribute("onChange","checkFilledComm("+newId+");");
						for(i = 0; i < commShow.length; i++){
							newShowOption = document.createElement("option");
							newShowOption.setAttribute("value",commShow[i]);
							newShowOption.appendChild(document.createTextNode(commShowName[i]));
							newShowSel.appendChild(newShowOption);
						}
						newRightDiv.appendChild(newShowSel);
					newFullDiv.appendChild(newRightDiv);
					//insert the new line
					mainCommDiv.appendChild(newFullDiv);
				}
			}
		}
	}






	function dumpTable(kind, lang) {
		window.location = "/"+ lang +"/dump/"+ kind +"/"+ document.form.SBtable.value +"/";
	}
	function memberbeitrag(lang) {
		window.location = "/"+ lang +"/memberbeitrag/"+ document.form.kunde.value +"/";
	}


	var http_request = false;
	var load = '<center><img src="/pics/load.gif" /></center>';

	function soh_request(request_action, para){
	//	alert('asdf');

	    if(window.XMLHttpRequest){
	        http_request = new XMLHttpRequest();
	        if(http_request.overrideMimeType){
	        	http_request.overrideMimeType('text/xml');
	    	}
	    }else if(
			window.ActiveXObject
			|| 2 == 1
		){
	        try{
	        	http_request = new ActiveXObject("Msxml2.XMLHTTP");
	        }catch(e){
			try{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){}
	        }
	    }
	    if(para){
	    	request_action(para);
    	}else{
	    	request_action();
    	}

	}

	function home_preview(){
		if(http_request){
			http_request.onreadystatechange = preview_receive;
			http_request.open('POST', '/scripts/sohcode.php', true);
			http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			http_request.send('text='+escape(document.getElementById('hometext').value));
		}
	}

	function news_preview(){
		if(http_request){
			http_request.onreadystatechange = preview_receive;
			http_request.open('POST', '/scripts/sohcode.php', true);
			http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			http_request.send('text='+escape(document.getElementById('news_text').value));
		}
	}

	function preview_receive(){
		if(http_request.readyState == 0) {			// nicht initialisiert

		} else if(http_request.readyState == 1) {	// Lädt gerade
			document.getElementById('preview').innerHTML = load;
		} else if(http_request.readyState == 2) {	// Fertig geladen

		} else if(http_request.readyState == 3) {	// Wartet auf Rückgabe

		} else if(http_request.readyState == 4) {	// Vollständig
			if (http_request.status == 200){
				var text = http_request.responseText;
				document.getElementById('preview').innerHTML = text;
		    	}
		}
	}
	
	function calendar(richtung){
		if(http_request){
			http_request.onreadystatechange = calendar_receive;
			http_request.open('GET', '/scripts/calendar_xml.php?t=' + document.getElementById('calendar_' + richtung).innerHTML, true);
			http_request.send(null);
		    }
	    }

	function calendar_receive(){
		if(http_request.readyState == 4){
			if (http_request.status == 200){
				var xml = http_request.responseXML;
				//document.getElementById('preview').innerHTML = xml;
				alert(xml);
		    	}
		}
	}


/**
*
* Base64 encode / decode
* http://www.webtoolkit.info/
*
**/

var Base64 = {

    // private property
    _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

    // public method for encoding
    encode : function (input) {
        var output = "";
        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
        var i = 0;

        input = Base64._utf8_encode(input);

        while (i < input.length) {

            chr1 = input.charCodeAt(i++);
            chr2 = input.charCodeAt(i++);
            chr3 = input.charCodeAt(i++);

            enc1 = chr1 >> 2;
            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
            enc4 = chr3 & 63;

            if (isNaN(chr2)) {
                enc3 = enc4 = 64;
            } else if (isNaN(chr3)) {
                enc4 = 64;
            }

            output = output +
            this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
            this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

        }

        return output;
    },

    // public method for decoding
    decode : function (input) {
        var output = "";
        var chr1, chr2, chr3;
        var enc1, enc2, enc3, enc4;
        var i = 0;

        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

        while (i < input.length) {

            enc1 = this._keyStr.indexOf(input.charAt(i++));
            enc2 = this._keyStr.indexOf(input.charAt(i++));
            enc3 = this._keyStr.indexOf(input.charAt(i++));
            enc4 = this._keyStr.indexOf(input.charAt(i++));

            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;

            output = output + String.fromCharCode(chr1);

            if (enc3 != 64) {
                output = output + String.fromCharCode(chr2);
            }
            if (enc4 != 64) {
                output = output + String.fromCharCode(chr3);
            }

        }

        output = Base64._utf8_decode(output);

        return output;

    },

    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

}

/*

	function checkFields() {
		var allInput = document.getElementsByTagName("input");
		var allOk = true;
		var moreErrorMsg = null;

		for (var i = 0; i < allInput.length; i++) {
			var input = allInput[i];
			var type = input.getAttribute("type");
			var value = input.value;
			var class = input.getAttribute("class");

			if (class == null) {
				class = "";
			}

			if (class.indexOf("alert") > 0) {
				class = class.replace(/alert/," ");
			}

			if (type != null && (type == "text" || type == "password")) {
				if (class.indexOf("string") > -1) {
					//check String
				}

				if (class.indexOf("int") > -1) {
					if (!isInt(value) && value != "") {
						allOk = false;
						class = class+" alert";
					}
				}

				if (class.indexOf("real") > -1) {
					if (!isFloat(value) && value != "") {
						allOk = false;
						class = class+" alert";
					}
				}

				if (class.indexOf("date") > -1) {
					if (!isDate(value) && value != "") {
						allOk = false;
						class = class+" alert";
						moreErrorMsg = "Example Date: 2007-12-22";
					}
				}

				if (class.indexOf("not_null") > -1) {
					if (value == null || value.length < 1) {
						allOk = false;
						class = class+" alert";
						moreErrorMsg = "Not Null Field";
					}
				}
			}

			input.setAttribute("class",class);
		}
*/
	/*
		errorBox = document.getElementById("errorMsg");
		while(errorBox.hasChildNodes()){
			errorBox.removeChild(errorBox.firstChild);
		}
	*/
/*		if(allOk == false) {
	//		errorBox.appendChild(document.createTextNode("Correct the Marked Errors."));
	//		errorBox.appendChild(document.createElement("br"));

	//		if(moreErrorMsg != null) {
	//			errorBox.appendChild(document.createTextNode(moreErrorMsg));
	//		}
		}

		return allOk;
	//	alert("hello "+i);
	}

	function isInt(x) {
		var y=parseInt(x);
		if (isNaN(y)) return false;
		return x==y && x.toString()==y.toString ();
	}

	function isFloat(x) {
		var y = parseFloat(x);
		var z = parseInt(x);
	//	alert(x +'\n'+ y +'\n'+ z);
		if(isNaN(y)) return false;
		if (x == y || y == z) {
		// && x.toString() == y.toString()) {
			return true;
		}
	}

	function isDate(value) {
		//Check Date
		var jetzt = new Date();
		var aktYear = jetzt.getFullYear();
		var eingabe = value;
		//check format

		if(eingabe.match(/^[0-9]+-[0-9]+-[0-9]+$/) == null) {
		//alternativ exakt:
		//if (eingabe.match(/^[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]$/) == null) {
			return false;
		} else {
			var eingabeArr = eingabe.split("-");
			var dateCheck = new Date();
			var eDay = parseInt(eingabeArr[2]);
			var eMonth = parseInt(eingabeArr[1],10);
			var eYear = parseInt(eingabeArr[0]);

			//check right year
			if (eYear.length > 4 || eYear < 1) {
				return  false;
			} else {
				//check correct Month
				if (eMonth > 12 || eMonth < 1) {
					return false;
				} else {
					var dayOk = true;
					monDayArr = new Array(31,29,31,30,31,30,31,31,30,31,30,31);

					if (eDay < 1) {
						dayOk = false;
					}
					if (eDay > monDayArr[eMonth-1]) {
						dayOk = false;
					}

					//error of day
					if(!dayOk) {
						return false;
					}
				}
			}
		}

		return true;
	}
*/