// Flackern bei Hover verhindern

try {
	document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

// window.onload = pngbehavior;

//_editor_url  = "/js/xinha/";  // (preferably absolute) URL (including trailing slash) where Xinha is installed
//_editor_lang = "de";      // And the language we need to use in the editor.
//_editor_skin = "silva";   // If you want use a skin, add the name (of the folder) here//

function $fs(id){
	return document.getElementById(id);
}

function randomString() {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var string_length = 8;
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return randomstring;
}

function mysql_to_date(string){
	if(string != "0000-00-00"){
		var arr = string.split("-");
		if(arr.length == 3){
			return (new Date(arr[0],parseInt(arr[1])-1,arr[2]));
		} else {
			return false;
		}
	} else {
		return null;
	}
}

// Encodes a string for POST
function surecode(string){
	return decodeURI(escape(encodeURIComponent(string)));
}

function $cE(name){
	return document.createElement(name);
}

function $cTN(text){
	return document.createTextNode(text);
}

function clear_against(obj,str){
	if(obj.value==str){
		obj.value="";
	}
}

// Starts automatically at start (or should)
function menue_navi(){
//	
//	var menue = document.getElementById('ul_menue');
//	
//	// Undermenues
//	var umens = menue.getElementsByTagName("ul");
//	umens_count = umens.length;
//	
//	// Make all invisible
//	for(i=0;i<umens_count;i++){
//		undermenue = umens[i];
//		if(undermenue != menue){
//			undermenue.style.display = "none";
//			id = "undermenue_"+i;
//			undermenue.setAttribute("id",id);
//			undermenue.parentNode.onmouseover =	function(){ 
//													// Das hier ist das Untermenü, nö
//													var undermenue2 = this.getElementsByTagName("ul")[0];
//													
//													// Erstmal alle anderen wegblenden
//													var siblings = this.parentNode.getElementsByTagName("ul");
//													for(var i=0;i<siblings.length;i++){
//														siblings[i].style.display = "none";
//													}
//													
//													// Hier einblenden!
//													set_display(this,"block",1,"*");
//													/*undermenues = undermenue2.getElementsByTagName("*");
//													for(var i=0;i<undermenues.length;i++){
//														undermenues[i].style.display = "block";
//													}*/
//												}
//		}
//	}
//	
}

// Array for functions to be started after load of document
var onloadfuncs = [];
function onloadfuncs_exec(){
	for(var i = 0;i<onloadfuncs.length; i++){
		onloadfuncs[i]();
	}
}

function set_display(element,set_to,recursive,tagname){
	element.style.display = set_to;
	if(recursive > 0){
		var under_elements = element.getElementsByTagName(tagname);
		for(i=0;i<under_elements.length;i++){
			set_display(under_elements[i],set_to,recursive-1,tagname);
		}
	}
}


function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function vistoggle(id){
	var element = document.getElementById(id);
	if(element.style.display == "block") {
		element.style.display = "none";	
	} else {
		element.style.display = "block";	
	}
}

function getchildren(obj,name){
	var children = new Array();
	if (obj.childNodes == null){ return null;}
	for	(var i=0; i<obj.childNodes.length; i++){
		if(obj.childNodes[i].nodeType == 1 && (obj.childNodes[i].nodeName.toUpperCase() == name.toUpperCase() || name===null)){
			children.push(obj.childNodes[i]);
		}
	}
	if(children.length == 0){
		return null;
	}
	return children;
}

function get_xmlHttp(){
	if (window.ActiveXObject) {
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
			}
		}
	} else if (window.XMLHttpRequest) {
		try {
			xmlHttp = new XMLHttpRequest;
		} catch (e) {
		}
	}
	
	return xmlHttp;
}

function element_clear(obj){
	while(obj.childNodes.length > 0){
		obj.removeChild(obj.childNodes[0]);
	}
}

/*HTMLElement.prototype.clear = function (){
	while(this.childNodes.length > 0){
		this.removeChild(this.childNodes[0]);
	}
}*/

function clear(obj){
	while(obj.childNodes.length > 0){
		obj.removeChild(obj.childNodes[0]);
	}
}

function confirm_delete(url){
	var really = confirm("Delete?");
	return really;
}

function confirm_popup(url,message){
	div_popup("confirm");
	clear($fs("confirm_message"));
	$fs("confirm_message").appendChild(document.createTextNode(message));
	$fs("confirm_yes").href=url;
}

// Von: http://www.dodwin.de/weblog/2007/03/in_array-fuer-javascript
// Datum: 17.November 2010
// Kommentar von Dodwin
// Name in inArrayB geändert, einige Änderungen
// B steht für Bool
Array.prototype.inArrayB = function(needle) {
	for(var i=0; i < this.length; i++){
		if(this[ i] == needle) {
			return true;
		}
		else if (this[ i].inArrayB) { // Überprüft ob es ein Array ist, mittels der eigenen Funktion
			if (this[ i].inArrayB(needle)) {
				return true;
			} // Rekursiver Aufruf, return-Wert wird überprüft
		}
	}
	return false;
}

// From: http://ryantetek.com/demos/select_text/highlight_text.js
function selectText(text) {
   if (document.body.createTextRange) { // IE
        var range = document.body.createTextRange();
        range.moveToElementText(text);
        range.select();
    } else if (window.getSelection && document.createRange) { // Mozilla, Opera
        var selection = window.getSelection();
        var range = document.createRange();
        range.selectNodeContents(text);
        selection.removeAllRanges();
        selection.addRange(range);
    } else if (window.getSelection) { // Safari
        var selection = window.getSelection();
        selection.setBaseAndExtent(text, 0, text, 1);
    }
}

function nextrealSibling(obj,tagname){
	var node = obj.nextSibling;
	while(node.nodeType != 1){
		node = node.nextSibling;
		if(node == null){
			break;
		}
	}
	
	if(typeof(tagname) == "undefined") {
		tagname = false;
	}
	
	if(tagname==false || node.nodeName.toLowerCase() == tagname.toLowerCase()){
		return node;
	} else {
		return nextrealSibling(node,tagname);
	}
}

function previousrealSibling(obj,tagname){
	var node = obj.previousSibling;
	while(node.nodeType != 1){
		node = node.previousSibling;
		if(node == null){
			break;
		}
	}
	
	if(typeof(tagname) == "undefined") {
		tagname = false;
	}
	
	if(tagname==false || node.nodeName.toLowerCase() == tagname.toLowerCase()){
		return node;
	} else {
		return previousrealSibling(node,tagname);
	}
}


function preventmark(obj){
	obj.onselectstart = function(e){
				return false;	}
	obj.onmousedown = function(e){// FF
				if(!e) e = window.event; 
				if ( e.preventDefault && e ) {
					e.preventDefault();	}
				return false;	}	
}


function pausecomp(millis) 
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); } 
	while(curDate-date < millis);
} // JavaScript Document
function menue(id){
	var sm = $fs(id);
	
	if(sm != null){
		var lis = getchildren(sm,"LI");
		
		for (var i = 0; i < lis.length; i++) {
			
			var cur_li = lis[i];
			
			cur_li.onmouseover = function () {
				if (getchildren(this,"UL") != null) {
					getchildren(this,"UL")[0].style.display = "block";
				}
			}
			
			cur_li.onmouseout = function () {
				if (getchildren(this,"UL") != null) {
					getchildren(this,"UL")[0].style.display = "none";
				}
			}
			
		}
	}
}/*------------------------------------------------------------------------------
Function:       footnoteLinks()
Author:         Aaron Gustafson (aaron at easy-designs dot net)
Creation Date:  8 May 2005
Version:        1.3
Homepage:       http://www.easy-designs.net/code/footnoteLinks/
License:        Creative Commons Attribution-ShareAlike 2.0 License
                http://creativecommons.org/licenses/by-sa/2.0/
Note:           If you change or improve on this script, please let us know by 
                emailing the author (above) with a link to your demo page.
------------------------------------------------------------------------------*/
/*function footnoteLinks(containerID,targetID) { if (!document.getElementById || !document.getElementsByTagName || !document.createElement) return false; if (!document.getElementById(containerID) || !document.getElementById(targetID)) return false; var container = document.getElementById(containerID); var target = document.getElementById(targetID); var h2 = document.createElement('h2'); addClass.apply(h2,['printOnly']); var h2_txt = document.createTextNode('Links'); h2.appendChild(h2_txt); var coll = container.getElementsByTagName('*'); var ol = document.createElement('ol'); addClass.apply(ol,['printOnly_list']); var myArr = []; var thisLink; var num = 1; for (var i=0; i<coll.length; i++) { var thisClass = coll[i].className; if ( (coll[i].getAttribute('href') || coll[i].getAttribute('cite')) && (thisClass == '' || thisClass.indexOf('ignore') == -1)) { thisLink = coll[i].getAttribute('href') ? coll[i].href : coll[i].cite; var note = document.createElement('sup'); addClass.apply(note,['printOnly']); var note_txt; var j = inArray.apply(myArr,[thisLink]); if ( j || j===0 ) { note_txt = document.createTextNode(j+1);} else { var li = document.createElement('li'); var li_txt = document.createTextNode(thisLink); li.appendChild(li_txt); ol.appendChild(li); myArr.push(thisLink); note_txt = document.createTextNode(num); num++;} note.appendChild(note_txt); if (coll[i].tagName.toLowerCase() == 'blockquote') { var lastChild = lastChildContainingText.apply(coll[i]); lastChild.appendChild(note);} else { coll[i].parentNode.insertBefore(note, coll[i].nextSibling);} } } target.appendChild(h2); target.appendChild(ol); addClass.apply(document.getElementsByTagName('html')[0],['noted']); return true;}*/
  function footnoteLinks(containerID, targetID) {
        if (!document.getElementById ||
            !document.getElementsByTagName || !document.createElement) {
            return false;
        }
        if (!document.getElementById(containerID) ||
            !document.getElementById(targetID)) {
            return false;
        }
        var container = document.getElementById(containerID);
        var target = document.getElementById(targetID);
        var h2 = document.createElement("h2");
        addClass.apply(h2, ["printOnly"]);
        var h2_txt = document.createTextNode("Links");
        h2.appendChild(h2_txt);
        var coll = container.getElementsByTagName("*");
        var ol = document.createElement("ol");
        addClass.apply(ol, ["printOnly_list"]);
        var myArr = [];
        var thisLink;
        var num = 1;
        for (var i = 0; i < coll.length; i++) {
            var thisClass = coll[i].className;
            if ((coll[i].getAttribute("href") ||
                coll[i].getAttribute("cite")) &&
                (thisClass == "" || thisClass.indexOf("ignore") == -1)) {
                thisLink = coll[i].getAttribute("href") ? coll[i].href : coll[i].cite;
                var note = document.createElement("sup");
                addClass.apply(note, ["printOnly"]);
                var note_txt;
                var j = inArray.apply(myArr, [thisLink]);
                if (j || j === 0) {
                    note_txt = document.createTextNode(j + 1);
                } else {
                    var li = document.createElement("li");
                    var li_txt = document.createTextNode(thisLink);
                    li.appendChild(li_txt);
                    ol.appendChild(li);
                    myArr.push(thisLink);
                    note_txt = document.createTextNode(num);
                    num++;
                }
                note.appendChild(note_txt);
                if (coll[i].tagName.toLowerCase() == "blockquote") {
                    var lastChild = lastChildContainingText.apply(coll[i]);
                    lastChild.appendChild(note);
                } else {
                    coll[i].parentNode.insertBefore(note, coll[i].nextSibling);
                }
            }
        }
        target.appendChild(h2);
        target.appendChild(ol);
        addClass.apply(document.getElementsByTagName("html")[0], ["noted"]);
        return true;
    }/*------------------------------------------------------------------------------
Filename:       jsUtilities Library
Author:         Aaron Gustafson (aaron at easy-designs dot net)
                unless otherwise noted
Creation Date:  4 June 2005
Version:        2.1
Homepage:       http://www.easy-designs.net/code/jsUtilities/
License:        Creative Commons Attribution-ShareAlike 2.0 License
                http://creativecommons.org/licenses/by-sa/2.0/
Note:           If you change or improve on this script, please let us know by 
                emailing the author (above) with a link to your demo page.
------------------------------------------------------------------------------*/
// ---------------------------------------------------------------------
//                      array.push (if unsupported)
// ---------------------------------------------------------------------
if(Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }; };
// ---------------------------------------------------------------------
//                      array.shift (if unsupported)
// ---------------------------------------------------------------------
if (Array.prototype.shift == null) { Array.prototype.shift = function() { var response = this[0]; for (var i=0; i < this.length-1; i++) { this[i] = this[i + 1]; }; this.length--; return response; }; };
// ---------------------------------------------------------------------
//                  function.apply (if unsupported)
//           Courtesy of Aaron Boodman - http://youngpup.net
// ---------------------------------------------------------------------
if (!Function.prototype.apply) { Function.prototype.apply = function(oScope, args) { var sarg = []; var rtrn, call; if (!oScope) oScope = window; if (!args) args = []; for (var i = 0; i < args.length; i++) { sarg[i] = "args["+i+"]";}; call = "oScope.__applyTemp__(" + sarg.join(",") + ");"; oScope.__applyTemp__ = this; rtrn = eval(call); oScope.__applyTemp__ = null; return rtrn;};}; 
// ---------------------------------------------------------------------
//                               inArray()
//                           [Port from PHP]
//               Hunts for a value in the specified array
// ---------------------------------------------------------------------
function inArray(needle) { for (var i=0; i < this.length; i++) { if (this[i] === needle) { return i; } } return false; } Array.prototype.inArray = inArray;
// ---------------------------------------------------------------------
//                               isArray()
//                           [Port from PHP]
//                  verifies if something is an array
// ---------------------------------------------------------------------
function isArray() { return (typeof(this.length)=="undefined") ? false : true; }; Array.prototype.isArray = isArray;
// ---------------------------------------------------------------------
//                               ksort()
//                           [Port from PHP]
//                     sorts an array by key names
// ---------------------------------------------------------------------
function ksort() { var sArr = []; var tArr = []; var n = 0; for (i in this) tArr[n++] = i+"|"+this[i]; tArr = tArr.sort(); for (var i=0; i<tArr.length; i++) { var x = tArr[i].split("|"); sArr[x[0]] = x[1]; } return sArr; } Array.prototype.ksort = ksort;
// ---------------------------------------------------------------------
//                             addClass()
//                 appends the specified class to the object
// ---------------------------------------------------------------------
function addClass(theClass) { if (this.className != '') { this.className += ' ' + theClass; } else { this.className = theClass; } } Object.prototype.addClass = addClass;
// ---------------------------------------------------------------------
//                           removeClass()
//                 removes the specified class to the object
// ---------------------------------------------------------------------
function removeClass(theClass) { var oldClass = this.className; var regExp = new RegExp('\\s?'+theClass+'\\b'); if (oldClass.indexOf(theClass) != -1) { this.className = oldClass.replace(regExp,''); } } Object.prototype.removeClass = removeClass;
// ---------------------------------------------------------------------
//                      lastChildContainingText()
//  finds the last block-level text-containing element within an object
// ---------------------------------------------------------------------
  function lastChildContainingText() {
        var testChild = this.lastChild;
        var contentCntnr = ["p", "li", "dd"];
        while (testChild !== null && testChild.nodeType != 1) {
            testChild = testChild.previousSibling;
        }
		if(testChild !== null){
			var tag = testChild.tagName.toLowerCase();
			var tagInArr = inArray.apply(contentCntnr, [tag]);
			if (!tagInArr && tagInArr !== 0) {
				testChild = lastChildContainingText.apply(testChild);
			}
			return testChild;
		} else {
			return null;
		}
    }

    Object.prototype.lastChildContainingText = lastChildContainingText;
/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;// JavaScript Document
/*
* Code based on: http://www.testticker.de/praxis/2006/04/02/20060313038.aspx/
*/
  	var xmlHtururu = null;
    var wert_global = "";
	var last_value = "";
	function suggest_trigger(){
		var search_field = document.getElementById("search_field");
		if(search_field.value != last_value) {
			suggest(search_field.value);
			last_value = search_field.value;
		}
	}
	function suggest_init(){
		
		var suggest = setInterval("suggest_trigger()",1000);
			
	}

    function suggest(wert) {
		if(xmlHtururu != null) xmlHtururu.abort();
        wert_global = wert;
        document.getElementById("search_field").focus();

                xmlHtururu = get_xmlHttp();
        if (xmlHtururu) {
			var params = decodeURI(escape(encodeURI(wert))); // Workaround for both UTF-8 and Special Symbol support (i have no idea how it works)
            xmlHtururu.open("GET", "-suggest/" + params, true);
            xmlHtururu.onreadystatechange = daten;
            xmlHtururu.send(null);
        }
    }

    var text = "";
    var textteile = new Array;

    function daten() {
        if (xmlHtururu.readyState == 4 && xmlHtururu.status==200) {
			var ausgabe = "";
            text = xmlHtururu.responseText;
			ergebnisse = text.split("##");
			
			// Ergebnismenge anzeigen
			var search_amount = document.getElementById('search_amount');
			search_amount.innerHTML = "<strong>Schnellsuche</strong><br /> " + ergebnisse[0]+" Ergebnis(se)";
			
			if(ergebnisse.length > 1){
				
				// Liste erstellen
				var liste = document.createElement('ol'); liste.id = "search_fast_list";
				var teile = "";
				var neuer_eintrag = null;
				var neuer_link = null;
				for (var i=1; i<ergebnisse.length; i++) {
					
					neuer_eintrag = document.createElement('li');
					teile = ergebnisse[i].split("%%");
					
					// Link erstellen
					neuer_link = document.createElement('a'); neuer_link.title = teile[2]; neuer_link.href = teile[1];
					// text = document.createTextNode(teile[0]); neuer_link.appendChild(text);
					neuer_link.innerHTML = teile[0];
					
					// Link in Ergebnisse einhÃ¤ngen
					neuer_eintrag.appendChild(neuer_link);
					liste.appendChild(neuer_eintrag);
				}
				document.getElementById("search_suggests").innerHTML = "";
				document.getElementById("search_suggests").appendChild(liste);
				document.getElementById("search_amount").style.display = "block"
				document.getElementById("search_suggests").style.display = "block";
			}else {
				document.getElementById("search_suggests").style.display = "none";
				if(document.getElementById("search_field").value == "") document.getElementById("search_amount").style.display = "none";
				else document.getElementById("search_amount").style.display = "block";
			} 
        }
    }
	/*
    function wert_mark(teil) {
        if (textteile[teil] != null && textteile[teil] != "") {
            var suchfeld = document.formular.suchfeld;
            var start = wert_global.length;
            var laenge = textteile[teil].length;
            suchfeld.value = textteile[teil];
            if (suchfeld.createTextRange) {
                var Auswahl = suchfeld.createTextRange();
                Auswahl.moveStart("character", start);
                Auswahl.moveEnd("character", laenge - start);
                Auswahl.select();
            } else if (suchfeld.setSelectionRange) {
                suchfeld.setSelectionRange(start, laenge);
            }
            suchfeld.focus();
        }
    }
	*/// JavaScript Document

function div_popup(id){
	document.getElementById(id).style.display = "block";
}
function div_popout(id){
	document.getElementById(id).style.display = "none";
}// JavaScript Document

function reveal_solutions(){
	var antworten_ausgewertet = getElementsByClass('antworten_ausgewertet');
	for(var i= 0; i< antworten_ausgewertet.length; i++){
		var antwort_ausgewertet = antworten_ausgewertet[i];
		if(antwort_ausgewertet.nodeName == 'DIV'){
			antwort_ausgewertet.style.display = 'block';
		}
	}
}

function hide_solutions(){
	var antworten_ausgewertet = getElementsByClass('antworten_ausgewertet');
	for(var i= 0; i< antworten_ausgewertet.length; i++){
		var antwort_ausgewertet = antworten_ausgewertet[i];
		if(antwort_ausgewertet.nodeName == 'DIV'){
			antwort_ausgewertet.style.display = 'none';
		}
	}
}
