

//this function will submit the search using the given querybox and currently selected filter
function submitSearchButton(queryBoxName, sourceTypeBox, omnitureValue)
{
	var query = "";
	var sourceType = "all";	//this is the defaultResponse.Redirect("http://www.webmd.com/search/default.aspx",true);
	if(queryBoxName.length > 0)
	{
		query = document.getElementById(queryBoxName).value;
	}
	
	if(sourceTypeBox.length > 0)
	{
		sourceType = document.getElementById(sourceTypeBox).value;
	}
	
	saveForm();
	
	try
	{
		wmdSearchTrack("search-bar_" + omnitureValue);	//omniture function
	}
	catch(err)
	{
	}
	if(sourceType == "offers")
	{
		//offers page performs search for all tab
		return webMDSearch(query, "all");
	}
	else
	{
		window.location.href = "?sourceType=" + sourceType + "&query=" + escape(query);
	}
	
	return false;
}


function  DoSearch()
{
	var query;
	var sourceType;
	var url;
	//get the query
	query = escape(document.getElementById("txtQuery").value);
	
	if(query.length > 0)
	{
		try
		{
			ctr('Search_landingSearch');	//omniture function
		}
		catch(err)
		{
		}
		sourceType = document.getElementById("sourceType").value;
		if(sourceType == "web_search")
		{
			window.location.href = "http://www.webmd.com/search/search_results/web_results.aspx?query=" + query + "&sourceType=" + sourceType;
		}
		else
		{
			window.location.href = "http://www.webmd.com/search/search_results/default.aspx?query=" + query + "&sourceType=" + sourceType;
		}
	}
	return false;
}


