	/* Functions Relating to Web Page User Interfaces */
	/*
		Show			( Url, width, height );	//Displays a popup in the center of the screen.
		ShowDialog	( Url, width, height );	//Shows a Modal Dialog
	*/
	
	var winModalWindow
	
	function HandleFocus()
	{
		if ( winModalWindow )
		{
			if (!winModalWindow.closed)
			{
				winModalWindow.focus();
			}
			else
			{
				window.top.releaseEvents ( Event.CLICK | Event.FOCUS );
				window.top.onclick = "";
			}
		}
		return false;
	}
	
	function IgnoreEvents(e)
	{
		return false;
	}
	
	function Show( vURL, w, h)
	{
		var LeftPos	=	( screen.availWidth		/ 2	) - ( w / 2 );
		var TopPos	=	( screen.availHeight	/ 2	) - ( h / 2 );
		return window.open( vURL, "_blank", "scrollbars=yes,height=" + h + ",width=" + w + ",statusbar=no,resizable=yes,left=" + LeftPos + ",top=" + TopPos );
	}
	
	function Show( vURL, scrollBars, w, h, statusBar, resizable)
	{
		var LeftPos	=	( screen.availWidth		/ 2	) - ( w / 2 );
		var TopPos	=	( screen.availHeight	/ 2	) - ( h / 2 );
		return window.open( vURL, "_blank", "scrollbars=" + scrollBars + ",height=" + h + ",width=" + w + ",statusbar=" + statusBar + ",resizable=" + resizable + ",left=" + LeftPos + ",top=" + TopPos );
	}
	
	function __firefox_ShowDependant( vURL, w, h)
	{	
		//Gives a sorta modal window in FireFox however gives a modeless dialog in IE though... 
		//Property "_blank" works in both for the sName of the window strange thought it may be...
		var LeftPos	=	( screen.availWidth		/ 2	) - ( w / 2 );
		var TopPos	=	( screen.availHeight	/ 2	) - ( h / 2 );
		return window.open( vURL, "_blank", "dependent=yes,scrollbars=yes,height=" + h + ",width=" + w + ",statusbar=no,resizable=yes,left=" + LeftPos + ",top=" + TopPos );
	}
	
	function __firefox_ShowDialog( vURL, w, h )
	{
		//TODO: Implement __firefox_ShowDialog( vURL, w, h )
	}
	
	//Recieved from James Wilson, Creator Unknown
	//Changed by Cory Dambach June 30, 2005: call to __firefox_ShowDependant() added
	function ShowDialog( vURL, w, h)
	{
		if ( window.showModalDialog )
		{
			var LeftPos	=	( screen.availWidth		/ 2	) - ( w / 2 );
			var TopPos	=	( screen.availHeight	/ 2	) - ( h / 2 );
			return window.showModalDialog( vURL, null, "scroll:no;dialogLeft:" + LeftPos + "px;dialogTop:" + TopPos + "px;dialogHeight:" + h + "px;dialogWidth:" + w + "px;status:no;" );
		}
		else
		{
			//return FakeOpenModal(vURL,w,h);
			return __firefox_ShowDependant( vURL, w, h);
		}
	}
	
	
	function HourGlass(bWantItOn) //Last Modified by James Wilson, Date Unknown
	{
		document.body.style.cursor = (bWantItOn) ? "wait" : "default";
	}
	
	function FakeOpenModal(vURL,w,h) //firefox.
	 {
		window.top.captureEvents( Event.CLICK | Event.FOCUS );
		window.top.onclick	= IgnoreEvents;
		window.top.onfocus	= HandleFocus;
		var LeftPos	=	( screen.availWidth		/ 2	) - ( w / 2 );
		var TopPos	=	( screen.availHeight	/ 2	) - ( h / 2 );
		winModalWindow = __firefox_ShowDialog( vURL, w, h );
		winModalWindow.focus();
		return winModalWindow.returnVal;
	}

	function DateClick(selObj) //Creator Unknown, Date Unknown
	{
		window.dateField = selObj;
		calendar = window.open('/scripts/calendar.htm','cal','WIDTH=200,HEIGHT=250');
	}

	function DateClickModal(selObj) //Creator Unknown, Date Unknown
	{
		var sFeatures="scroll:no;dialogHeight:300px;dialogWidth:250px;";
		Args = selObj; //set the input as the sole dialog Arguments
		CheckVal = Show('/scripts/calendar2.htm', 250, 250 );		
		CheckVal.dialogArguments = Args;
		return CheckVal;
	}
		
	function DatePopUp( sender, e ) //Creator Unknown, Date Unknown, widely established
	{
		if( sender == null ) //ahhhhhh! I can't believe I'm having to do this.
			sender = event.srcElement; //for love, this is for love...
		var NameToUpdate = sender.id.replace( /_cal/i, "" );
		return DateClickModal( Tag(NameToUpdate) );
	}
		
	function DatePopUp2(SpanName) //Creator Unknown, Date Unknown, Not in use
	{
		var EventSource = event.srcElement;
		var SpanElement = document.all[SpanName];
		var NameToUpdate = EventSource.name.replace(/_cal/i, "");
		DateClickModal(SpanElement.all.item(NameToUpdate));
	}