
//Set g_intPageScroll Y page scroll value
function getPageScroll()
{
    if (self.pageYOffset) {
        g_intPageScroll = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop){
        // Explorer 6 Strict
        g_intPageScroll = document.documentElement.scrollTop;
    } else if (document.body) {
        // all other Explorers
        g_intPageScroll = document.body.scrollTop;
    }
    return g_intPageScroll;
}

//Set page width, height and window width, height
function getPageSize()
{
    if (window.innerHeight && window.scrollMaxY) {	
        g_intXScroll = document.body.scrollWidth;
        g_intYScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ 
        // all but Explorer Mac
        g_intXScroll = document.body.scrollWidth;
        g_intYScroll = document.body.scrollHeight;
    } else { 
        // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        g_intXScroll = document.body.offsetWidth;
        g_intYScroll = document.body.offsetHeight;
    }
	
    var g_intWindowWidth, g_intWindowHeight;
    if (self.innerHeight) {
        // all except Explorer
        g_intWindowWidth = self.innerWidth;
        g_intWindowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { 
        // Explorer 6 Strict Mode
        g_intWindowWidth = document.documentElement.clientWidth;
        g_intWindowHeight = document.documentElement.clientHeight;
    } else if (document.body) { 
        // other Explorers
        g_intWindowWidth = document.body.clientWidth;
        g_intWindowHeight = document.body.clientHeight;
    }	
	
    // for small pages with total height less then height of the viewport
    if(g_intYScroll < g_intWindowHeight)
        g_intPageHeight = g_intWindowHeight;
    else
        g_intPageHeight = g_intYScroll;

    // for small pages with total width less then width of the viewport
    if(g_intXScroll < g_intWindowWidth){	
        g_intPageWidth = g_intWindowWidth;
    } else {
        g_intPageWidth = g_intXScroll;
    }
	
    var l_aryPageSize = new Array(g_intPageWidth,g_intPageHeight,g_intWindowWidth,g_intWindowHeight) 
    return l_aryPageSize;
}

function MovieLightBox(p_strFilename) {
    var l_intMovieHeight = 360;
    var l_intMovieWidth = 480;
    var l_strHTML = '';
    l_strHTML +=  '<object style="height:' + l_intMovieHeight + 'px;width:' + l_intMovieWidth +'px;display:block;" height="' + l_intMovieHeight +'" width="' + l_intMovieWidth +'" type="application/x-shockwave-flash" data="/Include/W3sFlvplayer.swf" >';
    l_strHTML +=  '<param name="movie" value="/Include/W3sFlvplayer.swf" />';
    l_strHTML +=  '<param name="enabled" value="1" />';
    l_strHTML +=  '<param name="flashvars" value="file=' + p_strFilename + '&autostart=true" />';
    l_strHTML +=  '<param name="wmode" value="transparent" />';
    l_strHTML +=  '<param name="bgcolor" value="#000000" />';
    l_strHTML +=  '<param name="quality" value="high" />';
    l_strHTML +=  '<param name="scale" value="noscale" /></object>';
    
    var l_objBody = document.getElementsByTagName("body").item(0);
    //Create Overlay
    if(document.getElementById('Overlay')) {
        var l_objOverlay = document.getElementById('Overlay');
        var l_objLightBox = document.getElementById('LightBox');
        
    } else {
        var l_objOverlay = document.createElement("div");
        l_objOverlay.setAttribute('id','Overlay');
        l_objOverlay.style.position = 'absolute';
        l_objOverlay.style.backgroundColor = '#a4a4a4';
        l_objOverlay.style.top = '0';
        l_objOverlay.style.left = '0';
        l_objOverlay.style.zIndex = '300';
        l_objOverlay.style.width = '100%';
        l_objOverlay.onclick=function(){document.getElementById('Overlay').style.display='none';document.getElementById('LightBox').style.display='none';};
        l_objBody.insertBefore(l_objOverlay, l_objBody.firstChild);
        SetOpacity(l_objOverlay, 6);
         //Create LightBox
        var l_objLightBox = document.createElement("div");
        l_objLightBox.setAttribute('id','LightBox');
        l_objLightBox.style.position = 'absolute';
        l_objLightBox.style.zIndex = '310';	
        l_objLightBox.innerHTML = l_strHTML;
        l_objBody.insertBefore(l_objLightBox, l_objOverlay.nextSibling);
	}
	l_objOverlay.style.display = 'block';
	l_objLightBox.style.display = 'block';
	
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll + ((arrayPageSize[3] - 35 - l_intMovieHeight) / 2) - 35;
    var lightboxLeft = ((arrayPageSize[0] - l_intMovieWidth) / 2) - 15;
    l_objOverlay.style.height = (g_intPageHeight + 'px');
    l_objLightBox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
    l_objLightBox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";
}
