
function searchCategory(site){
	var c = $('catsearch_cat').get('value').trim();

	var spl = c.split(':::');

	var url = 'http://' + site + "/indexes/suppliers-cat" + spl[0];

	if(spl[0].match(/^[a-y]$/) && spl[1].match(/^[a-z]$/)){
		window.location = url + spl[1] + "-all.html";
	} else if (spl[0].match(/[a-y]/)){
		window.location = url +  "-all.html";
	} else {
		alert("We are sorry but that doesn't seem to match any of our existing categories. Please try the keyword search by clicking on the Keyword tab ");
	}
}

function searchCompany(site){
	var url = 'http://' + site + "/news/";
	var ticker = $('cosearch_ticker').get('value');

	if(ticker.match(/[a-z]{3}/)){
		url += ticker + "/" + ticker + "000.html";;
		window.location = url;
	} else {
		alert("We are sorry but that company doesn't seem to exist in our database. Try typing less to let the autocomplete guess. ");
	}
}

// Overide Standard Autocompleter so we can pick up the company ticker
// When the selection is made
ProtalkAutocompleter = new Class({
	Extends: Autocompleter.Request.JSON
});


