// JavaScript Document

function addLoadEvent(func) {
var oldonload = window.onload;
 if (typeof window.onload != 'function') {
 window.onload = func;
 } else {
 window.onload = function() {
 oldonload();
 func();
 }
 }
}

function resetFields(whichform) {
	for (var i=0; i<whichform.elements.length; i++) {
		var element = whichform.elements[i];
			if (element.type == "submit") continue;
			if (!element.defaultValue) continue;
			element.onfocus = function() {
			if (this.value == this.defaultValue) {
				this.value = "";
			}
		}
		element.onblur = function() {
		if (this.value == "") {
			this.value = this.defaultValue;
		}
		}
	}
	whichform.onsubmit = function() {
		for (var i=0; i<this.elements.length; i++) {
			 var element = this.elements[i];
			 if (element.type == "submit" || element.type == "hidden") continue;
			 if (element.value == element.defaultValue) {
				 element.value="";
			 }
			 }
	}
}

function resetForms() {
	var keywordForm=document.getElementById("bsearch");
	if (keywordForm) {
		resetFields(keywordForm);
	}
}

addLoadEvent(resetForms);


