function LoadItems()
{
	var dsProductFeatures2 = new Spry.Data.XMLDataSet("http://www.ecarlist.com/xml/{pv1::dealer}/vehicle_summary/{pv1::id}", "vehicleSummary/vehicle");
}

function ClearFilters()
{
	dsMake.filter(null);
	dsModel.filter(null);
}

function AllModels()
	{
		dsMake.distinct();
		dsMake.filter(null);
		dsMake.distinct('make');
		document.frmSearch.dsMake.disabled = "";
		document.frmSearch.dsModel.disabled = true;
		document.frmSearch.dsModel.selectedIndex=0;
	}
function ShowAllModels()
	{
	
	}
	
function filterByYear(dsYear)
	{
	if (dsYear==0)
		{
			document.getElementById("make1").style.display='none'
			document.frmSearch.dsMake.selectedIndex=0;
			document.getElementById("make2").style.display=''
			ShowAllModels();
		}
		else
		{
			document.getElementById("make1").style.display=''
			document.getElementById("make2").style.display='none'
			document.frmSearch.dsMake2.selectedIndex=0;
			yearFilter(dsYear)
		}
	}

function yearFilter(x)
{
		ClearFilters
		var filterFunc = null;
//		if (dsYear)
		filterFunc = function(ds, row, rowNumber){ return (row.year == x) ? row : null; };
		dsMake.distinct();
		dsMake.filter(filterFunc);
		dsMake.distinct('make');
		dsProducts.filter(filterFunc);
		pv1.filter(null);
		document.frmSearch.dsMake.disabled = "";
		document.frmSearch.dsModel.disabled = true;
		document.frmSearch.dsModel.selectedIndex=0;

}
function filterByMake(dsMake)
	{
		dsModel.removeAllFilters();
		document.frmSearch.dsModel.disabled = "";
		ClearFilters
		var filterFunc = null;
		if (dsMake)
		filterFunc = function(ds, row, rowNumber){ return (row.make == dsMake) ? row : null; };
		dsModel.distinct();
		dsModel.addFilter(filterFunc);
		var tmpYearIndex = document.getElementById('dsYear').selectedIndex;
		if (tmpYearIndex!=0)
			{
			var tmpYearValue = document.getElementById('dsYear')[tmpYearIndex].value;
			var filterFunc2 = null;
			filterFunc2 = function(ds, row, rowNumber){ return (row.year == tmpYearValue) ? row : null; };
			dsModel.addFilter(filterFunc2);
			}
		dsModel.applyFilters();
		dsModel.distinct('model');
		dsProducts.addFilter(filterFunc);
		dsProducts.addFilter(filterFunc2);
		dsProducts.applyFilters();
		pv1.filter(null);
	}
function filterByModel(dsModel)
	{
		ClearFilters
		var filterFunc = null;
		if (dsModel)
		filterFunc = function(ds, row, rowNumber){ return (row.model == dsModel) ? row : null; };
		dsProducts.filter(filterFunc);
		pv1.filter(null);
	}

