﻿function ShowFlashVideoBox(vidid, width, height) {
    FlashVideo(width, height);
    DisplayFlash2(vidid, width, height, 'FlashVideoContainer', '/layouts/OxygenSoftware.Sitecore.FlashVideo/flashplayer/mediaplayer.swf'); 
}

function FlashVideo(width, height) {
    var divToShowBackground = document.getElementById('divLightBoxBackgroundFlash');
    divToShowBackground.style.display = '';
    /*var flasharea1 = document.getElementById('flash-area1');
    flasharea1.style.visibility = 'hidden';*/
    try {
        var the_height = parseInt(window.innerHeight, 10);
        divToShowBackground.style.height = the_height + 100 + 'px';
    }
    catch (e) {
        var the_height = parseInt(document.getElementsByTagName('body')[0].clientHeight, 10);
        divToShowBackground.style.height = the_height + 100 + 'px';
    }

    var header = document.getElementById('FlashVideoHeader');
    header.style.left = '320px';
    header.style.top = '120px';
    header.style.width = width+'px';
    
   
    try {
        var height = parseInt(height, 10) + 25;
        var top = parseInt((window.innerHeight - height) / 2, 10);
        //header.style.top = top;
        header.style.top = top + 'px';

        //var width = parseInt(width, 10) + 25;
        var width = parseInt(width, 10);

        var left = parseInt((window.innerWidth - width) / 2, 10);

        //header.style.left = left;
        header.style.left = left + 'px';
        //FF
        scrollTo(0, 0);
    } catch (e) {
        var viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
        var viewportheight = document.getElementsByTagName('body')[0].clientHeight;
        var height = parseInt(height, 10) + 25;
        var top = parseInt((viewportheight - height) / 2, 10);
        header.style.top = top;
        header.style.offset

        //var width = parseInt(width, 10) + 25;
        var width = parseInt(width, 10);

        var left = parseInt((viewportwidth - width) / 2, 10);
        header.style.left = left;
        //IE
        scrollTo(0, top - 100);
    }

    header.style.width = width;
    header.style.display = 'block';
    header.style.zIndex = 50;
}

function CloseFlashLightBox() {
    var divToShowBackground = document.getElementById('divLightBoxBackgroundFlash');
    divToShowBackground.innerHTML = '';
    divToShowBackground.style.display = 'none';
    /*var flasharea1 = document.getElementById('flash-area1');
    flasharea1.style.visibility = 'visible';*/
}

function DisplayFlash2(videoid, width, height, flashContainer, flashPlayerPath) {
    var flashvars = {
        width: width,
        height: height,
        file: 'http%3a%2f%2fcontainer-centralen.oxygenbilledbank.dk%2fgetVideo.aspx%3fVID%3d' + videoid + '%26CID%3d12%26VT%3dflv',
        displayheight: height,
        displaywidth: width,
        javascriptid: 'jstest',
        enablejs: true,
        type: 'flv',
        autostart: true
    };
    var params = {
        allowscriptaccess: "always",
        allowfullscreen: "true"
    };
    var attributes = {};
    swfobject.embedSWF(flashPlayerPath, flashContainer, width, height, "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}

