// ----------------------------------------------------
// Version: 0.1
// Last change: 10.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.1
// Letzte Änderung: 10.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;
}



// -----------------------------------------------------
// Name: hidePopUpLayer()
// Funktion: Blendet "PopUp-Layer" aus
// Rückgabe: Null
// Status: aktiv
// Version: 0.1
// Letzte Änderung: 10.06.2009
// -----------------------------------------------------
function hidePopUpLayer(cParent,cLayerName) {
	if(cParent) {
		window.parent.$j("#mainContentPopUpBaseLayerInner"+cLayerName).hide();
		window.parent.$j("#mainContentPopUpBaseLayer"+cLayerName).fadeOut("normal");
	} else {
		$j("#mainContentPopUpBaseLayerInner"+cLayerName).hide();		
		$j("#mainContentPopUpBaseLayer"+cLayerName).fadeOut("normal");
	}

	// Aktuelle Seite des Iframes auslesen
	cStartLocation=parent.document.getElementById("mainContentIframeLayer"+cLayerName).src;
	
	// Iframe neu laden, Zufallszahl anhängen, um Cache auszutricksen
	cLocationRandom=Math.round(10000000+10000000*(Math.random()));
	cStartLocation=cStartLocation+"?"+cLocationRandom;
	setTimeout("parent.document.getElementById('mainContentIframeLayer"+cLayerName+"').src=cStartLocation",cFadeDelayPopUpLayer+200);

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



// -----------------------------------------------------
// 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;
	}
}

