/* Function for get an ad from a list into the user favorites */
function add_favorite(id)
{
    if (id) {
        $('#fav'+id).attr('src', '/zimio/img/mini-spinner.gif');

        $.ajax({
            url: '/node/favorite/id/'+id,
            success: function(html) {
                if (html=='1') {
                    $('#'+id).addClass('favorite');
                    $('#fav'+id).attr('src', '/zimio/css/img/btn-favorite.gif');
                } else {
                    $('#'+id).removeClass('favorite');
                    $('#fav'+id).attr('src', '/zimio/css/img/btn-favorite-off.gif');
                }
            }
        });
    }
}

/* Function to close the recent news */
function recent_news(id) {
    $.get('/user/shownews/id/' + id);
    $('#novedades').fadeOut(500, function () {$('#novedades').remove()});
}

function popupSafari(url) {

    var w = 600;
    var h = 450;
    var left = (screen.width/2)-(w/2);
    var top = (screen.height/2)-(h/2);

    window.open (url, 'Zimio - BetaID', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);

    return false;
}