function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function pop (a){
	if(navigator.appName.substring(0,8)=="Netscape"){
		mini=window.open(a,'Pop','toolbar=1,location=1,status=1,menubar=1,resizable=yes,scrollbars=1,height=607,width=1024,top=0,left=0');
		mini.focus();
	}
	else{
		mini=window.open(a,'Pop','toolbar=1,location=1,status=1,menubar=1,resizable=yes,scrollbars=1,height=607,width=1024,top=0,left=0');
		mini.focus();
	}
}

function popup2 (a){
	if(navigator.appName.substring(0,8)=="Netscape"){
		mini=window.open(a,'popup2','toolbar=1,location=1,status=1,menubar=1,resizable=yes,scrollbars=1,height=700,width=680,top=0,left=0');
		mini.focus();
	}
	else{
		mini=window.open(a,'popup2','toolbar=1,location=1,status=1,menubar=1,resizable=yes,scrollbars=1,height=700,width=680,top=0,left=0');
		mini.focus();
	}
}

function popup3 (a){
	if(navigator.appName.substring(0,8)=="Netscape"){
		mini=window.open(a,'popup3','toolbar=1,location=1,status=1,menubar=1,resizable=yes,scrollbars=1,height=607,width=1024,top=0,left=0');
		mini.focus();
	}
	else{
		mini=window.open(a,'popup3','toolbar=1,location=1,status=1,menubar=1,resizable=yes,scrollbars=1,height=607,width=1024,top=0,left=0');
		mini.focus();
	}
}

function netzgebiet_karte_popup (a){
	if(navigator.appName.substring(0,8)=="Netscape"){
		mini=window.open(a,'netzgebiet_karte_popup','toolbar=0,location=0,status=0,menubar=0,resizable=no,scrollbars=0,height=517,width=800,top=0,left=0');
		mini.focus();
	}
	else{
		mini=window.open(a,'netzgebiet_karte_popup','toolbar=0,location=0,status=0,menubar=0,resizable=no,scrollbars=0,height=517,width=800,top=0,left=0');
		mini.focus();
	}
}
function glossar(a){
	if(navigator.appName.substring(0,8)=="Netscape"){
		mini=window.open(a,'glossar','toolbar=1,location=0,status=0,menubar=0,resizable=yes,scrollbars=1,height=200,width=280,top=0,left=0');
		mini.focus();
	}
	else{
		mini=window.open(a,'glossar','toolbar=1,location=0,status=0,menubar=0,resizable=yes,scrollbars=1,height=200,width=280,top=0,left=0');
		mini.focus();
	}
}
function zoom (a){
	if(navigator.appName.substring(0,8)=="Netscape"){
		mini=window.open(a,'Zoom','toolbar=0,location=0,directories=0,status=0,menubar=0,menubar=yes, scrollbars=YES,scrollbars=1,resizable=no,copyhistory=0,height=315,width=565,top=0,left=0');
		mini.focus();
	}
	else{
		mini=window.open(a,'Zoom','toolbar=0,location=0,directories=0,status=0,menubar=0,menubar=yes, scrollbars=YES,scrollbars=1,resizable=no,copyhistory=0,height=320,width=568,top=0,left=0');
		mini.focus();
	}
}

function sitemap (dateiname){
	if(navigator.appName.substring(0,8)=="Netscape"){
		mini=window.open(dateiname,'sitemap','toolbar=yes,location=no,status=no,menubar=yes,resizable=yes,scrollbars=yes,height=520,width=750,top=0,left=0');
    	mini.focus();
	}
	else{
		mini=window.open(dateiname,'sitemap','toolbar=1,location=0,status=0,menubar=1,resizable=yes,scrollbars=1,height=500,width=750,top=0,left=0');
    	mini.focus();
	}
}

function makeRemote(dateiname) {
remote = window.open("","remotewin",'toolbar=1,location=0,status=0,menubar=1,resizable=yes,scrollbars=1,height=520,width=475,top=0,left=0');
remote.location.href = dateiname
if (remote.opener == null) remote.opener = window;
remote.opener.name = "opener";
}
function go(url) {
opener.location.href = url;
}

var i=0, sw=screen.width*80/100, sh=screen.height*100/100;
function resize() {
if (navigator.appName == 'Netscape') i=0;
nw = 240 + ((document.closeButton.width > document.articleImage.width) ? document.closeButton.width : document.articleImage.width);
nh = document.articleImage.height + 230 - i;
if(nw>sw) nw = sw;
if(nh>sh) nh = sh;
window.resizeTo(nw, nh);
nx = screen.width/2 - nw/2;
ny = screen.height/2 - nh/2;
window.moveTo(nx, ny);
}

//Script für PullDown Menüs
function surfto(form) {
var myindex=form.select1.selectedIndex;
if (form.select1.options[myindex].value != "0") {
location=form.select1.options[myindex].value;}
}
function surftonav(form) {
	var myindex=form.menue.selectedIndex;
	location=form.menue.options[myindex].value;
}
function surftoquick(form,id) {
	var myindex=form[id].selectedIndex;
	form[id].selectedIndex = 0;
	var myurl=form[id].options[myindex].value;
	
	if(myurl.indexOf('__##__')!=-1){
		var tmp_array = myurl.split('__##__');
		myurl = tmp_array[0];
		var mytarget = tmp_array[1];
		//wir brauchen keine unterscheidung zwischen verschiedenen popups,
		//könnten sie aber hier mit hilfe des targets implementieren
		if(mytarget=='popup'){
			pop(myurl);
		}else if(mytarget=='popup2'){
			popup2(myurl);
		}else{
			popup3(myurl);
		}
	}else{
		location=myurl;
	}
}
function surftokategorie(form) {
    var myindex=form.menue.selectedIndex;
    location=form.menue.options[myindex].value;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//functionen für anfahrtsskizzen
function new_desc(neu, layername)
{
	document.getElementById('desc').innerHTML = ("<img src='"+neu+"'>");
	if (document.getElementById(layername).style.visibility == "hidden")
	{
		document.getElementById(layername).style.visibility = "visible"; return;
	}
}

function hide_desc(layername)
{
	if (document.getElementById(layername).style.visibility == "visible")
	{
		document.getElementById(layername).style.visibility = "hidden"; return;
	}
}



function returnObjById( id ){
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}

function clearFields(){
	alert('clear!' + returnObjById('prozent').value);
	returnObjById('prozent').value='';
	returnObjById('kwh').value='';
	returnObjById('verbrauch').value='';
}
function check(test)
{
	if(test == 1)
	{
	document.getElementById("Rechner").verbrauch.value = 1800;
	}
	if(test == 2)
	{
	document.getElementById("Rechner").verbrauch.value = 3000;
	}
	if(test == 3)
	{
	document.getElementById("Rechner").verbrauch.value = 3800;
	}
	if(test == 4)
	{
	document.getElementById("Rechner").verbrauch.value = 4400;
	}
document.getElementById("Rechner").submit();
}

function ResetCheck () {
  var chk = window.confirm("Wollen Sie wirklich alle Eingaben löschen?");
  return (chk);
}

/* berechnung fuer energiespartipps*/
  var jsv = new Array();
  var ergebnis = new Array(0,0,0,0)
 
  
 function berechne(){
   for (i = 0; i < 13; i++) {
    if (getElementEsForm("feld" + i).checked == true) {
     ergebnis[0] += jsv[i][0];
     ergebnis[1] += jsv[i][1];
     ergebnis[2] += jsv[i][2];
     ergebnis[3] += jsv[i][3];
farbWechsler();
   }
   }

 for (a = 0; a < 4; a++) {
   n = document.createTextNode(ergebnis[a]);
   getElementEsForm("ergebnis" + a).replaceChild(n, getElementEsForm("ergebnis" + a).firstChild);
   ergebnis[a] = 0;
  }
 }
  
 function getElementEsForm(elementID, parentID){
  if (document.getElementById) {
   return document.getElementById(elementID);
  } else if(document.layers) {
   return (parentID)? eval("document."+parentID+".document.layers."+elementID):document.layers[elementID];
  } else if (document.all) {
   return document.all[elementID];
  } else {
   return false;
  }
}

/*otischer farbwechsel fuer berechnungenergiespartipps */
var Color= new Array();
Color[7] = "CEDAE9";
Color[6] = "AFC3DB";
Color[5] = "8BA6C8";
Color[4] = "9AB4D3";
Color[3] = "87A5C7";
Color[2] = "7995B6";
Color[1] = "6A84A2";

function farbWechsler(){
	if (document.getElementById('ergebnis0')) {
    	for(iCounter=1;iCounter < 8; iCounter++){
			setTimeout("setColor('#" + Color[iCounter] + "')", iCounter * 150);
		}
		setTimeout("setColor('#909183')", 8 * 150);
	}
	if (document.getElementById('ergebnis1')) {
    	for(iCounter=1;iCounter < 8; iCounter++){
			setTimeout("setColor('#" + Color[iCounter] + "')", iCounter * 150);
		}
		setTimeout("setColor('#909183')", 8 * 150);
	}
	if (document.getElementById('ergebnis2')) {
    	for(iCounter=1;iCounter < 8; iCounter++){
			setTimeout("setColor('#" + Color[iCounter] + "')", iCounter * 150);
		}
		setTimeout("setColor('#909183')", 8 * 150);
	}
	if (document.getElementById('ergebnis3')) {
    	for(iCounter=1;iCounter < 8; iCounter++){
			setTimeout("setColor('#" + Color[iCounter] + "')", iCounter * 150);
		}
		setTimeout("setColor('#909183')", 8 * 150);
	}
}
function setColor(col){
	colorResult = document.getElementById('ergebnis0');
	colorResult.style.backgroundColor = col;
	colorResult = document.getElementById('ergebnis1');
	colorResult.style.backgroundColor = col;
	colorResult = document.getElementById('ergebnis2');
	colorResult.style.backgroundColor = col;
	colorResult = document.getElementById('ergebnis3');
	colorResult.style.backgroundColor = col;
}

function toggleElementDisplaySelect (element,select) {
var wert = select.options[select.options.selectedIndex].value;

element = element.style;
if (wert == "Meine bisherige Stromversorgung"){
   
    element.display = 'block';
}
else{
    element.display = 'none';
}

}


