
$(document).ready(
                function() {
                    banner_rotate();
                }
                );

function banner_rotate() {
    if (!$('#image-rotate').length) {

        $('#flash-box').append("<a href=\"" + links[index] + "\"><img border=\"0\" width=\"527\" height=\"328\" id=\"image-rotate\" src=\"" + images[index] + "\" alt=\"\"/></a>");
    }
    setTimeout(doBannerFade, 7000);

}

function doBannerFade() {
    $('#flash-box').attr("style", "background-image:url('" + images[index] + "');");
    $('#image-rotate').fadeOut(1250, function() {
        index++;
        if (index == images.length) {
            index = 0;
        }
        $('#image-rotate').attr("src", images[index]);
        $('#image-rotate').fadeIn(1250, function() {
            banner_rotate();
        }
                );

        if (links[index] != "#removeAttr") {
            $('#flash-box').attr("href", links[index]);
        } else {
            $('#flash-box').removeAttr("href");
        }
    }
                );
}  
