
var include_num = 1;
var bold = 0;

var s = new Array();

s[0] = "Annual Reports^legislative.htm^Dept. Safety, Security and Liason ";
s[1] = "Speeches^speech2007.htm^Free State Provincial ";
s[2] = "Z83^applicationform.htm^Dept. Safety, Security and Liason";
s[3] = "MEC Contacts^MECContacts.htm^Dept. Safety, Security and Liason ";
s[4] = "Reports^annualreports.htm^Dept. Safety, Security and Liason";
s[5] = "PAIA Manuals^paiamanuals.htm^Dept. Safety, Security and Liason";
s[6] = "Vission and Mission^VisionMission.htm^Dept. Safety, Security and Liason";
s[7] = "Value System^values.htm^Dept. Safety, Security and Liason";
s[8] = "Senior Management^seniormanagement.htm^Dept. Safety, Security and Liason";
s[9] = "Organisational Structure^OrgStructure.htm^Dept. Safety, Security and Liason";
s[10] = "Newsletter^mdesknewsletter.htm^Dept. Safety, Security and Liason";
s[11] = "Announcements^announcements.htm^Dept. Safety, Security and Liason";
s[12] = "Safety Tips^safety_personal.htm^All tips for your personal safety";
s[13] = "Budget Speech^budgetspeech.htm^Budget Statement and other budget related documents";
s[14] = "Register a Supplier^registerasupplierform.htm^A form to register suppliers";
s[15] = "Objectives^oandcfunctions.htm^Dept. Safety, Security and Liason";
s[16] = "Legislative^Legislative&Policy.htm^Dept. Safety, Security and Liason";
s[17] = "Recent Events^recentevents.htm^Dept. Safety, Security and Liason";
s[18] = "Childrens Safety^safety_children.htm^Dept. Safety, Security and Liason";
s[19] = "Firearms^safety_firearms.htm^Tips and FAQ about fire-arms";
s[20] = "Police Stations^policestations.htm^Contact Details of the Provincial office - SAPS: Senior Management";
s[21] = "Strategic plans^Strategicplan.htm^Download all the Strategic Plans";
s[22] = "Brouchures^Brouchures.htm^Dept. Safety, Security and Liason";
s[23] = "Domestic Violence^safety_domestic.htm^Dept. Safety, Security and Liason";
s[24] = "Physical Security^physicalsecurity.htm^Contact Details for All Physical Security";
s[25] = "Communications^communicationscontact.htm^Contact Details for Communications";

var cookies = document.cookie;
var p = cookies.indexOf("d=");
var r = new Array();

if (p != -1) {
	var st = p + 2;
	var en = cookies.indexOf(";", st);
	if (en == -1) {
		en = cookies.length;
	}
	var d = cookies.substring(st, en);
	d = unescape(d);
}
var od = d;
var m = 0;
if (d.charAt(0) == '"' && d.charAt(d.length - 1) == '"') {
	m = 1;
}

var r = new Array();
var co = 0;

if (m == 0) {
	var woin = new Array();
	var w = d.split(" ");
	for (var a = 0; a < w.length; a++) {
		woin[a] = 0;
		if (w[a].charAt(0) == '-') {
			woin[a] = 1;
		}
	}
	for (var a = 0; a < w.length; a++) {
		w[a] = w[a].replace(/^\-|^\+/gi, "");
	}
	a = 0;
	for (var c = 0; c < s.length; c++) {
		pa = 0;
		nh = 0;
		for (var i = 0; i < woin.length; i++) {
			if (woin[i] == 0) {
				nh++;
				var pat = new RegExp(w[i], "i");
				var rn = s[c].search(pat);
				if (rn >= 0) {
					pa++;
				} else {
					pa = 0;
				}
			}
			if (woin[i] == 1) {
				var pat = new RegExp(w[i], "i");
				var rn = s[c].search(pat);
				if (rn >= 0) {
					pa = 0;
				}
			}
		}
		if (pa == nh) {
			r[a] = s[c];
			a++;
		}
	}
	co = a;
}

if (m == 1) {
	d = d.replace(/"/gi, "");
	var a = 0;
	var pat = new RegExp(d, "i");
	for (var c = 0; c < s.length; c++) {
		var rn = s[c].search(pat);
		if (rn >= 0) {
			r[a] = s[c];
			a++;
		}
	}
	co = a;

}


function return_query() {
//	document.jse_Form.d.value = od;
}

function num_jse() {
	document.write(co);
}

function out_jse() {
	if (co == 0) {
		document.write('Sorry!No related records were found for your search.');
		return;
	}
	for (var a = 0; a < r.length; a++) {
		var os = r[a].split("^");
		if (bold == 1 && m == 1) {
			var br = "<b>" + d + "</b>";
			os[2] = os[2].replace(pat, br);
		}
		if (include_num == 1) {
			document.write(a + 1, '. <a href="', os[1], '">', os[0], '</a><br>', os[2], '<p>');
		} else {
			document.write('<a href="', os[1], '">', os[0], '</a><br>', os[2], '<p>');
		}
	}

}
