function getPageSize(){

	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

objFlashOverlay = document.getElementById('flashOverlay');
objFlashContainer = document.getElementById('flashContainer');

function detectMacXFF() {
	var userAgent = navigator.userAgent.toLowerCase();
	if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
		return true;
	}
}

var d = detectMacXFF();
if (d) {
	//osx ff css opacity + flash wmode transparent doesn't work
	objFlashOverlay.style.backgroundImage= "url(/images/overlay.png)";
	objFlashOverlay.style.backgroundRepeat="repeat";
} else {
	objFlashOverlay.style.backgroundColor = "#000";
	objFlashOverlay.style.MozOpacity = .75;
	objFlashOverlay.style.opacity = .75;
	objFlashOverlay.style.filter = "alpha(opacity=75)";
}
  
function openVideo(videoURL) {
	so.addParam("wmode", "transparent");
	so.addVariable("videoURL", videoURL);
	so.write("flashContent");
	getPageSize();
	objFlashOverlay.style.height = arrayPageSize[1]+'px';
	objFlashOverlay.style.display = 'block';
	objFlashContainer.style.display = 'block';
};
function closeVideo() {
	so.addVariable("videoURL", null);
	so.write("flashContent");
	objFlashOverlay.style.display = 'none';
	objFlashContainer.style.display = 'none';
}
	
