var j = jQuery.noConflict();
            
j(document).ready(function($){
    var itemWidth= $(".item").width();
    var itemSum = $("#slide div").size();
    var slideWidth = (itemWidth+6) * itemSum;
    
    var sponsorWidth= $("#sponsor").width();
    var sponsorSum = $("#sponsor-reel img").size();
    var sponsorReelWidth = sponsorWidth * sponsorSum;
                
    $(".item").css({
        'width' : itemWidth
    });
    $("#slide").css({
        'width' : slideWidth
    });
    $(".item:first").addClass("active");
    
    $("#sponsor-reel img").css({
        'width' : sponsorWidth
    });
    $("#sponsor-reel").css({
        'width' : sponsorReelWidth
    });
    $("#sponsor-reel img:first").addClass("active");

    
    setInterval("slideSponsor()",5000);           
    setInterval("slideInfo()",5000);
                
    
});
            
function slideInfo(){
    var slideImgWidth = j(".item").width();
    var activeImg = j('div.item.active').next();
                
    if (activeImg.length == 0) { 
        activeImg= j('div.item:first');
    } 
                
    var ID = activeImg.attr("rel")-1;
    var position = ID * (slideImgWidth+6);
                
    if(position > 940){                    
        activeImg= j('div.item:first');
        ID = activeImg.attr("rel")-1;
        position = ID * (slideImgWidth+6);
    }
                
    j("div.item").removeClass('active'); 
    activeImg.addClass('active');
                
    j("#slide").animate({
        left: -position
    }, 500 );
}
            
function slideSponsor(){
    var slideWidth= j("#sponsor-reel img").width();
    var active = j("#sponsor-reel img.active").next();
                
    if (active.length == 0) { 
        active= j('#sponsor-reel img:first');
    } 
                
    var ID = active.attr("alt")-1;
    var position = ID * (slideWidth);
                                
    j("#sponsor-reel img").removeClass('active'); 
    active.addClass('active');
                
    j("#sponsor-reel").animate({
        left: -position
    }, 500 );
}
