/* =================================
			Search Functionality Start
==================================== */

function setupSearch(button, text){
var default_message = "Search";
	btn = document.getElementById(button);
	txt = document.getElementById(text);
	txt.value = default_message;

	txt.onfocus = function() {
		if(this.value == default_message) {
			this.value='';
		}
	}
	
	txt.onblur = function() {
		if(this.value == default_message || this.value == '') {
			this.value=default_message;
		}
	}

	btn.onclick = function(){
		txt = document.getElementById(text);  
		var val = trim(txt.value, ' ');
		if(val==default_message|val==""){
			alert("Please enter keyword.");
			txt.value = '';
			txt.focus();
			return false;
		}
	}
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

/* =================================
			Search Functionality End
==================================== */
