document.write('<scr'+'ipt type="text/JavaScript" src="fileadmin/templates/js/udm-resources/udm-custom-reduced.js"></scr'+'ipt>');
document.write('<scr'+'ipt type="text/JavaScript" src="fileadmin/templates/js/udm-resources/udm-control.js"></scr'+'ipt>');
//document.write('<scr'+'ipt type="text/JavaScript" src="/fileadmin/templates/js/udm-resources/udm-style.js"></scr'+'ipt>');                
document.write('<scr'+'ipt type="text/JavaScript" src="fileadmin/templates/js/sifr.js"></scr'+'ipt>');
document.write('<scr'+'ipt type="text/JavaScript" src="fileadmin/templates/js/resize.js"></scr'+'ipt>'); 

//Erase the standard text in the textbox. If nothing is entered the standard text will be displayed again.

//the function starts when the whole site is loaded
window.onload = valueToogle;

//Label for the search field
var stValue ="Suchbegriff eingeben"
var unValue ="Benutzername"
var pnValue ="Personalnummer"
var startValue ="Von"
var endValue ="Nach"

/*var zstdValue = "TT"
var zstmValue = "MM"
var zstyValue = "JJJJ"*/

function valueToogle() {
	if (SearchTerm = document.getElementById('search_term')) {
		SearchTerm.value = stValue;
		SearchTerm.onfocus = emptyValue;
		SearchTerm.onblur = refillValue;
	}
	
	//Zaehlerstand erfassen TT
/*  if (zstandtag = document.getElementById('zstand_day')) {
		zstandtag.value = zstdValue;
		zstandtag.onfocus = emptyValue_zstand;
		zstandtag.onblur = refillValue_zstand;
	}
	
	//Zaehlerstand erfassen TT
  if (zstandmonat = document.getElementById('zstand_month')) {
		zstandmonat.value = zstmValue;
		zstandmonat.onfocus = emptyValue_zstand;
		zstandmonat.onblur = refillValue_zstand;
	}
	
	//Zaehlerstand erfassen TT
  if (zstandjahr = document.getElementById('zstand_year')) {
		zstandjahr.value = zstyValue;
		zstandjahr.onfocus = emptyValue_zstand;
		zstandjahr.onblur = refillValue_zstand;
	}
*/

	//Online Services
	if (Username = document.getElementById('username')) {
		if (Username.value =="") {
        Username.value = unValue;
     }
    Username.onfocus = emptyValue2;
		Username.onblur = refillValue2;
	}

	if (Password = document.getElementById('password')) {
	 	if (Password.value =="") {
     refillValue3();
     }
    Password.onfocus = emptyValue3;
		Password.onblur = refillValue3;
	}
	
	//Online Services
	if (Username = document.getElementById('user')) {
		if (Username.value =="") {
        Username.value = unValue;
     }
    
    Username.onfocus = emptyValue2;
		Username.onblur = refillValue2;
	}
	
	if (Password = document.getElementById('pass')) {
	 	if (Password.value =="") {
     refillValue3();
     }
    Password.onfocus = emptyValue3;
		Password.onblur = refillValue3;
	}
	

	if (Personalnummer = document.getElementById('persnr')) {
		Personalnummer.value = pnValue;
    Personalnummer.onfocus = emptyValue300;
		Personalnummer.onblur = refillValue300;
	}	
	
	
	if (Stdtstart = document.getElementById('std_t_start')) {
		Stdtstart.value = startValue;
		Stdtstart.onfocus = emptyValue4;
		Stdtstart.onblur = refillValue4;
	}
	
	if (Stdtend = document.getElementById('std_t_end')) {
		Stdtend.value = endValue;
		Stdtend.onfocus = emptyValue5;
		Stdtend.onblur = refillValue5;
	}		
	

}	

function emptyValue() {
	if (SearchTerm.value == stValue) {
		SearchTerm.value = "";
		SearchTerm.style.backgroundColor = "#efefef";
	}
}

/*function emptyValue_zstand() {
	if (zstandtag.value == zstdValue) {
		zstandtag.value = "";
		zstandtag.style.backgroundColor = "#efefef";
	}
	if (zstandmonat.value == zstmValue) {
		zstandmonat.value = "";
		zstandmonat.style.backgroundColor = "#efefef";
	}
	if (zstandjahr.value == zstyValue) {
		zstandjahr.value = "";
		zstandjahr.style.backgroundColor = "#efefef";
	}
}*/

function refillValue() {
	if (SearchTerm.value == "") {
		SearchTerm.value = stValue;
		SearchTerm.style.backgroundColor = "#FFFFFF";
	}
}

/*function refillValue_zstand() {
	if (zstandtag.value == "") {
		zstandtag.value = zstdValue;
		zstandtag.style.backgroundColor = "#FFFFFF";
	}
	if (zstandmonat.value == "") {
		zstandmonat.value = zstmValue;
		zstandmonat.style.backgroundColor = "#FFFFFF";
	}
	if (zstandjahr.value == "") {
		zstandjahr.value = zstyValue;
		zstandjahr.style.backgroundColor = "#FFFFFF";
	}
}*/

function emptyValue2() {
	if (Username.value == unValue) {
		Username.value = "";
		Username.style.backgroundColor = "#efefef";
	}
	
	if ((Username.value !== unValue) && (Username.value !=="")) {
		Username.style.backgroundColor = "#efefef";
	}
}

function refillValue2() {
	if (Username.value =="") {
		Username.value = unValue;
		Username.style.backgroundColor = "#FFFFFF";
	}
}

function emptyValue300() {
	if (Personalnummer.value == pnValue) {
		Personalnummer.value = "";
		Personalnummer.style.backgroundColor = "#efefef";
	}
	
	if ((Personalnummer.value !== pnValue) && (Personalnummer.value !=="")) {
		Personalnummer.style.backgroundColor = "#efefef";
	}
}

function refillValue300() {
	if (Personalnummer.value =="") {
		Personalnummer.value = pnValue;
		Personalnummer.style.backgroundColor = "#FFFFFF";
	}
}

function emptyValue3() {
	if (Password) {
		Password.style.backgroundColor = "#efefef";
		Password.style.backgroundImage = "none";
	}
}

function refillValue3() {
	if (Password.value == "") {
		Password.style.backgroundColor = "#FFFFFF";
    Password.style.backgroundImage = "url(fileadmin/templates/images/password_bg_moz.gif)";
	}
}


function emptyValue4() {
	if (Stdtstart.value == startValue) {
		Stdtstart.value = "";
		Stdtstart.style.backgroundColor = "#efefef";
	}
}

function refillValue4() {
	if (Stdtstart.value == "") {
		Stdtstart.value = startValue;
		Stdtstart.style.backgroundColor = "#FFFFFF";
	}
}

function emptyValue5() {
	if (Stdtend.value == endValue) {
		Stdtend.value = "";
		Stdtend.style.backgroundColor = "#efefef";
	}
}

function refillValue5() {
	if (Stdtend.value == "") {
		Stdtend.value = endValue;
		Stdtend.style.backgroundColor = "#FFFFFF";
	}
}







function getArgs(sep){
  var args = new Object();
  var query = location.search.substring(1);
  if(!sep) sep = '&';
  var pairs = query.split(sep);
  for(var i = 0; i <pairs.length; i++) {
    var pos = pairs[i].indexOf('=');
    if (pos == -1){
      args[pairs[i]]='';
      continue;
    }
    var argname = pairs[i].substring(0,pos);
    var value = pairs[i].substring(pos+1);
    args[argname] = unescape(value);}
  return args;
}







/****
FUNKTIONEN für Seitenfilter Business/Privat
*****/

function webFilter(bereich,aktion){
	//return false;
	var objCookie = new Cookie('filter');

	
	if(document.cookie.indexOf ('status')==-1){return false;}
	//alert(document.cookie)
	//Hauptmenü filtern
	//alert(document.cookie)

	status_privat = 'block';
	status_business = 'block';
	if(document.cookie.indexOf ('status:none')>-1){
		status_privat = 'block';
		status_business = 'block';
		setStatusHTML();

	}


	if(document.cookie.indexOf ('status:business')>-1){
		status_privat = 'none';
		status_business = 'block';
		setStatusHTML('business');

	}

	if(document.cookie.indexOf ('status:privat')>-1){
		status_privat = 'block';
		status_business = 'none';
		setStatusHTML('privat');



	}	


//durch Hauptmenü iterieren
	for(i=0; i<arPrivat.length; i++){	
		if(document.getElementById('link'+ arPrivat[i])){
			//document.getElementById('link'+ arPrivat[i]).parentNode.style.display = status_privat;

			if(status_privat=='none'){
				element_li = document.getElementById('link'+ arPrivat[i]).parentNode;
				element_li.parentNode.removeChild(element_li);
			}

		}
	}

	for(i=0; i<arBusiness.length; i++){	
			if(document.getElementById('link'+ arBusiness[i])){
				//alert(document.getElementById('link'+ arBusiness[i]))
			//document.getElementById('link'+ arBusiness[i]).parentNode.style.display = status_business;

				if(status_business=='none')	{		
					element_li = document.getElementById('link'+ arBusiness[i]).parentNode;
					element_li.parentNode.removeChild(element_li);
				}			
			}
	 }



//temporär FIX id=link44 wegschalten, wird aus einem noch unbekannten grund von
//getElementsByTagName('A') nicht gefunden
	
	if(document.cookie.indexOf ('status:privat')>-1){		
			if(document.getElementById('link44')){
					element_li = document.getElementById('link44').parentNode;
					element_li.parentNode.removeChild(element_li);
			}
			if(document.getElementById('link163')){
					element_li = document.getElementById('link163').parentNode;
					element_li.parentNode.removeChild(element_li);
			}
		}


	//durch Submenü navigieren
	arLinks = [];
if(document.getElementById('subnavi')){
	arLinks = 	document.getElementById('subnavi').getElementsByTagName('A');
};

	for(z=0;z<arLinks.length; z++){
		//alert(arLinks[z].innerHTML)

		for(i=0; i<arPrivat.length; i++){	
			if(arLinks[z].id == 'link'+ arPrivat[i]){
				//arLinks[z].parentNode.style.display = status_privat;
				if(status_privat=='none'){
					element_li = arLinks[z].parentNode;
					element_li.parentNode.removeChild(element_li);
				}


			}
		}

		for(i=0; i<arBusiness.length; i++){	
			
			if(arLinks[z].id == 'link'+ arBusiness[i]){
				//arLinks[z].parentNode.style.display = status_business;
				if(status_business=='none'){
					//alert(arLinks[z].id)		
					element_li = arLinks[z].parentNode;
					element_li.parentNode.removeChild(element_li);
				}

			}
		 }
	}


}




function setFilter(name){

	//alert(name)
	setStatusHTML(name);

	var objCookie = new Cookie("filter");
	//alert(objCookie.status)
	if(name){
		objCookie.status = name;
		objCookie.store(10);
		webFilter(name);	
	}

	document.location.reload();


}



//setzt die Links und Statusmeldungen im Sidebarelement

function setStatusHTML(name){

	if(!document.getElementById('link_filter1')){return false;}
	if(!document.getElementById('link_filter2')){return false;}

	link_1 =  document.getElementById('link_filter1');
	link_2 =  document.getElementById('link_filter2');


	link_1.innerHTML='';
	link_2.innerHTML='';

	fstatus = document.getElementById('filterstatus');

	html1 = "<a  onclick='setFilter(\"privat\");return false' href='#'>Privatkunden</a>";	
	html2 = "<a  onclick='setFilter(\"business\");return false' href='#'>Businesskunden</a>";
	html3 = "<a  onclick='setFilter(\"none\");return false' href='#'>Alle Filter entfernen</a>";
	//alert(fstatus.tagName)

	if(name=='privat'){
		link_1.innerHTML = html2;
		link_2.innerHTML = html3;
		fstatus.innerHTML = 'Privatkunde';
	}else if (name=='business'){
		link_1.innerHTML = html1;
		link_2.innerHTML = html3;
		fstatus.innerHTML = 'Businesskunde';
		
	}else{	
		link_1.innerHTML = html1;
		link_2.innerHTML = html2;
		fstatus.innerHTML = 'kein Filter';
		

	
	}
	
	


}



/**
 * This is the Cookie() constructor function.
 *
 * This constructor looks for a cookie with the specified name for the
 * current document.  If one exists, it parses its value into a set of
 * name/value pairs and stores those values as properties of the newly created
 * object.
 *
 * To store new data in the cookie, simply set properties of the Cookie
 * object.  Avoid properties named "store" and "remove" since these are 
 * reserved as method names.
 * 
 * To save cookie data in the web browser's local store, call store().
 * To remove cookie data from the browser's store, call remove().
 *
 * The static method Cookie.enabled() returns true if cookies are
 * enabled and returns false otherwise.
 */
function Cookie(name) {
    this.$name = name;  // Remember the name of this cookie

    // First, get a list of all cookies that pertain to this document
    // We do this by reading the magic Document.cookie property
    // If there are no cookies, we don't have anything to do 
    var allcookies = document.cookie;
    if (allcookies == "") return;

    // Break the string of all cookies into individual cookie strings
    // Then loop through the cookie strings, looking for our name
    var cookies = allcookies.split(';');
    var cookie = null;
    for(var i = 0; i < cookies.length; i++) {
        // Does this cookie string begin with the name we want?
        if (cookies[i].substring(0, name.length+1) == (name + "=")) {
            cookie = cookies[i];
            break;
        }
    }

    // If we didn't find a matching cookie, quit now
    if (cookie == null) return;

    // The cookie value is the part after the equals sign
    var cookieval = cookie.substring(name.length+1);

    // Now that we've extracted the value of the named cookie, we
    // must break that value down into individual state variable 
    // names and values. The name/value pairs are separated from each
    // other by ampersands, and the individual names and values are
    // separated from each other by colons. We use the split() method
    // to parse everything.
    var a = cookieval.split('&'); // Break it into an array of name/value pairs
    for(var i=0; i < a.length; i++)  // Break each pair into an array
        a[i] = a[i].split(':');

    // Now that we've parsed the cookie value, set all the names and values
    // as properties of this Cookie object. Note that we decode
    // the property value because the store() method encodes it
    for(var i = 0; i < a.length; i++) {
        this[a[i][0]] = decodeURIComponent(a[i][1]);
    }
}

/**
 * This function is the store() method of the Cookie object.
 *
 * Arguments:
 *
 *   daysToLive: the lifetime of the cookie, in days. If you set this
 *     to zero, the cookie will be deleted.  If you set it to null, or 
 *     omit this argument, the cookie will be a session cookie and will
 *     not be retained when the browser exits.  This argument is used to
 *     set the max-age attribute of the cookie.
 *   path: the value of the path attribute of the cookie
 *   domain: the value of the domain attribute of the cookie
 *   secure: if true, the secure attribute of the cookie will be set
 */
Cookie.prototype.store = function(daysToLive, path, domain, secure) {
    // First, loop through the properties of the Cookie object and
    // put together the value of the cookie. Since cookies use the
    // equals sign and semicolons as separators, we'll use colons
    // and ampersands for the individual state variables we store 
    // within a single cookie value. Note that we encode the value
    // of each property in case it contains punctuation or other
    // illegal characters.
    var cookieval = "";
    for(var prop in this) {
        // Ignore properties with names that begin with '$' and also methods
        if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function')) 
            continue;
        if (cookieval != "") cookieval += '&';
        cookieval += prop + ':' + encodeURIComponent(this[prop]);
    }

    // Now that we have the value of the cookie, put together the 
    // complete cookie string, which includes the name and the various
    // attributes specified when the Cookie object was created
    var cookie = this.$name + '=' + cookieval;
    if (daysToLive || daysToLive == 0) { 
        cookie += "; max-age=" + (daysToLive*24*60*60);
    }

    if (path) cookie += "; path=" + path;
    if (domain) cookie += "; domain=" + domain;
    if (secure) cookie += "; secure";

    // Now store the cookie by setting the magic Document.cookie property
    document.cookie = cookie;
}

/**
 * This function is the remove() method of the Cookie object; it deletes the
 * properties of the object and removes the cookie from the browser's 
 * local store.
 * 
 * The arguments to this function are all optional, but to remove a cookie
 * you must pass the same values you passed to store().
 */
Cookie.prototype.remove = function(path, domain, secure) {
    // Delete the properties of the cookie
    for(var prop in this) {
        if (prop.charAt(0) != '$' && typeof this[prop] != 'function') 
            delete this[prop];
    }

    // Then, store the cookie with a lifetime of 0
    this.store(0, path, domain, secure);
}

/**
 * This static method attempts to determine whether cookies are enabled.
 * It returns true if they appear to be enabled and false otherwise.
 * A return value of true does not guarantee that cookies actually persist.
 * Nonpersistent session cookies may still work even if this method 
 * returns false.
 */
Cookie.enabled = function() {
    // Use navigator.cookieEnabled if this browser defines it
    if (navigator.cookieEnabled != undefined) return navigator.cookieEnabled;

    // If we've already cached a value, use that value
    if (Cookie.enabled.cache != undefined) return Cookie.enabled.cache;

    // Otherwise, create a test cookie with a lifetime
    document.cookie = "testcookie=test; max-age=10000";  // Set cookie

    // Now see if that cookie was saved
    var cookies = document.cookie;
    if (cookies.indexOf("testcookie=test") == -1) {
        // The cookie was not saved
        return Cookie.enabled.cache = false;
    }
    else {
        // Cookie was saved, so we've got to delete it before returning
        document.cookie = "testcookie=test; max-age=0";  // Delete cookie
        return Cookie.enabled.cache = true;
    }
}

function Jump(){
onClick (window.location = "#top");
}

















