function trim(ret) {
 return ret.replace(/^\s*|\s*$/g,"");
}

function showbg(mouse) {
 x.value=trim(x.value);
 if (x.value == ""){
  y.style.backgroundImage ="url('../images/search_box_off1.gif')";
 }
 if (!mouse) {x.setAttribute("onmouseout", "showbg(true);");}
}

function hidebg(mouse) {
 y.style.backgroundImage ="url('../images/search_box1.gif')";
 if (!mouse) {x.setAttribute("onmouseout", "");}
}

var isIE = ((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Opera") == -1)); //IE heeft zo z'n eigen methode...
var x=document.getElementById('q');
var y=document.getElementById('f');
showbg(true);
window.onbeforeunload = function(){x.value=''};
x.setAttribute("onmouseover", "hidebg(true);");
x.setAttribute("onmouseout", "showbg(true);");
x.setAttribute("onfocus", "hidebg(false);");
x.setAttribute("onblur", "showbg(false);");
if (isIE){
 x.attachEvent("onfocus", function(){hidebg(false);});
 x.attachEvent("onblur", function(){showbg(false);});
 //y.attachEvent("onmouseover", function(){hidebg(true);});
 //y.attachEvent("onmouseout", function(){showbg(true);});
}
