﻿$(document).ready(function() {
    $("#outBoundLinks img").hover(function() {
        $(this).addClass("hovering");
        $(this).animate({
            opacity: 1
        }, 250);
    }, function() {
        $(this).removeClass("hovering");
        $(this).animate({
            opacity: .5
        }, 500);
    });
    $("#outBoundLinks img").animate({
        opacity: .5
    }, 1);
    setTimeout("illuminateLink()", 1000);
});

function illuminateLink() {
    var count = $("#outBoundLinks img").size();
    var random = Math.floor(Math.random() * count);
    var time = Math.floor(Math.random() * 1000) + 500;

    $("#outBoundLinks img:not(.hovering)").animate({
            opacity: .5
        }, 500);

    $("#outBoundLinks img").eq(random).animate({
        opacity: 1
    }, 500);

    setTimeout("illuminateLink()", time);
}
