function getPageSize() {
               
                var isIE;
                if(navigator.appName.indexOf('Internet Explorer') > -1){
                                isIE = true;
                }else{
                                isIE = false;
                }
    var e = document,
    i = window,
    k = e.compatMode && e.compatMode != "BackCompat" ? e.documentElement: e.body;
    var g = e.body;
    var l = (i.innerWidth && i.scrollMaxX) ? i.innerWidth + i.scrollMaxX: Math.max(g.scrollWidth, g.offsetWidth),
    f = (i.innerHeight && window.scrollMaxY) ? i.innerHeight + i.scrollMaxY: Math.max(g.scrollHeight, g.offsetHeight),
    h = isIE ? k.scrollWidth: (e.documentElement.clientWidth || self.innerWidth),
    c = isIE ? Math.max(k.scrollHeight, k.clientHeight) : (e.documentElement.clientHeight || self.innerHeight);
    var a = isIE ? k.clientWidth: (e.documentElement.clientWidth || self.innerWidth),
    j = isIE ? k.clientHeight: self.innerHeight;
    return {
        pageWidth: Math.max(h, l),
        pageHeight: Math.max(c, f),
        width: a,
        height: j,
        scrollLeft: isIE ? k.scrollLeft: pageXOffset,
        scrollTop: isIE ? k.scrollTop: pageYOffset
    }
}
 
 
 
// This creates the player and populates the content with the video
function createPlayer(_movie, _streamer) {
               
    _movie = _movie || '';
    _streamer = _streamer || '';
 
                if(_movie == '' || _movie == 'swf-player.swf') {
        _movie = '/videos/FinancialEngines_16x9.flv';
 
        // Turn off streamer for default movie
        _streamer = '';
    }
 
    jwplayer('videoSWF').setup({
        // JWPlayer SWF file
        flashplayer:  '/videos/com/jwplayer/player.swf',
 
        // Streamer created in Amazon CloudFront
        // For example: 'rtmp://s2nl7gho79pks.cloudfront.net/cfx/st/'
        streamer:     _streamer,
 
        // Movie URL, or file name if the movie is streamed
        file:         _movie,
 
        autostart:    'true',
        screencolor:  '000000',
        height:       '360',
        width:        '640',
        js_api:       1,
        controlbar:   {
            position: 'bottom'
        }
    });
 
    //jwplayer('videoSWF').play();
}
 
 
// Example:
//
// Standalone video:
// loadVideo("https://s3.amazonaws.com/fevideotest/FEIncomePlus022411.flv")
//
// Streamed video:
// loadVideo("FEIncomePlus022411.flv", "rtmp://s2nl7gho79pks.cloudfront.net/cfx/st/")
function loadVideo(_video, _streamer)
{
    _video = _video || '';
    _streamer = _streamer || '';
 
                try{
                                if(navigator.appName.indexOf('Internet Explorer') > -1 && navigator.appVersion.indexOf('MSIE 6') > -1){
                                                window.open('/videos/videoIE6.html?' + _video, '_blank', 'width=700,height=480');
                                                return;
                                }
                }catch(e){}
 
                var o = document.getElementById('videoTransBG');
                if(o){
                                o.style.height = getPageSize().pageHeight + 'px';
                                o.style.display = 'block';
                                o.style.zIndex = 100;
                                var p = document.getElementById('videoPlayer');
                                if(p){
                                                p.style.display = 'block';
                                                p.style.zIndex = 1000;
                                }
                }
                createPlayer(_video, _streamer);
                centerVideo();
 
                window.onresize = function(){ centerVideo(); };
               
}
 
function closeVideo(_video)
{
                var o = document.getElementById('videoTransBG');
                if(o){
                                o.style.display = 'none';
                                o.style.zIndex = 0;
                                var p = document.getElementById('videoPlayer');
                                if(p){
                                                p.style.zIndex = -1;
                                                //p.style.display = 'none';
                                }
                }
               
                stopMovie();
 
}
 
function startMovie() {
         jwplayer("videoSWF").play();
}
 
function stopMovie() {
        jwplayer("videoSWF").stop();
}
 
function centerVideo()
{
                var v = document.getElementById('videoPlayer');
               
                if(v){
                                //alert(((getPageSize().pageWidth / 2) + parseInt(v.style.width)) +"px")
                                v.style.left= ((getPageSize().width / 2) - (parseInt(v.style.width)/2) ) +"px";
                }
}
function hideObj(_video)
{
        var v = document.getElementById(_video);
        if(v){
            v.style.visibility = 'hidden';
        }
}
 
function showObj(_video)
{
        var v = document.getElementById(_video);
        if(v){
            v.style.visibility = 'visible';
        }
}
 
//loadVideo("/videos/does_it_work.flv")
//loadVideo("/videos/how_much_does_it_cost.flv")
