var f;

function doThemesSearch(p_theme, p_key) {

	/*
		p_theme = the actual value (English or French) to be passed.
		p_key = these hard coded values should NOT be changed!
		the words "Prevention", "Mitigation", "Technical", "Monitoring" and "Cooperation" are set as design elements, and many problems can happen is these are changed.
	*/

	// get values from Themes
	v_qry = "&Type=Themes&Query=FIELD Ques_Activities CONTAINS " + p_theme;
	
	// construct URL
	var v_loc = "http://" + f.Server_Name.value + "/" + f.DbName.value + "/srch" + p_key + "?SearchView&SearchOrder=4" + v_qry;

	// redirect
	window.location = v_loc;
};

function doKeywordsSearch(txt, val) {

	// Keywords
	v_qry = "&Type=Keywords&Text=" + txt + "&Query=";
	
	// multiple values seperated by semi-colons
	if( val.indexOf(";") != -1) {
		var v_splits = val.split(";");
		v_qry += "([" + v_splits[0] + "] is present OR [" + v_splits[1] + "] is present) OR ";
		} else {
		v_qry += "([" + val + "] is present) OR";
	};		

	// remove extra " OR "
	var v_lastOR = v_qry.lastIndexOf(")");
	var v_qry = v_qry.slice( 0, v_lastOR) + ")";
	
	// construct URL
	var v_loc = "http://" + f.Server_Name.value + "/" + f.DbName.value + "/search?SearchView&SearchOrder=4" + v_qry;
	
	// redirect
	window.location = v_loc;
};
