var str_layer_aktiv = ""; // Der aktuelle Layer für das Contextmenü.

/*
 * Erstellt den Inhalt für den Platzhalterlayer.
 */
function js_schreibe_menue(str_id, str_info)
	{
	html = '';
	
	html+='<TABLE STYLE="border:1pt solid #808080" WIDTH="100%" CELLPADDING="0" CELLSPACING="1">';
	html+='<TR><TD bgcolor=\"#A0A0A0\" STYLE="border:1pt solid #696969; background=\'#A0A0A0\'">&nbsp;'+str_info+'</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.cursor=\'hand\'; this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'transparent\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="window.parent.location=\'view-source:\'+window.parent.location.href;">&nbsp;<IMG SRC="pics/webmail/symbol_dummy_18.gif" WIDTH="18" HEIGHT="18" BORDER="0" HSPACE="1" VSPACE="1" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;&nbsp;Einfügen</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.cursor=\'hand\'; this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'transparent\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="window.parent.location=\'view-source:\'+window.parent.location.href;">&nbsp;<IMG SRC="pics/webmail/symbol_dummy_18.gif" WIDTH="18" HEIGHT="18" BORDER="0" HSPACE="1" VSPACE="1" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;&nbsp;Bearbeiten</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.cursor=\'hand\'; this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'transparent\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="window.parent.location=\'view-source:\'+window.parent.location.href;">&nbsp;<IMG SRC="pics/webmail/symbol_dummy_18.gif" WIDTH="18" HEIGHT="18" BORDER="0" HSPACE="1" VSPACE="1" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;&nbsp;Löschen</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.cursor=\'hand\'; this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'transparent\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="window.parent.location=\'view-source:\'+window.parent.location.href;">&nbsp;<IMG SRC="pics/webmail/symbol_dummy_18.gif" WIDTH="18" HEIGHT="18" BORDER="0" HSPACE="1" VSPACE="1" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;&nbsp;Leeren</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.cursor=\'hand\'; this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'transparent\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="window.parent.location=\'view-source:\'+window.parent.location.href;">&nbsp;<IMG SRC="pics/webmail/symbol_dummy_18.gif" WIDTH="18" HEIGHT="18" BORDER="0" HSPACE="1" VSPACE="1" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;&nbsp;Eigenschaften</TD></TR>';
	html+='</TABLE>';
	
	return html;
	
	/*
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'#CCCCCC\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="window.history.go(1);">&nbsp;<IMG SRC="menuforward.gif" WIDTH="19" HEIGHT="19" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Forward</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'#CCCCCC\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="window.parent.external.AddFavorite(window.top.location.href,window.top.document.title);">&nbsp;<IMG SRC="symbol_dummy_18.gif" WIDTH="19" HEIGHT="19" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Add to Favorites...</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'#CCCCCC\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="window.parent.location=\'view-source:\'+window.parent.location.href;">&nbsp;<IMG SRC="symbol_dummy_18.gif" WIDTH="19" HEIGHT="19" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;View Source</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'#CCCCCC\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="window.parent.print();">&nbsp;<IMG SRC="menuprint.gif" WIDTH="19" HEIGHT="19" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Print</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'#CCCCCC\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="window.parent.location.href=window.parent.location.href;">&nbsp;<IMG SRC="menurefresh.gif" WIDTH="19" HEIGHT="19" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Refresh</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'#CCCCCC\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="if(window.parent.document.body.style.zoom!=0) window.parent.document.body.style.zoom*=1.6; else window.parent.document.body.style.zoom=1.6;">&nbsp;<IMG SRC="menuzoom.gif" WIDTH="19" HEIGHT="19" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Zoom In</TD></TR>';
	html+='<TR><TD STYLE="border:1pt solid #CCCCCC" ONMOUSEOVER="this.style.background=\'#CFD6E8\';this.style.border=\'1pt solid #737B92\';" ONMOUSEOUT="this.style.background=\'#CCCCCC\';this.style.border=\'1pt solid #CCCCCC\';" ONCLICK="if(window.parent.document.body.style.zoom!=0) window.parent.document.body.style.zoom*=0.625; else window.parent.document.body.style.zoom=0.625;">&nbsp;<IMG SRC="menuzoom.gif" WIDTH="19" HEIGHT="19" BORDER="0" HSPACE="0" VSPACE="0" ALIGN="absmiddle">&nbsp;Zoom Out</TD></TR>';
	*/
	}

/*
 * Hauptfunktion für das Einblenden des jeweiligen Contextmenüs.
 */
function js_switchLayer(str_id, int_modus, str_html, int_hoehe) // 1 visible, 0 hidden
	{
	// Füllt den Platzhalterlayer mit den aktuellen Inhalten.
	document.getElementById(str_id).innerHTML = str_html;
	document.getElementById(str_id).style.height = int_hoehe;
	
	// Die ID des aktuellen Layers global verfügbar machen.
	str_layer_aktiv = str_id;
	
	// Den Layer neben dem Mauszeiger positionieren.
	js_moveLayer(str_id);
	
	// Den Layer an- oder aus schalten.
	var obj = document.getElementById(str_id);
    obj.style.visibility = int_modus ? "visible" : "hidden";
    }

/*
 * Verbergen des aktuellen Contextmenüs, sobald die Grenzwerte überschritten werden.
 */
function js_hideLayer()
	{
	if(str_layer_aktiv != "")
		{
		// Die Werte die nicht überschritten werden dürfen, solange der Layer angezeigt werden soll.
		int_x_max = parseFloat(document.getElementById(str_layer_aktiv).style.width) + parseFloat(document.getElementById(str_layer_aktiv).style.left);
		int_y_max = parseFloat(document.getElementById(str_layer_aktiv).style.height) + parseFloat(document.getElementById(str_layer_aktiv).style.top);
		int_x_min = parseFloat(document.getElementById(str_layer_aktiv).style.left);
		int_y_min = parseFloat(document.getElementById(str_layer_aktiv).style.top);
		
		// Sobald die Werte überschritten werden, den Layer schliessen.
		int_toleranz = 10; // Um soviel darf der Wert überschritten werden.
		
		if((xMousePos-int_toleranz) > int_x_max || (yMousePos-int_toleranz) > int_y_max || (xMousePos+int_toleranz) < int_x_min || (yMousePos+int_toleranz) < int_y_min )
			{
			var obj = document.getElementById(str_layer_aktiv);
	    	obj.style.visibility = "hidden";
			}
		}
    }

/*
 * Positionieren des aktuellen Contextmenüs.
 */
function js_moveLayer(str_id)
	{
	int_x = xMousePos;
	int_y = yMousePos;
	
	int_layer_width  = parseFloat(document.getElementById(str_layer_aktiv).style.width);
	int_layer_height = parseFloat(document.getElementById(str_layer_aktiv).style.height);
	
	// Falls das Menü nicht mehr in das Fenster passt, die Position ein wenig korrigeren.
	if(int_x+int_layer_width > xMousePosMax)
		int_x = xMousePosMax-(int_layer_width);

	if(int_y+int_layer_height > (yMousePosMax-20))
		int_y = yMousePosMax-(int_layer_height)-20;

	// Das Menü an die errechnete Position verschieben.
	document.getElementById(str_id).style.left = int_x+"px";
	document.getElementById(str_id).style.top  = int_y+"px";
	}