<!--
var xmlhttp = null;
var m_bImagesOnly;

function CenterImages( )
{
//DTV-If I don't call this in PlantResults.asp when the page loads, occassionally the images don't display correctly... Not sure why.

	var oImages = document.images("plantImg");

	if( oImages )
		for ( var i=0; i < oImages.length; i++ )
			ImageLoaded( oImages[i] );
}

function ImageLoaded( oObj )
{
	//NOTE!! This code works for Safari, Firefox, and IE. Great time spent optimizing, so don't look at further...

	var oDivObj = oObj.parentNode.parentNode; //get the <DIV> object containing the <IMG> (tablecontents.inc ~line 528)

	var nMaxWidth = oDivObj.clientWidth;
	var nMaxHeight = oDivObj.clientHeight;

	if( oObj.width > oObj.height )
		oObj.width = nMaxWidth;
	else
		oObj.height = nMaxHeight;

	if( oObj.width < nMaxWidth )
		oObj.style.left = (oDivObj.offsetWidth/2)-(oObj.offsetWidth/2)-1; //DTV; 12/9/08; "px" is default

	if( oObj.height < nMaxHeight )
		oObj.style.top = (oDivObj.offsetHeight/2)-(oObj.offsetHeight/2)-1; //DTV; 12/9/08; "px" is default

	oObj.style.visibility = "visible";

	//next, turn on NEW, N/A, and OUT images (if any)
	var oParent = oObj.parentNode;

	if( oParent )
	{
		var oSibling = oParent.nextSibling;
		var nTopOffset = 0;

		while( oSibling )
		{
			if( oSibling.style )
			{
				oSibling.style.top  = nTopOffset;
				oSibling.style.left = oDivObj.offsetWidth-oSibling.offsetWidth-2;

				nTopOffset += oSibling.offsetHeight;

				oSibling.style.visibility = "visible";
			}

			oSibling = oSibling.nextSibling;
		}
	}
}

function hlRow(tdObj,vTrue)
{
	tdObj.style.fontWeight = vTrue?'bold':'normal';
}

function hl(tdObj,vTrue)
{
	tdObj.style.backgroundColor = vTrue?'#FFF200':document.body.style.backgroundColor;

	var sib = tdObj.nextSibling;

	while (sib)
	{
		if (sib.className != 'td_Exp')
			sib.style.backgroundColor = vTrue?'#FFF200':document.body.style.backgroundColor;

		sib = sib.nextSibling;
	}
}

function ShowColumn( sColID, isChecked, bSetCookie)
{
	try
	{
		var oObj;

		//only IE can hide column using <COL display:none>; others need to hide each <th> and <td>
		if( g_ie5 ) //DTV; 12/16/08; The 'else' method doesn't work correctly w/ IE. The right adjacent column is also hidden/displayed with the current column
		{
			oObj = document.body.getElementsByTagName("COL");

			oObj = oObj.item(sColID);
		}
		else
			oObj = document.all(sColID);

		if( oObj != null )
		{
			if( oObj.length == undefined ) //means single item, NOT a collection
			{
				if (isChecked)
					oObj.style.display="";
				else
					oObj.style.display="none";
			}
			else
				for(var i=0; i < oObj.length; i++)
				{
					if (isChecked)
						oObj[i].style.display="";
					else
						oObj[i].style.display="none";
				}
		}

		if ( bSetCookie )
			SetCookie("Cols", WriteResponseString(true));
	}
	catch(e){}
}

function GetCookieValue( arySettings, sKey, sSub )
{
	var bOnOff = arySettings[sKey];
	if( bOnOff != '0' && bOnOff != '1' )
		bOnOff = GetCookie(sSub, sKey, "");

	return bOnOff;
}

function SetupTableDisplay( arySettings, bPrintablePage, bImagesOnly )
{
	m_bImagesOnly = bImagesOnly;

	var bOnOff = GetCookieValue( arySettings, "x1", "" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowRowNumbers(bOnOff=='1',false);if( !bPrintablePage )xbRowNumber.checked=(bOnOff=='1');}catch(e){}}

	if( !bPrintablePage )
	{
		bOnOff = GetCookieValue( arySettings, "x2", "" );
		if (bOnOff=='0' || bOnOff=='1')
		try
		{
			xbShowThumbnails.checked=(bOnOff=='1');

			xbHdrShowThumbnails.checked=(bOnOff=='1');
		}catch(e){}

		bOnOff = GetCookieValue( arySettings, "x3", "" );
		if (bOnOff=='0' || bOnOff=='1')
		{try{xbHideSoldOut.checked=(bOnOff=='1');}catch(e){}}

		bOnOff = GetCookieValue( arySettings, "x4", "" );
		if (bOnOff=='0' || bOnOff=='1')
		{try{xbNewOnly.checked=(bOnOff=='1');}catch(e){}}
	}

/* //ASP code in PlantResults.asp has already correctly set the checked radio - GetCookieValue doesn't work when value isn't '0' or '1'
	bOnOff = GetCookieValue( arySettings, "x6", "" );
	if (bOnOff=='h')
		rbOrderByHeight.checked=true;
	else if (bOnOff=='b')
		rbOrderByBloomSeason.checked=true;
	else
		rbOrderByDefault.checked=true;
*/
	if( !bPrintablePage )
	{
		bOnOff = GetCookieValue( arySettings, "x7", "" );
		if (bOnOff=='0' || bOnOff=='1')
		{try{xbPriorYearsOnly.checked=(bOnOff=='1');}catch(e){}}

		bOnOff = GetCookieValue( arySettings, "x8", "" );
		if (bOnOff=='0' || bOnOff=='1')
		{try{xbIncludePriorYears.checked=(bOnOff=='1');}catch(e){}}
	}

	bOnOff = GetCookieValue( arySettings, "c4", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_CultivarComments',bOnOff=='1',false);if( !bPrintablePage )xbCultivarComments.checked=(bOnOff=='1');}catch(e){}}


	bOnOff = GetCookieValue( arySettings, "c5", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_MumSeason',bOnOff=='1',false);if( !bPrintablePage )xbMumSeason.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c6", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_Year',bOnOff=='1',false);if( !bPrintablePage )xbYear.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c7", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_ThumbnailImage',bOnOff=='1',false);if( !bPrintablePage )xbThumbnailImage.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c8", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_FlowerColor',bOnOff=='1',false);if( !bPrintablePage )xbFlowerColor.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c9", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_FoliageColor',bOnOff=='1',false);if( !bPrintablePage )xbFoliageColor.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c10", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_FallFoliageColor',bOnOff=='1',false);if( !bPrintablePage )xbFallFoliageColor.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c11", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_GrassForm',bOnOff=='1',false);if( !bPrintablePage )xbGrassForm.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c12", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_PWType',bOnOff=='1',false);if( !bPrintablePage )xbPWType.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c13", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_AnnPer',bOnOff=='1',false);if( !bPrintablePage )xbAnnPer.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c14", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_Exposure',bOnOff=='1',false);if( !bPrintablePage )xbExposure.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c15", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_BloomSeason',bOnOff=='1',false);if( !bPrintablePage )xbBloomSeason.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c16", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_FlowerSize',bOnOff=='1',false);if( !bPrintablePage )xbFlowerSize.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c17", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_FlowerMonths',bOnOff=='1',false);if( !bPrintablePage )xbFlowerMonths.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c18", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_Height',bOnOff=='1',false);if( !bPrintablePage )xbHeight.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c19", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_Spacing',bOnOff=='1',false);if( !bPrintablePage )xbSpacing.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c20", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_PruningGroup',bOnOff=='1',false);if( !bPrintablePage )xbPruningGroup.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c21", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_Maturity',bOnOff=='1',false);if( !bPrintablePage )xbMaturity.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c22", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_RowWidth',bOnOff=='1',false);if( !bPrintablePage )xbRowWidth.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c23", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_MumHeight',bOnOff=='1',false);if( !bPrintablePage )xbMumHeight.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c24", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_MumColor',bOnOff=='1',false);if( !bPrintablePage )xbMumColor.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c25", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_MumSeries',bOnOff=='1',false);if( !bPrintablePage )xbMumSeries.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c26", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_MumColorClass',bOnOff=='1',false);if( !bPrintablePage )xbMumColorClass.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c27", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_HardinessZone',bOnOff=='1',false);if( !bPrintablePage )xbHardinessZone.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c28", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_ContainerSize',bOnOff=='1',false);if( !bPrintablePage )xbContainerSize.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c29", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_Aisle',bOnOff=='1',false);if( !bPrintablePage )xbAisle.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c30", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_PetalCount',bOnOff=='1',false);if( !bPrintablePage )xbPetalCount.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c31", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_FragranceLevel',bOnOff=='1',false);if( !bPrintablePage )xbFragranceLevel.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c32", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_MumFlowerType',bOnOff=='1',false);if( !bPrintablePage )xbMumFlowerType.checked=(bOnOff=='1');}catch(e){}}

	bOnOff = GetCookieValue( arySettings, "c33", "Cols" );
	if (bOnOff=='0' || bOnOff=='1')
	{try{ShowColumn('col_MumDateRange',bOnOff=='1',false);if( !bPrintablePage )xbMumDateRange.checked=(bOnOff=='1');}catch(e){}}

	ShowWishlistXBs();
}

function ShowRowNumbers(isChecked,bSetCookie)
{
	var oObj = document.all("idRowNum");

	if( oObj != null )
	{
		if( oObj.length == undefined ) //means single item, NOT a collection
		{
			if (isChecked)
				oObj.style.display="";
			else
				oObj.style.display="none";
		}
		else
			for(var i=0; i < oObj.length; i++)
			{
				if (isChecked)
					oObj[i].style.display="";
				else
					oObj[i].style.display="none";
			}
	}

	if (bSetCookie)
	{
		if (xbRowNumber.defaultChecked != xbRowNumber.checked)
			SetCookie("x1",isChecked?"1":"0");
		else
			SetCookie("x1","");
	}
}

function ShowThumbnails(isChecked, id)
{
	if( g_ie5 )
		oObj = document.images("idThumbnail"); //currently doesn't work with Firefox
	else
		oObj = document.body.getElementsByTagName("img");

	if( oObj != null )
	{
		if( oObj.length == undefined ) //means single item, NOT a collection
		{
			if( g_ie5 || oObj.id == "idThumbnail" )
			{
				if (isChecked)
					oObj.src = "images/tags/thumbnails/" + oObj.name + "_th.jpg";
				else
					oObj.src = tagImg.src;
			}
		}
		else
			for( i=0; i < oObj.length; i++)
			{
				if( g_ie5 || oObj[i].id == "idThumbnail" )
				{
					if (isChecked)
						oObj[i].src = "images/tags/thumbnails/" + oObj[i].name + "_th.jpg";
					else
						oObj[i].src = tagImg.src;
				}
			}
	}

	if (id=="xbShowThumbnails")
		xbHdrShowThumbnails.checked=isChecked;
	else
		xbShowThumbnails.checked=isChecked;

	SetCookie("x2",isChecked?"1":"0");
}

function ShowThumbnailCol(oObj)
{
	if (oObj.readyState == "complete")
	{
		if (oObj.src.indexOf( "images/tag.gif" ) != -1 )
		{
			oObj.style.posWidth=6;
			oObj.style.posHeight=21;
		}
		else
		{
			oObj.style.posWidth=40;
			oObj.style.posHeight=40;
		}
	}
}

function DisplayPage(sPageHRef)
{
	location=sPageHRef + WriteResponseString(false);
}

function DisplaySelectedPage(oListBox)
{
	location=oListBox.options[oListBox.selectedIndex].value + WriteResponseString(false);
}

function ChangeMaxRecordsSelection(oListBox, sQueryString, sMaxRecKey)
{
	if ( oListBox.selectedIndex == 0 ) // "--Select--" value
		return;

	SetCookie(sMaxRecKey, oListBox.options[oListBox.selectedIndex].value.toString() );

	var sPage = "PlantResults.asp?" + CleanQueryString( sQueryString );

    location=sPage + WriteResponseString(false);
}

function OrderBy(oObj, sQueryString)
{
	if( oObj.checked == oObj.defaultChecked )
		return;

	if( oObj.id == "rbOrderByBloomSeason" && oObj.checked && !xbBloomSeason.checked )
	{
		xbBloomSeason.checked = true;
		SetCookie("Cols", WriteResponseString(true));
	}


	var sPage = "PlantResults.asp?" + CleanQueryString( sQueryString );

    location=sPage + WriteResponseString(false);
}

function ListBoxSel( sCol, oListObj )
{
	try
	{
		if( oListObj.selectedIndex == -1 ) //not set
			return "";

		var nValue = oListObj.options[oListObj.selectedIndex].value;

		if( isNaN( nValue ) )
			return "";

		return "&" + sCol + "=" + nValue;

	}
	catch(e)
	{
		return "";
	}
}

function CheckboxOnOff(sCol, oObj)
{
	try
	{
		if ( oObj.checked != oObj.defaultChecked )
		{
			if ( oObj.checked )
				return "&" + sCol + "=1";
			else
				return "&" + sCol + "=0";
		}
		else
			return "";
	}
	catch(e)
	{
		return "";
	}
}

function OrderByRadioButton()
{
	try
	{
		if ( rbOrderByHeight.checked)
			return "&x6=h";

		if ( rbOrderByBloomSeason.checked)
			return "&x6=b";

		return ""; //includes: rbOrderByDefault.checked==true
	}
	catch(e)
	{
		return "";
	}
}

function StripParmValueCombo( sCombo, sResponseString )
{
	var nIndex = sResponseString.indexOf( "&" + sCombo );

	if( nIndex == -1 ) //not found
		return sResponseString;

	var nIndex1 = sResponseString.indexOf( "&", nIndex+1 );

	if( nIndex1 == -1 )
		sResponseString = sResponseString.slice( sResponseString, nIndex  );
	else
		sResponseString = sResponseString.slice( sResponseString, nIndex ) + sResponseString.substr( nIndex1 );

	return sResponseString;
}

function CleanQueryString( sQueryString )
{
	var sResponseString = new String( sQueryString );

	var i=0;

	for( i=1; i <= 8; i++ ) //x1 - x8
		sResponseString = StripParmValueCombo( "x"+i, sResponseString );

	for( i=4; i <= 33; i++ ) //c4 - c33
		sResponseString = StripParmValueCombo( "c"+i, sResponseString );

	return sResponseString;
}

function WriteResponseString(bCookie)
{
	var QueryString="";

	if(!bCookie)
	{
		//put non-Cookie values (temp values) BEFORE return!

		try{QueryString += CheckboxOnOff("x3", xbHideSoldOut);}catch(e){}
		try{QueryString += CheckboxOnOff("x4", xbNewOnly);}catch(e){}
		try{QueryString += CheckboxOnOff("x7", xbPriorYearsOnly);}catch(e){}
		try{QueryString += CheckboxOnOff("x8", xbIncludePriorYears);}catch(e){}

		try{QueryString += OrderByRadioButton();}catch(e){}

		if(window.navigator.cookieEnabled) //return here b/c rest of values are read from Cookies during SetupTableDisplay (above values are in command line)
			return QueryString;

		try{QueryString += CheckboxOnOff("x1", xbRowNumber);}catch(e){}
		try{QueryString += CheckboxOnOff("x2", xbShowThumbnails);}catch(e){}

		var sMaxRecKey = new String( m_bImagesOnly?"x5I":"x5" );

		try{QueryString += ListBoxSel(sMaxRecKey, lbRecsPerPage);}catch(e){}
	}

	try{QueryString += CheckboxOnOff("c4",xbCultivarComments);}catch(e){}
	try{QueryString += CheckboxOnOff("c6",xbYear);}catch(e){}
	try{QueryString += CheckboxOnOff("c7",xbThumbnailImage);}catch(e){}
	try{QueryString += CheckboxOnOff("c8",xbFlowerColor);}catch(e){}
	try{QueryString += CheckboxOnOff("c9",xbFoliageColor);}catch(e){}
	try{QueryString += CheckboxOnOff("c10",xbFallFoliageColor);}catch(e){}
	try{QueryString += CheckboxOnOff("c11",xbGrassForm);}catch(e){}
	try{QueryString += CheckboxOnOff("c12",xbPWType);}catch(e){}
	try{QueryString += CheckboxOnOff("c13",xbAnnPer);}catch(e){}
	try{QueryString += CheckboxOnOff("c14",xbExposure);}catch(e){}
	try{QueryString += CheckboxOnOff("c15",xbBloomSeason);}catch(e){}
	try{QueryString += CheckboxOnOff("c16",xbFlowerSize);}catch(e){}
	try{QueryString += CheckboxOnOff("c17",xbFlowerMonths);}catch(e){}
	try{QueryString += CheckboxOnOff("c18",xbHeight);}catch(e){}
	try{QueryString += CheckboxOnOff("c19",xbSpacing);}catch(e){}
	try{QueryString += CheckboxOnOff("c20",xbPruningGroup);}catch(e){}
	try{QueryString += CheckboxOnOff("c21",xbMaturity);}catch(e){}
	try{QueryString += CheckboxOnOff("c22",xbRowWidth);}catch(e){}
	try{QueryString += CheckboxOnOff("c27",xbHardinessZone );}catch(e){}
	try{QueryString += CheckboxOnOff("c28",xbContainerSize );}catch(e){}
	try{QueryString += CheckboxOnOff("c29",xbAisle );}catch(e){}
	try{QueryString += CheckboxOnOff("c30",xbPetalCount);}catch(e){}
	try{QueryString += CheckboxOnOff("c31",xbFragranceLevel);}catch(e){}
	try{QueryString += CheckboxOnOff("c5",xbMumSeason);}catch(e){}
	try{QueryString += CheckboxOnOff("c23",xbMumHeight);}catch(e){}
	try{QueryString += CheckboxOnOff("c24",xbMumColor);}catch(e){}
	try{QueryString += CheckboxOnOff("c25",xbMumSeries);}catch(e){}
	try{QueryString += CheckboxOnOff("c26",xbMumColorClass);}catch(e){}
	try{QueryString += CheckboxOnOff("c32",xbMumFlowerType);}catch(e){}
	try{QueryString += CheckboxOnOff("c33",xbMumDateRange);}catch(e){}

	return QueryString;
}

function HideSoldOut(isChecked, sQueryString )
{
	try{xbPriorYearsOnly.checked = false;}catch(e){} //won't exist under certain scenarios (See PlantResults.asp where it is defined)
	try{xbIncludePriorYears.checked = false;}catch(e){} //won't exist under certain scenarios (See PlantResults.asp where it is defined)

	var sPage = "PlantResults.asp?" + CleanQueryString( sQueryString );

	location = sPage + WriteResponseString(false);
}

function ShowNewPlantsOnly(isChecked, sQueryString)
{
	try{xbPriorYearsOnly.checked = false;}catch(e){} //won't exist under certain scenarios (See PlantResults.asp where it is defined)
	try{xbIncludePriorYears.checked = false;}catch(e){} //won't exist under certain scenarios (See PlantResults.asp where it is defined)

	var sPage = "PlantResults.asp?" + CleanQueryString( sQueryString );

	location = sPage + WriteResponseString(false);
}

function ShowPriorYearsOnly(isChecked, sQueryString)
{
	xbHideSoldOut.checked = false;
	xbNewOnly.checked = false;
	xbIncludePriorYears.checked = false;

	var sPage = "PlantResults.asp?" + CleanQueryString( sQueryString );

	location = sPage + WriteResponseString(false);
}

function IncludePriorYears(isChecked, sQueryString)
{
	xbHideSoldOut.checked = false;
	xbNewOnly.checked = false;
	xbPriorYearsOnly.checked = false;

	var sPage = "PlantResults.asp?" + CleanQueryString( sQueryString );

	location = sPage + WriteResponseString(false);
}

function ShowWishlistXBs()
{
	var oObj = document.body.all.item("xbWishList");

	if( oObj == null )
		return;

	if( oObj.length == undefined ) //means single item, NOT a collection
	{
		if( !window.navigator.cookieEnabled )
			oObj.display="none";
		else
			if( null != GetCookie( "WishList", "id", oObj.value )) //set checkboxes according to cookies
				oObj.checked = true;
	}
	else
		for( var i=0; i < oObj.length; i++)
			if( !window.navigator.cookieEnabled ) //only want checkboxes if they have Cookies enabled
				oObj[i].display="none";
			else
			{
				if( null != GetCookie( "WishList","id", oObj[i].value )) //set checkboxes according to cookies
					oObj[i].checked = true;
			}
}

function EmptyWishList()
{
	var resp = confirm( "Are you sure you want to empty your wish list? Click OK to empty.");

	if( resp ) //Empty!
		SetCookie("WishList","");

	return resp;
}

var g_sPlantInfo;
var g_oThumb;

function SetPlantPict( oThumb, sFilename, sPlantInfo )
{
	g_oThumb = oThumb;
	g_sPlantInfo = sPlantInfo;

	//DTV;12/9/08 - Cannot simply set background image of DIV. Must have IMG child object and use the onload event to 100% of time successfully display correct image. I tried everything else...

	var sPrevImg = new String(PlantPict_lgimg.src);

	if( sPrevImg.indexOf(sFilename) > -1 )
	{
		ShowPopup(oThumb, 'PlantPict', false);

		return;
	}

	PlantPict_lgimg.src = sFilename; //fires onload="PlantPictLoaded()", which correctly happens AFTER image is loaded
}

function PlantPictLoaded( oObj )
{
	var sFilename = oObj.src;

	var oImage = new Image(); //DTV; 12/9/08 - Creating oImage guarantees fresh load of object. W/out this, oObj coming in sometimes is LAST image when moving mouse quickly...
	oImage.src = oObj.src;

	if( g_sPlantInfo.length )
	{
		PlantInfo.innerHTML = g_sPlantInfo;
		PlantInfo.style.width = oImage.width+"px";

		PlantPict_lgimg.style.borderStyle = "solid";
	}

	ShowPopup(g_oThumb,'PlantPict',false); //DTV; 12/22/08; PlantPictLoaded() is asynchronous, cannot call sequentially after calling SetPlantPict in the onmouseover() events.
}

function PrintListCaution(nPlantCount)
{
	if( nPlantCount > 500 )
		return( confirm( "Displaying the Printer-Friendly List with this many plants (" + nPlantCount + ") may take a while and consume \
lots of computer resources. We recommend you change View preferences at the bottom of the screen or use Advance Search to reduce the number of plants in the list. \
Press \"OK\" to continue displaying the Printer-Friendly List or \"Cancel\" to return." ));

	return true;
}

function SetClematisPruningInfo( nPruningCode )
{
	var sText;

	switch( nPruningCode )
	{
        case 1:
            sText = "This group of clematis produce their flowers directly from old stems and, therefore, pruning must not be done until right after all flowering \
has been completed. Prune this group by removing all dead and weak stems immediately after flowering. Large established \
plants over 15 feet are normally not pruned, especially if they are growing in trees. All stems at this time should be tied into position on \
their trellis or other host. Also, if the Clematis has outgrown their space the correct and only time to prune to size is right after flowering is done. \
After pruning new growth will begin, this being the stems for next year's flowers.";
		break;

        case 2:
            sText = "In this group all first flowering comes from last season's ripened stems. In early Spring watch for swelling leaf buds beginning to show. \
Cut all dead material off above these swelling buds. Be sure all growth is tied to trellis, etc. at this time. Do not tie too tightly, so growth \
can begin and not hampered by tying too tight or cracking these stems.";
		break;

        case 3:
            sText = "This group blooms later and from new growth. This group should be pruned in February or March as new leaf buds begin to show low on the plant. \
All dead material above these buds should be removed at this time. Clean out any old foliage or foliage with mildew at this time also.";
		break;
	}

	//IE and Safari work fine with 'innerText'; Firefox only works with 'innerHTML'
	PruningInfo_help.innerHTML = sText;
}

function SetPruningInfo( oThumb, sPruningCode )
{
	SetPlantPict( oThumb, '/images/PruningGrp' + sPruningCode + '.jpg', '');
}

function UpdateSoldOut(nRow, bChecked)
{
	if( !xmlhttp )
	{
		if (window.XMLHttpRequest)
			xmlhttp=new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari
		else if (window.ActiveXObject)
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5
		else
		  alert("Your browser does not support XMLHTTP!");
	}

	if( xmlhttp )
	{
		var url = "UpdateRecords.asp?UpdateSoldOut=1&Row="+nRow+"&SoldOut="+bChecked;

		xmlhttp.onreadystatechange=UpdateRecordStatus;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
}

function UpdateRecordStatus()
{
	if (xmlhttp.readyState==4 && xmlhttp.responseText)
		alert(xmlhttp.responseText);
}

function CapitalizeLocation(oTextBox)
{
	oTextBox.value = oTextBox.value.toUpperCase();
}

function UpdateLocation(nRow, oTextBox)
{
	if( !oTextBox.value )
		return true;

	var re = /^([1-9]|[1][1-2])[ABCD]\-[NS]$/i; //Search for aisles 1-12, sections A,B,C, or D, and North or South side ONLY - "/i" means case insensitive
	var sLoc = new String( oTextBox.value );

	if( !sLoc.match(re) )
	{
		re = /^hostas|mandevillas|hydrangeas|trees$/i;

		if( !sLoc.match(re) )
		{
			alert( "Invalid Location");
			oTextBox.value = "";
			oTextBox.focus();

			return false;
		}
	}

	if( !xmlhttp )
	{
		if (window.XMLHttpRequest)
			xmlhttp=new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari
		else if (window.ActiveXObject)
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5
		else
		  alert("Your browser does not support XMLHTTP!");
	}

	if( xmlhttp )
	{
		var url = "UpdateRecords.asp?UpdateLocation=1&Row="+nRow+"&Location="+oTextBox.value;

		xmlhttp.onreadystatechange=UpdateRecordStatus;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}

	return true;
}

function UpdateRecordset()
{
	if( !xmlhttp )
	{
		if (window.XMLHttpRequest)
			xmlhttp=new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari
		else if (window.ActiveXObject)
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5
		else
		  alert("Your browser does not support XMLHTTP!");
	}

	if( xmlhttp )
	{
		var url = "UpdateRecords.asp?UpdateRecordset=1";

		xmlhttp.onreadystatechange=UpdateRecordStatus;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
}

// -->
