<!--
// Browserdefinitionen
NS4=false;
IE4=false;
NS6=false;
if(document.layers) NS4=true;
if(document.all) IE4=true;
if(document.getElementById) NS6=true;	
	
// Funktion startet direkt aufgerufenen Seiten mit Rahmenansicht
if ( (self.location.pathname!="/page.php") 
	&& (self.location.pathname!="/search_energreen.php") 
	&& (self.location.pathname!="/search_asew.php") 
	&& (self.location.pathname!="/search_watergreen.php") 
	&& (self.location.pathname!="/sitemap_energreen.php")
	&& (self.location.pathname!="/sitemap_asew.php")
	&& (self.location.pathname.indexOf("/asewGips")<0)
	&& (self.location.pathname!="/klickzaehler.php")
	&& (self.location.pathname!="/sitemap_watergreen.php")) {
	page = self.location.pathname;
	weblicdat = page.indexOf("wTmp"); // wird Datei aus Weblication aufgerufen?
	if (weblicdat<0) {
/*		if (self.name != "DOMAINFRAME") window.top.location.href = '/?page='+page;
		else {*/
			url = '/page.php?page='+page;
			self.location.replace(url);
//		}
	}
}
/*else if ((self.location.pathname=="/page.php") && (self.name!="DOMAINFRAME")) {
	page = self.location.search;
	url = '/'+page;
	top.location.replace(url);
} */

// Wieviele Navpunkte werden angezeigt
anzeige=0;

// Navigations- und Seitenaufruf
function showNavpoint(id, url){
	if(url != ""){
		self.location.href = "/page.php?page="+url+"&navid="+id;
//		self.location.href = url;
	}
}

// Funktion zum öffnen eines Formulars, über das eine Seite versendet werden kann
function senden(page)
{
	url = "/send.php?page="+page;
	window.open(url,'Seitesenden','width=570,height=550,scrollbars=yes,toolbar=no');
}

// Funktion zum Bookmark setzen
function bookmark(page)
{
	bookmarkurl="http://www.bad-gottleuba.de/"+page;
	bookmarktitle=document.title;
	if (document.all) {
		window.external.AddFavorite(bookmarkurl,bookmarktitle)
	} else alert("STRG + D drücken"); 
}	

// Funktion für Newsletter-Kategorien
function checkNLKat(checkid) {
	if ((checkid==3 || document.getElementById('check3').checked==true) && (document.getElementById('check4').checked==true || document.getElementById('check15').checked==true || document.getElementById('check16').checked==true)) {
		alert("Als Nichtmitgliedsunternehmen können Sie nur den Newsletter für Nichtmitgliedsunternehmen abonnieren!");
		document.getElementById('check4').checked=false;
		document.getElementById('check15').checked=false;
		document.getElementById('check16').checked=false;
	}
}

// Funktionen zum Aufruf von PopUp-Fenstern

function openFormcenter(service,email){
w=850;
h=600;
url="/formcenter.php?service="+service+"&email="+email;
popup = window.open(url, 'PopUp1', 'width='+w+',height='+h+',toolbar=yes,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
//popup.resizeTo(w, h);
popup.focus();
}

function PopUp(url,w,h)
{
popup = window.open(url, 'PopUp2', 'width='+w+',height='+h+',scrollbars=yes,resizable=yes');
popup.resizeTo(w, h);
popup.focus();
}

function openWin(url,w,h){
popup = window.open(url, 'PopUp3', 'width='+w+',height='+h+',toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes');
}

// Und noch eine PopUp-Funktion 
function openPopup(url){
 window.open(url, "popup", "scrollbars=yes,resizable=yes,menubar=yes,location=no,width=620,height=500");
}

function login()
{
gekowin = open('', 'gekowin', 'width=790,height=590,scrollbars=no,hotkeys=no,locationbar=no,menubar=no,resizable=no,status=no');
document.forms[0].target="gekowin";
return true;
}


// PopUp-Funktion für Routenplaner
function openRoute(url) {
popup = window.open(url,'Anfahrt','width=652,height=540,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes');
}

// Bei IE für schöne Optik sorgen
function formOptik() {
	if (document.all) {
	 for (var _i=0; _i < document.forms[1].length; _i++) {
	  if ((document.forms[1].elements[_i].type=="button") || (document.forms[1].elements[_i].type=="submit") || (document.forms[1].elements[_i].type=="reset")) document.forms[1].elements[_i].className="formbutton";
  	  else if (document.forms[1].elements[_i].type!="hidden") document.forms[1].elements[_i].className="formfelder"; 
	 }
	}
}

// Neue Funktion zum Setzen von Formularwerten (Werte kommen aus einer PHP-Session), Aufruf in page.php
function formGetvalues(frm,key,val) {
	if (frm.elements[key]) {
//		alert(key +": "+frm.elements[key].type);
		if ((frm.elements[key].type != "radio") && (frm.elements[key].type != "checkbox") && (frm.elements[key].type != undefined)) frm.elements[key].value=val;
		else {
			if (frm.elements[key].type == "checkbox") frm.elements[key].checked = true;
			else {
				nr = frm.elements[key].length;
				for (i=0;i<nr;i++) {
					if (frm.elements[key][i].value == val) frm.elements[key][i].click();
//					alert(frm.elements[key][i].value +"=="+ val);
				}
			}
		}
	}
}

function initLook() {
// Bei IE für schöne Optik sorgen
	if (document.all) {
	 var s = document.getElementsByTagName('input');
	 for (i=0; i < s.length; i++) {
	  if (s[i].type=="image") s[i].className=""; 
  	  else if ((s[i].type=="button") || (s[i].type=="submit") || (s[i].type=="reset")) s[i].className="formbutton";
	  else if (s[i].className=="") s[i].className="formfelder"; 
	 }
	}
	
// Damit Seite 100 % Höhe von Fenster
	if (IE4) {
		if (document.body.scrollHeight > document.body.offsetHeight) document.all.Rahmen.style.height = document.body.scrollHeight + 150;
	}
	else {
		if (document.body.scrollHeight > window.innerHeight) {
			if (NS4) document.layers['Rahmen'].height = document.body.scrollHeight + 130;
			if (NS6) document.getElementById('Rahmen').style.height = document.body.scrollHeight + 130;
		}
    }

}

// Quickinfo Menü Weiterleitung
function jump(dest) {
	if ((dest.indexOf(".pdf")>0) || (dest.indexOf(".php")>0)) {
		openWin(dest,700,500);
	}
	else if (dest.indexOf(".html")>0) {
		self.location.href = "/page.php?page="+dest;
	}
	else if (dest.indexOf("Geko")>0) {
		openGeko();
	}
	/*else if (dest.indexOf(".jsp&bgcolor=#cococo")>0) {
		openRhenag(dest);
	}
	else if (dest!="") {
		openFormcenter(dest);
	}*/
}
	
// Cookie-Funktionen
function WertHolen() {
 var Wert = "";
 if(document.cookie) {
  var Wertstart = document.cookie.indexOf("=") + 1;
  var Wertende = document.cookie.indexOf(";");
  if (Wertende == -1) Wertende = document.cookie.length;
  Wert = document.cookie.substring(Wertstart,Wertende);
 }
 return Wert;
}

function WertSetzen(Bezeichner, Wert, Verfall) {
 var jetzt = new Date();
 var Auszeit = new Date(jetzt.getTime() + Verfall);
 document.cookie = Bezeichner+"="+Wert+"; expires="+Auszeit.toGMTString()+";";
}

function Laden() {
 var Checkstr = WertHolen();
 var Check = "";
 if (Checkstr != "") {
  for (var i=0; i < Checkstr.length; i++) {
   Check = Checkstr.substring(i,i+1);
   if (Check == "1") document.forms['checkliste'].elements[i].click();
  }
//  alert("Ihre gespeicherten Daten wurden geladen!\n");
 }
}

function Speichern() {
 var Verfallszeit = 1000*60*60*24*365; // 1 Jahr
 var Checkstr = "";
 var Check = "";
 for (var i=0; i < document.forms['checkliste'].length; i++) {
  if (document.forms['checkliste'].elements[i].checked) Check = "1";
  else Check = "0";
  Checkstr += Check;
 }
 WertSetzen("Checkstr",Checkstr,Verfallszeit);
}

// Smooth scrolling

ss_addEvent(window,"load",ss_fixAllLinks);

function ss_fixAllLinks() {
 // Get a list of all links in the page
 var allLinks = document.getElementsByTagName('a');
 // Walk through the list
 for (var i=0;i<allLinks.length;i++) {
   var lnk = allLinks[i];
   if ((lnk.href && lnk.href.indexOf('#') != -1) &&  
       ( (lnk.pathname == location.pathname) ||
   ('/'+lnk.pathname == location.pathname) ) &&  
       (lnk.search == location.search)) {
     // If the link is internal to the page (begins in #)
     // then attach the smoothScroll function as an onclick
     // event handler
     ss_addEvent(lnk,'click',smoothScroll);
   }
 }
}

function smoothScroll(e) {
 // This is an event handler; get the clicked on element,
 // in a cross-browser fashion
 if (window.event) {
   target = window.event.srcElement;
 } else if (e) {
   target = e.target;
 } else return;
 
 // Make sure that the target is an element, not a text node
 // within an element
 if (target.nodeType == 3) {
   target = target.parentNode;
 }
 
 // Paranoia; check this is an A tag
 if (target.nodeName.toLowerCase() != 'a') return;
 
 // Find the <a name> tag corresponding to this href
 // First strip off the hash (first character)
 anchor = target.hash.substr(1);
 // Now loop all A tags until we find one with that name
 var allLinks = document.getElementsByTagName('a');
 var destinationLink = null;
 for (var i=0;i<allLinks.length;i++) {
   var lnk = allLinks[i];
   if (lnk.name && (lnk.name == anchor)) {
     destinationLink = lnk;
     break;
   }
 }
 
 // If we didn't find a destination, give up and let the browser do
 // its thing
 if (!destinationLink) return true;
 
 // Find the destination's position
 var destx = destinationLink.offsetLeft;  
 var desty = destinationLink.offsetTop;
 var thisNode = destinationLink;
 while (thisNode.offsetParent &&  
       (thisNode.offsetParent != document.body)) {
   thisNode = thisNode.offsetParent;
   destx += thisNode.offsetLeft;
   desty += thisNode.offsetTop;
 }
 
 // Stop any current scrolling
 clearInterval(ss_INTERVAL);
 
 cypos = ss_getCurrentYPos();
 
 ss_stepsize = parseInt((desty-cypos)/ss_STEPS);
 ss_INTERVAL = setInterval('ss_scrollWindow('+ss_stepsize+','+desty+',"'+anchor+'")',10);
 
 // And stop the actual click happening
 if (window.event) {
   window.event.cancelBubble = true;
   window.event.returnValue = false;
 }
 if (e && e.preventDefault && e.stopPropagation) {
   e.preventDefault();
   e.stopPropagation();
 }
}

function ss_scrollWindow(scramount,dest,anchor) {
 wascypos = ss_getCurrentYPos();
 isAbove = (wascypos < dest);
 window.scrollTo(0,wascypos + scramount);
 iscypos = ss_getCurrentYPos();
 isAboveNow = (iscypos < dest);
 if ((isAbove != isAboveNow) || (wascypos == iscypos)) {
   // if we've just scrolled past the destination, or
   // we haven't moved from the last scroll (i.e., we're at the
   // bottom of the page) then scroll exactly to the link
   window.scrollTo(0,dest);
   // cancel the repeating timer
   clearInterval(ss_INTERVAL);
   // and jump to the link directly so the URL's right
   location.hash = anchor;
 }
}

function ss_getCurrentYPos() {
 if (document.body && document.body.scrollTop)
   return document.body.scrollTop;
 if (document.documentElement && document.documentElement.scrollTop)
   return document.documentElement.scrollTop;
 if (window.pageYOffset)
   return window.pageYOffset;
 return 0;
}

function ss_addEvent(elm, evType, fn, useCapture)
// addEvent and removeEvent
// cross-browser event handling for IE5+,  NS6 and Mozilla
// By Scott Andrew
{
 if (elm.addEventListener){
   elm.addEventListener(evType, fn, useCapture);
   return true;
 } else if (elm.attachEvent){
   var r = elm.attachEvent("on"+evType, fn);
   return r;
 }
}  

var ss_INTERVAL;
var ss_STEPS = 25;

ss_addEvent(window,"load",ss_fixAllLinks);

// Cookies

function Cookiemanager(name,defaultExpiration,expirationUnits,defaultDomain,defaultPath) {
	this.name = name;
	this.defaultExpiration = this.getExpiration(defaultExpiration,expirationUnits);
	this.defaultDomain = (defaultDomain)?defaultDomain:(document.domain.search(/[a-zA-Z]/) == -1)?document.domain:document.domain.substring(document.domain.indexOf('.') + 1,document.domain.length);
	this.defaultPath = (defaultPath)?defaultPath:'/';
	this.cookies = new Object();
	this.expiration = new Object();
	this.domain = new Object();
	this.path = new Object();
	window.onunload = new Function (this.name+'.setDocumentCookies();');
	this.getDocumentCookies();
	}
Cookiemanager.prototype.getExpiration = function(expiration,units) {
	expiration = (expiration)?expiration:7;
	units = (units)?units:'days';
	var date = new Date();
	switch(units) {
		case 'years':
			date.setFullYear(date.getFullYear() + expiration);
			break;
		case 'months':
			date.setMonth(date.getMonth() + expiration);
			break;
		case 'days':
			date.setTime(date.getTime()+(expiration*24*60*60*1000));
			break;
		case 'hours':
			date.setTime(date.getTime()+(expiration*60*60*1000));
			break;
		case 'minutes':
			date.setTime(date.getTime()+(expiration*60*1000));
			break;
		case 'seconds':
			date.setTime(date.getTime()+(expiration*1000));
			break;
		default:
			date.setTime(date.getTime()+expiration);
			break;
		}
	return date.toGMTString();
	}
Cookiemanager.prototype.getDocumentCookies = function() {
	var cookie,pair;
	var cookies = document.cookie.split(';');
	var len = cookies.length;
	for(var i=0;i < len;i++) {
		cookie = cookies[i];
		while (cookie.charAt(0)==' ') cookie = cookie.substring(1,cookie.length);
		pair = cookie.split('=');
		this.cookies[pair[0]] = pair[1];
		}
	}
Cookiemanager.prototype.setDocumentCookies = function() {
	var expires = '';
	var cookies = '';
	var domain = '';
	var path = '';
	for(var name in this.cookies) {
		expires = (this.expiration[name])?this.expiration[name]:this.defaultExpiration;
		path = (this.path[name])?this.path[name]:this.defaultPath;
		domain = (this.domain[name])?this.domain[name]:this.defaultDomain;
		cookies = name + '=' + this.cookies[name] + '; expires=' + expires + '; path=' + path + '; domain=' + domain;
		document.cookie = cookies;
		}
	return true;
	}
Cookiemanager.prototype.getCookie = function(cookieName) {
	var cookie = this.cookies[cookieName]
	return (cookie)?cookie:false;
	}
Cookiemanager.prototype.setCookie = function(cookieName,cookieValue,expiration,expirationUnits,domain,path) {
	this.cookies[cookieName] = cookieValue;
	if (expiration) this.expiration[cookieName] = this.getExpiration(expiration,expirationUnits);
	if (domain) this.domain[cookieName] = domain;
	if (path) this.path[cookieName] = path;
	return true;
	}
var cookieManager = new Cookiemanager('cookieManager',1,'years');


//Efa Font-Sizer
var efa_default = 70;											//default text size as percentage of user default
var efa_increment = 10;											//percentage to increase/decrease font size
var efa_smaller = ['<li>Schriftgr&ouml;&szlig;e &auml;ndern</li><li class="navitems">',
				   'A',				//HTML to go before 'smaller' link
				   'Schrift gr&ouml;sser stellen',							//HTML to go inside 'smaller' anchor tag
				   'gross',											//class attribute
				   '',											//id attribute
				   '',											//name attribute
				   '',											//accesskey attribute
				   '',											//onmouseover attribute
				   '',											//onmouseout attribute
				   '',											//onfocus attribute
				   ''									//HTML to go after 'smaller' link
				   ]
var efa_reset = ['',
				 'A',				//HTML to go before 'reset' link
				 'Schriftgr&ouml;&szlig;e normal',	//HTML to go inside 'reset' anchor tag
				  'mittel',											//class attribute
				  '',											//id attribute
				  '',											//name attribute
				  '',											//accesskey attribute
				  '',											//onmouseover attribute
				  '',											//onmouseout attribute
				  '',											//onfocus attribute
				  ' '											//HTML to go after 'reset' link
				  ]
var efa_bigger = ['',					//HTML to go before 'bigger' link
				  'A',				//HTML to go inside 'bigger' anchor tag
				  'Schrift kleiner stellen',				//title attribute
				  'klein',											//class attribute
				  '',											//id attribute
				  '',											//name attribute
				  '',											//accesskey attribute
				  '',											//onmouseover attribute
				  '',											//onmouseout attribute
				  '',											//onfocus attribute
				  '<' + '/li>'											//HTML to go after 'bigger' link
				  ]
function Efa_Fontsize(increment,bigger,reset,smaller,def) {
	// check for the W3C DOM
	this.w3c = (document.getElementById);
	// check for the MS DOM
	this.ms = (document.all);
	// get the userAgent string and normalize case
	this.userAgent = navigator.userAgent.toLowerCase();
	// check for Opera and that the version is 7 or higher; note that because of Opera's spoofing we need to
	// resort to some fancy string trickery to extract the version from the userAgent string rather than
	// just using appVersion
	this.isOldOp = ((this.userAgent.indexOf('opera') != -1)&&(parseFloat(this.userAgent.substr(this.userAgent.indexOf('opera')+5)) <= 7));
	// check for Mac IE; this has been commented out because there is a simple fix for Mac IE's 'no resizing
	// text in table cells' bug--namely, make sure there is at least one tag (a <p>, <span>, <div>, whatever)
	// containing any content in the table cell; that is, use <td><p>text</p></td> or <th><span>text</span></th>
	// instead of <td>text</td> or <th>text</th>; if you'd prefer not to use the workaround, then uncomment
	// the following line:
	// this.isMacIE = ((this.userAgent.indexOf('msie') != -1) && (this.userAgent.indexOf('mac') != -1) && (this.userAgent.indexOf('opera') == -1));
	// check whether the W3C DOM or the MS DOM is present and that the browser isn't Mac IE (if above line is
	// uncommented) or an old version of Opera
	if ((this.w3c || this.ms) && !this.isOldOp && !this.isMacIE) {
		// set the name of the function so we can create event handlers later
		this.name = "efa_fontSize";
		// set the cookie name to get/save preferences
		this.cookieName = 'efaSize';
		// set the increment value to the appropriate parameter
		this.increment = increment;
		//default text size as percentage of user default
		this.def = def;
		//intended default text size in pixels as a percentage of the assumed 16px
		this.defPx = Math.round(16*(def/100))
		//base multiplier to correct for small user defaults
		this.base = 1;
		// call the getPrefs function to get preferences saved as a cookie, if any
		this.pref = this.getPref();
		// stuff the HTML for the test <div> into the testHTML property
		this.testHTML = '<div id="efaTest" style="position:absolute;visibility:hidden;line-height:1em;">&nbsp;</div>';
		// get the HTML for the 'bigger' link
		this.biggerLink = this.getLinkHtml(1,bigger);
		// get the HTML for the 'reset' link
		this.resetLink = this.getLinkHtml(0,reset);
		// get the HTML for the 'smaller' link
		this.smallerLink = this.getLinkHtml(-1,smaller);
		// set up an onlunload handler to save the user's font size preferences
	} else {
		// set the link html properties to an empty string so the links don't show up
		// in unsupported browsers
		this.biggerLink = '';
		this.resetLink = '';
		this.smallerLink = '';
		// set the efaInit method to a function that only returns true so
		//we don't get errors in unsupported browsers
		this.efaInit = new Function('return true;');
	}
	// concatenate the individual links into a single property to write all the HTML
	// for them in one shot
	this.allLinks = this.biggerLink + this.resetLink + this.smallerLink;
}
// check the user's current base text size and adjust as necessary
Efa_Fontsize.prototype.efaInit = function() {
		// write the test <div> into the document
		document.writeln(this.testHTML);
		// get a reference to the body tag
		this.body = (this.w3c)?document.getElementsByTagName('body')[0].style:document.all.tags('body')[0].style;
		// get a reference to the test element
		this.efaTest = (this.w3c)?document.getElementById('efaTest'):document.all['efaTest'];
		// get the height of the test element
		var h = (this.efaTest.clientHeight)?parseInt(this.efaTest.clientHeight):(this.efaTest.offsetHeight)?parseInt(this.efaTest.offsetHeight):999;
		// check that the current base size is at least as large as the browser default (16px) adjusted
		// by our base percentage; if not, divide 16 by the base size and multiply our base multiplier
		//  by the result to compensate
		if (h < this.defPx) this.base = this.defPx/h;
		// now we set the body font size to the appropriate percentage so the user gets the 
		// font size they selected or our default if they haven't chosen one
		this.body.fontSize = Math.round(this.pref*this.base) + '%';
}
// construct the HTML for the links; we expect -1, 1 or 0 for the direction, an array
// of properties to add to the <a> tag and HTML to go before, after and inside the tag
Efa_Fontsize.prototype.getLinkHtml = function(direction,properties) {
	// declare the HTML variable and add the HTML to go before the link, the start of the link
	// and the onclick handler; we insert the direction argument as a parameter passed to the
	// setSize method of this object
	var html = properties[0] + '<a href="#" onclick="efa_fontSize.setSize(' + direction + '); return false;"';
	// concatenate the title attribute and value
	html += (properties[2])?'title="' + properties[2] + '"':'';
	// concatenate the class attribute and value
	html += (properties[3])?'class="' + properties[3] + '"':'';
	// concatenate the id attribute and value
	html += (properties[4])?'id="' + properties[4] + '"':'';
	// concatenate the name attribute and value
	html += (properties[5])?'name="' + properties[5] + '"':'';
	// concatenate the accesskey attribute and value
	html += (properties[6])?'accesskey="' + properties[6] + '"':'';
	// concatenate the onmouseover attribute and value
	html += (properties[7])?'onmouseover="' + properties[7] + '"':'';
	// concatenate the onmouseout attribute and value
	html += (properties[8])?'onmouseout="' + properties[8] + '"':'';
	// concatenate the title onfocus and value
	html += (properties[9])?'onfocus="' + properties[9] + '"':'';
	// concatenate the link contents, closing tag and any HTML to go after the link and return the
	// entire string
	return html += '>'+ properties[1] + '<' + '/a>' + properties[10];
}
// get the saved preferences out of the cookie, if any
Efa_Fontsize.prototype.getPref = function() {
	// get the value of the cookie for this object
	var pref = this.getCookie(this.cookieName);
	// if there was a cookie value return it as a number
	if (pref) return parseInt(pref);
	// if no cookie value, return the default
	else return this.def;
}
// change the text size; expects a direction parameter of 1 (increase size), -1 (decrease size)
// or 0 (reset to default)
Efa_Fontsize.prototype.setSize = function(direction) {
	// see if we were passed a nonzero direction parameter;
	// if so, multiply it by the increment and add it to the current percentage size;
	// if the direction was negative, it will reduce the size; if the direction was positive,
	// it will increase the size; if the direction parameter is undefined or zero, reset
	// current percentage to the default
	this.pref = (direction)?this.pref+(direction*this.increment):this.def;
	this.setCookie(this.cookieName,this.pref);
	// set the text size
	this.body.fontSize = Math.round(this.pref*this.base) + '%';
}
// get the value of the cookie with the name equal to a string passed as an argument
Efa_Fontsize.prototype.getCookie = function(cookieName) {
	var cookie = cookieManager.getCookie(cookieName);
	return (cookie)?cookie:false;
}
// set a cookie with a supplied name and value
Efa_Fontsize.prototype.setCookie = function(cookieName,cookieValue) {
	return cookieManager.setCookie(cookieName,cookieValue);
}
var  efa_fontSize = new Efa_Fontsize(efa_increment,efa_smaller,efa_reset,efa_bigger,efa_default);
//-->
