	var IsPageLoaded = false;
	var RunCheckAllOnPageLoadWith = null;
	var RunCheckSetOnPageLoad = false;
	var H_DIV = 1;
	var LastCheck = -1;
	var HighestCheck = -1;
	

	function pageLoadSetup()
	{
		if(typeof(ReloadURL)=="string") document.forms[0].action = ReloadURL;
		// light up the checked checkboxes on a BACK for instance
		var aInputs = document.Form1.getElementsByTagName("INPUT");
		var len = aInputs.length;
		if( len > 0 )
		{
			for ( var i=0; i < len; i++ ) 
			{
				if( aInputs[i].type == 'checkbox' && aInputs[i].name.indexOf("CHB_") == 0 ) // id starts with CHB_
				{
					if( aInputs[i].checked == true )
					{
						RowToggle( aInputs[i].name, true );
					}
				}
			}
		}
		
	
		// select non item in intertable queries
		var ddlInterTableQueries = document.getElementById( "m_ddlInterTableQueries" );
		if( ddlInterTableQueries != null )
		{
			if( ddlInterTableQueries.options.length > 0 )
			{
				ddlInterTableQueries.selectedIndex = 0;
			}
		}
		
		IsPageLoaded = true;
		if(RunCheckAllOnPageLoadWith != null)
		{
			CheckAll( RunCheckAllOnPageLoadWith );
		}
		if(RunCheckSetOnPageLoad)
		{
			CheckSet();
		}
			
		UpdateCheckAll();
	}

	function RowToggle( strCheckBoxID, bChecked )
	{
		var oCheckBoxes = document.getElementsByName( strCheckBoxID );
		for(var nIndex = 0; nIndex < oCheckBoxes.length; nIndex++)
		{
			oCheckBoxes[nIndex].checked = bChecked;
		}
		
		var oCheckBox = oCheckBoxes[0]
		
		var e = oCheckBox.parentNode;
		
		while( e != null )
		{
			if( e.id == 'wrapperTable' )
			{				
			
				if( bChecked )
				{
					var oldBackgroundColor = e.style.backgroundColor;
					oldBackgroundColor = escape( oldBackgroundColor );
					
					if( e.getAttribute( "J_BackgroundColor" ) == null )
					{
						e.setAttribute( "J_BackgroundColor", oldBackgroundColor );
					}
					
					if(typeof(DefinedHighlightColour) != "undefined")
					{
						e.style.backgroundColor = DefinedHighlightColour;
					}
				}
				else
				{
					var backgroundColor = e.getAttribute( "J_BackgroundColor" );
					if(backgroundColor != null)
					{
						e.style.backgroundColor = unescape( backgroundColor );
					}
				}
				
				return;
			}

			e = e.parentNode;
		}
	}

	function RegisterCheckBox( oCheckBox ) // Called by JIPs generated CB
	{
		AddCheckBoxToRegisteredString( oCheckBox );
		ShowSelectedCount();
		UpdateButtons();
		UpdateCheckAll();
	}

	function ShiftClick( e ) // event e
	{
		var aInputs = document.Form1.getElementsByTagName( "INPUT" );
		var len = aInputs.length;
		e=(e)?e:event;
		var ThisCheck=0;
		var target=(e.target)?e.target:e.srcElement;
		var j=0;
		for ( var i=0; i <len; i++ ) 
		{
			if( aInputs[i].type == 'checkbox' && aInputs[i].name.indexOf( "CHB_" ) == 0 ) // id starts with CHB_
			{
				j++;
				if( target.name == aInputs[i].name )
				{
					if( !e.shiftKey )
					{
						LastCheck=j;
						HighestCheck=-1;
						return false;
					}
					ThisCheck=j;
				}
			}
		}
		check = true;
		var low=Math.min(LastCheck, ThisCheck);
		var high=Math.max(LastCheck, ThisCheck);
		j=0;
		for (var i=0; i < len; i++)
		{
			if( aInputs[i].type == 'checkbox' && aInputs[i].name.indexOf("CHB_") == 0 ) // id starts with CHB_
			{
				j++;
				if ((j < high) && (j > low))
				{
					if (!aInputs[i].checked)
					{
					RowToggle(aInputs[i].name, check);
					RegisterCheckBox(aInputs[i]);
					}
				}
				if (((j > high) && (j <= HighestCheck)) || ((j < low) && (j>= HighestCheck) && (HighestCheck != -1)))
				{
					if (aInputs[i].checked)
					{
						RowToggle(aInputs[i].name, !check);
						RegisterCheckBox(aInputs[i]);
					}
				}  
			}
		}
		if ((ThisCheck > LastCheck) && (ThisCheck > HighestCheck))
		{
			HighestCheck=ThisCheck;
		}
		else if ((ThisCheck < LastCheck) && ((ThisCheck < HighestCheck) || (HighestCheck == -1)))
		{
			HighestCheck=ThisCheck;
		}
	}
	
	function AddCheckBoxToRegisteredString( oCheckBox )
	{
		CheckBoxChangedHook( oCheckBox );
		var strCurrentRegisteredCheckBoxes;
		strCurrentRegisteredCheckBoxes = document.forms[0].hfChangedCheckboxes.value;
		if( strCurrentRegisteredCheckBoxes.indexOf(oCheckBox.name) == -1 )
		{
			if ( strCurrentRegisteredCheckBoxes != "" && strCurrentRegisteredCheckBoxes != null )
			{
				strCurrentRegisteredCheckBoxes += ",";
			}
			strCurrentRegisteredCheckBoxes += oCheckBox.name;
		}				
		document.forms[0].hfChangedCheckboxes.value = strCurrentRegisteredCheckBoxes;

		if( oCheckBox.checked )
		{
			NumChecked++;
		}
		else
		{
			NumChecked--;
		}
	}
	
	// hook function for other users to override to effect changes on checkbox change
	function CheckBoxChangedHook( oCheckBox ) { }
	
	function ShowSelectedCount()
	{
		ClientRenderVar.checkeditems = NumChecked;
		document.getElementById("m_lblCheckedCount").update();
	}

	function UpdateButtons()
	{ //PageSize and Buttons populated in cs
		for(btnName in Buttons)
		{
			var btn = document.getElementById( btnName );
			if(btn != null)
			{
				var bEnabled = (NumChecked >= Buttons[btnName].Min && NumChecked <= Buttons[btnName].Max || PageSize == 1);
				btn.disabled = !bEnabled;
				btn.className = bEnabled ? 'btn' : 'btnDisabled';
			}
		}
	}
	
	function UpdateCheckAll()
	{ 
		if(typeof(NumChecked)=='number' && typeof(SetSize)=='number')
		{
			//SetSize populated from cs
			var bIsSetChecked = (NumChecked == SetSize);
			UpdateCheckAll_SetTotalItems(bIsSetChecked);

			var bIsCheckAll = (NumChecked == NumCheckedForFullPage || bIsSetChecked);
			var cbxSingleLineCheckAlls = document.getElementsByName( "cbxCheckAll" );
			if(cbxSingleLineCheckAlls.length > 0 )
			{
				for(var nIndex = 0; nIndex < cbxSingleLineCheckAlls.length; nIndex++)
				{
					cbxSingleLineCheckAlls[nIndex].checked = bIsCheckAll;
				}
			}
			else
			{
				var cbxTopCheckAll  = document.getElementById( "m_cbxTopCheckAll" );
				if(cbxTopCheckAll != null)
				{
					cbxTopCheckAll.checked = bIsCheckAll;
					var cbxBottomCheckAll = document.getElementById( "m_cbxBottomCheckAll" );
					if(cbxBottomCheckAll != null)
					{ //BottomCheckAll may be null even if TopCheckAll exists before page finishes loading
						cbxBottomCheckAll.checked = bIsCheckAll;
					}
				}
			}
		}
	}
	function UpdateCheckAll_SetTotalItems(bIsSetChecked)
	{
		ClientRenderVar.totalitems = SetSize;
		var lnkCheckSetLink = document.getElementById( "m_lblCheckSetLinkText" );
		if(!bIsSetChecked)
		{
			lnkCheckSetLink.setSelectedOption("CheckAll");				
		}
		else
		{
			lnkCheckSetLink.setSelectedOption("UncheckAll");				
		}
	}
	
	function TopBottomCheckAll( bChecked )
	{
		var cbxTopCheckAll  = document.getElementById( "m_cbxTopCheckAll" );
		var cbxBottomCheckAll = document.getElementById( "m_cbxBottomCheckAll" );
		cbxTopCheckAll.checked = bChecked;
		cbxBottomCheckAll.checked = bChecked;
		CheckAll( bChecked );
	}
	
	
	function SingleLineCheckAll( cbxCheckAll )
	{//cbxCheckAll
		CheckAll( cbxCheckAll.checked )
	}

	function CheckAll( bIsChecked )
	{
		if(IsPageLoaded)
		{
			var aInputs = document.Form1.getElementsByTagName("INPUT");
			var len = aInputs.length;
			if( len > 0 )
			{
				for ( var i=0; i < len; i++ ) 
				{
					if( aInputs[i].type == 'checkbox' && aInputs[i].name.indexOf("CHB_") == 0 ) // id starts with CHB_
					{
						if(aInputs[i].checked != bIsChecked )
						{
							aInputs[i].checked = bIsChecked;
							AddCheckBoxToRegisteredString( aInputs[i] );
							RowToggle( aInputs[i].name, bIsChecked );
						}
					}
				}
			}
			if(bIsChecked)
			{
				NumCheckedForFullPage = NumChecked;	
			}	
			ShowSelectedCount();
			UpdateButtons();
			UpdateCheckAll();
		}
		else
		{
			RunCheckAllOnPageLoadWith = bIsChecked;
		}
	
	}
	function CheckSet()
	{
		if(IsPageLoaded)
		{
			var bIsChecked = (NumChecked != SetSize);
			var hfCheckAllChangedTo = document.getElementById( "hfCheckAllChangedTo" );
			hfCheckAllChangedTo.value = bIsChecked;
			document.forms[0].hfChangedCheckboxes.value = "";
			
			if(bIsChecked)
			{
				NumChecked = SetSize;
			}
			else
			{
				NumChecked = 0;
			}

			var aInputs = document.Form1.getElementsByTagName("INPUT");
			var len = aInputs.length;
			if( len > 0 )
			{
				for ( var i=0; i < len; i++ ) 
				{
					if( aInputs[i].type == 'checkbox' && aInputs[i].name.indexOf("CHB_") == 0 ) // id starts with CHB_
					{
						aInputs[i].checked = bIsChecked;
						
						RowToggle( aInputs[i].name, bIsChecked );
					}
				}
			}	
			UpdateCheckAll();
			ShowSelectedCount();
			UpdateButtons();
		}
		else
		{
			RunCheckSetOnPageLoad = true;
		}
	}
	
	function LmtBtn( spn )
	{
		btn = spn.childNodes[0];
	
		if(btn.disabled == true)
		{
			ShowSelectionError( Buttons[btn.name].Min, Buttons[btn.name].Max );
		}
	}
	
	function ShowSelectionError( nMin, nMax )
	{
		var fError;
		ClientRenderVar.maxitemschecked = nMax;
		if(NumChecked == 0)
		{
			fError = CheckAtLeast1;
		}
		else
		{
			fError = TooManyChecked;
		}
		alert( fError() );
	}

	function ReDisplay( strURLParmeters )
	{
		ReDisplay( strURLParmeters, null );
	}
	function ReDisplay( strURLParmeters, strScrollToAnchore )
	{
		if(strURLParmeters != ""){
			var hfUrlOverride = document.createElement("input");
			hfUrlOverride.type = "hidden";
			hfUrlOverride.name = "hfUrlOverride";
			hfUrlOverride.value = strURLParmeters;
			document.forms[0].appendChild( hfUrlOverride );
		}

		if( strScrollToAnchore != null )
		{
			document.forms[0].action += "#" + strScrollToAnchore;
		}
		document.forms[0].hfRedisplay.value = "true";
		document.forms[0].submit();
	}

	var MapPointWin = null;
	function mapdisplay( nRecordID, nTableID, nLanguID)
	{
		var strFeatures = "height=487,width=516,left=0,top=0,resizable=No,status=Yes,scrollbars=Yes,menubar=Yes,titlebar=Yes,toolbar=No,location=No";
		
		if ( MapPointWin && MapPointWin.open && !MapPointWin.closed )
		{
			MapPointWin.close();
		}
		
		var strMapPage = "/Matrix/MapPointPopUp.aspx";
		//if( typeof( InteractiveMapEnabled ) == 'boolean' && InteractiveMapEnabled )
		//{
			strMapPage = "/Matrix/Public/InteractiveMapPopup.aspx";
			strFeatures = "height=600,width=950,left=50,top=17,resizable=Yes,status=Yes,scrollbars=No,menubar=Yes,titlebar=Yes,toolbar=No,location=Yes";
		//}

		MapPointWin = window.open( strMapPage + "?RecordID=" + nRecordID + "&TableID=" + nTableID + "&L=" + nLanguID, "MapPointWin", strFeatures );
	}

	var GoogleMapWin = null;
	function googlemapdisplay( nRecordID, nTableID, nLanguID )
	{
		var strFeatures = "height=470,width=650,left=50,top=17,resizable=Yes,status=Yes,scrollbars=No,menubar=Yes,titlebar=Yes,toolbar=No,location=No";
		
		if ( GoogleMapWin && GoogleMapWin.open && !GoogleMapWin.closed )
		{
			GoogleMapWin.close();
		}		
		strUrl = "/Matrix/Public/GoogleMapPopUp.aspx?RecordID=" + nRecordID + "&TableID=" + nTableID + "&L=" + nLanguID;
		GoogleMapWin = window.open( strUrl, "GoogleMapWin", 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";
		}
		
		var languageArg = "";
		try
		{
			languageArg = languageURLArgument;
			if( languageArg != "" )
			{
				languageArg = '&' + languageURLArgument;
			}
		}
		catch(err)
		{
		}
		
		ITQPopupWin = window.open( "/Matrix/Public/DisplayITQPopup.aspx?iid=" + nITQID + "&did=" + nDisplayID + "&params=" + strParams + "&exk=" + strExpireKey + languageArg, "ITQ", strFeatures );
	}

	
	var PhotoWin = null;
	function photodisplay( strPicPath )
	{
		var strFeatures = "height=410,width=410,left=25,top=25";
		
		if ( PhotoWin && PhotoWin.open && !PhotoWin.closed )
		{
			PhotoWin.close();
		}
		
		PhotoWin = window.open( "/Matrix/PhotoDisplay.aspx?PICPATH=" + strPicPath, "PhotoWin", strFeatures );
	}

	var WatchItemWin = null;
	function watchItem( strID, nTableID )
	{
		var strFeatures = "height=275,width=550,left=250,top=200";
		
		if ( WatchItemWin && WatchItemWin.open && !WatchItemWin.closed )
		{
			WatchItemWin.close();
		}
		//alert("watchItem" + nRecordID);
		WatchItemWin = window.open( "/Matrix/AddWatchedItem.aspx?ListingID=" + strID + "&TableID=" + nTableID, "WatchItemWin", strFeatures );
	}
	
	var MultiSortWin = null;
	function multiSortWindow()
	{
		var strFeatures = "height=370,width=700,left=25,top=25";
		
		if ( MultiSortWin && MultiSortWin.open && !MultiSortWin.closed )
		{
			MultiSortWin.close();
		}
		
		var strParams = document.location.search;
		
		MultiSortWin = window.open( "/Matrix/MultiSortPopup.aspx" + strParams, "MultiSortWin", strFeatures );
	}
	
	function PrintHTML()
	{
		var strDisplayURL = document.forms[0].action;
		var nQueryLoc = strDisplayURL.indexOf("?");
		var query = "";
		if(nQueryLoc > -1)
		{
			query = strDisplayURL.substr(nQueryLoc);
		}
		window.open( "HTMLPreReport.aspx" + query );

	}
	
	function RefreshPage()
	{
		window.location.reload();
	}	

	function Action_ITQ( nInterTableLinkID )
	{
		if( NumChecked > 0 && NumChecked <= MaxSearchRecords )
		{
			var hfCustomAction = document.createElement("input");
			hfCustomAction.type = "hidden";
			hfCustomAction.name = "hfCustomAction";
			hfCustomAction.value = "InterTableQuery";

			var hfITQID = document.createElement("input");
			hfITQID.type = "hidden";
			hfITQID.name = "hfITQID";
			hfITQID.value = nInterTableLinkID;
			
			document.forms[0].appendChild( hfCustomAction );
			document.forms[0].appendChild( hfITQID );

			document.forms[0].hfRedisplay.value = "false";
			
			document.forms[0].submit();
		}
		else
		{
			//reselect top ITQ option
			var ddlInterTableQueries = document.getElementById( "m_ddlInterTableQueries" );
			ddlInterTableQueries.selectedIndex = 0;
			ShowSelectionError( 1, MaxSearchRecords );
		}
		
	}

	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( strFieldIDs )
	{
		//SetSize and MaxSearchRecords populated from cs				
		if(!OverLimit)
		{
			var hfCustomAction = document.createElement("input");
			hfCustomAction.type = "hidden";		
			hfCustomAction.name = "hfCustomAction";
			hfCustomAction.value = "Sort";

			var hfSortFieldIDs = document.createElement("input");
			hfSortFieldIDs.type = "hidden";
			hfSortFieldIDs.name = "hfSortFieldIDs";
			hfSortFieldIDs.value = strFieldIDs;
			
			document.forms[0].appendChild( hfCustomAction );
			document.forms[0].appendChild( hfSortFieldIDs );
			
			document.forms[0].submit();
		}
		else
		{
			Action_Sort_SetMaxSearchRecords();
			alert( TooManyToSort() );
		}
	}
	function Action_Sort_SetMaxSearchRecords()
	{
		ClientRenderVar.maxsearchrecords = MaxSearchRecords;
	}

	function Action_NarrowToDisplay( strURLParmeters )
	{
		if(strURLParmeters != ""){
			var hfUrlOverride = document.createElement("input");
			hfUrlOverride.type = "hidden";
			hfUrlOverride.name = "hfUrlOverride";
			hfUrlOverride.value = strURLParmeters;
			document.forms[0].appendChild( hfUrlOverride );
		}

		if(NumChecked > 0 && NumChecked <= Buttons.m_btnNarrow.Max )
		{
			var hfCustomAction = document.createElement("input");
			hfCustomAction.type = "hidden";		
			hfCustomAction.name = "hfCustomAction";
			hfCustomAction.value = "NarrowToNewDisplay";

			
			document.forms[0].appendChild( hfCustomAction );
			
		}
		else
		{
			document.forms[0].hfRedisplay.value = "true";
		}
		document.forms[0].submit();
	}
	
	// Triggers the display page to add all checked items to the Cart
	function Action_AddToCart( )
	{
		var strNoChecks = "";
		var nNumChecked = NumChecked;

		if( nNumChecked < 1 && PageSize > 1 )
		{
			alert( CheckAtLeast1() );
			return;
		}
		
		if( nNumChecked < 1 && PageSize == 1 )
		{
			nNumChecked = 1;
		}
		
		if( nNumChecked > CartMaxAdd )
		{
			var rendervars = new Object();
			rendervars.maxitemschecked = CartMaxAdd;
			rendervars.AvailableCartSize = CartMaxAdd;
			alert(TooManyCheckedCart(rendervars));
			return;
		}
		
		var hfCustomAction = document.createElement("input");
		hfCustomAction.type = "hidden";		
		hfCustomAction.name = "hfCustomAction";
		hfCustomAction.value = "AddToCart";
			
		document.forms[0].appendChild( hfCustomAction );
		
		document.forms[0].submit();
	}
	function Action_RemoveFromCart()
	{
		if( NumChecked < 1 && PageSize > 1 )
		{
			alert(CheckAtLeast1());
			return;
		}
		
		var hfCustomAction = document.createElement("input");
		hfCustomAction.type = "hidden";		
		hfCustomAction.name = "hfCustomAction";
		hfCustomAction.value = "RemoveFromCart";
			
		document.forms[0].appendChild( hfCustomAction );
		
		document.forms[0].submit();
	}
	
	function Action_EmptyCart()
	{
		if( !confirm( ClearCartConfirmation() ) )
		{
			return;
		}
		
		var hfCustomAction = document.createElement("input");
		hfCustomAction.type = "hidden";		
		hfCustomAction.name = "hfCustomAction";
		hfCustomAction.value = "EmptyCart";

		document.forms[0].appendChild( hfCustomAction );

		document.forms[0].submit();
	}
	
	function Action_ViewCart()
	{
		var hfCustomAction = document.createElement("input");
		hfCustomAction.type = "hidden";		
		hfCustomAction.name = "hfCustomAction";
		hfCustomAction.value = "ViewCart";

		document.forms[0].appendChild( hfCustomAction );

		document.forms[0].submit();
	}

	function ShowBottomPaging()
	{
		return;
		var WindowHeight = 0;
		if( typeof( window.innerWidth ) == 'number' )
		{
			//Non-IE
			WindowHeight = window.innerHeight;
		}
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
		{
			//IE 6+ in 'standards compliant mode'
			WindowHeight = document.documentElement.clientHeight;
		}
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		{
			//IE 4 compatible
			WindowHeight = document.body.clientHeight;
		}

		var BottomTag = document.getElementById( "Bottom" );
		var bShow = ( BottomTag.offsetTop > WindowHeight );
		
		var BottomLink = document.getElementById( "GoToBottomDiv" );
		var BottomPagingControl = document.getElementById( "BottomPagingControl" );

		var display = bShow ? 'block':'none';
		
		BottomLink.style.display = display;
		BottomPagingControl.style.display = display;
	}
	
	function ShowPrintable()
	{
		var m_PrintablePanel = document.getElementById( "m_pnlDisplay" );
		var txtDisplay = m_PrintablePanel.innerHTML;

		var txtStyles = "";
		
		//build up the styles that are on the page.
		for( var nCounter = 0; nCounter < document.styleSheets.length; nCounter ++ )
		{
			txtStyles += document.styleSheets[nCounter].cssText
		}
	
		
		var popup = window.open('');

		popup.document.write('<html><head><title>Printable Display</title>');
		popup.document.write( "<style>" + txtStyles + "</style>");
		popup.document.write('</head><body>');
		popup.document.write( txtDisplay );
		popup.document.write('</body></html>');
		popup.document.close();
	}

function OpenHTMLReport(URLParams)
{
	if(GetCookie('MatrixHTMLPrint')=='1'){
		window.open( "HTMLReport.aspx" + URLParams, "report");
		SetCookie('MatrixHTMLPrint', '0');
	}
}

function CheckBack()
{
	if(typeof(VisitNumberCookieName) == 'string')
	{
		var VisitCookie = GetCookie(VisitNumberCookieName);
		if(VisitCookie != VisitNumber)//they clicked back!
		{
			location.replace(ReloadURL);
		}
	}	
}

function DivClick(divObj)
{
	var innerCode = divObj.innerHTML;
	var Start = innerCode.indexOf("RowToggle('CHB_");
	if (Start != -1)
	{
		Start = Start + 11; //Setting the index past the part we don't want
		var End = innerCode.indexOf("'",Start);
		var CHB_Name = innerCode.substring(Start,End);
		var CHB_obj = document.getElementsByName(CHB_Name);
		//alert([innerCode]);
		//alert([Start + " " + End]);
		//alert(["CHB_Name = " + CHB_Name +" CHB_obj="+ CHB_obj]);
	
		//Check If we Run
		if (H_DIV == 1)
		{
			//Run OnClick
			//Since the nothing has happen to the check box we need to set it to what ever its not
			for(var nIndex = 0; nIndex < CHB_obj.length; nIndex++)
			{
				CHB_obj[nIndex].checked = !CHB_obj[nIndex].checked;
			}
			RegisterCheckBox(CHB_obj[0]);
			RowToggle(CHB_Name,CHB_obj[0].checked);	
		}
		else
		{
			//Do Nothing cept reset the H_DIV
			H_DIV = 1;	
		}
	}
	else
	{
		//We do nothing due to the oject being null (most likey missing checkbox)
	}
}

// These two functions are available for mouseover and mouseout events if the display is configured.
// Currently not required in regular displays, but must be present.
function DivMouseOverHandler( div ) {}
function DivMouseOutHandler( div ) {}

function linkClick()
{
  H_DIV = 2;
}
