﻿// JScript File
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function showVideo(video_id, default_url) {
    var video_icon = document.getElementById("VP_VIDEO_ICON_" + video_id);
    var video_object = document.getElementById("VP_VIDEO_OBJECT_" + video_id);
    if (video_icon == null | video_object == null) {
        if (default_url.length > 0)
            window.location = default_url;
        else
            alert('Si è verificato un errore. Verifica se hai abilitato javascript.\nScrivi a byoblu@byoblu.com se l\'errore persiste.');
        return;
    }
    video_icon.style.display = 'none';
    video_object.style.display = '';


   // var isIE = (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent));
   // if (isIE) {
        if (typeof (pauseSlider) != "undefined") {
            if (pauseSlider != null) {
                pauseSlider = true;
            }
        } 
    //}

    }

function NewShowVideo(video_id, default_url, url, w, h) {
    var video_icon = document.getElementById("VP_VIDEO_ICON_" + video_id);
   // var video_object = document.getElementById("VP_VIDEO_OBJECT_" + video_id);
    //if (video_icon == null | video_object == null) {
    if (video_icon == null) {
        if (default_url.length > 0)
            window.location = default_url;
        else
            alert(KEYVideoImageNotFound);
        return;
    }
    var flashvars_video = {};
    var params_video = { wmode: 'transparent', menu: "false", allowfullscreen: 'true', allowscriptaccess: 'always' };
    var attributes_video = {};
    swfobject.embedSWF(url, video_id, w, h, "9.0.0", "/widgets/Browse%20Page/expressInstall.swf", flashvars_video, params_video, attributes_video);

    video_icon.style.display = 'none';
    if (typeof (pauseSlider) != "undefined") {
        if (pauseSlider != null) {
            pauseSlider = true;
        }
    }
}

function caricaUrl(url) {
}

function ShowPrivacy(check) {

    if (check != null) {
        if (check.checked)
            window.open("/page/privacy.aspx", "privacy");
    }
    else
        window.open("/page/privacy.aspx", "privacy");
}

/* Funzione per aumentare-diminuire font articolo */

ok = (document.styleSheets) ? 1 : 0;

function fontUp() {
    if (ok) {
        var size = document.getElementById('postBody').style.fontSize.substring(0, 2)
        var dimFont = parseInt(size, 10)

        if (isNaN(dimFont)) { dimFont = 16; }
        dimFont += 1;
        {
            if (dimFont > 20) dimFont = 20;
        }
        document.getElementById('postBody').style.fontSize = dimFont + 'px';
    }

}

function fontDown() {
    if (ok) {
        var size = document.getElementById('postBody').style.fontSize.substring(0, 2)
        var dimFont = parseInt(size, 10)

        if (isNaN(dimFont)) { dimFont = 16; }
        dimFont -= 1;
        {
            if (dimFont < 11) dimFont = 11;
        }
        document.getElementById('postBody').style.fontSize = dimFont + 'px';
    }

} 

/* Facebook sharer 
function fbs_click(url) {
    u=url;
    alert(u);
    window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u), 'sharer', 'toolbar=0,status=0,width=626,height=436');
    return false;
}
*/
function openPopup(urlpopup, nomepopup, w, h, settingspopup) {
    var x = (screen.width - w) / 2;
    var y = (screen.height - h) / 2 - 20;
    if (x < 0) x = 0;
    if (y < 0) y = 0;
    if (w > screen.width) w = screen.width;
    if (h > screen.height) h = screen.height;
    var settings = 'top=' + y + ',left=' + x + ',width=' + w + ',height=' + h + ',' + settingspopup;
    var popup = window.open(urlpopup, nomepopup, settings);
    popup.focus();
}
function printPost(link) {
    var w = 578;
    var h = 530;
    var settings = 'location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=no,fullscreen=no';
    openPopup(link, 'link', w, h, settings);
}


