var arrExtras = new Array(0);

function popupOTL(courseID,videoID,watchID,width,height,hasCaptions,jumpToTimeCode){
	var video = {course:courseID,id:videoID,scrollbar:0,width:width,
		height:(readCookie("showcaptions") == "yes" && hasCaptions)?(parseInt(height)+52):height,
		extras:"",
		jumptotimecode:(jumpToTimeCode && typeof(jumpToTimeCode == 'string')) ?'&tc='+jumpToTimeCode:""};
		video.url = "/html/player/?id="+video.id+video.jumptotimecode+'&height='+video.height+'&width='+video.width;

	var loading = (readCookie('ISSUES') == 'true');
	var adjust = (loading)?doExtras(popupWindow,width,height):false;
	if(typeof(adjust == "object")){
		copyObjectProperties(video,adjust);
	}
	video.url = "/html/player/?id="+video.id+video.jumptotimecode+'&height='+video.height+'&width='+video.width;
	var popupWindow = popupVideo(video.url,'player'+video.course,video.width,video.height,video.scrollbar);	
return	popupWindow;
}

function setWatched(obj){
	if(obj){obj.className = 'viewedMovie';}
	return false;
}


function popupVideo(url,popup,width,height,sb){
var popupWindow = (window.open(url,popup,'height=' + height + ',width=' + width + ',menubar=0,resizable=1,scrollbars='+sb+',toolbar=0,status=0'));
	if(window.focus){popupWindow.focus()};
return popupWindow;	
}


function doExtras(popupWindow,width,height){
var sbw = (typeof(readCookie('POPUP.SCROLLBAR')) != 'undefined')? readCookie('POPUP.SCROLLBAR') : 0;
// DO ANY OTHER WINDOW SIZE ADJUSTMENTS
var	w = (sbw > 0)?(parseInt(width)+parseInt(sbw)):width;
var sb=(sbw > 0)?1:0;
return {width:w,scrollbar:sb};	
}

function getWindowSize(popupWindow){
 var obj = (popupWindow)? popupWindow: window;
 var w = 0;
 var h = 0;
	if(obj.innerWidth){
		w=obj.innerWidth;
		h=obj.innerHeight;
	}
 	else{
		var docElement = (obj.document.documentElement && obj.document.documentElement.clientWidth && obj.document.documentElement.clientWidth != 0);
	w=(docElement)?obj.document.documentElement.clientWidth:obj.document.getElementsByTagName('body')[0].clientWidth;
	h=(docElement)?obj.document.documentElement.clientHeight:obj.document.getElementsByTagName('body')[0].clientHeight;
 	}
return {width:w,height:h};
}