//Begin pop up window
var mainMovieWindow = null;
function popUpMovie(theUrl){
		var minWidth = 491;
		var minHeight = 415;
		var maxWidth = 491;
		var maxHeight = 415;
		var tempScreenWidth = (screen.width == null) ? minWidth : screen.width;
		var tempScreenHeight = (screen.height == null) ? minHeight : screen.height;
		var screenWidth = (tempScreenWidth < maxWidth) ? tempScreenWidth : maxWidth;
		var screenHeight = (tempScreenHeight < maxHeight) ? tempScreenHeight : maxHeight;
		
		settings = "height="+Math.round(screenHeight*.95)+",width="+Math.round(screenWidth*.99)+",toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,left=0,top=0,screenX=0,screenY=0"
		mainMovieWindow=window.open(theUrl,"theMovie"+new Date().getTime(),settings);
}
//this is used to fix pop up blocker issues
function popUpMovieFix(theUrl){
	if (mainMovieWindow && !mainMovieWindow.closed && mainMovieWindow.open) {
		mainMovieWindow.focus();
	}else if(mainMovieWindow && isSafari() && mainMovieWindow.open) {
		mainMovieWindow.focus();
	}else{ //start timer
		popUpMovie(theUrl);//try putting this window up again
		setTimeout("whichWayToView()", 1000);
	}
}
function whichWayToView(){
	if (mainMovieWindow && !mainMovieWindow.closed && mainMovieWindow.open) {
		mainMovieWindow.focus();
	}else if(mainMovieWindow && isSafari() && mainMovieWindow.open) {
		mainMovieWindow.focus();
	}else{ //start timer
		//clearInterval(ourInterval);
		top.location.href = 'video.html';
	}
}

function popUpDelay(theUrl){
		setTimeout("popUpMovieFix()", 2000,theUrl);
}
//Check for Safari
function isSafari() {
	agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	 //MAC CHECK
	this.mac = (agent.indexOf("mac")!=-1);
	// MAC SAFARI
	this.safari = (this.mac && (agent.indexOf("safari")!=-1));
	return this.safari;

}

