function lightboxLink_clearAll(qdiv)
{
	// qdiv: "linklistDiv" oder "DMlistDiv"
	document.LBdiv=qdiv;
	document.getElementById(qdiv).innerHTML="";
	Shadowbox.clearCache();
}

function lightboxDownload(aHref)
{
	window.onbeforeunload = noop; // Deaktiviert Exit-Warnung
	download_hRef=aHref + "&download=now";
	document.location.href=download_hRef;
	setTimeout(aktiviereExitWarnung,1500);	// wegen Gugel-Chrome und FF
}

function lightboxLink(aHref, filename, qdiv, klasse)
{
	filename=decodeURIComponent(filename);
	filename=filename.replace("'","´");
	
	// qdiv: "linklistDiv" oder "DMlistDiv"
	var titel = " <span style=\"text-decoration:underline;color:orange;cursor:pointer\" onclick=\"lightboxDownload(&#039;" + aHref + "&#039;)\">" + filename + "</span><span style=\"color:orange;cursor:pointer;margin-right:8px;float:right\" onclick=\"Shadowbox.close();\"><b>X</b></span>";
	
	aHref="<a title='" + titel + "' class='" + klasse + "' rel='lightbox[RELIAM]' href='" + aHref + "&download=forLightbox'></a>";

	document.getElementById(qdiv).innerHTML += "&nbsp;" + aHref;
	Shadowbox.clearCache();
//alert("Klasse: *" + klasse + "*");
var ankerTag='a.' + klasse;
	Shadowbox.setup( ankerTag, { 
			    animate:			true,
			    animateFade:		true,
			    animSequence:		"wh",
			    autoplayMovies:		true,
				continuous:			true,
				counterLimit:		99,
			    counterType:		"skip",
				displayCounter:		true,
				displayNav:			false,
			    enableKeys:			true,
			    fadeDuration:		0.7,
			    flashParams:		{bgcolor:"#000000"},
				flashVars:			{},
				flashVersion:		"9.0.0",
			    handleOversize:     "resize",
			    handleUnsupported:	"link",
			    initialWidth:		1,
			    initialHeight:		1,
			    Width:				1024,
			    Height:				576,
				modal:				false,
				onOpen:				lightboxOnOpen,
				onClose:			lightboxOnClose,
				overlayColor:		"#000000",
				overlayOpacity:		0.8,
//				player:				'swf',
				resizeDuration:		0.3,
			    showOverlay:		true,
			    showMovieControls:	true,
				slideshowDelay:		0,
			    viewportPadding:  	0
	  });
}
function lightboxOnOpen()
{
	document.LB=true;
	if(document.LBdiv=="DMlistDiv")
	{
		DM_Grid.enableKeyboardSupport(false);
	}
	else
	{
		tastatursperre(true);
	    document.MailgridSelection=selektierteZeilen(MailGrid);
	}
	setTimeout(setFokusNow,303);
	setTimeout(setFokusNow,707);
	setTimeout(setFokusNow,1212);
	return true;
}
function setFokusNow()
{
	try
	{
		document.getElementById("fokusTrick").focus();
		document.getElementById("fokusTrick").blur();
	}
	catch(err)
	{
	}
}
function lightboxOnClose()
{
	if(document.LBdiv=="DMlistDiv")
	{
		DM_Grid.enableKeyboardSupport(true);
	}
	else
	{
		setTimeout(restoreMailGridSelektion,303);
	}
	setTimeout(lbfalse,505);
	return true;
}
function lbfalse()
{
	document.LB=false;
}
function restoreMailGridSelektion()
{
	MailGrid.startFastOperations();		// keine Events auslösen, sonst flackerts ...
    // alte Selektion im Mailgrid wiederherstellen ....
    for(var i=0;i<document.MailgridSelection.length;i++)
    {
    	MailGrid.selectRowById(document.MailgridSelection[i], true, false, false);
    }
	MailGrid.stopFastOperations();
	tastatursperre(false);
	document.LB=false;
}
function lightboxOpen(index,klasse,qdiv)
{
	document.LBdiv=qdiv;
	var liste=getElementsByClassName(klasse);
	document.parkElement=liste[index];
	// fängt Doppelklicks ab.
	if (!document.dblClkHandler) {
		document.dblClkHandler = window.setTimeout("lightboxOpenElement()", 100);
		window.setTimeout("document.dblClkHandler=false", 1000);
	}

}

function lightboxOpenElement()
{
	var elem = document.parkElement;
	Shadowbox.open(elem);
}

function lightboxInit()
{
	// caller: preBoot() in dhtmlx_environment
	Shadowbox.clearCache();

	Shadowbox.init({
		loadingImage: '../images/loading.gif', 
		skipSetup: false,			    
		animate:			true,
			    animateFade:		true,
			    animSequence:		"wh",
			    autoplayMovies:		true,
				continuous:			true,
				counterLimit:		99,
			    counterType:		"skip",
				displayCounter:		true,
				displayNav:			false,
			    enableKeys:			true,
			    fadeDuration:		0.7,
			    flashParams:		{bgcolor:"#000000"},
				flashVars:			{},
				flashVersion:		"9.0.0",
			    handleOversize:     "resize",
			    handleUnsupported:	"link",
			    initialWidth:		1,
			    initialHeight:		1,
			    Width:				1024,
			    Height:				576,
				modal:				false,
//				onOpen:				lightboxOnOpen,
//				onClose:			lightboxOnClose,
				overlayColor:		"#000000",
				overlayOpacity:		0.8,
//				player:				'swf',
				resizeDuration:		0.3,
			    showOverlay:		true,
			    showMovieControls:	true,
				slideshowDelay:		0,
			    viewportPadding:  	0

	});
}

