 /*--------------------------search --------------------*/
function setupSearch(button, text){
	var default_message = "Search by keyword(s)";
	btn = document.getElementById(button);
	txt = document.getElementById(text);
	txt.value = default_message;

	txt.onclick = function(){
		if(this.value==default_message){
		this.value='';
	}}
	
	btn.onclick = function(){
	txt = document.getElementById(text);  
	var val = trim(txt.value, ' ');
	if(val==default_message|val==""){
		alert("Please enter search text");
		document.getElementById(text).focus();
		document.getElementById(text).value='';
		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"), "");
}

// Used for change the rollver images on the button input

function imgHov(e) {
if(e.src.match('_h.gif')) {

	e.src = e.src.replace(/_h.gif/i, ".gif");

	}  else {

		e.src = e.src.replace(/.gif/i, "_h.gif");

	}
}

