/* funktion fuer Oeffnen eines Pflegefensters mit vorherigen Pruefung, ob dieses Fenster schon existiert. */


function windowOpenWithCheck(pSurl,pSwindowObjektName,pSwindowName,pSwidth,pSheigth,pSstatus,pSmenubar,pSresizable,pStitlebar,pSlocation,pSscrollbars,pStoolbar,pSstatusString,pSmessage,pSopener)
{
/*Fenster Oeffnen*/
	/* Gibt es schon ein Pflegesession ? Cookie auslesen! */
	pSwindowObjektName = window.open('', pSwindowName);
	
	if (getcookie(pSwindowName))
	{
		if (confirm(pSmessage))
		{
			//Beginn CR3895
			pSwindowObjektName = window.open('about:blank', pSwindowName);	//Objecthandle holen
			// Cookie löschen und Fenster zu:
			delcookie(pSwindowName);
			pSwindowObjektName.close();
			//Ende CR3895
			windowOpenBasic(pSurl,pSwindowObjektName,pSwindowName,pSwidth,pSheigth,pSstatus,pSmenubar,pSresizable,pStitlebar,pSlocation,pSscrollbars,pStoolbar,pSstatusString,pSopener);
		}
		
	}
	else{
		windowOpenBasic(pSurl,pSwindowObjektName,pSwindowName,pSwidth,pSheigth,pSstatus,pSmenubar,pSresizable,pStitlebar,pSlocation,pSscrollbars,pStoolbar,pSstatusString,pSopener);
	}
	return false;
};


function windowOpen(pSurl,pSwindowObjektName,pSwindowName,pSwidth,pSheigth,pSstatus,pSmenubar,pSresizable,pStitlebar,pSlocation,pSscrollbars,pStoolbar,pSstatusString,pSopener)
{
	/*Fenster öffnen*/
	windowOpenBasic(pSurl,pSwindowObjektName,pSwindowName,pSwidth,pSheigth,pSstatus,pSmenubar,pSresizable,pStitlebar,pSlocation,pSscrollbars,pStoolbar,pSstatusString,pSopener);	
	return false;
	
};
function windowOpenBasic(pSurl,pSwindowObjektName,pSwindowName,pSwidth,pSheigth,pSstatus,pSmenubar,pSresizable,pStitlebar,pSlocation,pSscrollbars,pStoolbar,pSstatusString,pSopener)
{
	/*Fenster öffnen*/
	pSwindowObjektName = window.open(pSurl, pSwindowName, "width="+pSwidth+",height="+pSheigth+",status="+pSstatus+",menubar="+pSmenubar+",resizable="+pSresizable+",titlebar="+pStitlebar+",location="+pSlocation+",scrollbars="+pSscrollbars+",toolbar="+pStoolbar);	
	pSwindowObjektName.opener = pSopener;
	if ((pSstatusString != null) || (pSstatusString != ''))  pSwindowObjektName.status = pSstatusString;
	pSwindowObjektName.focus();
}

/*function loadPflegeSeite(pSwindowName)
{
	// Der registrierungsfunktion der Hauptaplikation aufrufen.
	opener.top.frames["logo"].loadSite(pSwindowName);
}

function unloadPflegeSeite(pSwindowName)
{
	// Der registrierungsfunktion der Hauptaplikation aufrufen.
	opener.top.frames["logo"].unloadSite(pSwindowName);
}*/

function loadPflegeSeite(pSwindowName,domain)
{
//	alert("domain:"+domain);
	expiredate = new Date();
	expiredate.setTime(expiredate.getTime()+5*24*60*60*1000);
	setcookie(pSwindowName,"test",expiredate,"/",null,false);
}

function unloadPflegeSeite(pSwindowName,domain)
{
	expiredate = new Date();
	expiredate.setTime(expiredate.getTime()-5*24*60*60*1000);
	setcookie(pSwindowName,"true",expiredate,"/",null,false);
}

function getDomaine(aLocation)
{
     return aLocation.hostname;
}
