var current_partner_logo = 1;

$(document).ready( function() { 

    // Enter any on-startup stuff into this function.
    $('#newsletter_signup_input').focus( function() {
        this.value = '';
        $(this).css('color', 'black');
    });

    $('.header_icon').hover(
        function () {
            var new_src = "/images/" + $(this).attr('id') + "_on.png";
            $(this).attr('src', new_src);
        },
        function () {
            var new_src = "/images/" + $(this).attr('id') + "_off.png";
            $(this).attr('src', new_src);
        }
    );

    setTimeout("rotate_partner_logos()", 10000);

});


function rotate_partner_logos() {

    var next_partner_logo = (current_partner_logo * 1) + 1;
    var next_jq_logo = "#partner_logo_" + next_partner_logo;

    // Check to see if the "next" logo exists. If not, wrap around to 1.
    if ( ! $(next_jq_logo).length ) { 
        next_partner_logo = 1;
        next_jq_logo = "#partner_logo_1"; 
    }

    var current_jq_logo = "#partner_logo_" + current_partner_logo;

    $(current_jq_logo).fadeOut(500, function() { $(next_jq_logo).fadeIn(500); });

    current_partner_logo = next_partner_logo;

    setTimeout("rotate_partner_logos()", 10000);

}

