
function InitializeSearch ()
{
	searchBy = "";
	orderBy = "";
	
	if (searchBy != "") SetSearchBy(searchBy);
	if (orderBy != "") SetOrderBy(orderBy);
}

function SetSearchBy (str)
{
	$nodes = $('tx_ttproducts_pi1[search-by]').immediateDescendants();
	$id = 0;
	for (i = 0; i < $nodes.length; i++)
		if ($nodes[i].value == str)
			id = i;

	$('tx_ttproducts_pi1[search-by]').selectedIndex = id;
}

function SetOrderBy (str)
{
	$nodes = $('tx_ttproducts_pi1[orderBy]').immediateDescendants();
	$id = 0;
	for (i = 0; i < $nodes.length; i++)
		if ($nodes[i].value == str)
			id = i;

	$('tx_ttproducts_pi1[orderBy]').selectedIndex = id;
}

Event.observe(window, 'load', InitializeSearch);