// #############################################################
//
//	IS24 Scripts
//
// #############################################################


/**
 * -------------------------------------------------------------
 * Init global vars
 * -------------------------------------------------------------
 *
 *
 *
*/
// Determine crucial browsers according to its user agent
//
// get browser
var is24_useragent = navigator.userAgent.toLowerCase();
//
var is24_isIE     = is24_useragent.indexOf("msie") != -1 && is24_useragent.indexOf("opera") == -1 ? true : false;

// new initial function call, when page ready
	YAHOO.util.Event.onDOMReady(is24_executeOnLoad); 
	
 	YAHOO.util.Event.addListener(window, "load", is24_createHelpDivElement);
	YAHOO.util.Event.addListener(window, "load", proxyCollapsable);
	YAHOO.util.Event.addListener(window, "load", locateCollapsableForManageObjects);
 
/**
 * ---------------------------------------------------------------
 * Generic getter for markup elements called by its css class name
 * ---------------------------------------------------------------
 *
 * Usage examples of how to call the function:
 *
 * To get all a elements in the document with a "is24-info" class:
 * getElementsByClassName(document, "a", "is24-info");
 *
 * To get all div elements within the element named "container", with a "is24-col" and a "is24-left" class:
 * getElementsByClassName(document.getElementById("container"), "div", ["is24-col", "is24-left"]);
 *
*/

function is24_getElementsByClassName (oClassNames, strTagName, oElm){
	// Yahoo method replaces old implementation
	return YAHOO.util.Dom.getElementsByClassName(oClassNames, strTagName, oElm);
}

// Array support for the push method in IE 5
if (typeof Array.prototype.push != "function") {
	Array.prototype.push = ArrayPush;
	function ArrayPush (_value) {
		this[this.length] = _value;
	}
}



/**
 * -------------------------------------------------------------
 * Externalise links
 * -------------------------------------------------------------
 *
 * Method to spare the target attribute in anchors due to BITV.
 * This is a way to have the same function another way around.
*/

function is24_externaliseLinks() {
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank"; 
		}
	}
}

/**
 * -------------------------------------------------------------
 * measure Screen function
 * -------------------------------------------------------------
 *
 * Measures the width of the document.
 * is used for decision wether to include skyscraper or not.
 *
 * @return false
 *
*/
function measureScreen()
{
  if(is24_isIE){
    var screenWidth = document.body.offsetWidth;
    }
  else {
    var screenWidth = window.innerWidth;
  }   
  return screenWidth;
}


/**
 * -------------------------------------------------------------
 * Open Popup Script
 * -------------------------------------------------------------
 *
 * Opens a new window based on parameters given to this function.
 * Alternatively, the link opens in a seperate window in case that
 * Javascript is not available (through target="_blank" in href tag).
 *
 * @param String linkURL Link address to be displayed in the popup window
 * @param String winName Name of the particular popup window, if no name default name is given
 * @param int winWidth Width of the popup window
 * @param int winheight Height of the popup window
 * @param String winArgs Properties of the popup window
 * @param bool setfocus Set to true in order to focus the popup window
 *
 * @return false
 *
*/

function openPopup(linkURL,winName,winWidth,winHeight,winArgs,setfocus) {
	if (linkURL != null) {
		if (window.is24_isPopup == null) {
			if (winName == null) {
				winName = "is24_newWin";
			}
			if (winWidth == null || typeof winWidth != "number") {
				winWidth = 600;
			}
			if (winHeight == null || typeof winHeight != "number") {
				winHeight = 400;
			}
			if (winArgs == null) {
				winArgs = "";
			}
			if (setfocus == null) {
				setfocus = true;
			}
			//
			// List of possible properties in the arguments variable, seperated by a comma, no leading/trailing spaces!
			//
			//   top		= [pixel]
			//   menubar	= yes|no	|	left	= [pixel]
			//   resizable	= yes|no	|	screenX	= [pixel]
			//   screenY	= [pixel]
			//
			// Example link:
			//
			// <a href="http://www.is24.de" onclick="return openPopup(this.href,'newWin',800,600,'menubar=yes,left=200')" target="_blank" title="Externer Link">Text des Links</a> 
			//
			// todo #15662
			var scrollVar = ",scrollbars=yes";
			if(winArgs.indexOf("scrollbars=") != -1){
				scrollVar = "";
				var reg = /scrollbars=(0|no)/;
				winArgs = winArgs.replace(reg,"scrollbars=yes");
			}
			_winArgs = "width="+ winWidth +",height="+ winHeight + ", " + winArgs + scrollVar;
			var _newWin = window.open(linkURL, winName, _winArgs); // removed winName 
			if (setfocus == true) {
				_newWin.focus();
			}
			else {
				_newWin.blur(); // hide popup
			}
		} else {
			// Link shall open in an already opened popup
			document.location.href = linkURL;
		}
		return false;
	}
	return false;
};
// end openPopup()

/**
 * -------------------------------------------------------------
 * # Collect all functions needed to be executed on page load #
 * -------------------------------------------------------------
 *
 * Note: Currently in use!
 *
*/
function is24_executeOnLoad() {
	// is24_externaliseLinks();
	locateCalendar();
	imageCheckbox();
	inputField();
	inputStyle();
	selectAllFunctionality();
	selectAllDivFunctionality();
	makeToggleLists();
	splitList();
	hideFilterButton();
	enableHoverButtons();
};

/**
 * -------------------------------------------------------------
 * Helpers
 * -------------------------------------------------------------
 *
*/


/**
 * -------------------------------------------------------------
 * Help Popup: layer with help text which follows mouse cursor
 * -------------------------------------------------------------
 *
 *
*/

var is24_elemHelp = null;
//var is24_elemHelpCSSID = "is24-helper-popup-layer";
var is24_elemHelpCSSID = "is24-tooltip";

var is24_img_hover_in  = "/styles/next/css/img/fi/info_active.gif";
var is24_img_hover_out = "/styles/next/css/img/fi/info.gif";

var is24_x_pos = "0";
var is24_y_pos = "0";

function is24_createHelpDivElement() {
		
		// elem for expose-map popup layer
		var is24_elemMap = document.createElement("div");
		is24_elemMap.setAttribute("id", "is24-map-helper-layer");
		document.body.appendChild(is24_elemMap);	
		
		// first prepare links
		var helps = is24_getElementsByClassName("is24-help","span");
		var blueHelps = is24_getElementsByClassName("is24-help-label","span");
		for(var i=0; i<blueHelps.length; i++) helps[helps.length] = blueHelps[i].parentNode; // merge arrays, and take the label instead of span!
		if(helps.length == 0) return false; // exit if no help elements on page
		
		var text = is24_getElementsByClassName("is24-tooltip-text","div"); // get all tooltip-texts in document
		
		for(var i = 0; i < helps.length; i++){
			var infoBild = helps[i].getElementsByTagName("img")[0]; 
			if(text[i]){
				infoBild.helptext = text[i].innerHTML;
				text[i].style.display = "none"; // hide help text in page
			}
			else { 
				infoBild.helptext = "Kein Hilfetext gefunden";
				//helps[i].firstChild.helptext = "Kein Hilfetext gefunden."; 
			}

			//YAHOO.util.Event.addListener(infoBild, 'mouseover', is24_helpHover);
			//YAHOO.util.Event.addListener(infoBild, 'mouseout', is24_helpHoverOut);
			//YAHOO.util.Event.addListener(infoBild, 'mousemove', moveHelpHover);
			
			// same for label
			YAHOO.util.Event.addListener(helps[i], 'mouseover', is24_helpHover);
			YAHOO.util.Event.addListener(helps[i], 'mouseout', is24_helpHoverOut);
			YAHOO.util.Event.addListener(helps[i], 'mousemove', moveHelpHover);
		} // end for
		
		is24_elemHelp = document.createElement("div");
		is24_elemHelp.setAttribute("id", is24_elemHelpCSSID);
		is24_elemHelp.style.width = "195px";
		is24_elemHelp.style.zIndex = 100;
		//is24_elemHelp.style.visibility = "hidden";
		is24_elemHelp.style.display = "none";
		is24_elemHelp.style.position = "absolute";
		is24_elemHelp.style.top = "0px";
		document.getElementsByTagName("body")[0].appendChild(is24_elemHelp);
		
		// put an iframe under the help-tooltip for - but only on http pages! #20491
		if(document.all){
			hideBox = document.createElement("iFrame");
			hideBox.style.scrolling = "no";
			hideBox.style.overflow = "hidden";
			hideBox.style.background = "white";
			hideBox.src = "/local/cms/is24/js/scwblank.htm"; // blank html is good for https pages!
			hideBox.style.width = "180px";
			hideBox.style.position = "absolute";
			hideBox.style.zIndex = 99;
			hideBox.style.visibility = "hidden";
			hideBox.style.display = "none";
			document.getElementsByTagName("body")[0].appendChild(hideBox);
		}
};

function is24_updateXYPosition(e) {
    e = e || window.event;
   
    if(typeof e.type == 'undefined') {
    	return;
    }
   
    if (e.pageX || e.pageY) {
    	// FF
            is24_x_pos = e.pageX ;
            is24_y_pos = e.pageY ;
        }
    else {
    	// IE
            var scrollPos; var scrollPosX;
			if (typeof window.pageYOffset != 'undefined') {
			   scrollPos = window.pageYOffset;
			   scrollPosX = window.pageXOffset;
			}
			else if (typeof document.compatMode != 'undefined' &&
			     document.compatMode != 'BackCompat') {
			   scrollPos = document.documentElement.scrollTop;
			   scrollPosX = document.documentElement.scrollLeft;
			}
			else if (typeof document.body != 'undefined') {
			   scrollPos = document.body.scrollTop;
			   scrollPosX = document.body.scrollLeft;
			}
            is24_x_pos = e.clientX + scrollPosX ; // e.clientX + document.body.scrollLeft - document.body.clientLeft;
            is24_y_pos = e.clientY + scrollPos; // e.clientY + document.body.scrollTop - document.body.clientTop;
        }
};


function is24_helpHoverOut(obj) {
	if(typeof this == "undefined" || typeof this.parentNode == "undefined") {
		return;
	}
	(this.parentNode.className == "is24-help") ? this.src = is24_img_hover_out : false ; // change image for blue forms
	window.setTimeout("is24_hideDelay()", 200);
};

function is24_showDelay() {
	is24_elemHelp.style.visibility = "visible";
	if(typeof hideBox != "undefined") hideBox.style.visibility = "visible"; 
	is24_elemHelp.style.display = "";
	if(typeof hideBox != "undefined") hideBox.style.display = ""; 
	is24_checkHelpBounds(); // call again, because information is only accessable when element is visible!
};

function is24_hideDelay() {
	is24_elemHelp.style.visibility = "hidden";
	if(typeof hideBox != "undefined") hideBox.style.visibility = "hidden";
	is24_elemHelp.style.display = "none";
	if(typeof hideBox != "undefined") hideBox.style.display = "none"; 
	
};

function moveHelpHover(e){
	if(is24_elemHelp.style.visibility == "hidden") return;
	is24_updateXYPosition(e);
	is24_checkHelpBounds();
}

function is24_checkHelpBounds() {
	// check if the help element is still on screen and in case adjust it
	var breite = (window.innerWidth) ? window.innerWidth+window.pageXOffset : document.body.offsetWidth;
	var ieScroll = document.body.scrollTop | document.documentElement.scrollTop | window.pageYOffset | 0; 
	var hoehe = (window.innerHeight) ? window.innerHeight+window.pageYOffset : YAHOO.util.Dom.getViewportHeight()+ ieScroll;

	if(is24_elemHelp != null) {
		// check auf x-position
		if(is24_x_pos+(parseFloat(is24_elemHelp.style.width)) >= breite) {
			// zu weit draussen, help element wird nach links verschoben
			var differ = (breite - 5 - (parseFloat(is24_elemHelp.style.width)+ is24_x_pos));
			is24_elemHelp.style.left = is24_x_pos + differ + "px";
		} 
		else {
			// innerhalb des schirms
			is24_elemHelp.style.left = is24_x_pos+10+"px";
		}

		// check auf y-position
		if(is24_y_pos+(parseFloat(is24_elemHelp.offsetHeight)) >= hoehe) {
			// zu weit draussen, help element wird nach oben verschoben
			var differ = (hoehe - 5 - (parseFloat(is24_elemHelp.firstChild.offsetHeight)+ is24_y_pos)); // hoehe des inhaltes der box nehmen
			is24_elemHelp.style.top = is24_y_pos + differ + "px";
		} 
		else {
			// y position ndert sich nicht
			is24_elemHelp.style.top = is24_y_pos+10+"px";
		}
	}

	if(typeof hideBox != "undefined"){
		hideBox.style.top = parseInt(is24_elemHelp.style.top)+5+"px";
		hideBox.style.left = parseInt(is24_elemHelp.style.left)+7+"px";
		hideBox.style.height = (is24_elemHelp.firstChild) ? is24_elemHelp.firstChild.offsetHeight+"px" : "15px";
	}
}

// almost no YAHOO functions here, because of error in IE!
function is24_helpHover(obj) {
	if(typeof this == "undefined" || typeof this.parentNode == "undefined") {
		return;
	}
	(this.className == "is24-help") ? is24_elemHelp.id = "is24-tooltip" : is24_elemHelp.id = "is24-tooltip-label";
	is24_updateXYPosition(obj); 				// get position of the hovered help-icon
	(this.className == "is24-help") ? this.src = is24_img_hover_in : false ; // change image for blue forms
	if(is24_elemHelp != "null") {		
		is24_elemHelp.innerHTML = "<div>"+this.getElementsByTagName("img")[0].helptext+"</div>";
		is24_checkHelpBounds();
		window.setTimeout("is24_showDelay()", 200);
		//window.setTimeout("fadeIn(is24_elemHelp)",200);
	}
};

// concept function for animating fade-ins
function fadeIn(elem){
	// half second fade in 
	// set element fully transparent
	elem.style.opacity = 0; // FF style
	if(elem.style.filter) elem.style.filter.opacity = "alpha(0)"; // IE style
	elem.style.visibility = "visible";
		for(var i=0; i <= 100; i+=10){
           (function(){
           		var el = elem;
                var pos = i;
                // Set the timeout to occur at the specified time in the future
                // note that the time grows -> all animationsteps are called at once here in the loop
                setTimeout(function(){
                // Set the new opacity of the element
                YAHOO.util.Dom.setStyle(el, "opacity", (pos/100));       }, ( pos + 1 ) * 5 ); })();
           }
};

// concept function for animating opening/closing of elements
// encapsulated as object, multiple animations possible!!
var animateHeight = function (elem, targetHeight, duration, callBackFunc){
	var elem = elem;
	var id = Math.random()*300;
	if(id > 150) elem.style.border = "red";
	if(elem.style.height) var currentHeight = parseInt(elem.style.height);
	var currentHeight = elem.offsetHeight;
	var diff = currentHeight - targetHeight;
	var step = diff / 20; // 20 steps animation
		for(var i=0; i <= 100; i+=5){
           (function(){
           		var el = elem;
                var pos = i/5;              
                // Set the timeout to occur at the specified time in the future
                // note that the time grows -> all animationsteps are called at once here in the loop
                setTimeout(function(){
                // Set the new height of the element
                var newH = parseInt(currentHeight-(pos*step))+"px";
                //console.info(id+"  Höhe: "+newH+"    ehemals "+currentHeight);
                YAHOO.util.Dom.setStyle(el, "height", newH );   }, ( pos + 1 ) * 15 ); })();
           }
};

/**
 * -------------------------------------------------------------
 * End Help Popup
 * -------------------------------------------------------------
 *
*/


// IS24 KALENDER
// links mit der klasse "is24_date" werden als links fuer den kalender genutzt
// das input feld vom typ text das VOR dem link steht wird mit dem Kalender verbunden
// der link bekommt einen onclick handler welcher dann den kalender anzeigen laesst
// benoetigt: yui /.../ calendar.js
function locateCalendar(){
	kalender = {}; // kalender array for storing all calenders on page
	dateDiv = {}; // divs for storing the calender(s)
    var trigger = new Array();
	var element;
    // kalender icon finden (link tag mit css klasse is24_date)
    trigger[0] = YAHOO.util.Dom.getElementsByClassName("is24-date", "a");
	trigger[1] = YAHOO.util.Dom.getElementsByClassName("is24-date-past", "a");
    if (trigger[0].length > 0 || trigger[1].length > 0) {
		for (var b = 0; b < 2; b++) {
		for (var a = 0; a < trigger[b].length; a++) {
			var quelle = trigger[b][a];
			while (quelle.previousSibling) {
				if (quelle.previousSibling.type == "text") {
					element = quelle.previousSibling;
					var pos = a;
					// onclick handler fr das kalender icon
					trigger[b][pos].pos = a;
					trigger[b][pos].ele = element;
					YAHOO.util.Event.addListener(trigger[b][pos], "click", function(){
						makeCalendar(this, this.ele, this.pos,this.className);
					});
					break;
				}
				quelle = quelle.previousSibling; // eins zurueck
			}
		} // inner for loop
	} // outer for loop
        return false;
    } else {
        return false;
    }
}
// Kalender muss Datumsformat Tag.Monat.Jahr haben!!
function makeCalendar(trigger, element, count, classname){

    // create container, falls noch nicht existent
    if(!document.getElementById("calendar"+count)){
	    dateDiv[count] = document.createElement("div");
	    dateDiv[count].setAttribute("style", "position:absolute;top:1;left:1;backgroundColor:white;visibility:visible;"); // set styles for later manipulation
	    dateDiv[count].id = "calendar"+count;
	    document.body.appendChild(dateDiv[count]);
    }
    
    var mycal = YAHOO.util.Dom.get("calendar"+count);
    //mycal.style.left = YAHOO.util.Dom.getX(trigger) + 15 ; // x position
    //mycal.style.top = YAHOO.util.Dom.getY(trigger) + 15 ;  // y position
    YAHOO.util.Dom.setX(mycal, YAHOO.util.Dom.getX(trigger)  ); // Frank: Kalender liegt ueber dem Icon
    YAHOO.util.Dom.setY(mycal, YAHOO.util.Dom.getY(trigger)  ); 
    
    YAHOO.util.Dom.addClass(document.body, "yui-skin-sam"); // damit der yui-CSS-style greift...
    
    if(typeof kalender[count] == "undefined"){
	    kalender[count] = new YAHOO.widget.Calendar("kalender","calendar"+count); // yahoo kalender erzeugen, global
	    kalender[count].inputElement = element; // callback to the input element
		kalender[count].cfg.setProperty("close",true); // close icon zum kalender adden
		
		if (classname == "is24-date") {
			kalender[count].cfg.setProperty("mindate", new Date()); // allow only future dates 
		}
		else if(classname == "is24-date-past") {
			// assume past time calendar and substract 6 months
			var now = new Date();
			var nowMonth = now.getMonth(); // present month
			var nowYear = now.getFullYear(); // present year
			if (nowMonth - 6 < 0) {
				nowMonth = 11
				nowYear = nowYear - 1;
			}
			else {
				nowMonth = nowMonth - 6;
			}
			
			var before = new Date(nowYear,nowMonth);
			//console.info("minimum datum: "+before.getDate()+"   "+nowMonth+"-"+nowYear);
			kalender[count].cfg.setProperty("mindate", new Date(before)); // allow past time dates
			kalender[count].cfg.setProperty("maxdate", new Date(new Date().getTime()-(1000*60*60*24))); // allow max yesterday to be picked
		}
		
	    // deutsche lokalisierung
	    kalender[count].cfg.setProperty("MONTHS_SHORT",   ["Jan", "Feb", "M\u00E4r", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]); 
	    kalender[count].cfg.setProperty("MONTHS_LONG",    ["Januar", "Februar", "M\u00E4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]);
	    kalender[count].cfg.setProperty("WEEKDAYS_1CHAR", ["S", "M", "D", "M", "D", "F", "S"]);
	    kalender[count].cfg.setProperty("WEEKDAYS_SHORT", ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]);
	    kalender[count].cfg.setProperty("WEEKDAYS_MEDIUM",["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam"]);
	    kalender[count].cfg.setProperty("WEEKDAYS_LONG",  ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]);
	    
	    kalender[count].cfg.setProperty("START_WEEKDAY", 1); 			// Woche beginnt mit Montag
	    kalender[count].cfg.setProperty("DATE_FIELD_DELIMITER", ".");	// Datumsangaben werden mit "." getrennt z.B. "23.12.2007"
	    kalender[count].cfg.setProperty("MDY_DAY_POSITION", 1);
	    kalender[count].cfg.setProperty("MDY_MONTH_POSITION", 2);
	    kalender[count].cfg.setProperty("MDY_YEAR_POSITION", 3);
	}
	    // falls schon datum im input feld steht, dann bernehmen...
	    if(kalender[count].inputElement.value != "") {
	        var eingabe;
	        if(kalender[count].inputElement.value.indexOf(".") != -1) eingabe = kalender[count].inputElement.value.split(".");
	        if(kalender[count].inputElement.value.indexOf("/") != -1) eingabe = kalender[count].inputElement.value.split("/");
	        if(eingabe[2].length < 4) eingabe[2] = "20"+eingabe[2]; // falls 2-stelliges jahr eingegeben
	        kalender[count].cfg.setProperty("pagedate", eingabe[1]+"."+eingabe[2] );
	        var datestring = eingabe[0]+"."+eingabe[1]+"."+eingabe[2];
	        kalender[count].cfg.setProperty("selected", datestring);
	    }
	    else {
	    	kalender[count].cfg.setProperty("selected", new Date().toString() );
	    } 
	    
    kalender[count].render();
    kalender[count].show();
    
    // set calendar events
    kalender[count].selectEvent.subscribe(function(type,args){
        //var datum = new Date(args[0].toString); // datumsobjekt erzeugen - doesnt work!
        var datum = args[0].toString();
        var datumNeu = datum.split(",");
        datum = datumNeu[2]+"."+datumNeu[1]+"."+datumNeu[0];
        kalender[count].inputElement.value = datum;
        //kalender.hide();
        } );
}
/* ------------------ Ende KALENDER ------------------------------------------------------------*/

/* fix non-existing support for adjacent sibling selector (used in Lists): */
function is24_fixAdjacent(surround_attr, surround_value) {
	var targetEl;
	var targetList;
	
	if(surround_attr == "id") {	
		if(document.getElementById(surround_value)) {
			targetDiv = document.getElementById(surround_value);
			targetList = targetDiv.getElementsByTagName("li");
		}
		else {return false;}
	}
	else {
		if(is24_getElementsByClassName(document, "ol", surround_value).length > 0) {
			targetDiv = is24_getElementsByClassName(document, "ol", surround_value);
			targetList = targetDiv[0].getElementsByTagName("li");	
		}
		else {return false;}		
	}
	
	var element = 0;	
	while(element < targetList.length){
		if(YAHOO.util.Dom.hasClass(targetList[element], "is24-c")) {
			element++;
			YAHOO.util.Dom.addClass(targetList[element], "is24-ac");
		}
		/*var tempname = targetList[element].className; // default wert
		if(targetList[element].className.indexOf(" ") != -1) {
			tempname = targetList[element].className.split(" "); // am Leerzeichen trennen, array erzeugen
			for(var i=0; i < tempname.length; i++){
				if(tempname[i] == "is24-c"){
					element++;
					targetList[element].className += " is24-ac";
				}
			}
		}
		else{
			if(tempname=="is24-c"){
				 element++;
				targetList[element].className += " is24-ac";
			}
		} */
		element++; // sprung zum naechsten Element
	}
}
// -------------------------------------------------------------------------------------------------------------
// function that manages the different collapse calls - enter new tags for collapsing here!
function proxyCollapsable(){
	locateCollapsable("p");		// standard call for collapsing
	locateCollapsable("h5");	// special for filter navigation
}
// Function that locates links that make other elements collapse or expand - used in angebotsmanager
function locateCollapsable(tag){
	var collinks = YAHOO.util.Dom.getElementsByClassName("is24-collapse",tag);
	var explinks = YAHOO.util.Dom.getElementsByClassName("is24-expand",tag);
	
	for(var i = 0; i < explinks.length; i++){
		collinks.push(explinks[i]); // joining the two arrays
	}
	explinks = null; // delete array
	
	for(var i = 0; i < collinks.length; i++){
		
		collinks[i].href = "javascript:return false;";
		
		// find associated element to hide/show and bind it to link
		var el = collinks[i];
		collinks[i].manipulator = "";
		
		while (el.nextSibling) {
			el = el.nextSibling; // go to next child
			if (el.nodeType == 1) {
				collinks[i].manipulator = el; // bind HTML element
				break;
			}
		}

		if(collinks[i].manipulator == ""){
			var el = collinks[i];
			while (el.previousSibling) {
				el = el.previousSibling; // go to next child
				if (el.nodeType == 1) {
					collinks[i].manipulator = el; // bind HTML element
					break;
				}
			}
		}

		// set onclick-handler
		YAHOO.util.Event.addListener(collinks[i], "click", function(e){
			var el = this;
				// assuming <fieldset> element
					if(YAHOO.util.Dom.hasClass(this,"is24-collapse")) {
						// use hide class for better result in IE
						YAHOO.util.Dom.addClass(this.manipulator, "is24-hide");
						this.className = "is24-expand";
						if (YAHOO.util.Dom.getElementsByClassName("is24-toggle-text", "span", this).length > 0) {
							var toggle = YAHOO.util.Dom.getElementsByClassName("is24-toggle-text", "span", this)[0]; // span finden
							var temp = this.getElementsByTagName("a")[0].firstChild.nodeValue;
							this.getElementsByTagName("a")[0].firstChild.nodeValue = toggle.firstChild.nodeValue;
							toggle.firstChild.nodeValue = temp; // alten text ins toggle
						}
					} else {
						// use hide class for better result in IE
						YAHOO.util.Dom.removeClass(this.manipulator, "is24-hide");
						this.className = "is24-collapse";
						if (YAHOO.util.Dom.getElementsByClassName("is24-toggle-text", "span", this).length > 0) {
							var toggle = YAHOO.util.Dom.getElementsByClassName("is24-toggle-text", "span", this)[0]; // span finden
							var temp = this.getElementsByTagName("a")[0].firstChild.nodeValue; // zwischenspeichern vom alten text
							this.getElementsByTagName("a")[0].firstChild.nodeValue = toggle.firstChild.nodeValue; // neuen text schreiben
							toggle.firstChild.nodeValue = temp; // alten text ins toggle
						}
					}
	
			// disable link behaviour
			YAHOO.util.Event.preventDefault(e);
		} ); // onclick-handler
		
		// first time make elements invisible if the links is of class "is24-expand"
		var temp = nextElement(collinks[i]);
		if(collinks[i].className == "is24-expand") YAHOO.util.Dom.addClass(temp, "is24-hide");
		// end invisible
	} // for loop	
}

var is24_collapseContainer = {
    groupLinks : [],
    collapseCount:0,
    expandCount:0,
    maxCount:0    
};   


function locateCollapsableForManageObjects(){
	var forms = document.getElementsByTagName('form');
	for (var i = 0; i < forms.length;i++){
      var all = [];
      var collapsable = YAHOO.util.Dom.getElementsByClassName("is24-collapse","div",forms[i]);
      var expandable = YAHOO.util.Dom.getElementsByClassName("is24-expand","div",forms[i]);
      var allcollapsable = YAHOO.util.Dom.getElementsByClassName("is24-collapseall","div",forms[i]);
      var allexpandable = YAHOO.util.Dom.getElementsByClassName("is24-expandall","div",forms[i]);
      all = all.concat(collapsable).concat(expandable);
      if ((collapsable.length+expandable.length)>0 && (allcollapsable.length+allexpandable.length)>0){
        is24_collapseContainer.collapseCount = expandable.length;
        is24_collapseContainer.expandCount = collapsable.length;
        is24_collapseContainer.maxCount = expandable.length+collapsable.length;
        is24_collapseContainer.groupLinks = is24_collapseContainer.groupLinks.concat(allcollapsable);
        is24_collapseContainer.groupLinks = is24_collapseContainer.groupLinks.concat(allexpandable);
        is24_collapseContainer.all = all;

        for(var j = 0; j < is24_collapseContainer.groupLinks.length; j++){
          YAHOO.util.Event.addListener(is24_collapseContainer.groupLinks[j], "click", function(e){
			if(YAHOO.util.Dom.hasClass(this, "is24-collapseall")) {
				var temp = YAHOO.util.Dom.getElementsByClassName("is24-am-details", "tr");
                //turnToCollapse(this);
                is24_collapseContainer.expandCount  = 0;
                is24_collapseContainer.collapseCount = is24_collapseContainer.maxCount;
				for(var x = 0; x < temp.length; x++) {
                  expandElement(temp[x]);
                  var pSibling = temp[x].previousSibling;
                  while (pSibling.tagName != 'TR'){
                    pSibling = pSibling.previousSibling;
                  }
                  YAHOO.util.Dom.addClass(pSibling, "is24-bottom-border01");                  
                }
				for(var x = 0; x < temp.length; x++) collapseElement(temp[x]);
				for(var x = 0; x < is24_collapseContainer.groupLinks.length; x++) {
                  if(YAHOO.util.Dom.hasClass(is24_collapseContainer.groupLinks[x], "is24-collapse")||YAHOO.util.Dom.hasClass(is24_collapseContainer.groupLinks[x], "is24-collapseall")) {
                    turnToExpand(is24_collapseContainer.groupLinks[x]);
                  }
                }
				for(var x = 0; x < is24_collapseContainer.all.length; x++) {
                  if(YAHOO.util.Dom.hasClass(is24_collapseContainer.all[x], "is24-collapse")||YAHOO.util.Dom.hasClass(is24_collapseContainer.all[x], "is24-collapseall")) {
                    turnToExpand(is24_collapseContainer.all[x]);
                  }
                }
			}
			else if(YAHOO.util.Dom.hasClass(this, "is24-expandall")) {
				var temp = YAHOO.util.Dom.getElementsByClassName("is24-am-details", "tr");
				//turnToExpand(this);
                is24_collapseContainer.expandCount  = is24_collapseContainer.maxCount;
                is24_collapseContainer.collapseCount = 0;
				for(var x = 0; x < temp.length; x++) {
                  expandElement(temp[x]);
                  var pSibling = temp[x].previousSibling;
                  while (pSibling.tagName != 'TR'){
                    pSibling = pSibling.previousSibling
                  }
                  YAHOO.util.Dom.removeClass(pSibling, "is24-bottom-border01");                     
                }
				for(var x = 0; x < is24_collapseContainer.groupLinks.length; x++) if(YAHOO.util.Dom.hasClass(is24_collapseContainer.groupLinks[x], "is24-expand")||YAHOO.util.Dom.hasClass(is24_collapseContainer.groupLinks[x], "is24-expandall")) turnToCollapse(is24_collapseContainer.groupLinks[x]);
				for(var x = 0; x < is24_collapseContainer.all.length; x++) if(YAHOO.util.Dom.hasClass(is24_collapseContainer.all[x], "is24-expand")||YAHOO.util.Dom.hasClass(is24_collapseContainer.all[x], "is24-expandall")) turnToCollapse(is24_collapseContainer.all[x]);
			}
            if(window.innerHeight) { 
				e.preventDefault(); 
			}
			else { 
				var oEvent = window.event; oEvent.returnValue = false;
			}
		  });	
        }
        for(var j = 0; j < all.length; j++){
          YAHOO.util.Event.addListener(all[j], "click", function(e){
			var el  = this.parentNode.parentNode;
			// search for <tr> with the details
			while(el = nextElement(el)){
				if(el.className.indexOf("is24-am-details") != -1) break; // detail <tr> gefunden
			}
			if(YAHOO.util.Dom.hasClass(this, "is24-collapse")) {
				// use hide class for better result in IE
				turnToExpand(this);
				collapseElement(el);
                var pSibling = el.previousSibling;
                  while (pSibling.tagName != 'TR'){
                    pSibling = pSibling.previousSibling
                  }
                  YAHOO.util.Dom.addClass(pSibling, "is24-bottom-border01");   
                is24_collapseContainer.collapseCount++;
                is24_collapseContainer.expandCount--;                
			} else if(YAHOO.util.Dom.hasClass(this, "is24-expand")) {
				// use hide class for better result in IE
				turnToCollapse(this);
				expandElement(el);
                var pSibling = el.previousSibling;
                while (pSibling.tagName != 'TR'){
                   pSibling = pSibling.previousSibling
                }
                YAHOO.util.Dom.removeClass(pSibling, "is24-bottom-border01");   
                is24_collapseContainer.collapseCount--;
                is24_collapseContainer.expandCount++;                
			}	 
            if (is24_collapseContainer.expandCount==0){
              for (var i2 = 0; i2 < is24_collapseContainer.groupLinks.length;i2++){
                turnToExpand(is24_collapseContainer.groupLinks[i2]);
              }
            } else {
              for (var i2 = 0; i2 < is24_collapseContainer.groupLinks.length;i2++){
                if (YAHOO.util.Dom.hasClass(is24_collapseContainer.groupLinks[i2], "is24-expandall"))
                turnToCollapse(is24_collapseContainer.groupLinks[i2]);
              }            
            }
			// finally disable href in link
			if(window.innerHeight) { 
				e.preventDefault(); 
			}
			else { 
				var oEvent = window.event; oEvent.returnValue = false;
			}
		  }); // end onclick handler        
	    }
      } 
    }
    return;
	
}

/*
else if(YAHOO.util.Dom.hasClass(this, "is24-collapseall")) {
				var temp = YAHOO.util.Dom.getElementsByClassName("is24-am-details", "tr");
				//turnToCollapse(this);
				for(var x = 0; x < temp.length; x++) collapseElement(temp[x]);
				for(var x = 0; x < all.length; x++) if(YAHOO.util.Dom.hasClass(all[x], "is24-collapse")||YAHOO.util.Dom.hasClass(all[x], "is24-collapseall")) turnToExpand(all[x]);
			}
			else if(YAHOO.util.Dom.hasClass(this, "is24-expandall")) {
				var temp = YAHOO.util.Dom.getElementsByClassName("is24-am-details", "tr");
				//turnToExpand(this);
				for(var x = 0; x < temp.length; x++) expandElement(temp[x]);
				for(var x = 0; x < all.length; x++) if(YAHOO.util.Dom.hasClass(all[x], "is24-expand")||YAHOO.util.Dom.hasClass(all[x], "is24-expandall")) turnToCollapse(all[x]);
			}
		

*/

function expandElement(el){
	YAHOO.util.Dom.removeClass(el, "is24-hide");
}
function collapseElement(el){
	YAHOO.util.Dom.addClass(el, "is24-hide");
}
function turnToCollapse(el){
	if(YAHOO.util.Dom.hasClass(el, "is24-expand")){
		YAHOO.util.Dom.removeClass(el, "is24-expand");
		YAHOO.util.Dom.addClass(el, "is24-collapse");
	}
	else{
		YAHOO.util.Dom.removeClass(el, "is24-expandall");
		YAHOO.util.Dom.addClass(el, "is24-collapseall");
	}
	changeLinkText(el);
}
function turnToExpand(el){
	if(YAHOO.util.Dom.hasClass(el, "is24-collapse")){
		YAHOO.util.Dom.removeClass(el, "is24-collapse");
		YAHOO.util.Dom.addClass(el, "is24-expand");
	}
	else{
		YAHOO.util.Dom.removeClass(el, "is24-collapseall");
		YAHOO.util.Dom.addClass(el, "is24-expandall");
	}
	changeLinkText(el);
}
function changeLinkText(el){
	var toggle = YAHOO.util.Dom.getElementsByClassName("is24-toggle-text", "span", el)[0]; // span finden
	var temp = el.getElementsByTagName("a")[0].firstChild.nodeValue; // zwischenspeichern vom alten text
	el.getElementsByTagName("a")[0].firstChild.nodeValue = toggle.firstChild.nodeValue; // neuen text schreiben
	toggle.firstChild.nodeValue = temp; // alten text ins toggle
	return true;
}
// -------------------------------------------------------------------------------------------------------------
// Funktion sucht input Felder vom Typ is24-input-help und laesst beim reinklicken den default text verschwinden
function inputField(){
	var fields = YAHOO.util.Dom.getElementsByClassName("is24-input-help"); // ,"input");
	if(fields.length < 1) return;
	
	var defaultValues = {}; // holds all default values of input fields
	
	for(var a = 0; a < fields.length; a++){
		defaultValues[fields[a].id] = fields[a].value;
		// Event-Handler
		fields[a].onfocus = function(){
			this.value = (this.value == defaultValues[this.id]) ? "" : this.value;
			YAHOO.util.Dom.removeClass(this, "is24-input-help");
		}
		fields[a].onblur = function(){
			this.value = (this.value == "") ? defaultValues[this.id] : this.value;
			if(this.value != defaultValues[this.id]) YAHOO.util.Dom.removeClass(this, "is24-input-help");
				else YAHOO.util.Dom.addClass(this, "is24-input-help");
		}
	}
}

// set mouseover/focus input styles only for "white form" elements
function inputStyle(){
	var alle = new Array();
	
	//var forms = YAHOO.util.Dom.getElementsByClassName("is24-kingsize", "form", document.body);
	// todo #28484 new styles for all forms
	var forms = document.getElementsByTagName("form");
	for(var g = 0; g < forms.length; g++) {
		inputs = forms[g].getElementsByTagName("INPUT");
		texta = forms[g].getElementsByTagName("TEXTAREA");
		
		// pack in one array
		for(var i = 0; i < inputs.length; i++) {alle[alle.length] = inputs[i]; }// manual concatenation
		for(var i = 0; i < texta.length; i++) {alle[alle.length] = texta[i]; }// manual concatenation
		if(alle.length == 0) continue;
		
		for(var f = 0; f < alle.length; f++){
		if(alle[f].tagName == "INPUT" && alle[f].type != "text") continue;
			alle[f].fokus = false; // helper variable
			YAHOO.util.Event.addListener(alle[f], 'mouseover', function(){YAHOO.util.Dom.addClass(this,'hover');}, '');
			YAHOO.util.Event.addListener(alle[f], 'focus', function(){this.fokus=true; YAHOO.util.Dom.addClass(this,'hover');}, '');
			YAHOO.util.Event.addListener(alle[f], 'blur', function(){this.fokus=false; YAHOO.util.Dom.removeClass(this,'hover');}, '');
			YAHOO.util.Event.addListener(alle[f], 'mouseout', function(){if(!this.fokus) YAHOO.util.Dom.removeClass(this,'hover');}, '');
		}
		
		var inputi = is24_getElementsByClassName("is24-invalid","div", forms[g]);
		if(inputi.length != 0){
			for(var h = 0; h < inputi.length; h++){
				var inp = inputi[h].getElementsByTagName("input")[0];
				YAHOO.util.Event.addListener(inp, 'focus', function(){YAHOO.util.Dom.removeClass(this.parentNode, "is24-invalid"); YAHOO.util.Dom.addClass(this.parentNode, "is24-required"); }, '');
			}
		
		} 
		
	}
		
}

// Function searches for checkbox elements that toggle lists of other checkbox elements on/off and
// give them the desired functionality
function selectAllFunctionality(){
	var uls = document.getElementsByTagName("ul");
	if(uls.length == 0) return;
	
for(var x = 0; x < uls.length; x++){
	var liElem = uls[x].getElementsByTagName("li");
	for(var a = 0; a < liElem.length; a++){
		var liIn = liElem[a].getElementsByTagName("input")[0];
		if(typeof liIn != "undefined") {
			YAHOO.util.Event.addListener(liIn, 'click',function(){
				if(this.checked){
					YAHOO.util.Dom.addClass(this.parentNode,"is24-c");
					//deactivate "select all" link, if there is one, and remove class IN ANY CASE!
					if(this.parentNode.className.indexOf("is24-checkall") == -1 && this.parentNode.className.indexOf("is24-checkall-bottom") == -1) {
						var triggers = YAHOO.util.Dom.getElementsByClassName("is24-checkall","li",this.parentNode.parentNode);
						for(var a = 0; a < triggers.length; a++){ triggers[a].getElementsByTagName("input")[0].checked = false; YAHOO.util.Dom.removeClass(triggers[a],"is24-c");}
						var triggers2 = YAHOO.util.Dom.getElementsByClassName("is24-checkall-bottom","li",this.parentNode.parentNode);
						for(var a = 0; a < triggers2.length; a++){ triggers2[a].getElementsByTagName("input")[0].checked = false; YAHOO.util.Dom.removeClass(triggers2[a],"is24-c");}
					}
				}
				else {
					YAHOO.util.Dom.removeClass(this.parentNode,"is24-c");
					YAHOO.util.Dom.removeClass(this.parentNode,"hover"); // IE bug	
				} 
			}); // end event declaration
		}
	}
}
	
	var lis = new Array();
	var lisb = new Array();
	
	for (var b = 0; b < uls.length; b++) {
		var lis = YAHOO.util.Dom.getElementsByClassName("is24-checkall","li",uls[b]);
		var lisb = YAHOO.util.Dom.getElementsByClassName("is24-checkall-bottom","li",uls[b]);
	
		for(var i = 0; i < lisb.length; i++) lis[lis.length] = lisb[i]; // manual concatenation
		if(lis.length == 0) continue;
		
		for(var a = 0; a < lis.length; a++){
			var atag = lis[a].getElementsByTagName("a")[0]; // get link element
			var box = lis[a].getElementsByTagName("input")[0]; // get the checkbox
			if(box.nodeName != "INPUT") continue; // IE knows only nodeName
			YAHOO.util.Event.addListener(box, 'click', function(){
				var dummy = this; var eltern = "";
				while(dummy.parentNode){
					if(dummy.parentNode.nodeName == "UL") {
						eltern = dummy.parentNode;
						break;
					}
					dummy = dummy.parentNode;
				}
				updateMyList(eltern, this.checked); // call for list to update its children
			}); // end event declaration

			if(atag){ // sometimes there can be no link element
				atag.onclick = function(e){
					if(e) {
						e.preventDefault();
					}
					else{  	window.event.returnValue = false;
					}
					this.parentNode.parentNode.getElementsByTagName("input")[0].click();
					return false;
				} // endonclick
			} // endif
		}
	}
}

function updateMyList(listElement, isChecked){
	
	var lis = listElement.getElementsByTagName("li");
	
	// check for special lists that have different behaviour
	// when in listbox then DONT select all, but only the "select-all" link
	if(listElement.className == "is24-listbox") {
		for(var a = 0; a < lis.length; a++){
			if(lis[a].className.indexOf("is24-checkall") == -1 && lis[a].className.indexOf("is24-checkall-bottom") == -1){
				var inp = lis[a].getElementsByTagName("input");
				(isChecked) ? inp[0].checked = !isChecked : inp[0].checked = inp[0].checked;
				// change class
				(isChecked) ? YAHOO.util.Dom.removeClass(inp[0].parentNode,"is24-c") : "";
				(!isChecked) ?  YAHOO.util.Dom.removeClass(inp[0].parentNode,"hover") : ""; // IE bug
			}
		}
	} // end listbox
	else {
		for(var a = 0; a < lis.length; a++){
			if(lis[a].className.indexOf("is24-checkall") == -1 && lis[a].className.indexOf("is24-checkall-bottom") == -1){
				var inp = lis[a].getElementsByTagName("input");
				inp[0].checked = isChecked;
				// change class
				(isChecked) ? YAHOO.util.Dom.addClass(inp[0].parentNode,"is24-c") : YAHOO.util.Dom.removeClass(inp[0].parentNode,"is24-c");
				(!isChecked) ?  YAHOO.util.Dom.removeClass(inp[0].parentNode,"hover") : ""; // IE bug
			}
		}
	}

}

// this function enables the "alle auswählen / zurücksetzen" links in the angebotsmanager
function selectAllDivFunctionality(){
	var DivList = function (){
		this.selectAllDivs = new Array();
		that = this; // shortcut to the object
		
		this.init = function(){	
			this.selectAllDivs[0] = YAHOO.util.Dom.getElementsByClassName("is24-checkall","div",document)[0];
			this.selectAllDivs[1] = YAHOO.util.Dom.getElementsByClassName("is24-checkall-bottom","div",document)[0];
			if(typeof this.selectAllDivs[0] != "object") return ;
			this.temp = this.selectAllDivs[0];
			this.listElements = new Array();
			while(this.temp = nextElement(this.temp)){
				if(this.temp.className.indexOf("checkall-bottom") == -1) {
					this.listElements[this.listElements.length] = this.temp;
				}
				else break; // reached the end of the list
			}
			for(var a = 0; a < this.selectAllDivs.length; a++){
				YAHOO.util.Event.addListener(this.selectAllDivs[a], 'click', function(){
					if(this.getElementsByTagName("input")[0].checked) that.selectAll();
					else that.deselectAll();
				});
			}
		}
		
		this.selectAll = function(){
			for(var a = 0; a < this.listElements.length; a++){
				// #21908 check for more than one checkbox
				var radio = this.listElements[a].getElementsByTagName("input"); // [0].checked = true;
				for(var i = 0; i < radio.length; i++){
					if(radio[i].type == "checkbox") radio[i].checked = true;
				}
			}
			for (var i2=0; i2 <that.selectAllDivs.length;i2++){
			 if(that.selectAllDivs[i2])
			  that.selectAllDivs[i2].getElementsByTagName("input")[0].checked = true;
			}			
		}
		
		this.deselectAll = function(){
			for (var a = 0; a < this.listElements.length; a++) {
				// #21908 check for more than one checkbox
				var radio = this.listElements[a].getElementsByTagName("input"); // [0].checked = false;
				for (var i = 0; i < radio.length; i++) {
					if (radio[i].type == "checkbox") 
						radio[i].checked = false;
				}
			}
			for (var i2=0; i2 <that.selectAllDivs.length;i2++){
			if(that.selectAllDivs[i2])
			  that.selectAllDivs[i2].getElementsByTagName("input")[0].checked = false;
			}
		}
		
		this.changeMode = function(){
		}	
		
	}; // end of object
	
	var myList = new DivList(); // using constructor for new Object
	myList.init(); // start List Functionality
}

// todo image checkboxes - ok
function imageCheckbox(){
	var boxes = YAHOO.util.Dom.getElementsByClassName("is24-bigcheckbox","input",document.body);
	if(boxes.length == 0) return;
	
	for(var a = 0; a < boxes.length; a++){
		var bild = document.createElement("img");
		(boxes[a].checked=="") ? bild.src = "/styles/next/js/checkbox/off.gif" : bild.src = "/styles/next/js/checkbox/on.gif";
		bild.style.marginRight = "7px";
		bild.style.cssFloat = "left"; // FF
		bild.style.styleFloat = "left"; // IE
		bild.id="img_" + boxes[a].id; // !!!! NEW, it is needed for ActivationState.jsp
		bild.box = boxes[a]; // reference to html checkbox
		bild.box.style.display = "none";
		boxes[a].parentNode.insertBefore(bild, boxes[a]);
		
		// click on a image
		YAHOO.util.Event.addListener(bild, 'click', function(){this.box.click();});

		// Hack for ie7 (the change event will not be fired in the proposed way) so the click event must be
		// used. A click on the proper label for a checkbox will generate a change event 
		// so we need both and label clicking will not work in ie7.
		// Also at ie7 the label is only bounded to visible/block elements. So the label will not work on ie7
		YAHOO.util.Event.addListener(bild.box, 'change', renderCheckBoxStateAsImage, bild, true);
		YAHOO.util.Event.addListener(bild.box, 'click', renderCheckBoxStateAsImage, bild, true);
	}
}

// execute the function if the state of a image checkbox is changed
function renderCheckBoxStateAsImage() {
	(this.box.checked == "") ? this.src = "/styles/next/js/checkbox/off.gif" : this.src = "/styles/next/js/checkbox/on.gif";
	(this.box.checked == "") ? this.alt = "Nein" : this.alt = "Ja";
}

function makeToggleLists(){
	var lists = document.getElementsByTagName("ul");
	if (lists.length == 0) return;
	
	for(var a = 0; a < lists.length; a++){
		if(YAHOO.util.Dom.getElementsByClassName("is24-toggle","div",lists[a])){
			var divi = YAHOO.util.Dom.getElementsByClassName("is24-toggle","div",lists[a]);
			// we can have multiple toggles!!
			for(var i = 0; i < divi.length; i++)
			{ 
				divi[i].oldHeight = divi[i].offsetHeight; // remember initial height!
				divi[i].style.height = "0px"; // make invisible via height
				divi[i].style.marginTop = "0px"; // remove "gap" to previous element
			}
			var lis = lists[a].getElementsByTagName("li");
			for(var b = 0; b < lis.length; b++){
				lis[b].onclick = function(){
					var parent = this.parentNode;
					toggleList(parent);
				}
			}
		}
	} 
}

// opens and closes elements depending on radio buttons
function toggleList(list){
	var lis = list.getElementsByTagName("li"); // search the clicked list only
	for(var b = 0; b < lis.length; b++){
		var check = lis[b].getElementsByTagName("input")[0];
		if(!check) continue;
		if(check.checked) {
			var divi = lis[b].getElementsByTagName("div")[0];
			if(divi && divi.className == "is24-toggle") {
				divi.style.display = "block"; 
				// todo: animation!
				var temp = new animateHeight(divi, divi.oldHeight, 1000);
				divi.style.marginTop = "14px";
			}
		}
		if(!check.checked) {
			var divi = lis[b].getElementsByTagName("div")[0];
			if(divi && divi.className == "is24-toggle"){ 
				// divi.style.display = "none"; 
				// todo: animation
				var temp = new animateHeight(divi, 0, 1000);
				divi.style.marginTop = "0px";
			}
		}
	} 
}

// Dom helper function
function nextElement(elem){
	// Todo get next element of 'elem' that is not a blank textnode - OK
	do {	
		elem = elem.nextSibling;
	} while ( elem && elem.nodeType != 1 );
	return elem;
}

// Dom helper function
function prevElement(elem){
	// Todo get next element of 'elem' that is not a blank textnode - OK
	do {	
		elem = elem.previousSibling;
	} while ( elem && elem.nodeType != 1 );
	return elem;
}

/* ------------------- Podcast Tracking ----------------------------------------------------*/
// Functions sends Tracking Information to Indextools, only for podcast tracking!
function sendPodcastTracking(trackingValue){
try{
	var actionnumber = "21";
	var video = (typeof(trackingValue) == "string") ? trackingValue : "";
	var _category = category | "";
	
	// Nedstat tracking
	/*if (typeof(sitestat) != "undefined") {
		if (typeof ns_pixelUrl != "undefined") {
			tmpUrl = ns_pixelUrl.substring(0, ns_pixelUrl.indexOf('&')); // get PixelURL
		}
		else {
			return false;
		}*/
		
		// documentgroup1 holen
		var docgroup = dg1 || "";
		
		// videoname und spieldauer auflösen
		var daten = trackingValue.split("-");
		var videoName = daten[0];
		var spielDauer = daten[1];
		
		sitestat(TRACKING_PREFIX + "&ns_event=21&ns_type=hidden&dg1=" + docgroup + "&category="+ _category + "&sdauer=" + spielDauer + "&vname=" + videoName);
	
}catch(e){  }
}

/* -------------------ende Podcast Tracking ----------------------------------------------------*/

function trackIndextools(action, params){
/* deprecated */
	trackNedstat(action, params);
}

// nedstat tracking function for action tracking
function trackNedstat(action,params){
    if(typeof(action) != "string") return false;
    if(action == "22") action = "28"; // action value was changed
    var _category = category | "";
    
    if(params){
       	var count = params.cf22 || ""; // Zählereignis
        var ns_dg1 = dg1 || ""; // documentgroup
        var ns_dg2 = dg2|| ""; // docgroup2
        var ns_dg3 = params.cf26 || ""; // docgroup3
        var ns_dg4 = params.cf27 || ""; // docgroup4
		var plz = params.cf49 || ""; // PLZ
        var semtyp = params.cf56 || ""; // Seminartyp
    }
    
    try{
    /*if (typeof(sitestat) != "undefined") {
		if (typeof ns_pixelUrl != "undefined") {
			tmpUrl = ns_pixelUrl.substring(0, ns_pixelUrl.indexOf('&')); // get PixelURL
		}
		else {
			return false;
		}*/
		
		sitestat(TRACKING_PREFIX + "&ns_event="+action+"&ns_type=hidden&count=" + count + "&category="+ _category + "&mpl=" + mpl + "&dg1=" + ns_dg1 + "&dg2=" + ns_dg2 + "&dg3=" + ns_dg3 + "&dg4=" + ns_dg4 + "&plz=" + plz + "&semtyp=" + semtyp);
	
	}catch(e){}
}
// hide buttons inside of filternavigation - expect reset buttons
function hideFilterButton(){
	var forms = is24_getElementsByClassName("is24-nav-filter", "div", document);
	if (forms.length == 0) return;
	for(var i = 0; i < forms.length; i++){
		var temp = forms[i].getElementsByTagName("form")[0].getElementsByTagName("input");
		for(var a = 0; a < temp.length; a++) {
			if(temp[a].type == "submit" && (temp[a].parentNode && temp[a].parentNode.className != "is24-reset")) temp[a].className += " is24-hide"; // hide element via CSS
		}
	}
}

// function gives graphical CSS buttons the 'hover' ability 
function enableHoverButtons(){
	if(YAHOO.util.Dom.getElementsByClassName("is24-btn-submit","span",document.body).length == 0 && YAHOO.util.Dom.getElementsByClassName("is24-btn-cancel","span",document.body).length == 0 ) return false;
	var left = new Image();
	left.src = "/styles/next/css/img/promo-left.gif";
	var right = new Image();
	right.src = "/styles/next/css/img/promo-right.gif";
	var leftOver = new Image();
	leftOver.src = "/styles/next/css/img/promo-hover-left.gif";
	var rightOver = new Image();
	rightOver.src = "/styles/next/css/img/promo-hover-right.gif";
	
	prepareButtons(YAHOO.util.Dom.getElementsByClassName("is24-btn-submit","span",document.body));
	prepareButtons(YAHOO.util.Dom.getElementsByClassName("is24-btn-cancel","span",document.body));
	
	function prepareButtons(buttons){
		for(var a = 0; a < buttons.length; a++){
			// hover handler here...
			YAHOO.util.Event.addListener(buttons[a], 'mouseover', function(){
				if (this.tagName === "SPAN") {
					this.style.backgroundImage = "url(" + leftOver.src + ")";
					this.getElementsByTagName("input")[0].style.backgroundImage = "url(" + rightOver.src + ")";
				}
			});
			YAHOO.util.Event.addListener(buttons[a], 'mouseout', function(){
				if(this.tagName === "SPAN"){
					this.style.backgroundImage = "url("+left.src+")";
					this.getElementsByTagName("input")[0].style.backgroundImage = "url(" + right.src + ")";
				}
			});
		}
	}
}

// list with "is24-split" element gets support for showing/hiding parts of the list
function splitList(){
	var allLists = document.getElementsByTagName("ul");
	if (allLists.length == 0) return true;
	// find position
	for (var a = 0; a < allLists.length; a++){
		if(YAHOO.util.Dom.hasClass(allLists[a],"is24-split")){
			// construct link
			var link = document.createElement("p");
			YAHOO.util.Dom.addClass(link, "is24-expand");
			link.innerHTML = "<a href=\"#\"></a>";
			var linkText = findSplitText(allLists[a]);
			var anzeigenText = linkText.substring(0, linkText.indexOf(":"));
			var versteckenText = linkText.substring(linkText.indexOf(":")+1);
			link.firstChild.appendChild(document.createTextNode(anzeigenText));
			allLists[a].parentNode.appendChild(link); // link ausserhalb der liste
			YAHOO.util.Event.addListener(link, "click", showSplitList);
			toggleListElements(allLists[a]);
		}
	}
	
	function showSplitList(e){
		toggleListElements(this.parentNode);
		
		YAHOO.util.Dom.addClass(this, "is24-collapse");
		YAHOO.util.Dom.removeClass(this, "is24-expand");
		
		var text = findSplitText(this.parentNode);
		this.firstChild.firstChild.nodeValue = text.substring(text.indexOf(":")+1);
		
		YAHOO.util.Event.removeListener(this, "click", showSplitList);
		YAHOO.util.Event.addListener(this, "click", hideSplitList);
		if (document.all) {
			window.event.returnValue = false;
		}
		else {
			e.preventDefault()
		};
	}
	function hideSplitList(e){
		toggleListElements(this.parentNode);
		
		YAHOO.util.Dom.addClass(this, "is24-expand");
		YAHOO.util.Dom.removeClass(this, "is24-collapse");
		
		var text = findSplitText(this.parentNode);
		this.firstChild.firstChild.nodeValue = text.substring(0, text.indexOf(":"));
		
		YAHOO.util.Event.removeListener(this, "click", hideSplitList);
		YAHOO.util.Event.addListener(this, "click", showSplitList);
		if (document.all) {
			window.event.returnValue = false;
		}
		else {
			e.preventDefault()
		};
	}
	
	function findSplitText(linkElement){
		var linkText = YAHOO.util.Dom.getElementsByClassName("is24-split-text","span",linkElement.parentNode)[0].firstChild.nodeValue;
			linkText = linkText+""; // to string
		return linkText;
	}
	
	function toggleListElements(list){
		var lists = list.getElementsByTagName("li");
		for(var a = 0; a < lists.length; a++){
			if(lists[a].className.indexOf("is24-split-bottom") != -1){
				for(var i = a; i < lists.length; i++){
					if(YAHOO.util.Dom.hasClass(lists[i],"is24-hide")){
						YAHOO.util.Dom.removeClass(lists[i],"is24-hide");
					}
					else{
						YAHOO.util.Dom.addClass(lists[i],"is24-hide");
					}
				}
			}
		}
	}
}

/*
========================================================================


    C O O K I E    A P I


========================================================================
*/
// OLD Functions first

function FMsetCookie(name, val) {
	
	//var today = new Date();
	//var expire = 3600000*24*30; // 30 Tage
	//var the_date = new Date(today.getTime() + expire);
	//var the_cookie = name + "=" + val + "; nfti_date="+escape(today) + "; expires=" + the_date.toGMTString();
	//document.cookie = the_cookie;
	
	
	var host = determineCookieHost();

	if (host == null) {
		//do not set cookie domain
		setCookie(name, val, false, false, false, false, false, true);
	} else {
		//do set cookie domain 
		setCookie(name, val, false, false, host, false, false, true);
	}
//	document.cookie = name + "=" + val;
};

/*
  This methode is Strongly DEPRECATED.
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  The path must be the same as the one which was used to create the cookie.
  Otherwise you are not be able to remove the cookie.
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
function FMremoveCookie(name){
	var host = determineCookieHost();///
	if(host==null) deleteCookie(name,"/",false);
	else deleteCookie(name,"/",host);
};

/*
  This methode is DEPRECATED.
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  Path must be specified. 
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

*/
function setPersistentCookie(name, val, duration) {
	
	var today = new Date();
	var expire = 3600000*24*duration; // duration in Tagen
	var the_date = new Date(today.getTime() + expire);
	
	var host = determineCookieHost();
	//setCookie(name, value, expires, path, domain, secure, ntfi_date)
	if (host == null) {
		//do not set cookie domain
		setCookie(name, val, the_date, '/', false, false, today, true);
	} else {
		//do set cookie domain 
		setCookie(name, val, the_date, '/', host, false, today, true);
	}
	
	//var the_cookie = name + "=" + val + "; nfti_date="+escape(today) + "; expires=" + the_date.toGMTString()+ "; path=" + "/";
	//document.cookie = the_cookie;
	//document.cookie = name + "=" + val;
};

/*
This methode ist strongly deprecated.
It returns the value of only one possible cookie with the given name.
But there can exist several cookies with the same name.
*/
function FMgetCookie(name) {
	var the_cookie = document.cookie;
	the_cookie = unescape(the_cookie);
	the_cookie_split = the_cookie.split(";");
	//alert (the_cookie_split.length);
	for (i=0;i<the_cookie_split.length;i++) {
		var part_of_split = the_cookie_split[i];
		var find_name = part_of_split.indexOf(name);
		if (find_name!=-1) {
			var equal = part_of_split.indexOf("=") + 1;
			var value_of_split = part_of_split.substring(equal,part_of_split.length);
			return value_of_split; // when the cookie's content is empty you maybe will get also 0.
		}
	}
	return 0;
};

function isPopupClosed() {
	if (  window.MyScout != null && window.MyScout.closed == true ) { 
		FMsetCookie('myscoutCookie', 1);
	}
};

//  / OLD Functions

/*
   name - name of the cookie
   value - value of the cookie
   [expires] - expiration date of the cookie
     (defaults to end of current session)
   [path] - path for which the cookie is valid
     (defaults to path of calling document)
   [domain] - domain for which the cookie is valid
     (defaults to domain of calling document)
   [secure] - Boolean value indicating if the cookie transmission requires
     a secure transmission
   * an argument defaults when it is assigned null as a placeholder
   * a null placeholder is not required for trailing omitted arguments
*/
function setCookie(name, value, expires, path, domain, secure, nfti_date, disableEscaping) {
  if (typeof disableEscaping == 'undefined' || disableEscaping == null || disableEscaping != true) disableEscaping = false; 
  var curCookie = name + "=" + 
      ((disableEscaping) ? value : escape(value)) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((nfti_date) ? "; nfti_date=" + ((disableEscaping) ? nfti_date : escape(nfti_date)) : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

/*
  Cookie's name shouldn't contain '='
  Also Cookie's value shouldn't contain characters like ',' and '= ' and ';'
*/
function getAllCookies() {
    var everycookievalue = document.cookie;
    var mySplit = everycookievalue.split(";");
    var cookieString;
    var resultName;
    var resultValue;
    var pos;
    var cookies = new Array();
    for ( count=0; ( mySplit[count] != undefined ); count++ ) {
        cookieString = mySplit[count] + '';
        cookieString = cookieString.replace(/^\s+|\s+$/g, '');
        pos = cookieString.indexOf('=');
        if (pos == -1) {//for IE
            resultName = cookieString;
            resultValue = '';
        } else {
            resultName = cookieString.substring(0, pos);
            resultValue = cookieString.substring(pos + 1, cookieString.length);
        }
        cookies[count] = [resultName, resultValue];
    }
    return cookies;
}
/*
   It returns an array of values.
*/
function getCookiesWithName(name, comparator) {
    var allCookies = getAllCookies();
    var toReturn = new Array();
    var count = 0;
    for (var i = 0; i < allCookies.length; i++) {
        var cookie = allCookies[i];
        var cookieName = cookie[0] + '';
        var cookieValue = cookie[1] + '';
        if (typeof comparator != 'undefined') {
            if (comparator(cookieName, name, cookieValue) == true) {
                toReturn[count++] = allCookies[i];
            }
        } else if (cookieName == name) {//Use instead ===  or JSObject.equals
            toReturn[count++] = allCookies[i];
        }
    }
    return toReturn;
}


/*
  It determines instructions for removing cookies.
*/
function getRemovalPrescription() {
    var toReturn = new Array();
    
    var host = determineCookieHost();
    if (host == null) return toReturn;
    
    var serverName = document.location.host;
    var hosts = new Array(false, host, serverName);
    
    var pathName = getDocumentPath();//pathName = parseURL(document.location.href).pathname;
    var paths;
    if (pathName == '/') {
        paths = new Array(false, '/');
    } else {
        paths = new Array(false, '/', pathName);
    }
    
    var count = 0;
    for (i = 0; i < hosts.length; i++) {
        for (j = 0; j < paths.length; j++) {
            toReturn[count++] = [paths[j], hosts[i]];
        }
    }
    return toReturn;
}

function deleteCookiesWithName(name, prescription) {
    var cookies = getCookiesWithName(name);
    var before = cookies.length;
    if (before == 0) return before;
    
    if (typeof prescription != 'object') {
        prescription = getRemovalPrescription();
    }
    if (prescription.length == 0) {
        return before;
    }
    var instruction = prescription[prescription.length - 1];
    prescription.length = prescription.length - 1;//pop
// use logger instead    
//                                    document.write('<b>Vorher:</b> ---->' + document.cookie);
//                                    document.write("<br><br>");
//                                    document.write('<b>RemovalPrescription</b> ---->' + instruction);
//                                    document.write("<br><br>");
    deleteCookie(name, instruction[0], instruction[1]);
//                                    document.write('<b>Nachher:</b> ---->' + document.cookie);
//                                    document.write("<br><br>");
    var after = getCookiesWithName(name).length;
    if (after == 0) return after;//Volltreffer
    if (after == before) {//Cookie couldn't be deleted. Either no new cookie was created. Wrong removal instruction.
        after = deleteCookiesWithName(name, prescription);//go further and try the next removal instruction
    } else if (after > before) { //disaster fund 
        deleteCookie(name, instruction[0], instruction[1]);//remove the unintended created cookie instantly 
        after = getCookiesWithName(name).length;
        if (after > before) {
            return after;//should never happen. hopefully the very rare case. consider to throw an exception.
        }
        after = deleteCookiesWithName(name, prescription);//go further with the next removal instruction
    } else if (after < before) { //cookie removed successfully
        //Weitere evtl. vorhandene Cookies (mit gleichen Namen) Löschen.
        after = deleteCookiesWithName(name, prescription);//go further with the next removal instruction
    }
    return after;
}

function deleteCookie(name, path, domain) {
    var expires = new Date(1980, 0, 1);
    setCookie(name, '', expires, path, domain, false, false, false);
}

function printCookies(cookies) {
    if (typeof cookies != 'object' || cookies == null) {
        cookies = getAllCookies();
    }
    for (var i = 0; i < cookies.length; i++) {
        var cookie = cookies[i];
        var cookieName = cookie[0] + '';
        var cookieValue = cookie[1] + '';
        document.write(cookieName + '---->' + cookieValue);
        document.write("<br><br>");
    }
}

/**
 * -------------------------------------------------------------
 * determine the value of the cookie host ignoring all sub domains.
 * -------------------------------------------------------------
 *
 *
*/
function determineCookieHost() {
    var server = window.location.hostname;
    
    var host = null;
    var sub = server.split('.');
    switch (sub.length) {
        case 0: {
            break;
        }
        case 1: {
            break;
        }
        case 2: {
            //same behavior as returning null
            //host = server;
            break;
        }
        /*
        //same behavior as default
        case 3: {
            host = sub[1] + "." + sub[2];
            break;
        }
        */
        case 4: {            
            if (isNumber(sub[3])) {//Is server an IP address?
                break;//If it is true, then return null.
            } else {
              //do the same as specified in default case
            }
        }
        default: {
            host = '.' + sub[sub.length - 2] + '.' + sub[sub.length - 1];
            //host = server.substring(server.indexOf('.') + 1);
            break;
        }
    }
    return host;
};

function CookieClass(name, value, expires, path, domain, secure, nfti_date, disableEscape) {
    this.name = name;
    this.value = value;
    this.domain = domain;
    this.path = path;
    this.secure = secure;
    this.expires = expires;
    this.nfti_date = nfti_date;
    this.disableEscape = disableEscape;
}

/**
 * -------------------------------------------------------------
 * Wheter the giving string is a number or not
 * -------------------------------------------------------------
 *
 *
*/
function isNumber(sText) {
	if (sText=="") return false;
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
	var dotCnt = 0;
	
	for (i = 0; i < sText.length && IsNumber == true; i++) {
		Char = sText.charAt(i);
		if (Char==".") dotCnt = dotCnt +1;
		if (ValidChars.indexOf(Char) == -1 || dotCnt>1) {
			IsNumber = false;
		}
	}
	return IsNumber;
}

//parse a URL to form an object of properties 
function parseURL(url) {
    //save the unmodified url to href property
    //so that the object we get back contains
    //all the same properties as the built-in location object
    var loc = { 'href' : url };

    //split the URL by single-slashes to get the component parts
    var parts = url.replace('//', '/').split('/');

    //store the protocol and host
    loc.protocol = parts[0];
    loc.host = parts[1];

    //extract any port number from the host
    //from which we derive the port and hostname
    parts[1] = parts[1].split(':');
    loc.hostname = parts[1][0];
    loc.port = parts[1].length > 1 ? parts[1][1] : '';

    //splice and join the remainder to get the pathname
    parts.splice(0, 2);
    loc.pathname = '/' + parts.join('/');

    //extract any hash and remove from the pathname
    loc.pathname = loc.pathname.split('#');
    loc.hash = loc.pathname.length > 1 ? '#' + loc.pathname[1] : '';
    loc.pathname = loc.pathname[0];

    //extract any search query and remove from the pathname
    loc.pathname = loc.pathname.split('?');
    loc.search = loc.pathname.length > 1 ? '?' + loc.pathname[1] : ''; 
    loc.pathname = loc.pathname[0]; 

    //return the final object 
    return loc; 
}

function getDocumentPath() {
    var path = '/';
    var href = document.location.href;
    if (href.indexOf('http:') == -1) return path;
    var s = href.split("/");
    for (var i = 3; i < ( s.length - 1 ); i++) {
        path += s[i] + '/';
    }
    return path;
}

function unescapeRepetitive(escapedString, character) {
    var escapedSign = escape(character);
    if (escapedSign.indexOf('%') == -1) return escapedString;
    var matcher = '(%)(25)*('+ escapedSign.substr(1,2) +')';
    var reg = new RegExp(matcher, 'g');
    return escapedString.replace(reg, character);
}

function repaireCookies_AcceptCookies() {
    var cookies = getCookiesWithName('ImmobilienScout24_cookieAccept');
    if (cookies.length == 0) return;
    var exitcode = deleteCookiesWithName('ImmobilienScout24_cookieAccept');
    if (exitcode != 0) {
        //alert('Es ist leider ein Fehler aufgetretten. Die im Browser hinterlegten Cookies weisen Inkonsisten auf. Um weitere Fehler zu vermeiden, sollten Sie Cookies der Immobilienscout24 löschen. Wir bitten dies zu entschuldigen.');
        return;
    }
}

function repaireCookies_PersistentState() {
    var comparator = function(p1,p2, p3) {
        if (p1 == p2) {
            if (p3.indexOf('%') != -1 || p3.indexOf(':') == -1 || p3 == '' || p3 == '\"' ) return true;
        }
    }
    //iterate over all cookies with the persistentState and search for an unescaped one.
    //is it an unescaped one? Then delete all cookies with the same name w/o exceptions.
    var cookies = getCookiesWithName('persistentState', comparator);
    if (cookies.length == 0) return;
    
    var exitcode = deleteCookiesWithName('persistentState');
    if (exitcode != 0) {
        //alert('Es ist leider ein Fehler aufgetretten. Die im Browser hinterlegten Cookies weisen Inkonsisten auf. Um weitere Fehler zu vermeiden, sollten Sie Cookies der Immobilienscout24 löschen. Wir bitten dies zu entschuldigen.');
        return;
    }
}

function repaireCookies_FPC() {
    var comparator = function(p1,p2, p3) {
        return p1.indexOf(p2) == -1 ? false : true;
    }
    
    var cookies = getCookiesWithName('fpc', comparator);
    if (cookies.length == 0) return;
    
    var cookieName;
    var cookieValue;
    for (var i = 0; i < cookies.length; i++) {//iterate over all fpc cookies and search for an unescaped one.
        var cookie = cookies[i];
        cookieName = cookie[0] + '';
        cookieValue = cookie[1] + '';
        if (cookieValue != '' && cookieValue.indexOf('%') == -1) {//is it an unescaped one?
            break;//take it
        } else {
            if (i == cookies.length -1 && cookieValue != '') {//last chance. there ist no valid fpc. take the invalid fpc und use it.
                cookieValue = unescapeRepetitive(cookieValue, '|');
                cookieValue = unescapeRepetitive(cookieValue, '=');
            }
        }
    }
    
    //retrieve all fpc cookie names
    var fpcCookieNames = new Object();
    for (var i = 0; i < cookies.length; i++) {
        var cookie = cookies[i];
        var cn = cookie[0] + '';
        var cv = cookie[1] + '';
        fpcCookieNames[cn] = cv;
    }
    
    for (cn in fpcCookieNames) {
        var exitcode = deleteCookiesWithName(cn);
        if (exitcode != 0) {
            //alert('Es ist leider ein Fehler aufgetretten. Die im Browser hinterlegten Cookies weisen Inkonsisten auf. Um weitere Fehler zu vermeiden, sollten Sie Cookies der Immobilienscout24 löschen. Wir bitten dies zu entschuldigen.');
            return;
        }
    }
        
    var expires = new Date();
    expires.setTime(expires.getTime() + 1000 * 60 * 60 * 24 * 365);
    
    var host = determineCookieHost();
    if (typeof host == 'undefined' || host == null) host = false;
    
    setCookie(cookieName, cookieValue, expires, '/', host, false, false, true);
}

function repaireMalformedCookies() {
    //repair
    repaireCookies_AcceptCookies();
    repaireCookies_PersistentState();
    //repaireCookies_FPC();

    //ignore
    //BIGIP
    //SSO
    //IS24_last_search
    //selectedpois

    //session cookies
    //IS24VisitId;
    //IS24VisitIdSC;

    //not changed yet
    //expose_cd
    
    //should have 
    //is24uv/IS24
    
    //?
    //POPUPCHECK
    //itfpctmp
    //otp_typ  
}

/*
========================================================================

    E N D  C O O K I E    A P I

========================================================================
*/

function setSkyscraper(minimalWidth, linkBannerID, bannerRegion, randomID, groupID) {
    if ( measureScreen() >= minimalWidth ) {
    	document.write('<scr'+'ipt type="text/jav'+'ascr'+'ipt" src=\"http://adserver.adtech.de/addyn|3.0|247|'
    	+ linkBannerID 
    	+ '|0|168|ADTECH;loc=100;target=_blank;key='
    	+ bannerRegion
    	+ ';grp='
    	+ groupID
    	+ ';misc='
    	+ randomID
    	+ '\"></scr'+'ipt>');
    }
}


function showSkyscraper(placementID, kvSBereich, kvImmotyp, kvRegio1, kvRegio2, randomID, groupID) {
   	document.write('<scr' + 'ipt type="text/jav'+'ascr'+'ipt" src=\"http://im.banner.t-online.de/addyn|3.0|784|' 
      + placementID 
      + '|0|168|ADTECH;loc=100;target=_blank;'
      + 'kvsbereich=' + kvSBereich + ';'
      + 'kvimmotyp=' + kvImmotyp + ';'
      + 'kvregio1=' + kvRegio1 + ';'
      + 'kvregio2=' + kvRegio2 + ';'
      + 'grp=' + groupID + ';'
      + 'misc=' + randomID
      + '\"></scr'+'ipt>');
}

function showSkyscraperBanner(placementID, kvRegio1, kvRegio2, randomID, groupID, sizeID) {
   	document.write('<scr' + 'ipt type="text/jav'+'ascr'+'ipt" src=\"http://im.banner.t-online.de/addyn|3.0|784|' 
      + placementID 
      + '|0|'+sizeID//168
      + '|ADTECH;loc=100;target=_blank;'
      + 'kvregio1=' + kvRegio1 + ';'
      + 'kvregio2=' + kvRegio2 + ';'
      + 'grp=' + groupID + ';'
      + 'misc=' + randomID
      + '\"></scr'+'ipt>');
}

function closeOnClickKSC()
{
	var myLink = YAHOO.util.Dom.getElementsByClassName("exitlink ksclink","a");
	YAHOO.util.Event.addListener(myLink, "click", function(){self.close();window.open(myLink,'IS24')});
}