/* Code for the commercial breaks */
function hideDiv() {
    //document.getElementById('popupObject').style.visibility = 'hidden';
    //document.getElementById('popFrame').style.visibility = 'hidden';

    document.getElementById('popupObject').style.display = 'none';
    document.getElementById('popFrame').style.display = 'none';

    document.getElementById('html_id').style.overflow = 'auto';
}
    
function showDiv() {
    document.getElementById('popupObject').style.display = '';
    document.getElementById('popFrame').style.display = '';
}

//window.onload = function () {
function loadCommercial () {
window.setTimeout("hideDiv()",10000);
//alert(document.getElementById('commercial').innerHTML);

	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

    var str = document.getElementById('commercial').innerHTML;
    
    if (str.indexOf("empty") == -1) {
	    if (hasRightVersion) {
        //	self.resizeTo(screen.availWidth, screen.availHeight);
        	
            document.getElementById('html_id').style.overflow = 'hidden'; 
	        document.getElementById('popupObject').style.display = 'block';

	        var totWidth, totHeight;
	        var winWidth, winHeight;

	        //get the width and height of the document
	        var test1 = document.body.scrollHeight;
	        var test2 = document.body.offsetHeight

	        if (test1 > test2) {
		        totWidth = document.body.scrollWidth;
		        totHeight = document.body.scrollHeight;
	        } else {
		        totWidth = document.body.offsetWidth;
		        totHeight = document.body.offsetHeight;
	        }

	        //get the width and height of the window
	        if (self.innerHeight) {
		        winWidth = self.innerWidth;
		        winHeight = self.innerHeight;
	        } else if (document.documentElement && document.documentElement.clientHeight) {
		        winWidth = document.documentElement.clientWidth;
		        winHeight = document.documentElement.clientHeight;
	        } else if (document.body) {
		        winWidth = document.body.clientWidth;
		        winHeight = document.body.clientHeight;
	        }

            var leftAdjustment = .5;
            var topAdjustment = .1;
            
	        padLeft = (winWidth - 550) * leftAdjustment;
	        padTop = (winHeight - 480) * topAdjustment;
    	    
	        if (padTop < 0) padTop = 10;

        //  padRight = padLeft + (totWidth - winWidth);
        //  padBottom = padTop + (totHeight - winHeight);


            if (totWidth > winWidth) padRight = totWidth - 550 - padLeft;
            else padRight = winWidth - 550;

            if (totHeight > winHeight) padBottom = totHeight - 480 - padTop;
            else padBottom = winHeight - 480;

            //document.getElementById('popFrame').style.height=totHeight + 'px';
            //document.getElementById('popFrame').style.width=totWidth + 'px';

	        document.getElementById('popupObject').style.left=0;
	        document.getElementById('popupObject').style.top=0;

	        document.getElementById('comm_mast').style.paddingLeft=padLeft + 'px';
	        document.getElementById('comm_mast').style.paddingRight=padRight + 'px';
	        document.getElementById('comm_mast').style.paddingTop=padTop + 'px';
	        document.getElementById('comm_mast').style.paddingBottom='0px';

	        document.getElementById('commercial').style.paddingLeft=padLeft + 'px';
	        document.getElementById('commercial').style.paddingRight=padRight + 'px';
	        document.getElementById('commercial').style.paddingTop='0px';
	        document.getElementById('commercial').style.paddingBottom=padBottom + 'px';
	    }
    } else document.getElementById('popFrame').style.display = 'none';
}