//link bumping

(function ($) {
// Link Bumping FUNCTION
$.fn.LinkBump = function() {
	$(this).addClass("bump_up")

	$(this).mouseup(function(){
	    $(this).toggleClass("bump_down");
	});
				
	$(this).mousedown(function(){
	    $(this).toggleClass("bump_down");
	});

	$(this).mouseout(function(){
	    $(this).removeClass("bump_down");
	});
};
})(jQuery);

$(document).ready(function(){
    $(".link-ani" ).each(function(){
	$(this).LinkBump();
    });

    $(".jcarousel-skin-ie7 .jcarousel-item h3 a").LinkBump();

    $(".formbutton").LinkBump();

    $("#header ul li a").LinkBump();
		
    //social buttons fade
    var f_speed = 100;
    $("#social a" ).each(function(){
	$(this).hover(
	    function () {
		$("img",this).fadeTo(f_speed, 0);
	    }, 
	    function () {
		$("img",this).fadeTo(f_speed, 1);
	    }
	);
    });

    //input form animation
    $("input.form_input").focus(function() {
	$(this).animate({ backgroundColor: "#cad0e1" }, 100)
	.animate({ backgroundColor: "#ffffff" }, 10000);
    });

    //navigation animation
    
    $("#header ul li ul").hide();

    var config = {    
     sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
     interval: 100, // number = milliseconds for onMouseOver polling interval    
     over: showsubnav, // function = onMouseOver callback (REQUIRED)    
     timeout: 500, // number = milliseconds delay before onMouseOut    
     out: hidesubnav// function = onMouseOut callback (REQUIRED)    
    };

    $("#header ul li").hoverIntent( config )

    $("#footersearchlink").one('mouseenter', function () {
	$("#footersearchhover").show("slide", { direction: "down" }, 250);
    });
    
});


function showsubnav(){ $(this).children("ul").show("slide", { direction: "up" }, 250);}
function hidesubnav(){ $(this).children("ul").hide("slide", { direction: "up" }, 250);}

function doSearch(inputName)
{
    window.location.href = "/search.aspx?search=" + $("#" + inputName).val();
}

function search_updateFormAction(theForm)
{
	theForm.action = "/search";
}