var submitInProgress = false;

function Navigate( formFragmentIdentity )
{
	if ( submitInProgress )
	{
		window.status = "A request is already in progress, please wait for it to complete before attempting navigating elsewhere";
	}
	else
	{
		submitInProgress = true;
		with ( document.forms["GenericForm"] )
		{
			elements["FormFragmentIdentityTextBox"].value = formFragmentIdentity;
			elements["ClearSessionTextBox"].value = "no";
			submit();
		}
	}
}

function MenuNavigate( formFragmentIdentity )
{
	if ( submitInProgress )
	{
		window.status = "A request is already in progress, please wait for it to complete before attempting navigating elsewhere";
	}
	else
	{
		submitInProgress = true;
		with ( document.forms["GenericForm"] )
		{
			elements["FormFragmentIdentityTextBox"].value = formFragmentIdentity;
			elements["ClearSessionTextBox"].value = "yes";
			submit();
		}
	}
}

function PopUpWindow()
{
	// properties
	this.Url = "about:blank";
	this.Name = "";
	this.Replace = true;
	
	// typical dynamic properties
	//	_channelmode = { yes | no | 1 | 0 }
	//	_directories = { yes | no | 1 | 0 }
	//	_fullscreen = { yes | no | 1 | 0 }
	//	_height = number of pixels
	//	_left = number of pixels
	//	_location = { yes | no | 1 | 0 }
	//	_menubar = { yes | no | 1 | 0 }
	//	_resizable = { yes | no | 1 | 0 }
	//	_scrollbars = { yes | no | 1 | 0 }
	//	_status = { yes | no | 1 | 0 }
	//	_titlebar = { yes | no | 1 | 0 }
	//	_toolbar = { yes | no | 1 | 0 }
	//	_top = number of pixels
	//	_width = number of pixels
	
	// public methods
	this.Open = PrivateOpen;
	this.Features = PrivateFeatures;

	var featurePrefix = "_";

	function PrivateOpen()
	{
		return window.open( this.Url, this.Name, this.Features(), this.Replace );
	}
	
	function PrivateFeatures()
	{
		var returnValue = "";
		var delimiter = "";

		for ( var featureName in this )
		{
			if ( typeof( this[featureName] ) != "function" && featureName.indexOf( featurePrefix ) != -1 )
			{
				returnValue += delimiter + StripUnderscore( featureName ) + "=" + this[featureName];
				if ( delimiter.length =0 ) delimiter = ",";
			}
		}
		return returnValue;
	}
	
	function StripUnderscore( featureName )
	{
		return featureName.split( featurePrefix )[featureName.split( featurePrefix ).length-1];
	}	
}

function NewWindowURL( urlName)
{
	//use this when you want to open a small popup window
	//Only being used for Help AFAIK so am setting the size to an appropriate value
	window.open(urlName,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=660,height=640,left=40,top=50");
}
