// 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 arrReplacements = strName.split(",");
	var strURL = new String(window.document.location);
	
	for (var i=0; i<arrReplacements.length; i++)
	{
		var objRemoveParameter = new RegExp("&*" + arrReplacements[i] + "=[a-z0-9]+&*");
		if (objRemoveParameter.test(strURL))
		{
			strURL = strURL.replace(objRemoveParameter, "");
			blnForceReload = true;
		}
	}
	if (blnForceReload == true)
	{
		if (strURL.lastIndexOf("?") == strURL.length-1) 
		{
			if (strNew == "")
			{
				strURL = strURL.substr(0,strURL.length-1);
			}
			else
			{
				strURL = strURL + strNew;
			}
		}
		else
		{
			if (strNew != "")
			{
				strURL = strURL + "?" + strNew;
			}
		}
		window.document.location.replace(strURL);
	}
} // Ende der Funktion reloadDocument*/

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=no, status=no");
	objWindow.focus();
}

function openWindowWithScrolling(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();
}

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