/*

Displays the hint text on select or input

*/

function prepareInputsForHints(){
	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++){
		// Test to see if the hint span exists
		if (inputs[i].parentNode.getElementsByTagName("span")[0]){
			// Span exists so on focus, show the hint
			inputs[i].onfocus = function (){
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			// When the cursor moves away from the field, hide the hint
			inputs[i].onblur = function (){
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
	// Repeat same tests above for selects
	var selects = document.getElementsByTagName("select");
	for (var k=0; k<selects.length; k++){
		if (selects[k].parentNode.getElementsByTagName("span")[0]){
			selects[k].onfocus = function (){
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			selects[k].onblur = function (){
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
}

/* Used without a global onload hander - see init2.js */
/* window.onload = prepareInputsForHints; */

