var title="";

function setTitle(x){
  title=x;
}

function lade2(datei,b,h,text){
    var left=0,top=0;

	//Text direkt aus Funktionsaufruf oder aus dem SetTitle (globale Definition)
	if (text != "") popuptitle = text;
	else popuptitle = title; 

	//Fensterbreite bestimmen
    if (window.innerWidth) { //Netscape
          left=Math.round((window.innerWidth-b)/2-15);
    }
    else if (document.body && document.body.offsetWidth) { //Explorer
          left=Math.round((document.body.offsetWidth-b)/2-15);
    }

	//Anfangspunkt bestimmten
    if (window.pageYOffset) { // alle außer Explorer
          top=window.pageYOffset;
    }
    else if (document.documentElement.scrollTop) {
          top=document.documentElement.scrollTop;
    }
    else if (document.body.scrollTop) {
          top=document.body.scrollTop;
    }
    top=top+5;

    if (left<0) left=0;
    if (top<150) top=150;

    hide();

    document.getElementById("popup_heading").innerHTML = popuptitle;
    
    if (datei.substr(datei.length-3,3) == "jpg") {
     	
     	//Bild in Popup_Content einfügen
         document.getElementById("popup_content").innerHTML = "<img id='popup_img' src=" + datei + " alt='Bild wird geladen...' title='Hier klicken um das Fenster zu schlie&szlig;en!' border='0' width='" + b + "' height='" + h + "'>";
		
	}
	else if (datei.substr(0,12) == "slideshowID=") {
		
		//Slideshow-XML in Popup_Content starten
 		var so = new SWFObject("monoslideshow.swf", "SOmonoSlideshow", b, h , "7", "#ffffff");
		so.addVariable("showLogo", "false");
		so.addVariable("showVersionInfo", "false");
		so.addVariable("dataFile", "slideshowXML.php?id=" + datei.substr(12));
		so.write("popup_content");
		
	}
	else if (datei == "slideshowAll") {
		alert("all");
		//Slideshow-XML in Popup_Content starten
 		var so = new SWFObject("monoslideshow.swf", "SOmonoSlideshow", b, h , "7", "#ffffff");
		so.addVariable("showLogo", "false");
		so.addVariable("showVersionInfo", "false");
		so.addVariable("dataFile", "slideshowXMLall.php?id=2");
		so.write("popup_content");
	
	}

    document.getElementById("popup_layer").style.top = top + "px";
    document.getElementById("popup_layer").style.left = left + "px";
    document.getElementById("popup_layer").style.width = b + "px";
    document.getElementById("popup_layer").style.height = h + "px";
    document.getElementById("popup_layer").style.visibility = "visible";

 }

function hide(){
    document.getElementById("popup_layer").style.visibility = "hidden";
    //document.getElementById("popup_img").src = "images/leer.png";
    document.getElementById("popup_content").innerHTML = "";
    window.scrollBy(-1000,0);
}



function imgchange(bild,element){
   window.document.images[element].src = bild;
}

