function parseArguments()
{
	// create new array to store arguments
	var arguments = new Array();

	var url = document.URLUnencoded;
	var index = url.indexOf("?");
	
	if (index >= 0)
	{
		var url = url.substr(index + 1);
		var pos = 0;
		
		do
		{
			index = url.indexOf("&", pos);
			if (index < 0)
			{
				index = url.length;
			}
			
			var arg = url.substring(pos, index);
			
			pos = index + 1;
			
			if (arg.length > 0)
			{
				index = arg.indexOf("=");
				if (index < 0)
				{
					index = arg.length;
				}
				
				var name = arg.substring(0, index);
				var value = arg.substr(index + 1);
				
				arguments[name] = value;
			}
			else
			{
				// no more arguments to parse
				break;
			}
		}
		while (true);
	}
	
	// store the array in a new document property
	document.arguments = arguments
}

function findControl(control, inOpener)
{
	var ctrl = null;
	
	if (typeof control == "string")
	{
		// find the object by name
		var wnd = null;
		
		if (inOpener)
		{
			wnd = window.opener;
		}
		else
			wnd = window;
		
		if (wnd != null)
		{
			if (document.all)
			{
				ctrl = wnd.document.all(control);
			}
			else if (document.getElementById)
			{
				ctrl = wnd.document.getElementById(control);
			}
		}
	}
	else
		ctrl = control;
	
	return ctrl;
}

function getDateFromCalendar( txtDate )
{
	var SelectedDate;
	//window.open( "CrossingCalendar.aspx" );
	SelectedDate = window.showModalDialog( "/common/CrossingCalendar.aspx", "", "dialogHeight:400px; dialogWidth:190px" );
	if( SelectedDate != null )
	{
//	alert(document.getElementById(txtDate).id);
//	alert(document.getElementById(txtDate).TextBox.value);
		document.getElementById(txtDate).value = SelectedDate;
//		__doPostBack(txtDate.Id,'');
	}
}
