//<![CDATA[

/**
 * Opens a new javascript window (popup).
 * 
 * @param _url    url to open in the popup window
 * @param _width  width from the popup window
 * @param _height height from the popup window
 * @return        object of the popup window
 * @author        re-lounge GmbH (http://www.re-lounge.com)
 */

function newWindow (_url, _width, _height) {
	if(mywindow && mywindow.closed==false)
	    mywindow.closeWindow()

	// Check height 
	if (_height > screen.availHeight)
		_height = screen.availHeight;
	
	var params = "dependent=no, ";
	params    += "height=" + _height +", ";
	params    += "hotkeys=yes, ";
	params    += "left=" + (screen.availWidth - _width)/2  + ", ";
	params    += "location=no, ";
	params    += "menubar=yes, ";
	params    += "resizable=yes, ";
	params    += "scrollbars=yes, ";
	params    += "status=yes, ";
	params    += "toolbar=no, ";
	params    += "top=" + (screen.availHeight - _height)/2  + ", ";
	params    += "width=" + (_width + 17);

	var mywindow = window.open(_url, "Zweitfenster", params);
	mywindow.focus();
	return mywindow;
}

/**
 * Closes a popup.
 * 
 * @param obj  reference of the popup to close
 * @return     void
 * @author     re-lounge GmbH (http://www.re-lounge.com)
 */
function closeWindow (obj){
	obj.close();
}

/**
 * Inits main navigation and adds flyout functionality.
 * 
 * @param obj  ID of the initialization object (UL)
 * @return     void
 * @author     re-lounge GmbH (http://www.re-lounge.com)
 */
function initMainNavigation(obj){
	var rootObj = document.getElementById(obj);
	if (rootObj != null) {
		for (var i=0; i < rootObj.childNodes.length; i++) {
			if (rootObj.childNodes[i].nodeName.toLowerCase() == "li"){
				if (navigator.appVersion.indexOf("MSIE")!=-1 && parseFloat(navigator.appVersion.split("MSIE")[1])<=6) {	
					// for IE < 7 only:
					
					// Position of flyouts:
					if (rootObj.childNodes[i].childNodes[2].childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[0] != null){
						var ulNode = rootObj; // ul > li
						var ulliNode = rootObj.childNodes[i]; // ul > li
						var ululNode = rootObj.childNodes[i].childNodes[2].childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[0]; //  ul > li > a > table > tr > td > ul
						//alert(ululNode.nodeName + ": " + ulNode.offsetTop + "+" + ulliNode.offsetTop +"+"+ ulliNode.offsetHeight + "px");
						ululNode.style.top = ulNode.offsetTop + ulliNode.offsetTop + ulliNode.offsetHeight + "px";
					}
				} else {
					// other browsers

					// mouseover and mouseout for ul > li
					rootObj.childNodes[i].onmouseover = function (){
						// ul > li:hover > ul {display: block;}
						for (var j=0; j < this.childNodes.length; j++) {
							if (this.childNodes[j].nodeName.toLowerCase() == "ul"){
								this.childNodes[j].style.display = "block";
							}
						}
					}
					rootObj.childNodes[i].onmouseout = function (){
						// ul > li:hover > ul {display: none;}
						for (var j=0; j < this.childNodes.length; j++) {
							if (this.childNodes[j].nodeName.toLowerCase() == "ul"){
								this.childNodes[j].style.display = "none";
							}
						}
					}
					// mouseover and mouseout for ul > li > ul
					for (var j=0; j < rootObj.childNodes[i].childNodes.length; j++) {
						if (rootObj.childNodes[i].childNodes[j].nodeName.toLowerCase() == "ul"){
							// Position of flyouts:  top(ul) = top(li) + height (li)
							if (navigator.appVersion.indexOf("MSIE")!=-1 && parseFloat(navigator.appVersion.split("MSIE")[1])<=7) {	
								rootObj.childNodes[i].childNodes[j].style.top = rootObj.offsetTop + rootObj.childNodes[i].offsetTop + rootObj.childNodes[i].offsetHeight + "px";
							} else {
								rootObj.childNodes[i].childNodes[j].style.top = rootObj.childNodes[i].offsetTop + rootObj.childNodes[i].offsetHeight + "px";
							}
							rootObj.childNodes[i].childNodes[j].onmouseover = function () {
								// change class for ul > li
								this.parentNode.className = "hover";
								//alert("menu: "+this.offsetTop + ", " + this.parentNode.style.top);
							}
							rootObj.childNodes[i].childNodes[j].onmouseout = function () {
								// change class for ul > li
								this.parentNode.className = "";
							}
						}
					}
				}
			}
		}	
	}
}

/**
 * Implements open and close functionality to definition lists.
 * 
 * @param obj  ID of the initialization object (DL)
 * @return     void
 * @author     re-lounge GmbH (http://www.re-lounge.com)
 */
function initFaq (obj) {
	var rootObj = document.getElementById(obj);
	if (rootObj != null) {
		for (var i=0; i < rootObj.childNodes.length; i++) {
			//alert(rootObj.childNodes[i].nodeName);
			if (rootObj.childNodes[i].nodeName.toLowerCase() == "dl"){
				// Hide elements
				var newAttribute = document.createAttribute("class");
				newAttribute.nodeValue = "hidden";
				rootObj.childNodes[i].setAttributeNode(newAttribute);
				for (var j=0; j < rootObj.childNodes[i].childNodes.length; j++) {
					if (rootObj.childNodes[i].childNodes[j].nodeName.toLowerCase() == "dt"){
						// Prevent text selection of <dt> text in opera and ie
						var newAttribute = document.createAttribute("unselectable");
						newAttribute.nodeValue = "on";
						rootObj.childNodes[i].childNodes[j].setAttributeNode(newAttribute);
						// Add onclick for <dt> childNodes
						rootObj.childNodes[i].childNodes[j].icon = "open";
						rootObj.childNodes[i].childNodes[j].onclick = function(){
							// change icon
							if (this.firstChild.nodeName.toLowerCase() == "img"){
								// change "iconlinkopen" to "iconlinkclose" and vice versa
								var path = this.firstChild.getAttribute("src").substr(0,this.firstChild.getAttribute("src").lastIndexOf("iconlink"));
								var file = this.firstChild.getAttribute("src").substr(this.firstChild.getAttribute("src").lastIndexOf("iconlink"));
								if (path.indexOf("basic") != -1) {
									// Use in HTML templates
									if (this.icon == "open"){
										src = path + file.replace(/open/,"close");
										this.icon = "close";
									} else {
										src = path + file.replace(/close/,"open");
										this.icon = "open";
									}
								} else {
									// Use in FirstSpirit
									if (this.icon == "open"){
										src = '/web/media/css/basic/iconlinkclose.gif';
										this.icon = "close";
									} else {
										src = '/web/media/css/basic/iconlinkopen.gif';
										this.icon = "open";
									}
								}
								var newAttribute = document.createAttribute("src");
								newAttribute.nodeValue = src;
								this.firstChild.setAttributeNode(newAttribute);
							}	
							// change display for <dd>
							var currNode = this;
							while (currNode != null) {
								if (currNode.nodeName.toLowerCase() == "dd") {
									if (currNode.style.display == "block")
										currNode.style.display = "none";
									else
										currNode.style.display = "block";
									break;
								}
								currNode = currNode.nextSibling;
							}
						}
					}
				}				
			}
		}
	}
}

var sitemapCollapseNodes = new Array();

/**
 * Inits sitemap 
 * (Hides level 2 and implements open and close functionality to unordered lists)
 * 
 * @param obj  ID of the initialization object (UL)
 * @return     void
 * @author     re-lounge GmbH (http://www.re-lounge.com)
 */
function initSitemap (obj) {
	var rootObj = document.getElementById(obj);
	var num = 1;
	var cms = false;

	// Hide sub levels
	if (rootObj != null) {
		for (var i=0; i < rootObj.childNodes.length; i++) {
			if (rootObj.childNodes[i].nodeName.toLowerCase() == "li"){
				for (var j=0; j < rootObj.childNodes[i].childNodes.length; j++) {
					if (rootObj.childNodes[i].childNodes[j].nodeName.toLowerCase() == "ul"){
						for (var k=0; k < rootObj.childNodes[i].childNodes[j].childNodes.length; k++) {
							if (rootObj.childNodes[i].childNodes[j].childNodes[k].nodeName.toLowerCase() == "li"){
								for (var l=0; l < rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes.length; l++) {
									if (rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].nodeName.toLowerCase() == "ul"){
										for (var m=0; m < rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes.length; m++) {
											if (rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].nodeName.toLowerCase() == "li"){
												if (num == 1){
													//alert(rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].getAttribute("test"));
													//alert(rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].firstChild.nodeName);	
												}
												for (var n=0; n < rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes.length; n++) {
													// Hide sublevels (li > ul)
													// <ul> = rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n]
													if (rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].nodeName.toLowerCase() == "ul"){
														// Add ID
														if (!sitemapCollapseNodeNum)
															var sitemapCollapseNodeNum = 0;
														var idValue = obj + "_" + sitemapCollapseNodeNum;
														sitemapCollapseNodeNum++;
														
														if (!rootObj.sitemapCollapseNodes)
															rootObj.sitemapCollapseNodes = new Array();
														rootObj.sitemapCollapseNodes.push(idValue);
														//alert(idValue);
														
														var newAttribute = document.createAttribute("id");
														newAttribute.nodeValue = idValue;
														rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].setAttributeNode(newAttribute);
														// Hide
														rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].style.display = "none";
													}
													// Add open/close functionality (li > a > span > img)
													if (rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].nodeName.toLowerCase() == "a"){
														// <img> = rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].firstChild.firstChild
														// Add ID
														if (!sitemapCollapseImageNodeNum)
															var sitemapCollapseImageNodeNum = 0;
														var idValue = obj + "_image_" + sitemapCollapseImageNodeNum;
														sitemapCollapseImageNodeNum++;
														if (!rootObj.sitemapCollapseImageNodes)
															rootObj.sitemapCollapseImageNodes = new Array();
														rootObj.sitemapCollapseImageNodes.push(idValue);
														//alert(idValue);
														var newAttribute = document.createAttribute("id");
														newAttribute.nodeValue = idValue;
														rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].firstChild.firstChild.setAttributeNode(newAttribute);

														// Get path and filename of image
														var filename = rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].firstChild.firstChild.getAttribute("src").substr(rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].firstChild.firstChild.getAttribute("src").lastIndexOf("iconlink"));
														var path = rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].firstChild.firstChild.getAttribute("src").substr(0,rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].firstChild.firstChild.getAttribute("src").lastIndexOf("iconlink"));
														rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].firstChild.firstChild.path = path;
														rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].firstChild.firstChild.filename = filename;
														// Change icon
														if (path.indexOf("basic") != -1) {
															// Use in HTML templates
															src = path + filename.replace(/close/,"open");
															cms = false;
														} else {
															// Use in FirstSpirit
															src = '/web/media/css/basic/iconlinkopen.gif';
															cms = true;
														}
														// 18.03.2008, mare: Workaround for CMS 
														cms = true;
														src = '/web/media/css/basic/iconlinkopen.gif';
														var newAttribute = document.createAttribute("src");
														newAttribute.nodeValue = src;
														rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].firstChild.firstChild.setAttributeNode(newAttribute);

														rootObj.childNodes[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].childNodes[n].firstChild.firstChild.onclick = function () {
															if (this.parentNode.parentNode.parentNode.childNodes[2]){
																if (this.parentNode.parentNode.parentNode.childNodes[2].style.display == "block"){
																	this.parentNode.parentNode.parentNode.childNodes[2].style.display = "none";
																	// change icon image
																	//alert(this.getAttribute("src")+", "+this.filename);
																	if (this.path.indexOf("basic") != -1) {
																		// Use in HTML templates
																		src = this.path + this.filename.replace(/close/,"open");
																	} else {
																		// Use in FirstSpirit
																		src = '/web/media/css/basic/iconlinkopen.gif';
																	}
																	var newAttribute = document.createAttribute("src");
																	newAttribute.nodeValue = src;
																	this.setAttributeNode(newAttribute);
																} else {
																	this.parentNode.parentNode.parentNode.childNodes[2].style.display = "block";
																	// change icon image
																	//alert(this.getAttribute("src"));
																	if (this.path.indexOf("basic") != -1) {
																		// Use in HTML templates
																		src = this.path + this.filename.replace(/open/,"close");
																	} else {
																		// Use in FirstSpirit
																		src = '/web/media/css/basic/iconlinkclose.gif';
																	}
																	var newAttribute = document.createAttribute("src");
																	newAttribute.nodeValue = src;
																	this.setAttributeNode(newAttribute);
																}
															}
															return false;
														}
													}

												}
												num++;
												
												
											}
										}							
									}
								}							
							}
						}
					}
				}
			}
		}
	}
	// Generate collapse/expand menu
	var newNode = document.createElement("div");
	var newAttribute = document.createAttribute("class");
	newAttribute.nodeValue = "menu";
	currNode = rootObj.parentNode.insertBefore(newNode, rootObj);
	currNode.setAttributeNode(newAttribute);
	if (cms)
		currNode.innerHTML = '<a href="javascript:expandSitemap(\'sitemap_1\');"><span class="iconlinkopen"><img src="/web/media/css/basic/iconlinkopen.gif" alt="" /></span> Alle Ebenen öffnen</a> &nbsp;|&nbsp; <a href="javascript:collapseSitemap(\'sitemap_1\');"><span class="iconlinkopen"><img src="/web/media/css/basic/iconlinkclose.gif" alt="" /></span> Alle Ebenen schließen</a>';
	else
		currNode.innerHTML = '<a href="javascript:expandSitemap(\'sitemap_1\');"><span class="iconlinkopen"><img src="/web/media/css/basic/iconlinkopen.gif" alt="" /></span> Alle Ebenen öffnen</a> &nbsp;|&nbsp; <a href="javascript:collapseSitemap(\'sitemap_1\');"><span class="iconlinkopen"><img src="/web/media/css/basic/iconlinkclose.gif" alt="" /></span> Alle Ebenen schließen</a>';
}

/**
 * Collapses sitemap 
 * 
 * @param obj  ID of the sitemap object (UL)
 * @return     void
 * @author     re-lounge GmbH (http://www.re-lounge.com)
 */
function collapseSitemap(obj){
	var rootObj = document.getElementById(obj);
	// Hide <ul>'s
	if (rootObj.sitemapCollapseNodes){
		for (var i=0; i < rootObj.sitemapCollapseNodes.length; i++){
			document.getElementById(rootObj.sitemapCollapseNodes[i]).style.display = "none";
		}
	}
	// Change Icon
	if (rootObj.sitemapCollapseImageNodes){
		for (var i=0; i < rootObj.sitemapCollapseImageNodes.length; i++){
			if (document.getElementById(rootObj.sitemapCollapseImageNodes[i]).parentNode.parentNode.parentNode.childNodes[2]) {
				var filename = document.getElementById(rootObj.sitemapCollapseImageNodes[i]).getAttribute("src").substr(document.getElementById(rootObj.sitemapCollapseImageNodes[i]).getAttribute("src").lastIndexOf("iconlink"));
				var path = document.getElementById(rootObj.sitemapCollapseImageNodes[i]).getAttribute("src").substr(0,document.getElementById(rootObj.sitemapCollapseImageNodes[i]).getAttribute("src").lastIndexOf("iconlink"));
				// Change icon
				var newAttribute = document.createAttribute("src");
				if (path.indexOf("basic") != -1) {
					// Use in HTML templates
					src = path + filename.replace(/close/,"open");
				} else {
					// Use in FirstSpirit
					src = '/web/media/css/basic/iconlinkopen.gif';
				}
				newAttribute.nodeValue = src;
				document.getElementById(rootObj.sitemapCollapseImageNodes[i]).setAttributeNode(newAttribute);
			}
		}
	}
}

/**
 * Expands sitemap 
 * 
 * @param obj  ID of the sitemap object (UL)
 * @return     void
 * @author     re-lounge GmbH (http://www.re-lounge.com)
 */
function expandSitemap(obj){
	var rootObj = document.getElementById(obj);
	// Show <ul>'s
	if (rootObj.sitemapCollapseNodes){
		for (var i=0; i < rootObj.sitemapCollapseNodes.length; i++){
			document.getElementById(rootObj.sitemapCollapseNodes[i]).style.display = "block";
		}
	}
	// Change Icon
	if (rootObj.sitemapCollapseImageNodes){
		for (var i=0; i < rootObj.sitemapCollapseImageNodes.length; i++){
			if (document.getElementById(rootObj.sitemapCollapseImageNodes[i]).parentNode.parentNode.parentNode.childNodes[2]) {
				var filename = document.getElementById(rootObj.sitemapCollapseImageNodes[i]).getAttribute("src").substr(document.getElementById(rootObj.sitemapCollapseImageNodes[i]).getAttribute("src").lastIndexOf("iconlink"));
				var path = document.getElementById(rootObj.sitemapCollapseImageNodes[i]).getAttribute("src").substr(0,document.getElementById(rootObj.sitemapCollapseImageNodes[i]).getAttribute("src").lastIndexOf("iconlink"));
				// Change icon
				var newAttribute = document.createAttribute("src");
				if (path.indexOf("basic") != -1) {
					// Use in HTML templates
					src = path + filename.replace(/open/,"close");
				} else {
					// Use in FirstSpirit
					src = '/web/media/css/basic/iconlinkclose.gif';
				}
				newAttribute.nodeValue = src;
				document.getElementById(rootObj.sitemapCollapseImageNodes[i]).setAttributeNode(newAttribute);
			}
		}
	}
}

/**
 * Adds position:fixed functionality to IE < 7 
 * Uses {@link #repositionFixedElement(object, int, string)} for permanent positioning of the element.
 * 
 * @param object obj        ID of the element with fixed position
 * @param int topmargin     topmargin
 * @param string position   "bottom" or "top"
 * @return                  void
 * @author                  re-lounge GmbH (http://www.re-lounge.com)
 */
function initPositionFixed(obj,topmargin,position) {
	if (document.getElementById(obj) != null){
		document.getElementById(obj).style.display = "block";
		document.getElementById(obj).style.height = document.documentElement.clientHeight;
		document.getElementById(obj).style.position = "absolute";
		window.setInterval(function callFunc() { repositionFixedElement(obj,topmargin,position); }, 100);
	}
}

/**
 * For permanent reposition of elements with fixed positions (IE < 7)
 * Used from {@link #initPositionFixed(object, int, string)}
 * 
 * @param object obj        ID of the element with fixed position
 * @param int topmargin     topmargin
 * @param string position   "bottom" or "top"
 * @return                  void
 * @author                  re-lounge GmbH (http://www.re-lounge.com)
 */
function repositionFixedElement(obj,topmargin,position) {
	if (document.getElementById(obj) !=null ) {
		switch (position){
			case "bottom":
				document.getElementById(obj).style.top = document.documentElement.scrollTop + ((document.documentElement.clientHeight - document.getElementById(obj).offsetHeight) - topmargin);
				break;
			case "top":
			default:
				document.getElementById(obj).style.top = document.documentElement.scrollTop + topmargin;
		}
	}
}


/**
 * Adds em support to swf object
 * Used from {@link #initPositionFixed(object, int, string)}
 * 
 * @param object obj      flash object
 * @param int org_width   original width of flash movie in px
 * @param int org_height  original height of flash movie in px
 * @param int width       targetwidth for the flash movie (1 column, 2 columns, 3 columns)
 * @return                void
 * @author                re-lounge GmbH (http://www.re-lounge.com)
 */
function swfObjectUseEm (obj, org_width, org_height, width){
	var browserDefaultFontSize = 16;
	var height = Math.round((org_height*width)/org_width);
	if (document.getElementById(obj) !=null ) {
		// Convert px to em: [pixel value]/[browserDefaultFontSize]
		// firstChild is <object> in IE and <embed> in Firefox
		document.getElementById(obj).firstChild.style.width = width/browserDefaultFontSize+"em";
		document.getElementById(obj).firstChild.style.height = height/browserDefaultFontSize+"em";
	}
}


/* --------------------------------------------------------------------------------------
 * FUNCTION setStylesheet()
 * --------------------------------------------------------------------------------------
 * Changes current stylesheet (to given stylesheet reference "val") and reloads page.
 * Author: re-lounge, http://www.re-lounge.com
 */
function setStylesheet(val) {
	// Set cookie
	SetCookie("zoomStep",val,expdateAll,"/");
	// Reload
	window.location.reload(true);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *																					   *
 * 	Cookie related functions														   *
 *																					   *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 			*/

/* --------------------------------------------------------------------------------------
 * FUNCTION cookiesEnabled()
 * --------------------------------------------------------------------------------------
 * Verifies if cookies are enabled and writes "true" or "false" in a global variable.
 * Author: re-lounge, http://www.re-lounge.com
 */
function cookiesEnabled(){
	var now = new Date();
	var val = String(now.getTime());
	SetCookie("cookieTest",val);
	cookiesEnabled = false;
	if (GetCookie("cookieTest")==val)
		return true;
	else
		return false;
} 
var cookiesEnabled = cookiesEnabled();
 
/* --------------------------------------------------------------------------------------
 * FUNCTION initCookieDate()
 * --------------------------------------------------------------------------------------
 * Initialises cookie expiries for new and changed cookies.
 * Author: re-lounge, http://www.re-lounge.com
 *
 * The following data is collected in cookies:
 *
 * - Current style used
 * - Current view of service elements in service area (open or closed)
 * - Current view service area (open or closed)
 *
 * The cookie expiry is 3 months for all element data.
 *
 */
function initCookieDate(){
	expdateAll = new Date ();
	expdateAll.setTime(expdateAll.getTime() + (3 * 30 * 24 * 60 * 60 * 1000));	// 3 Monate
}
initCookieDate();

// --------------------------------------------------------------------------------------
//  Cookie Functions -- "Night of the Living Cookie" Version (25-Jul-96)
// --------------------------------------------------------------------------------------
//
//  Written by:  Bill Dortch, hIdaho Design <bdortch@hidaho.com>
//  The following functions are released to the public domain.
//
//  This version takes a more aggressive approach to deleting
//  cookies.  Previous versions set the expiration date to one
//  millisecond prior to the current time; however, this method
//  did not work in Netscape 2.02 (though it does in earlier and
//  later versions), resulting in "zombie" cookies that would not
//  die.  DeleteCookie now sets the expiration date to the earliest
//  usable date (one second into 1970), and sets the cookie's value
//  to null for good measure.
//
//  Also, this version adds optional path and domain parameters to
//  the DeleteCookie function.  If you specify a path and/or domain
//  when creating (setting) a cookie**, you must specify the same
//  path/domain when deleting it, or deletion will not occur.
//
//  The FixCookieDate function must now be called explicitly to
//  correct for the 2.x Mac date bug.  This function should be
//  called *once* after a Date object is created and before it
//  is passed (as an expiration date) to SetCookie.  Because the
//  Mac date bug affects all dates, not just those passed to
//  SetCookie, you might want to make it a habit to call
//  FixCookieDate any time you create a new Date object:
//
//    var theDate = new Date();
//    FixCookieDate (theDate);
//
//  Calling FixCookieDate has no effect on platforms other than
//  the Mac, so there is no need to determine the user's platform
//  prior to calling it.
//
//  This version also incorporates several minor coding improvements.
//
//  **Note that it is possible to set multiple cookies with the same
//  name but different (nested) paths.  For example:
//
//    SetCookie ("color","red",null,"/outer");
//    SetCookie ("color","blue",null,"/outer/inner");
//
//  However, GetCookie cannot distinguish between these and will return
//  the first cookie that matches a given name.  It is therefore
//  recommended that you *not* use the same name for cookies with
//  different paths.  (Bear in mind that there is *always* a path
//  associated with a cookie; if you don't explicitly specify one,
//  the path of the setting document is used.)
//  
//  Revision History:
//
//    "Toss Your Cookies" Version (22-Mar-96)
//      - Added FixCookieDate() function to correct for Mac date bug
//
//    "Second Helping" Version (21-Jan-96)
//      - Added path, domain and secure parameters to SetCookie
//      - Replaced home-rolled encode/decode functions with Netscape's
//        new (then) escape and unescape functions
//
//    "Free Cookies" Version (December 95)
//
//
//  For information on the significance of cookie parameters, and
//  and on cookies in general, please refer to the official cookie
//  spec, at:
//
//      http://www.netscape.com/newsref/std/cookie_spec.html    
//
//******************************************************************
//
// "Internal" function to return the decoded value of a cookie
//
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
//
//  Function to correct for 2.x Mac date bug.  Call this function to
//  fix a date object prior to passing it to SetCookie.
//  IMPORTANT:  This function should only be called *once* for
//  any given date object!  See example at the end of this document.
//
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
//
//  Function to return the value of the cookie specified by "name".
//    name - String object containing the cookie name.
//    returns - String object containing the cookie value, or null if
//      the cookie does not exist.
//
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}
//
//  Function to create or update a cookie.
//    name - String object containing the cookie name.
//    value - String object containing the cookie value.  May contain
//      any valid string characters.
//    [expires] - Date object containing the expiration data of the cookie.  If
//      omitted or null, expires the cookie at the end of the current session.
//    [path] - String object indicating the path for which the cookie is valid.
//      If omitted or null, uses the path of the calling document.
//    [domain] - String object indicating the domain for which the cookie is
//      valid.  If omitted or null, uses the domain of the calling document.
//    [secure] - Boolean (true/false) value indicating whether cookie transmission
//      requires a secure channel (HTTPS).  
//
//  The first two parameters are required.  The others, if supplied, must
//  be passed in the order listed above.  To omit an unused optional field,
//  use null as a place holder.  For example, to call SetCookie using name,
//  value and path, you would code:
//
//      SetCookie ("myCookieName", "myCookieValue", null, "/");
//
//  Note that trailing omitted parameters do not require a placeholder.
//
//  To set a secure cookie for path "/myPath", that expires after the
//  current session, you might code:
//
//      SetCookie (myCookieVar, cookieValueVar, null, "/myPath", null, true);
//
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

//  Function to delete a cookie. (Sets expiration date to start of epoch)
//    name -   String object containing the cookie name
//    path -   String object containing the path of the cookie to delete.  This MUST
//             be the same as the path used to create the cookie, or null/omitted if
//             no path was specified when creating the cookie.
//    domain - String object containing the domain of the cookie to delete.  This MUST
//             be the same as the domain used to create the cookie, or null/omitted if
//             no domain was specified when creating the cookie.
//
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function toggleBandDetail(obj) {
	
	var band = obj.parentNode.parentNode.parentNode;
	var icon = obj.childNodes[0];
	
	obj.blur();
	
	if(band.className == "band active"){
		band.className = "band";
		icon.src='/web/media/css/badenovamsc/iconlinkclose_band.gif';
	}else{
		band.className = "band active";
		icon.src='/web/media/css/badenovamsc/iconlinkopen_band.gif';
	}
	
	return false;

}

function hideBandDetail(bandID) {
	var obj = document.getElementById("bandDetailContent_"+bandID);
	var icon = document.getElementById("bandDetailIcon_"+bandID);
	var bandContainer = document.getElementById("bandContainer_"+bandID);
	
	obj.style.display = 'none';
	icon.src = '/web/media/css/badenovamsc/iconlinkclose_band.gif';
	bandContainer.style.backgroundImage = 'url(/web/media/css/badenovamsc/bg_steckbrief.jpg)';
	bandContainer.style.height = '40px';
}

function setInitValue(elem){
	if(elem.value == "")
		elem.value = "Suche";
	else if (elem.value == "Suche")
		elem.value = "";
	else
		elem.value = elem.value;
}


/*]]*/

//]]>