// Skripte-Bibliothek der Firma 24-7-52.ch GmbH
/*
+---------------------------------------------------------------------------+
| Funktion:	reloadDocument				     								|
+---------------------------------------------------------------------------+
| Zugriff:	@access public													|
+---------------------------------------------------------------------------+
| Version:	@version 2.0													|
+---------------------------------------------------------------------------+
| Funktion: Entfernt die angegebenen URL-Argumente, fügt g.g.f. neue hinzu	|
|			und lädt danach das aktuelle Dokument neu.						|
|			Diese Funktion wird im Allgemeinen dazu verwendet, um zu		|
|			verhindern, dass Aktionen beim Reload nicht wieder durchgeführt	|
|			werden.															|
+---------------------------------------------------------------------------+    
| Aufruf:	window.reloadDocument("action,id", "name=usr", true);			|
+---------------------------------------------------------------------------+
| Eingabe:	@param strName String			Ein oder mehrere durch Komma ge-|
|											getrennte Argumente, welche ge- |
|											löscht werden sollen.			|
|           @param strNew String 			Neue Argumente, welche hinzuge- |
|											fügt werden sollen.				|
|           @param blnForceReload Boolean	Gibt an, ob das Dokument in		|
|											jedem Fall neu geladen werden	|
|											soll.							|
+---------------------------------------------------------------------------+    
| Ausgabe:	-																|
+---------------------------------------------------------------------------+
*/
function reloadDocument(strName, strNew, blnForceReload)
{
	var arrNewArgs   = new Array();
	var strNewSearch = new String();
	var arrDelete    = strName.split(",");
	var arrReplace   = strNew.split("&");
	var strFileURI   = new String(window.document.location);
	var arrLocation  = strFileURI.split("?");
	var strFileURL   = new String(arrLocation[0]);
	var strFileSearch= new String(arrLocation[1]);
	var arrArgs      = strFileSearch.split("&");
	
	for (i = 0; i < arrArgs.length; i++)
	{
		var arrAKVP = arrArgs[i].split("=");
		if ((arrAKVP[0] != undefined) &&  (arrAKVP[1] != undefined))
			arrNewArgs[arrAKVP[0]] = arrAKVP[1];
	}
	for (i = 0; i < arrDelete.length; i++)	
		delete arrNewArgs[arrDelete[i]];
		
	for (i = 0; i < arrReplace.length; i++)
	{
		var arrRKVP = arrReplace[i].split("=");
		if ((arrRKVP[0] != undefined) &&  (arrRKVP[1] != undefined))
			arrNewArgs[arrRKVP[0]] = arrRKVP[1];
	}
	for (key in arrNewArgs)
		strNewSearch+= "&" + key + "=" + arrNewArgs[key];
		
	if (strNewSearch != "")
		strNewSearch = "?" + strNewSearch.substr(1, strNewSearch.length);
		
	strFileURI = strFileURL + strNewSearch;
	
	window.location = strFileURI;
}

function openWindow(strURL, strName, intWidth, intHeight) 
{
	var strPosition = "left=" + ((screen.width - intWidth) / 2) +", top=" + ((screen.height - intHeight) / 2); 
	var objWindow   = this.open(strURL, strName, strPosition + ",width=" + intWidth +" , height=" + intHeight + ", menubar=no, toolbar=no, directories=no, scrollbars=yes, status=no");
	objWindow.focus();
}
