function atendimento() {
    $.ajax({
        url: base_url + '/atendimento/status.php',
        success: function(data) {
            if (data == 'Online') {
                $('#atendimento').attr('src', base_url +'/images/online.png');
            } else {
                $('#atendimento').attr('src', base_url +'/images/offline.png');
            }
            setTimeout('atendimento()', 3000);
        }
    });
}


$(function() {
    $('.close').click(function() {
        $(this).parent().fadeOut('slow');
    }).mouseover(function() {
        $(this).css('cursor', 'pointer');
    });
    $('a[rel=external]').click(function() {
        var url = $(this).attr('href');
        window.open(url);
        return false;
    });
    $('.tooltip').tooltip({
        track: true,
        delay: 0,
        showURL: false,
        fade: 200
    });
    $('#slider ul').jcarousel({
        auto: 5,
        wrap: 'last',
        scroll: 1
    });
    
    if ($('#marquee').length > 0) {
        $('#marquee').marquee('pointer').mouseover(function () {
            $(this).trigger('stop');
        }).mouseout(function () {
            $(this).trigger('start');
        }).mousemove(function (event) {
            if ($(this).data('drag') == true) {
                this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
            }
        }).mousedown(function (event) {
            $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
        }).mouseup(function () {
            $(this).data('drag', false);
        });
    }

//     $('#small-slider ul').jcarousel({
//         auto: 5,
//         wrap: 'last',
//         scroll: 5
//     });
    $('#atendimento').click(function(){
        var width  = 400;
        var height = 500;
        var left   = (screen.width - width) / 2;
        var top    = ((screen.height - height) / 2) - 30;

        var w = window.open('atendimento/cliente/index.php', 'at',  'height=' +height+ ', width=' +width+ ',status=no, toolbar=no, resizable=no, scrollbars=no, minimizable=no, left=' +left+ ', top=' +top);
    });
    atendimento();
});


