function markText(txtKeyword, inputHtml) {	
	var re; /*regex object*/
	var varMatches; /*matches array*/
	var outHtml; /*output html*/
	var replaceText;/*build the span tag with the keyword in advance*/

	replaceText = '<span class="Hilite">' + txtKeyword + '</span>';
	re = new RegExp("(\<[^>][^<]*\>)([^<]*)","g"); /*create non-greedy regex match*/
	outHtml = new String('');	/*init html string*/
		
	while ((varMatches = re.exec(inputHtml)) != null)/*exec sequentially to apply span tags*/
	{
		outHtml += varMatches[1]; 	/*html tag part*/
		outHtml += replaceMe(varMatches[2], txtKeyword, replaceText); /*call the search & replace function*/
	}
	return outHtml;
}

function replaceMe(brText, keyword, replacetext) {
	var reg = new RegExp(keyword, "gi"); //"i" - igonrecase
	brText = brText.replace(reg, replacetext);		
	return brText;
}

function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			return pair[1];
		}
	}   
}

function urlencode(string) {
	return escape(string);
}