// ----------------------------------------------------
// Version: 0.1
// Last change: 25.06.2009
// Edited by: Sebastian Mohila
// Description: Library for popup layer functions
//
// (C) 2000 - 2009 formativ.net oHG / Sebastian Mohila
// All Rights Reserved
// ----------------------------------------------------


// -----------------------------------------------------
// Name: showPopUpLayer()
// Funktion: Blendet "PopUp-Layer" ein
// Rückgabe: Null
// Status: aktiv
// Version: 0.3
// Letzte Änderung: 25.06.2009
// -----------------------------------------------------
function showPopUpLayer(cLayerName) {
	$j("#mainContentPopUpBaseLayer"+cLayerName).css("filter","alpha(opacity=80)").fadeIn("normal");
	$j("#mainContentPopUpBaseLayerInner"+cLayerName).css("filter","alpha(opacity=100)").fadeIn("normal");	

	// Namen des aktuell eingeblendeten Layers global zur Verfügung stellen
	cLayerNameNow=cLayerName;
	
	return false;
}



// -----------------------------------------------------
// Name: hidePopUpLayer()
// Funktion: Blendet "PopUp-Layer" aus
// Rückgabe: Null
// Status: aktiv
// Version: 0.2
// Letzte Änderung: 25.06.2009
// -----------------------------------------------------
function hidePopUpLayer(cParent,cLayerName) {
	if(cParent) {
		window.parent.$j("#mainContentPopUpBaseLayerInner"+cLayerName).hide();
		window.parent.$j("#mainContentPopUpBaseLayer"+cLayerName).fadeOut("normal",function() {
			// Aktuelle Seite des Iframes auslesen und Iframe neu laden
			cStartLocation=window.parent.$j("#mainContentIframeLayer"+cLayerName).attr("src");
			window.parent.$j("#mainContentIframeLayer"+cLayerName).attr("src",cStartLocation);
		});
	} else {
		$j("#mainContentPopUpBaseLayerInner"+cLayerName).hide();		
		$j("#mainContentPopUpBaseLayer"+cLayerName).fadeOut("normal",function() {
			// Aktuelle Seite des Iframes auslesen und Iframe neu laden
			cStartLocation=window.parent.$j("#mainContentIframeLayer"+cLayerName).attr("src");
			window.parent.$j("#mainContentIframeLayer"+cLayerName).attr("src",cStartLocation);
		
		});
	}

	// Namen des zuletzt eingeblendeten Layers löschen
	delete cLayerNameNow;

	return false;
}



// -----------------------------------------------------
// Name: checkKeyEventPopUpLayer()
// Funktion: Ermittelt Tastatureingabe für PopUp-Layer
// Rückgabe: Status der Tastatureingabe (boolean)
// Status: aktiv
// Version: 0.1
// Letzte Änderung: 10.06.2009
// -----------------------------------------------------
function checkKeyEventPopUpLayer(e,cParent) {
	var cStatus=false;
	
	if(window.event) {
		if(window.event.keyCode==27) cStatus=true; 
	} else if(e.keyCode==e.DOM_VK_ESCAPE) cStatus=true; 

	if(cStatus && typeof(cLayerNameNow)!="undefined") {
		check=confirm("Fenster schließen?");
		if(check==true) hidePopUpLayer(cParent,cLayerNameNow);
		else return false;
	}
}

