//give an input text/password field a title and it will be used as a grey hint inside the input

function input_hints() {
	var divs = document.getElementsByTagName('input');
	for (i=0;i<divs.length;i++) {
		try {
			if (divs[i].type=='text' || divs[i].type=='password') {
				//alert(divs[i].title+'-'+divs[i].value);
				if (divs[i].title && !divs[i].value) {
					divs[i].value = divs[i].title;
					divs[i].style.color = 'grey';
					divs[i].onfocus = function(){
						this.value = ''; //empty input
						this.style.color = ''; //set color back to default
						this.onfocus = false; //prevent this from happening again
					}
				}			
			}
		} catch(err) {
			//alert(err);
		}
	}				
}

if (window.addEventListener) {
	window.addEventListener("load", input_hints, false)
} else if (window.attachEvent) {
	window.attachEvent("onload", input_hints)
}
