// Zeige ein Bild in einem Popup passgenau an
function ViewImage(ifile, ix, iy, ititle)
{
	var win;
	var sWidth;
	var sHeight;
	win = window.open("", "imageviewer","left=50,top=50,width="+ix+",height="+iy+", menubar=no,toolbar=no");
	
	win.document.open();
	win.document.write("<html>\n<head>\n<title>"+ititle+"</title></head>\n");
	win.document.write("<body style='padding: 0px; margin: 0px;'>\n");
	win.document.write("<div style='overflow: auto; width: 100%; height: 100%;'>\n");
	win.document.write('<a href="#" onclick="self.close()"><img src='+ifile+' border="0" alt=""></a><br />\n');
	win.document.write("</div>\n");
	win.document.write('</body>\n</html>');
	win.document.close();
}

// Zeigt oder versteckt ein Element
function flip(id)
{
	if(document.getElementById(id).style.display == "none")
		document.getElementById(id).style.display = "";
	else
		document.getElementById(id).style.display = "none";
}

function hover(ele)
{
	var strBegin = ele.src.substr(0, ele.src.lastIndexOf("."));
	var strEnde = ele.src.substr(ele.src.lastIndexOf("."));
	
	if(strBegin.substr(ele.src.lastIndexOf(".")-2, 2) == "_h")
		ele.src = strBegin.substr(0, ele.src.lastIndexOf(".")-2) + strEnde;
	else
		ele.src = strBegin +"_h"+ strEnde;
}

function dehover(ele)
{
	var strBeginTmp = ele.src.substr(0, ele.src.lastIndexOf("."));
	var strBegin = ele.src.substr(0, ele.src.lastIndexOf(".")-2);
	var strEnde = ele.src.substr(ele.src.lastIndexOf("."));
	
	if(strBeginTmp.substr(ele.src.lastIndexOf(".")-2, 2) == "_h")
		ele.src = strBeginTmp.substr(0, ele.src.lastIndexOf(".")-2) + strEnde;
	else
		ele.src = strBeginTmp +"_h"+ strEnde;
}

function showProjektbild(bilder, bildnummer)
{
	document.getElementById('bild_'+bildnummer).style.display = "";

	for(i=1; i<=bilder; i++)
	{
		if(i == bildnummer)
			continue;

		document.getElementById('bild_'+i).style.display = "none";
	}
}

