﻿var ShowPopUp = true;

var closeHeaderHTML_Move =  '<div id="sub__cspopupname_" onmousedown=setpress() onmouseup=unsetpress() onMousemove="Mauskontrolle(this)" style="position:absolute;height:_popupheight_px;width:_popupwidth_px;top:_popuptop_px;left:_popupleft_px;">' +
                            '<table  border=0 cellpadding=3 cellspacing=0 style="width:100%;height:100%;border:1px solid #aeaeae;background-color:#ffffff;"><tr><td style="cursor: move;" bgcolor="#AAAAFF" align="left">&nbsp;<b>' +
            		            '_cspopupfensterheader_' +
            		            '</b></td><td style="cursor: move;" bgcolor="#AAAAFF" align="right"><a href="javascript:ClosePopUp(\'_cspopupname_\');">' + 
		                        '<img src="/WWsupport/netmind/close.gif" border=0></a><\/td></tr>' +
		                        '<tr><td height=100% colspan=2 valign=top>_cspopupfenstercontent_</td></tr>' +
		                        '</table></div>';
var closeHeaderHTML_Fixed = '<div id="sub__cspopupname_" style="position:absolute;height:_popupheight_px;width:_popupwidth_px;top:_popuptop_px;left:_popupleft_px;">' +
                            '<table  border=0 cellpadding=3 cellspacing=0 style="width:100%;height:100%;border:1px solid #aeaeae;background-color:#ffffff;"><tr><td bgcolor="#AAAAFF" align="left">&nbsp;<b>' +
            		            '_cspopupfensterheader_' +
            		            '</b></td><td bgcolor="#AAAAFF" align="right"><a href="javascript:ClosePopUp(\'_cspopupname_\');">' + 
		                        '<img src="/WWsupport/netmind/close.gif" border=0></a><\/td></tr>' +
		                        '<tr><td height=100% colspan=2 valign=top>_cspopupfenstercontent_</td></tr>' +
		                        '</table></div>';
var closeHeaderHTML_Container_Fixed =  '<div id="sub__cspopupname_" style="position:absolute;height:_popupheight_px;width:_popupwidth_px;top:_popuptop_px;left:_popupleft_px;">' +
                            '<table  border=0 cellpadding=2 cellspacing=0 style="width:100%;height:100%;"><tr>' +
            		            '<td align="right"><a href="javascript:ClosePopUp(\'_cspopupname_\');">' + 
		                        '<img src="/WWsupport/netmind/close.gif" border=0></a><\/td></tr>' +
		                        '<tr><td height=100% valign=top>' +
		                        '_cspopupfenstercontent_' +
		                        '</td></tr>' +
		                        '</table></div>';
var closeHeaderHTML_Arrow_Right =  '<div id="sub__cspopupname_" style="position:absolute;height:_popupheight_px;width:_popupwidth_px;top:_popuptop_px;left:_popupleft_px;">' +
                            '<table  border=0 cellpadding=2 cellspacing=0 style="width:100%;height:100%;"><tr>' +
            		            '<td align="right"><a href="javascript:ClosePopUp(\'_cspopupname_\');">' + 
		                        '<img src="/WWsupport/netmind/close.gif" border=0></a><\/td></tr>' +
		                        '<tr><td height=100% valign=top>' +
		                        '<table border=0 width=100% cellpadding=0 cellspacing=0>' +
                            '<tr><td style="background-color:#ffff88;height:100%;width:100%;border-top:1px solid #000000;border-left:1px solid #000000;border-bottom:1px solid #000000;" colspan=2>' +
                            '<table cellpadding=4 cellspacing=0><tr><td>' +
                             '_cspopupfenstercontent_' +
                            '</td></tr></table></td><td valign=top style="height:100%"><table border=0 style="height:100%;" cellpadding=0 cellspacing=0><tr><td valign=top><img border=0 src="/WWsupport/netmind/arrowright.gif"></td>' +
                            '</tr><tr><td height=100% style="border-left:1px solid #000000;">&nbsp;</td></tr></table></td></tr></table>' +
		                        '</td></tr>' +
		                        '</table></div>';
var closeHeaderHTML_Arrow_Left =  '<div id="sub__cspopupname_" style="position:absolute;height:_popupheight_px;width:_popupwidth_px;top:_popuptop_px;left:_popupleft_px;">' +
                            '<table  border=0 cellpadding=2 cellspacing=0 style="width:100%;height:100%;"><tr>' +
            		            '<td align="right"><a href="javascript:ClosePopUp(\'_cspopupname_\');">' + 
		                        '<img src="/WWsupport/netmind/close.gif" border=0></a><\/td></tr>' +
		                        '<tr><td height=100% valign=top>' +
		                        '<table border=0 width=100% cellpadding=0 cellspacing=0>' +
                            '<tr><td valign=top style="height:100%"><table border=0 style="height:100%;" cellpadding=0 cellspacing=0><tr><td valign=top><img border=0 src="/WWsupport/netmind/arrowleft.gif"></td>' +
                            '</tr><tr><td height=100% style="border-right:1px solid #000000;">&nbsp;</td></tr></table></td><td style="background-color:#ffff88;height:100%;width:100%;border-top:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;" colspan=2>' +
                            '<table cellpadding=4 cellspacing=0><tr><td>' +
                             '_cspopupfenstercontent_' +
                            '</td></tr></table></td></tr></table>' +
		                        '</td></tr>' +
		                        '</table></div>';
var closeHeaderHTML_Arrow_TopLeft =  '<div id="sub__cspopupname_" style="position:absolute;height:_popupheight_px;width:_popupwidth_px;top:_popuptop_px;left:_popupleft_px;">' +
                            '<table  border=0 cellpadding=2 cellspacing=0 style="width:100%;height:100%;"><tr>' +
            		            '<td align="right">' + 
		                        '<\/td></tr>' +
		                        '<tr><td height=100% valign=top>' +
		                        '<table border=0 width=100% cellpadding=0 cellspacing=0>' +
                            '<tr><td valign=top style="height:100%"><table border=0 style="width:100%;height:100%;" cellpadding=0 cellspacing=0><tr><td valign=top><img border=0 src="/WWsupport/netmind/arrowtopleft.gif"></td><td style="width:100%;border-bottom:1px solid #000000;" align=right><a href="javascript:ClosePopUp(\'_cspopupname_\');"><img src="/WWsupport/netmind/close.gif" border=0></a></td></tr>' +
                            '<tr><td colspan=2 style="background-color:#ffff88;height:100%;width:100%;border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;">' +
                            '<table cellpadding=4 cellspacing=0><tr><td>' +
                             '_cspopupfenstercontent_' +
                            '</td></tr></table></td></tr></table>' +
		                        '</td></tr>' +
		                        '</table></div>';
var closeHeaderHTML_Arrow_TopRight =  '<div id="sub__cspopupname_" style="position:absolute;height:_popupheight_px;width:_popupwidth_px;top:_popuptop_px;left:_popupleft_px;">' +
                            '<table  border=0 cellpadding=2 cellspacing=0 style="width:100%;height:100%;"><tr>' +
            		            '<td align="right">' + 
		                        '<\/td></tr>' +
		                        '<tr><td height=100% valign=top>' +
		                        '<table border=0 width=100% cellpadding=0 cellspacing=0>' +
                            '<tr><td valign=top style="height:100%"><table border=0 style="width:100%;height:100%;" cellpadding=0 cellspacing=0><tr><td style="width:100%;border-bottom:1px solid #000000;" align=left><a href="javascript:ClosePopUp(\'_cspopupname_\');"><img src="/WWsupport/netmind/close.gif" border=0></a></td><td valign=top><img border=0 src="/WWsupport/netmind/arrowtopright.gif"></td></tr>' +
                            '<tr><td colspan=2 style="background-color:#ffff88;height:100%;width:100%;border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;">' +
                            '<table cellpadding=4 cellspacing=0><tr><td>' +
                             '_cspopupfenstercontent_' +
                            '</td></tr></table></td></tr></table>' +
		                        '</td></tr>' +
		                        '</table></div>';
var cspopupname;


// Funktionen zur Verschiebung des Optionen-Dialogs
document.onmousemove = checkPosition;
var mypress=0; 
var divPosX=0;
var divPosY=0; 
var diffx=0;
var diffy=0;

function checkPosition(e){
	if(document.all){
		mausX = event.clientX + document.body.scrollLeft;
		mausY = event.clientY + document.body.scrollTop;
	}else{
		mausX = e.pageX; mausY = e.pageY;
  }
}

function setpress(){
	mypress=1;
	diffx=mausX- divPosX;
	diffy=mausY- divPosY;
}

function unsetpress(){
	mypress=0;
}

function Mauskontrolle(Element) {
	divPosX = Element.offsetLeft;
	divPosY = Element.offsetTop;
 
	if(mypress==1){ 
		if (mausY-diffy >= 0) Element.style.top=mausY-diffy; else Element.style.top=0;
		if (mausX-diffx >= 0) Element.style.left=mausX-diffx; else Element.style.left=0;
	}
	return true;
}

function MakeVisible(popupwindow){
	if (ShowPopUp && document.getElementById)
		document.getElementById(popupwindow).style.visibility = "visible";
}

function MakeInVisible(popupwindow){
	if (document.getElementById)
		document.getElementById(popupwindow).style.visibility = "hidden";
}

function ClosePopUp(popupwindow){
	MakeInVisible(popupwindow);
	/*
	var ablauf = new Date();
	var vierstunden = ablauf.getTime() + (HidePopUpTime * 24 * 60 * 60 * 1000);
	ablauf.setTime(vierstunden);
	document.cookie = "footernopopup=1; expires=" + ablauf.toGMTString();
	*/
}

function SetDivTag(popdiv,divname,top, left, width, height){
	popupwindow = popdiv;
	popupwindow = popupwindow.replace(/_cspopupname_/, divname);
  popupwindow = popupwindow.replace(/_cspopupname_/, divname);
	popupwindow = popupwindow.replace(/_popupheight_/, height);
	popupwindow = popupwindow.replace(/_popupwidth_/, width);
	popupwindow = popupwindow.replace(/_popuptop_/, top);
	popupwindow = popupwindow.replace(/_popupleft_/, left);
	cspopupname = divname;
	return popupwindow;
	
	/*
	if (document.getElementById){
	try{
		var el = document.getElementById(popdiv);
		el.style.top = top;
		el.style.left = left;
		el.style.width = width;
		el.style.height = height;
		if (clipping) {
			el.style.overflow = "hidden";
		}
		} catch(e) {alert(e);}
	}
	*/
}

function LoadPopUp(popuplink, popupwindow){

	var cookieval = document.cookie;
	if(cookieval.indexOf("nopopup") > -1) {
		ShowPopUp = false;
		return;
	}

	var request;
	var lbPopUp = document.getElementById(cspopupname);
	if (window.XMLHttpRequest){
		request=new XMLHttpRequest();
	}
	else if (window.ActiveXObject){
		try	{
			request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try	{
				request=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				request = false;
			}
		}
	}
	
	try {
		var proto = window.location.protocol;
		if (popuplink.substring(0,5).toLowerCase() == "http:")
		popuplink = proto + popuplink.substring(5);

		
		request.open("GET", popuplink, true);
		lbPopUp.innerHTML = "<span id='waitMsg' class='lbMsgText'>" + bitteWartenTxt + "<\/span>";		
		request.onreadystatechange = function(evt)
		{
			if (request.readyState == 4) {
				if (true) { //request.status == 200
					var content = request.responseText;
					var sContent = content.toLowerCase();
					var pos1 = sContent.indexOf("<body");
					pos1 = sContent.indexOf(">", pos1);
					var pos2 = sContent.indexOf("\/body");
					
					popupwindow = popupwindow.replace(/_cspopupfensterheader_/, closeHeaderXL);
					popupwindow = popupwindow.replace(/_cspopupfenstercontent_/, content.substr(pos1+1, pos2));
          
					lbPopUp.innerHTML = popupwindow;
					
				} else {
					lbPopUp.innerHTML = closeHeaderHTML.replace(/_cspopupfensterheader_/, closeHeaderXL);
					lbPopUp.innerHTML += 'error ' + request.status + popuplink;
				}
			}
		};
		request.send(null);
	} catch(e) {
		alert("error: " + e);
	}
}
