
// öffne Fenster bzw. blende Fenster ein
// hole die Daten
function getData(id){
    var req = (window.XMLHttpRequest) 
               ?
               new XMLHttpRequest()
               :
               ((window.ActiveXObject)
               ?
               new ActiveXObject("Microsoft.XMLHTTP")
               :
               false
               );
        
    req.open("GET","http://www.energymanagement.at/typo3conf/ext/bess/pi1/res/getInformationText.php?id="+id,true);
    req.onreadystatechange = function()
    {
        if (req.readyState==4)
        {
            if (req.status == 200)
            {
                var d = document.getElementById("informationBox");
                d.innerHTML = "<h2>Information:<hr /></h2>"+req.responseText+"<br /><br /><div id='closeWindow' onclick='hideInformationBox()'>&gt;&gt;&gt; Close information window &lt;&lt;&lt;</div>";
				//var e = document.getElementById("loading");
				//e.style.display = "none";
                //alert(req.responseText);   
            }
        }
		else{
			//var d = document.getElementById("number");
            //d.innerHTML = "--- waiting for data ---";
			//var e = document.getElementById("loading");
			//e.style.display = "block";
		}
    }
    req.send(null)
}


function showInformationBox(id){
	
	if(opacity = informationBox.style['opacity']){
		
	
		hideInformationBox();	
	}
	
	getData(id);
	new Effect.Opacity("informationBox",
		{
			duration: 1.0,
			transition: Effect.Transitions.linear,
			from: 0,
			to: 0.8
		}
	);
}

// schließe Fenster bzw. blende Fenster ein
function hideInformationBox(){
	new Effect.Opacity("informationBox",
		{
			duration: 1.0,
			transition: Effect.Transitions.linear,
			from: 0.8,
			to: 0
		}
	);
	/*

	new Effect.Puff("informationbox", {duration: 1,from: 0,to: 1});*/
}
