// Global JavaScript


//	functions for clearing/recalling the input field 
//	onclick="clearInput(this, 'default text')" onblur="recallInput(this,'default text')"
function clearInput(thisInput, dText) {
	if (thisInput.value == dText) {
		thisInput.value = "";
		
		thisInput.style.color = "#000";
	}
}

function recallInput(thisInput, dText) {
	if (thisInput.value == "") {
		thisInput.value = dText;
		
		thisInput.style.color = "#999";
	}
}


/******** drown down menu effect *********/
$(document).ready(function() {

    /***** css fixes ******/
    //disabling for the hover/slide effect to work
    $("#servicesDropDown").css({ 'display': 'none' });

    // have to redefine for ie7 to fix ie7 hack	
    $("#servicesDropDown").css({ 'margin': '0 0 0 -20px' });

    //disabling for the hover/slide effect to work
    $("#navMenu dl dd").css({ 'display': 'none' });


    // for ourServices drop down
    $("#ourServices-li").hoverIntent({
        sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
        interval: 200, // number = milliseconds for onMouseOver polling interval
        over: expandOS, // function = onMouseOver callback (REQUIRED)    
        timeout: 500, // number = milliseconds delay before onMouseOut
        out: contractOS // function = onMouseOut callback (REQUIRED)    
    });
    function expandOS() { $("#servicesDropDown").slideDown("medium") }
    function contractOS() { $("#servicesDropDown").slideUp("medium") }


    function theSetUp(i) {
        var config = {
            sensitivity: 7,
            interval: 250,
            over: expandNavMenu,
            timeout: 50,
            out: contractNavMenu
        }

        var thePath = "dl#NM-" + i;
        
        $(thePath).hoverIntent(config);
        
        function expandNavMenu() { $(thePath + ' dd').slideDown('fast') }
        function contractNavMenu() { $(thePath + ' dd').slideUp('fast') }
    }

    // looping through theSetUp() to create the 9 menu drop down animations
    for (i = 1; i <= 9; i++) {
        theSetUp(i);
    }

}); // close document.ready

