// Firefox
/*
if	(window.innerHeight && window.scrollMaxY) {
	var pageWidth  = window.innerWidth + window.scrollMaxX;
	var pageHeight = window.innerHeight + window.scrollMaxY;
}

// works in Explorer 6 Strict, Mozilla (not FF) and Safari
else {
	var pageWidth  = document.body.offsetWidth + document.body.offsetLeft;
	var pageHeight = document.body.offsetHeight + document.body.offsetTop;
}



*/

function resizeMask() {
	if (document.all) {
		var xMax = document.body.clientWidth;
		var yMax = document.body.clientHeight;
		document.getElementById("darkMask").style.width  = xMax + "px";
		document.getElementById("darkMask").style.height = yMax + "px";
	}
}

function centerPopup(theDiv) {
	var height = parseInt(document.getElementById(theDiv).style.height);
	var width  = parseInt(document.getElementById(theDiv).style.width);
	
	if (document.all) {
		var xMax = document.body.clientWidth;
		var yMax = document.body.clientHeight;
	}
	else {
		var xMax = window.innerWidth;
		var yMax = window.innerHeight;
	}
	
	var posX = Math.round((xMax-width)/2);
	var posY = Math.round((yMax-height)/2);
	
	document.getElementById(theDiv).style.top  = posY + "px";
	document.getElementById(theDiv).style.left = posX + "px";
}

var theVideoDivContent = "";
	
function showVideo(theVideo) {
	
	// hide main video player, replace it with static image
	document.getElementById("flashvideo").innerHTML = "<img src='http://www.cisco.com/assets/global/IRE/yourcountryyourcall/vid/president.jpg' />";
	
	// activate dark mask
	document.getElementById("darkMask").style.display = "block";
	
	// center video popup, show it
	centerPopup("popupVideo");
	document.getElementById("popupVideo").style.display = "block";
	
	var sVid = new SWFObject("http://www.cisco.com/cdc_content_elements/flash/video-player/mediaplayer.swf","videoPlayerOver","398","244","8");
	sVid.addParam("allowfullscreen","true");
	sVid.addVariable("width","398");
	sVid.addVariable("height","244");
	// sVid.addVariable("captions","http://www.cisco.com/assets/global/IRE/yourcountryyourcall/vid/" + theVideo + ".xml");
	sVid.addVariable("callback","true");
	sVid.addVariable("file","http://www.cisco.com/assets/global/IRE/yourcountryyourcall/vid/" + theVideo + ".flv");
	sVid.addVariable("image","http://www.cisco.com/assets/global/IRE/yourcountryyourcall/vid/" + theVideo + ".jpg");
	sVid.addVariable("pagename","");
	sVid.addVariable("videoname","");
	sVid.addVariable("countrycode","IRE");
	sVid.addVariable("wmode","transparent");
	sVid.write("popupVideoDiv");
}

function hideVideo() {
	// empty popupVideoDiv for IE 7
	document.getElementById("popupVideoDiv").innerHTML = "";

	// hide main video popup
	document.getElementById("popupVideo").style.display = "none";

	// hide dark mask
	document.getElementById("darkMask").style.display = "none";

	// reload default video
	var sVid = new SWFObject("http://www.cisco.com/cdc_content_elements/flash/video-player/mediaplayer.swf","videoplayer","398","244","8");
	sVid.addParam("allowfullscreen","true");
	sVid.addVariable("width","398");
	sVid.addVariable("height","244");
	sVid.addVariable("captions","http://www.cisco.com/assets/global/IRE/yourcountryyourcall/vid/president.xml");
	sVid.addVariable("callback","true");
	sVid.addVariable("file","http://www.cisco.com/assets/global/IRE/yourcountryyourcall/vid/president.flv");
	sVid.addVariable("image","http://www.cisco.com/assets/global/IRE/yourcountryyourcall/vid/president.jpg");
	sVid.addVariable("pagename","");
	sVid.addVariable("videoname","");
	sVid.addVariable("countrycode","IRE");
	sVid.addVariable("wmode","transparent");
	sVid.write("flashvideo");
}

