function submit_search() {
	
	var search_text = trim($('SEARCH_TEXT').value);
	
	$('SEARCH_TEXT').value = trim($('SEARCH_TEXT').value);
	
	if (search_text.length) {
		$('SUBMIT_SEARCH').value = '1';
		$('PRODUCT_SELECTED').value = 0;
		$('CATEGORY_SELECTED').value = 0;
		$('PAGE_SELECTED').value = 0;
		$('PAGE_SEARCH_NUM').value = 0;
		$('ACTION').value = 'SHOW_PRODUCTS';
		document.myForm.submit();
	} else {
		alert('Please enter text to search products by.');	
	}		
}

function view_all() {	
	$('VIEW_ALL').value = '1';
	$('PRODUCT_SELECTED').value = 0;
	$('PAGE_SEARCH_NUM').value = 0;
	$('ACTION').value = 'SHOW_PRODUCTS';
	document.myForm.submit();		
}

function update_search_type()
{
	var new_search_type = document.myForm.SHOP_BY[document.myForm.SHOP_BY.selectedIndex].value;
	var old_search_type = document.myForm.SHOP_BY_SELECTED.value;
	
	if (new_search_type == 'BRAND')
	{
		document.myForm.SEARCH_INPUT_TEXT_VALUE.value = '';
		document.getElementById('search_input_text').style.display = 'none';
		document.getElementById('search_input_dropdown').style.display = 'block';
	}
	
	if (old_search_type == 'BRAND')
	{
		document.myForm.SEARCH_INPUT_DROPDOWN_VALUE.selectedIndex = 0;
		document.getElementById('search_input_text').style.display = 'block';
		document.getElementById('search_input_dropdown').style.display = 'none';
	}
	
	document.myForm.SHOP_BY_SELECTED.value = new_search_type;
}

function show_search_matches(str) {
	/*
	if (str.length < 3)	{ 
		document.getElementById("txtSearchMatches").innerHTML="";
		//DivSetVisible('search_popup_content', 'search_popup_shim', 'popup_closed', false);
		return;
	}
	
	var url = "scripts/search/get_search_matches.php";
	url = url + "?ajax=1";
	url = url + "&sid=" + Math.random();	
	url = url + "&search=" + str;
	url = url + "&search_type_selected=" + document.getElementById('SEARCH_TYPE').value;
	//alert(url);
	xmlreqGET(url);
	*/
} 
