// looks for all elements with the auto-clear class
// reads their title and sets that as auto-clear text

window.addEvent('domready', function() {
	$$(".auto-clear").each(function(el) {
		if(el.type == "text" || (!window.ie && el.type == "password")) {
			
			if(el.value == '') {
				el.value = el.title;
				el.setStyle("color", "#808080");
			}
		
			el.addEvent('focus', function() {
				if(this.value == this.title) this.value = "";
				this.setStyle("color", "black");
			});
		
			el.addEvent('blur', function() {
				if(this.value == '') {
					this.value = this.title;
					this.setStyle("color", "#808080");
				}
			});
		}
	})
});

// this used to clear the data in the fields before a submit
// mainly for the searching area
function clearAutoClearFields() {
	$$(".auto-clear").each(function(el) {
		if(el.value == el.getProperty('title')) el.value = '';
	});
}