// jQuery page load function
$(document).ready(function() {

    $("ul.nav").superfish({
        delay: 0,                            // one second delay on mouseout 
        animation: { height: 'show' },       // fade-in and slide-down animation 
        speed: 'fast',                       // faster animation speed 
        autoArrows: false,                   // disable generation of arrow mark-up 
        dropShadows: false                   // disable drop shadows
    });

    $.preloadCssImages();

    $("input.searchterms").click(function(){
	if( $(this).val() == "search" )
	{
	    $(this).val('');
	}
    });

    $("input.searchterms").keypress(function(event){
	if (event.keyCode == '13') {
     	     event.preventDefault();
	     window.location = $("a#btnSearch").attr("href") + "?query=" + $(this).val();
   	}
    });


    $("a#btnSearch").click(function(){
	if( $("input.searchterms").val() != "search" )
	{
	     window.location = $(this).attr("href") + "?query=" + $("input.searchterms").val();
	}
	return false;
    });

    if( $(".nomineeImages").length > 0 )
    {
	$(".nomineeImages").each(function(index) {
	    if( $("#nomineeImages" + (index+1) + " li").length > 1 )
	    {
	    	$("#nomineeImages" + (index+1)).bxGallery({
	       		thumbwidth: 100,
	        	thumbcrop: true
	    	});
	    }
	});
    }

});
