var mediaPlayer;

function openMediaWindow(name, url, width, height, properties) {
	var left = (screen.availWidth - width) / 2; 
	var top = (screen.availHeight - height) / 2;
	if (height == screen.availHeight) {
		top = 0;
		height -= 60;
		width -= 10;
	}
	properties += (properties) ? "," : "";
	properties += "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + ",screenX=" + top + ",screenY=" + left;
	mediaPlayer = window.open(url, name, properties);
	mediaPlayer.focus();
}

function launchMedia(mediaId, mediaPlayer) {
	var width = "557";
	var height = "555";
	var	url = "/Products/media?c=mediachallenge&mediaId=" + mediaId + "&mediaPlayer=" + mediaPlayer;
	if (location.href.indexOf("http://go.veritas.com") >= 0 || location.href.indexOf("backupexec.com") >= 0) {
		url = "http://www.veritas.com" + url;
	}
	if (mediaPlayer == "E") {
		width = "770";
		height = "552";
	}
	openMediaWindow("popup", url, width, height, "location=0,toolbar=0,status=0,menubar=0,resizable=1");
}

function launchFlash(filePath) {
	if (filePath.indexOf("http") != 0) {
		filePath = "http://eval.veritas.com/mktginfo" + filePath;
	}
	openMediaWindow("flash", filePath, screen.availWidth, screen.availHeight, "location=0,toolbar=0,status=0,menubar=0,resizable=1");
}
