// 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;
		}
		}
	}
}

function resetForms() {
	var keywordForm=document.getElementById("keywordsearch");
	if (keywordForm) {
		resetFields(keywordForm);
	}
	var patternForm=document.getElementById("patternform");
	if (patternForm) {
		resetFields(patternForm);
	}
	var patternForm=document.getElementById("newsletter");
	if (patternForm) {
		resetFields(patternForm);
	}	
}

addLoadEvent(resetForms);


