function Submit()
{
	var strPath = window.location.pathname;
	var strPageFileName = strPath.substring(strPath.lastIndexOf('/') + 1);

	if (arguments.length == 1)
	{
		document.getElementById("hdSourceObject").value = arguments[0];
		document.getElementById("hdAction").value = "";	
		
		var strQueryString = location.search.substring(1, location.search.length); 
		if (strQueryString.length > 0)
		{
			document.getElementById("fMainForm").action = strPageFileName + "?" + strQueryString;	
		}
		else
		{
			document.getElementById("fMainForm").action = strPageFileName;	
		}
	}
	if (arguments.length == 2)
	{
		document.getElementById("hdSourceObject").value = arguments[0];
		document.getElementById("hdAction").value = arguments[1];	
		
		var strQueryString = location.search.substring(1, location.search.length); 
		if (strQueryString.length > 0)
		{
			document.getElementById("fMainForm").action = strPageFileName + "?" + strQueryString;	
		}
		else
		{
			document.getElementById("fMainForm").action = strPageFileName;	
		}
	}		
	if (arguments.length == 3)
	{
		document.getElementById("hdSourceObject").value = arguments[0];
		document.getElementById("hdAction").value = arguments[1];	
		document.getElementById("fMainForm").action = arguments[2];	
	}		
	
	document.getElementById("fMainForm").submit();
}

function SetSiteMapPath(a_arrPath)
{
	if (document.getElementById("hdSiteMapPath"))
	{
		document.getElementById("hdSiteMapPath").value = SerializeToString(a_arrPath);
	}
	Submit("SiteMap", "ChangePath");	
}

function ResetSiteMapPath(a_arrPath)
{
	if (document.getElementById("hdSiteMapPath"))
	{
		document.getElementById("hdSiteMapPath").value = SerializeToString(a_arrPath);
	}
	Submit("SiteMap", "ResetPath");	
}

function OpenWindow(a_strUrl, a_strName, a_nWidth, a_nHeight)
{
	/*
	status  	The status bar at the bottom of the window.
	toolbar 	The standard browser toolbar, with buttons such as Back and Forward.
	location 	The Location entry field where you enter the URL.
	menubar 	The menu bar of the window
	directories 	The standard browser directory buttons, such as What's New and What's Cool
	resizable 	Allow/Disallow the user to resize the window.
	scrollbars 	Enable the scrollbars if the document is bigger than the window
	height 	Specifies the height of the window in pixels. (example: height='350')
	width 	Specifies the width of the window in pixels.
	*/

	return window.open(a_strUrl, a_strName, "status=1, toolbar=0, location=0, menubar=0, scrollbars=1, height=" + a_nHeight + ", width=" + a_nWidth + "");
}