$(document).ready(function() {
    $('.indexNav a').each(function() {
        var randomNumber = Number( (Math.random()*parseInt(document.config.startDelay)).toFixed(0) );
        $(this).oneTime(randomNumber, function() {
            $(this).attr('state', 'hover').css('margin', '-172px 0 0 0').everyTime(document.config.speed, $(this).attr('href'), function() {
                if($(this).attr('state') == 'normal') {
                    $(this).attr('state', 'hover');
                    $(this).css('margin', '-172px 0 0 0');
                } else if($(this).attr('state') == 'hover') {
                    $(this).attr('state', 'normal');
                    $(this).css('margin', '0');
                }
            });
        }).mouseover(function() {
            $(this).attr('state', 'paused');
            $(this).css('margin', '0');
        }).mouseout(function() {
            $(this).attr('state', 'hover');
            $(this).css('margin', '-172px 0 0 0');
        });
    });
});

document.config = {
    startDelay : 5000,
    speed : 5000
}