function doStockSearch(symbolId, quoteTranslation, url)
{
	doStockSearchGO(symbolId, quoteTranslation, url, "symbol");
}

// this function is called when we do a symbol search that must point to the legacy site
function doStockSearchN(symbolId, quoteTranslation, url)
{
	doStockSearchGO(symbolId, quoteTranslation, url, "ticker");
}

function doStockSearchGO(symbolId, quoteTranslation, url, symbolOrTicker)
{
	var symbol = document.getElementById(symbolId).value;
	// blank out the default if nothing was entered
	if (quoteTranslation.toUpperCase() == symbol.toUpperCase()) symbol = "";

	// &fs param needed for WebTrends -- specifies
	var location = url + "?" + symbolOrTicker + "=" + encodeURIComponent(symbol) + "&fs=1";
	Redirect(location);
}

function doStockSearchJP(symbolId, quoteTranslation, url)
{
	var symbol = document.getElementById(symbolId).value;
	// blank out the default if nothing was entered
	if (quoteTranslation.toUpperCase() == symbol.toUpperCase()) symbol = "";
	
	var searchType = "";
	var originType = "";
	var objNodeList = document.getElementsByName("qtype");
	for (var x=0; x < objNodeList.length; x++)
	{
		if (objNodeList.item(x).checked)
		{
			searchType = objNodeList.item(x).value;
			break;
		}
	}

	objNodeList = document.getElementsByName("stockFilter");
	for (var y=0; y < objNodeList.length; y++)
	{
		if (objNodeList.item(y).checked)
		{
			originType = objNodeList.item(y).value;
			break;
		}
	}

	var location = url + "?symbol=" + encodeURIComponent(symbol) + "&searchtype=" + searchType + "&origin=" + originType + "&fs=1";
	Redirect(location);
}

function doSearch(url, text, dropDown)
{
	var searchText = document.getElementById(text).value;
	if ("SEARCH" == searchText.toUpperCase()) searchText = "";
	var searchDropDown = document.getElementById(dropDown);
	var searchType = searchDropDown.options[searchDropDown.selectedIndex].value
	var location = url + encodeURIComponent(searchText) + "&searchtype=" + searchType;
	Redirect(location);
}

function doSearchType(url, text, searchType)
{
	var searchText = document.getElementById(text).value;
	if ("SEARCH" == searchText.toUpperCase()) searchText = "";
	var location = url + encodeURIComponent(searchText) + "&searchtype=" + searchType;
	Redirect(location);
}

// this function is called when we do a newssearch that must point to the legacy site
function doSearchN(url, text, section)
{
	var searchText = document.getElementById(text).value;
	if ("SEARCH" == searchText.toUpperCase()) searchText = "";
	var section = document.getElementById(section).value;
	var location = url + encodeURIComponent(searchText) + "&qtype=" + section;
	Redirect(location);
}

function DoSubmitCheck()
{
	if (document.forms[0].DoSubmit.value != "false")
	{
		// cancel the form submit
		return false;
	}
	else
	{
		// proceed with the form submit
		return true;
	}
}

function Redirect(location)
{
	if (typeof(document.forms[0].DoSubmit) != 'undefined')
	{
		// dirty flag that causes the DoSubmitCheck function below
		// to return false, canceling the form submit and redirecting
		// to our desired location with the new ticker
		document.forms[0].DoSubmit.value = "true";
	}
	window.parent.location = location;
}