	var IsPageLoaded = false;
	
	function pageLoadSetup()
	{
		if(typeof(ReloadURL)=="string") document.forms[0].action = ReloadURL;
		IsPageLoaded = true;
	}

	//stubbed functions in case a public display has not public features
	function RowToggle( strCheckBoxID, bIsChecked )	{}
	function RegisterCheckBox( oCheckBox ) {}
	function AddCheckBoxToRegisteredString( oCheckBox )	{}
	function ShowSelectedCount()	{}
	function UpdateButtons()	{}
	function UpdateCheckAll()	{ }
	function TopBottomCheckAll( bChecked )	{}
	function SingleLineCheckAll( cbxCheckAll )	{}
	function CheckAll( bIsChecked )	{}
	function CheckSet()	{}
	function watchItem( strID, nTableID ){}

	
	function ReDisplay( strURLParmeters )
	{
		if(strURLParmeters != ""){
			var hfUrlOverride = document.createElement("input");
			hfUrlOverride.type = "hidden";
			hfUrlOverride.name = "hfUrlOverride";
			hfUrlOverride.value = strURLParmeters;
			document.forms[0].appendChild( hfUrlOverride );
		}

		document.forms[0].hfRedisplay.value = "true";
		document.forms[0].submit();
	}

	var MapPointWin = null;
	function mapdisplay( nRecordID, nTableID)
	{
		var strFeatures = "height=487,width=516,left=0,top=0,resizable=0,status=yes,scrollbars=1,menubar=yes,titlebar=yes,toolbar=0,location=0";
		
		if ( MapPointWin && MapPointWin.open && !MapPointWin.closed )
		{
			MapPointWin.close();
		}		

		MapPointWin = window.open( "/Matrix/MapPointPopUp.aspx?RecordID=" + nRecordID + "&TableID=" + nTableID, "MapPointWin", strFeatures );
	}

	var GoogleMapWin = null;
	function googlemapdisplay( nRecordID, nTableID)
	{
		var strFeatures = "height=487,width=516,left=0,top=0,resizable=0,status=yes,scrollbars=1,menubar=yes,titlebar=yes,toolbar=0,location=0";
		
		if ( GoogleMapWin && GoogleMapWin.open && !GoogleMapWin.closed )
		{
			GoogleMapWin.close();
		}		

		GoogleMapWin = window.open( "/Matrix/Public/GoogleMapPopUp.aspx?RecordID=" + nRecordID + "&TableID=" + nTableID, "MapPointWin", strFeatures );
	}

	var DisplayPopupWin = null;
	function displayPopup( strKey, nDisplayID, nWidth, nHeight )
	{
		var strFeatures = "height=" + nHeight + ",width=" + nWidth + ",left=25,top=25,status:no,scroll:yes";
		
		if ( DisplayPopupWin && DisplayPopupWin.open && !DisplayPopupWin.closed )
		{
			DisplayPopupWin.close();
		}
		
		DisplayPopupWin = window.open( "/Matrix/DisplayPopup.aspx?Key=" + strKey + "&did=" + nDisplayID, "PhotoWin", strFeatures );
	}

	var ITQPopupWin = null;
	function ITQPopup( nITQID, nDisplayID, strParams, strExpireKey, nWidth, nHeight )
	{
		var strFeatures = "height=" + nHeight + ",width=" + nWidth + ",left=25,top=25,resizable=yes,status=yes,scrollbars=yes,menubar=yes,titlebar=yes,toolbar=yes,location=yes";
		
		if ( ITQPopupWin && ITQPopupWin.open && !ITQPopupWin.closed )
		{
			ITQPopupWin.close();
		}
		
		if( typeof( bIsPublicPage ) == 'boolean' && bIsPublicPage == true )
		{
			strParams += "&pbs=1";
		}
		
		ITQPopupWin = window.open( "/Matrix/Public/DisplayITQPopup.aspx?iid=" + nITQID + "&did=" + nDisplayID + "&params=" + strParams + "&exk=" + strExpireKey, "ITQ", strFeatures );
	}

	function RefreshPage()
	{
		window.location.reload();
	}	

	function Action_ITL( strFieldID, strValue ) //ITL = Inter Table Link (shortened to reduce Template html size) (no we don't need the table_ID)
	{
		var hfCustomAction = document.createElement("input");
		hfCustomAction.type = "hidden";
		hfCustomAction.name = "hfCustomAction";
		hfCustomAction.value = "InterTableLink";

		var hfITLFieldID = document.createElement("input");
		hfITLFieldID.type = "hidden";
		hfITLFieldID.name = "hfITLFieldID";
		hfITLFieldID.value = strFieldID;
		
		var hfITLValue = document.createElement("input");
		hfITLValue.type = "hidden";
		hfITLValue.name = "hfITLValue";
		hfITLValue.value = strValue;
		
		document.forms[0].appendChild( hfCustomAction );
		document.forms[0].appendChild( hfITLFieldID );
		document.forms[0].appendChild( hfITLValue );

		document.forms[0].hfRedisplay.value = "false";
		
		document.forms[0].submit();
	}

	function Action_Sort( strFieldID )
	{
	}


function CheckBack()
{
	if(typeof(VisitNumberCookieName) == 'string')
	{
		var VisitCookie = GetCookie(VisitNumberCookieName);
		if(VisitCookie != VisitNumber)//they clicked back!
		{
			location.replace(ReloadURL);
		}
	}	
}


