﻿var ctrl = $('.featured li');
var msgs = $('.msgs li');
$(msgs).each(function() {
    $(this).hide();
});
$(msgs).eq(0).show();
$(ctrl).click(function() {
    var index = $(ctrl).index(this) + 1;
        $(msgs).hide();
    if (!$(this).hasClass('active')){
        $(ctrl).removeClass('active');
        $(this).addClass('active');
        $(msgs).eq(index).show();
        $('#msg-cont').css({ backgroundPosition: '580px ' + (-355 * index) + 'px' });
    }else{
        $(ctrl).removeClass('active');
        $(msgs).eq(0).show();
        $('#msg-cont').css({ backgroundPosition: '580px 0px' });
    }
}, function() { });

// ads
var quotes = $('.lrt li');
var ri = Math.floor(quotes.length * Math.random());
$(quotes[ri]).show();

var imgs = $('.rotate');
var cimg = Math.floor(imgs.length * Math.random());
$(imgs).click(function() {
    window.location=$(this).find('a').attr('href');
});
$(imgs[cimg]).show();
var rotateImg = setInterval(function() {
    $(imgs).hide();
    $(imgs[cimg]).show();
    cimg++;
    if (cimg == imgs.length) { cimg = 0 };
}, 5000);



