

function reloadPageOnResize ( init ) {
	( init == true ) ? onresize = reloadPageOnResize : location.reload() ;
}

if ( (navigator.appName=="Netscape") && (parseInt(navigator.appVersion)==4) ) reloadPageOnResize ( true ) ;


// für Counter-Pixel
function replace(text,from,to)  // replace strings in strings
 {
    while (( ti=text.indexOf(from) ) >= 0)
    {
        text = text.substr(0,ti)+to+text.substr(ti+1);
    }    
    return text;
 } 

function x_escape(text)  // extended escape function
 {
    var x_chars = "*2A+2B-2D.2E/2F_5F";
    
    text = escape(text);
    for (ci=0; ci < x_chars.length; ci+=3)
    {
        text = replace(text,x_chars.substr(ci,1),"%"+x_chars.substr(ci+1,2));
    }
    return text;
 }   
 
function getCounterPixel (myurl, params) {
        var CGI="http://count.eon.com/cgi-bin/count/eon-suedwasser/"+myurl;
        if ((params.substring(0,1) != "&") && (params != "")) params = "&" + params;
		
		if (myurl.indexOf('?') > -1) { 
			CGI += "&ref=";
		} else {
			CGI += "?ref=";
		}
			
		if (parent.location == document.referrer) {
            document.write("<IMG SRC=\""+CGI+x_escape(parent.document.referrer)+params+"\" WIDTH=\"1\" HEIGHT=\"1\">");
			
        } else {
            document.write("<IMG SRC=\""+CGI+x_escape(document.referrer)+params+"\" WIDTH=\"1\" HEIGHT=\"1\">");
			
        }
}

function openPlugins (lang) {
	if(lang == "en"){
		var url = "http://apps.eon-energie.com/EONBAYERN/frameset_english/service_eng/service_eng.htm?target=plugins";
		var temp = "width=600 ,height=580, location=no, menubar=no";
	}else{
		var url = "http://apps.eon-energie.com/EONBAYERN/frameset_german/service/service.htm?target=plugins";
		var temp = "width=600 ,height=580, location=no, menubar=no";
	}
	window.open( url, "service", temp ) ;
}

function toPrint ( file, lang) {
	
	// Url decoden um doppeltes encoden zu vermeiden
	file = unescape( file);
	
	// zusätzliche Parameter definiert im Javascript-Block der auszudruckenden Seite
	// zur Übergabe an die Printversion	
	if ( typeof( params) != 'undefined') {
		pos = file.indexOf('?')
		if ( pos<0) {
			params = params.replace( /^&/, "?");
		}
		file = file + params;
	}
	
	// file ist als Paremeter zu encoden
	file = escape( file);
	
	if(lang == "en"){
		var url = "http://www.suedwasser.com/frameset_english/print_version.php?page=" + file;
	}else{
		var url = "http://www.suedwasser.com/frameset_german/print_version.php?page=" + file;
	}
	fenster = window.open( url, "printversion", "height=580,width=700,scrollbars=yes,toolbar=yes" ) ;
	
	fenster.focus();
}

function openNamedPopup(url,name,width,height) {
	namedWin = window.open(url,name,"width="+width+",height="+height+",resizable=no,status=no,toolbar=no,scrollbars=no,menubar=no,location=no");
	namedWin.focus();
}

//Browsercheck
function checkBrowser(){
	this.ver=navigator.appVersion;
	this.name=navigator.appName;
	this.dom=document.getElementById?1:0;
	this.ie6=(this.name.indexOf("Microsoft")>-1 && this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie5=(this.name.indexOf("Microsoft")>-1 && this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(this.name.indexOf("Microsoft")>-1 && document.all && !this.dom)?1:0;
	this.ie=(this.ie6 || this.ie5 || this.ie4)?1:0;
	this.mo7=(this.name.indexOf("Netscape")>-1 && this.ver.indexOf("Firebird/0.7") && this.dom)?1:0;
	this.mo9=(this.name.indexOf("Netscape")>-1 && this.ver.indexOf("Firefox/0.9") && this.dom)?1:0;
	this.mo=(this.mo7 || this.mo9)?1:0;
	this.ns5=(this.name.indexOf("Netscape")>-1 && this.dom && parseInt(this.ver) >= 5 && !this.mo) ?1:0;
	this.ns4=(this.name.indexOf("Netscape")>-1 && document.layers && !this.dom)?1:0;
	this.ns=(this.ns5 || this.ns4)?1:0;	
	this.bw=(this.ie || this.ns || this.mo);
	return this
}
bw=new checkBrowser();

//Erzeugt Layerobject
function makeObj ( obj , nest ) {
	( !nest ) ? nest = '' : nest = 'document.' + nest + '.'  ;
	
	this.el=0;
	this.css=0;
	if (bw.dom)	{
		this.el=document.getElementById(obj);
		this.css=document.getElementById(obj).style;
	}
	if (bw.ie4) {
		this.el=document.all[obj];
		this.css=document.all[obj].style;
	}
	if (bw.ns4) {
		this.el=eval(nest+'document.'+obj);
		this.css=eval(nest+'document.'+obj);
	}
	
	this.obj = obj + "Object";
	eval(this.obj + "=this");
	
	return this ;
}

//für Ansprechpartner Popup
function popup_asp() {
	szOrt2 = document.forms["anspr"].szOrt.value;
	szZielgruppe2 = document.forms["anspr"].szZielgruppe.value;
	
	if(document.forms["anspr"].menuset){
		menuset2 = document.forms["anspr"].menuset.value;
	}else{
		menuset2 = "off";
	}
	
	url = "http://apps.eon-energie.com/EONBAYERN/ansprechpartner/ansprechpartner_layout.php?szZielgruppe=";
	if (top.name == "") {
		if (szZielgruppe2 == "") url = url + "Privatkunden"
		else url = url + szZielgruppe2;
	}
	else url = url + top.name;
	
	url = url + "&szOrt=" + escape(szOrt2);
	url = url + "&menuset=" + menuset2;
	NewWin =  window.open(url,"popup_asp",'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=530');
}