<!--

function addUploadForm()
{
var ni = document.getElementById('uploadDiv');
var numi = document.getElementById('theValue');
var num = (document.getElementById("theValue").value -1)+ 2;
numi.value = num;
var divIdName = "upload"+num+"Div";
var newdiv = document.createElement('div');
newdiv.setAttribute("id",divIdName);
//newdiv.innerHTML = "Element Number "+num+" has been added! <a href=\"javascript:;\" onclick=\"removeEvent(\'"+divIdName+"\')\">Remove the div &quot;"+divIdName+"&quot;</a>";
newdiv.innerHTML = "<input type=\"file\" name=\"attachment[]\" class=\"button\" style=\"width:285px;margin-bottom:5px;\" />";
ni.appendChild(newdiv);
}
function removeEvent(divNum)
{
var d = document.getElementById('uploadDiv');
var olddiv = document.getElementById(divNum);
d.removeChild(olddiv);
}

//////////////////////////////////////////////////////
// TOP MENU
//////////////////////////////////////////////////////

ulLiMenu = function(elemId) {
	if ( document.getElementById(elemId)) { // nur für IE, MacIE, Opera
	var navroot = document.getElementById(elemId);
	var lis=navroot.getElementsByTagName("li");
		for (i=0; i<lis.length; i++) {
			for (j=0; j<lis[i].getElementsByTagName("ul").length; j++){
				lis[i].onmouseover=function() {
				this.getElementsByTagName("ul")[j].style.visibility = 'visible';
				}
				lis[i].onmouseout= function() {
				this.getElementsByTagName("ul")[j].style.visibility = 'hidden';
				}
			}
		}

		for (i=0; i<lis.length; i++) { // loop LIs
			for (j=0; j<lis[i].getElementsByTagName("ul").length; j++){ // Loop  in LIs
				lis[i].getElementsByTagName("ul")[j].onmouseover=function(){
				this.parentNode.getElementsByTagName("a")[0].className ="over";
				}
				lis[i].getElementsByTagName("ul")[j].onmouseout=function(){
				if (this.parentNode.getElementsByTagName("a")[0].id!="aktiv") // Bug(?)fix IE: zurücksetzen von class überschreibt ID-Eigenschaft
				this.parentNode.getElementsByTagName("a")[0].className ="out";
				//alert("mouseouse auf UL")
				}
			} // ENDE loop in LIs
		}// ENDE loop  LI
	} // ENDE IE only
} // ENDE function

function init(){
ulLiMenu("NavTop");
}

//////////////////////////////////////////////////////
// SANIERUNGSBEISPIELE TEXTE
//////////////////////////////////////////////////////

function sanierung(string) {
texte = new Array(
"Unsanierter Zustand", 
"Sanierungsmaßnahme: Neue Fenster", 
"Sanierungsmaßnahmen: Fassadendämmung, Dachdämmung, Kellerdeckendämmung", 
"Sanierungsmaßnahme: Brennwertheizkessel", 
"Sanierungsmaßnahmen: Fassadendämmung, Dachdämmung, Kellerdeckendämmung, neue Fenster", 
"Sanierungsmaßnahmen: Fassadendämmung, Dachdämmung, Kellerdeckendämmung, neue Fenster, Brennwertheizkessel", 
"Sanierungsmaßnahmen: Fassadendämmung, Dachdämmung, Kellerdeckendämmung, neue Fenster, Brennwertheizkessel, Lüftungsanlage mit Wärmerückgewinnung", 
"Sanierungsmaßnahmen: Fassadendämmung, Dachdämmung, Kellerdeckendämmung, neue Fenster, Brennwertheizkessel, Lüftungsanlage mit Wärmerückgewinnung und Wärmepumpe"
);
var x = texte[string];
document.getElementById("sanierung_text").innerHTML = x;
}

//////////////////////////////////////////////////////
// PRELOAD VON BILDERN
//////////////////////////////////////////////////////

var imagedir="img/";
var myimages=new Array();
function preloadimages(){
	for (i=0;i<preloadimages.arguments.length;i++){
	myimages[i]=new Image()
	myimages[i].src=imagedir + preloadimages.arguments[i]
	}
}
//preloadimages("b_enter_on.gif","m_bio_sub_1_on.gif","m_bio_sub_2_on.gif","m_bio_sub_3_on.gif","m_charts_on.gif","m_community_on.gif","m_community_sub_1_on.gif","m_community_sub_1a_on.gif","m_community_sub_1b_on.gif","m_community_sub_2_on.gif","m_dates_on.gif","m_dates_sub_1_on.gif","m_dates_sub_2_on.gif","m_favourites_on.gif","m_galerie_on.gif","m_home_on.gif","m_impressum_on.gif","m_kontakt_on.gif","m_news_on.gif","m_radio_on.gif","m_shop_on.gif");

//////////////////////////////////////////////////////
// TOGGLE FUNKTION
//////////////////////////////////////////////////////

function ToggleDiv(DivID) {
	var obj = document.getElementById(DivID);
	if (obj.style.display == "block") {
		obj.style.display = "none";
	}else{
		obj.style.display = "block";
	}

/*

	if (document.layers) { // NN4+
		if (document.layers[DivID].visibility == 'visible') {
		document.layers[DivID].visibility = "hide";
		document.layers[DivID].display = "none";
		}else{
		document.layers[DivID].visibility = "show";
		document.layers[DivID].display = "inline";
		}
	} else if(document.getElementById) { // gecko(NN6) + IE 5+
	var obj = document.getElementById(DivID);
		if (obj.style.visibility == 'visible') {
		obj.style.visibility = "hidden";
		obj.style.display = "none";
		}else{
		obj.style.visibility = "visible";
		obj.style.display = "inline";
		}
	} else if (document.all) { // IE 4
		if (document.all[DivID].style.visibility == 'visible') {
		document.all[DivID].style.visibility = "hidden";
		document.all[DivID].style.display = "none";
		}else{
		document.all[DivID].style.visibility = "visible";
		document.all[DivID].style.display = "inline";
		}
	}
*/

}

/////////////////////////////
// ZU FAVORITEN HINZUFÜGEN //
/////////////////////////////

function bookmark(){
var title = "energiewohnen.de - Sanieren und Sparen durch energie-optimalen Sanierung.";
var url = "http://www.energiewohnen.de";
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all) // ie
	window.external.AddFavorite(url, title);
}

//////////////////////////
// HTML POPUP //
//////////////////////////

function popHTML(url,pwidth,pheight) {
var left = (screen.width/2)-(pwidth/2);
var top = (screen.height/2)-(pheight/2);
NewWin=window.open('' + url + '','NewWin','width=' + pwidth + ',height=' + pheight + ',resizable=1,top=' + top + ',left=' + left + '');
}

//////////////////////////
// BILD POPUP //
//////////////////////////

var newwindow;
var wheight = 0, wwidth = 0;
function popup(url, title, iwidth, iheight, colour) {
var pwidth, pheight;
// SCREEN MITTE
links = (screen.width/2)-(iwidth/2);
oben = (screen.height/2)-(iheight/2);
if ( !newwindow || newwindow.closed ) {
pwidth=iwidth+30;
pheight=iheight+30;
newwindow=window.open('','htmlname','width=' + pwidth +',height=' +pheight + ',resizable=1,top='+oben+',left='+links);
wheight=iheight;
wwidth=iwidth;
}
if (wheight!=iheight || wwidth!=iwidth ) {
pwidth=iwidth+30;
pheight=iheight+60;
newwindow.resizeTo(pwidth, pheight);
wheight=iheight;
wwidth=iwidth;
}
newwindow.document.clear();
newwindow.focus();
newwindow.document.writeln('<html>');
newwindow.document.writeln('<head>');
newwindow.document.writeln('<title>' + title + '<\/title>');
newwindow.document.writeln('<\/head>');
newwindow.document.writeln('<body bgcolor= \"' + colour + '\">');
newwindow.document.writeln('<table border=\"0\" width=\"100%\" height=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"100%\" align=\"center\">');
newwindow.document.writeln('<a href=\"javascript:window.close()\">');
newwindow.document.writeln('<img src=' + url + ' border=\"0\" alt=\"Fenster schließen\">');
newwindow.document.writeln('<\/a>');
newwindow.document.writeln('<\/td><\/tr><\/table>');
newwindow.document.writeln('<\/body>');
newwindow.document.writeln('<\/html>');
newwindow.document.close();
newwindow.focus();
}
function tidy5() {
if (newwindow && !newwindow.closed) { newwindow.close(); }
}

//-->