

function closeLightbox()
{
    $('#closeBut').click();    
}


function getLastFeed( type, id, element )
{
        $.ajax({ type: "POST",
            url: 'ajax/getlastfeed.php',
            data: { type: type,
                    id: id
            },
            remember: { what: element, cid: id
            },
            success: function (data) {
                if( data != 'NO' ){
                    
                    var json = $.parseJSON(data);
                    waht = this.remember.what;
                    cid = this.remember.cid;
                    var d = new Date();
                    id = d.getTime();
                    $(" <div />" )
                        .attr( "id", id)
                        .addClass( "hbcFeedContent" )
                        .html( json.body )
                        .appendTo( jQuery( "#" + this.remember.what ) );
                    var toSlide = $('#current' + this.remember.what + 'Id').val();
                    $('#' + toSlide).slideUp('slow', function(){
                        $('#' + cid).remove();
                    });
                    $('#current' + element + 'Id').val(id);
                    $('#current' + waht + 'Title').html(json.title);
                }
            }
        });    
}    

$(document).ready(function() {        
    
    
    
    $("#socialBlock").everyTime(5000,function(i) {
       getLastFeed( 'social', $('#current' + this.id + 'Id').val(), this.id);        
    });
    
    $("#internalBlock").everyTime(7000,function(i) {
       getLastFeed( 'internal', $('#current' + this.id + 'Id').val(), this.id);        
    });
    
    $("#dealBlock").everyTime(9000,function(i) {
       getLastFeed( 'deal', $('#current' + this.id + 'Id').val(), this.id);        
    });
    
    $(".btnVideoDemo").makeFadeRollOver();
    
    
});
