function grayOut(vis) {
    var dark=document.getElementById('darkenScreenObject');
    var overlay=$('overlayObject');

    if (dark && overlay) {
	if (vis) {
	    // Calculate the page width and height
	    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
		var pageWidth = document.body.scrollWidth+30+'px';
		var pageHeight = document.body.scrollHeight+30+'px';
	    } else if( document.body.offsetWidth ) {
		var pageWidth = document.body.offsetWidth+'px';
		var pageHeight = document.body.offsetHeight+'px';
	    } else {
		var pageWidth='100%';
		var pageHeight='100%';
	    }
	    //set the shader to cover the entire page and make it visible.
	    dark.style.width= pageWidth;
	    dark.style.height= pageHeight;
	    dark.style.display='block';
	    overlay.style.display='block';

	    if (Prototype.Browser.IE)  {
		var pageWidthValue = document.body.offsetWidth;
	    }
	    else {
		var pageWidthValue = window.innerWidth;
	    }
	    var pageHeightValue = 650;

	    var mleft = (pageWidthValue - overlay.clientWidth) / 2;
	    overlay.style.left = mleft > 0 ? (mleft + 'px') : '0px';
	    var mtop = (pageHeightValue - overlay.clientHeight) / 2;
	    overlay.style.top = mtop > 0 ? (mtop + 'px') : '0px';
	} else {
	    dark.style.display='none';
	    overlay.style.display='none';
	    var oldHTML = overlay.innerHTML;
	    overlay.innerHTML = '';
	    overlay.innerHTML = oldHTML;
	    window.onResize = '';
	}
    }
}

function reloadNow() {
    var dark=document.getElementById('darkenScreenObject');
    if (dark && dark.style.display != 'none') {
	// Calculate the page width and height
	if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
	    var pageWidth = document.body.scrollWidth+30+'px';
	    var pageHeight = document.body.scrollHeight+30+'px';
	} else if( document.body.offsetWidth ) {
	    var pageWidth = document.body.offsetWidth+'px';
	    var pageHeight = document.body.offsetHeight+'px';
	} else {
	    var pageWidth='100%';
	    var pageHeight='100%';
	}

	dark.style.width= pageWidth;
	dark.style.height= pageHeight;
    }

    var overlay=$('overlayObject');
    if (overlay && overlay.style.display != 'none') {
	if (Prototype.Browser.IE) {
	    var pageWidthValue = document.body.offsetWidth;
	}
	else {
	    var pageWidthValue = window.innerWidth;
	}
	var pageHeightValue = 650;

	var mleft = (pageWidthValue - overlay.clientWidth) / 2;
	overlay.style.left = mleft > 0 ? (mleft + 'px') : '0px';
	var mtop = (pageHeightValue - overlay.clientHeight) / 2;
	overlay.style.top = mtop > 0 ? (mtop + 'px') : '0px';
    }
}

function selectVideo(active_id, inactive_id, src) {
    //    $('video_content').innerHTML = "";

    var flashvars = {
	playList: src
    };
    var params = {
	allowfullscreen: 'true',
	allowscriptaccess: 'true'
    };
    var attributes = {
    };

    swfobject.embedSWF("/template/swf/fPlayerEx.swf", "vContent", "780", "460", "10.0.0", "/template/swf/expressInstall.swf", flashvars, params, attributes);


    //    $('video_content').innerHTML = '<iframe src="' + src + '" smartsize="true" frameborder="false" scrolling="no" height="480" width="815" style="border: 0px;z-index:100;"></iframe>';


    if (inactive_id != '')
        $(inactive_id).removeClassName('active');

    if (active_id != '')
        $(active_id).addClassName('active');
}
