
var tickers = [ ];
$(document).ready(function()
{
	$.ajax(
	{ 
		type: 'GET', 
		url: '/funds/products.xml',
		dataType: 'xml',
		success: function(xmlDOM)
		{
			$(xmlDOM).find('Ticker').each(function()
			{
				tickers.push($(this).text().toUpperCase());
			});
			
			$('#Search form').submit(function(event)
			{
				var text = $('#Search input[type=text]').val();
				for(var i=0;i<tickers.length;i++)
				{
					if(tickers[i] == text.toUpperCase())
					{
						window.location = '/funds/' + text.toLowerCase() + '.html';
						event.preventDefault();
					}
				}
			});
		}
	});
});
