// JavaScript Document

//onfocus turn text box color to black 
function clearText(thefield){
	if (thefield.defaultValue==thefield.value){
		thefield.value = "";
		thefield.style.color='#000000';
	}
}

//onblur turn text box color back to grey if empty and put date back in
function replaceText(thefield){
	if (thefield.value == ""){
		thefield.value = thefield.defaultValue;
		thefield.style.color='#CCCCCC';
	}
	else if(thefield.value.length==10){
		thefield.style.color='#000000';
	}
}

window.addEvent('domready', attachMouseHoverEvents);

function attachMouseHoverEvents()
{	
    // IE 6 input button rollover
    if (window.ie6)
    {
	    var prevElement = $('previousbutton');
	    var nextElement = $('nextbutton');
	    var finishElement = $('finishbutton');
	    var submitElements = $$('.submit');
    	
	    if(nextElement!=null){
		    nextElement.addEvent('mouseenter', hoverIn);
		    nextElement.addEvent('mouseleave', hoverOut);
	    }
    	
	    if(finishElement!=null){
		    finishElement.addEvent('mouseenter', hoverIn);
		    finishElement.addEvent('mouseleave', hoverOut);
	    }
    	
	    submitElements.each(function(element) {
	        if (element != prevElement)
	        {
	            element.addEvent('mouseenter', hoverIn);
		        element.addEvent('mouseleave', hoverOut);
		    }
	    });		
    	
	    function hoverIn() {
		    this.addClass('hoverOver');
	    };
    	
	    function hoverOut() {
		    this.removeClass('hoverOver');
	    };
	}
}
function showHideSelectOccupation(obj)
{
	showHideElement(obj.id);
	showHideElement(obj.id + '_lookup');
}
function showHideElement(id)
{
	var obj = document.getElementById(id);
	if (typeof(obj) != 'undefined')
	{
		obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
	}
}