
// variabili Globali
var sKeyFlowplayer = "#$91894130ddfaad64cf2";

function setFlowplayerHP(_id, _url) {
    setFlowplayer(_id, _url, "320", "240");
}

function setFlowplayerFondazione(_id, _url) {
    setFlowplayer(_id, _url, "580", "435");
}

function setFlowplayerDetails(_id, _url) {
    setFlowplayer(_id, _url, "580", "435");
}

function setFlowplayer(_id, _url, _width, _height) {
    if (HTML5isSupported()) {
        $('#' + _id).html('<video width="' + _width + '" height="' + _height + '" controls="controls" preload="auto" src="' + _url + '"></video>');
    } else {
        $('#' + _id).css({ 'width': _width + 'px' });
        $('#' + _id).css({ 'height': _height + 'px' });
        $f(_id, "../swf/flowplayer.commercial-3.2.7.swf", {
            clip: {
                url: _url,
                autoPlay: false,
                autoBuffering: true
            },
            key: sKeyFlowplayer
        });
    }
}


function setFlowplayer(_id, _url, _width, _height) {
    if (HTML5isSupported()) {
        $('#' + _id).html('<video width="' + _width + '" height="' + _height + '" controls="controls" preload="auto" src="' + _url + '"></video>');
    } else {
        $('#' + _id).css({ 'width': _width + 'px' });
        $('#' + _id).css({ 'height': _height + 'px' });
        $f(_id, "../swf/flowplayer.commercial-3.2.7.swf", {
            clip: {
                url: _url,
                autoPlay: false,
                autoBuffering: true
            },
            key: sKeyFlowplayer
        });
    }
}

function HTML5isSupported() {
    if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))
        return true;
    else
        return false;
}
