
function sendtoresults(iMode){
var theForm	= window.document.frmCategorySearch;
var industry_cnt = 0;
var out = "";


var txtSearchTitle = theForm.searchtitle;
out += (iMode!=0 && txtSearchTitle!=null && txtSearchTitle.value=="")?"\t- Please enter the Alert Title.\n":"";


var optSearchBy = theForm.SearchBy;
var optSelected = -1;
if (optSearchBy!=null){
	for (var i=optSearchBy.length-1; i > -1; i--) {
		if (optSearchBy[i].checked) {
			optSelected = optSearchBy[i].value;
			i = -1;
		}
	}

}

for (var i = 0; i<theForm.elements.length; i++){if ((theForm.elements[i].name=='main_skills' && theForm.elements[i].checked==true)){industry_cnt  = industry_cnt + 1;}}
out += (industry_cnt>5)?"\t- You are not allowed to select more than 5 industry sectors. Please select 5 or less.\n":"";

var lstCountry = theForm.country;
out += (lstCountry.options[lstCountry.options.selectedIndex].value=="")?"\t- You must select a country.\n":"";


var txtAnyKeywords=theForm.OR_Keywords;
var txtAndKeywords=theForm.AND_Keywords;
var txtPhraseKeywords=theForm.PHRASE_Keywords;
var txtNotKeywords=theForm.NOT_Keywords;

if (txtNotKeywords.value!=""){
	out += (txtAnyKeywords.value=="" &&txtAndKeywords.value=="" && txtPhraseKeywords.value=="")?"To perform a search with the \"None of These Words\" option,\n you must also enter some words in one of the following :\n\n \t- \'Include Any of These Words\' \n \t- \'All of These Words\' \n \t- \'This Exact Phrase\'\n":"";
}
if (out != ""){
     sendMessage ("Before submitting the form...", out, 50);
     return false;
}
else{
	if (iMode!=9){
	
		if (iMode==0){
			var txtSearchID = theForm.SearchId;
			if (txtSearchID!=null)txtSearchID.value='';
		}
		else if (iMode==1){theForm.action='/tiptop/search/newsearch.asp?emailalert=1';}	
		else if (iMode==2){theForm.action='/tiptop/search/savedsearch.asp';}
		else if (iMode==3){theForm.action='/tiptop/search/newsearch.asp';}
		theForm.submit();
	}
	else{
	return true;}
}
}
