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("CCSTATUS") == "on" && hasCaptions)?(parseInt(height)+52):height,
		extras:"",
		jumptotimecode:(jumpToTimeCode && typeof(jumpToTimeCode == 'string')) ?'&tc='+jumpToTimeCode:""};
		video.url = "http://movielibrary.lynda.com/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 = "http://movielibrary.lynda.com/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};
}

function readCookie(cookieName){
  var cookieValue = "";
  var search = cookieName + "=";
  if(document.cookie.length > 0){ 
    offset = document.cookie.indexOf(search);
    if (offset != -1){ 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end));
    }
  }
   return cookieValue;
}

function copyObjectProperties(setObj,getObj){
var err=null;var i;	
try{if(getObj && setObj){
	for(i in getObj){
	setObj[i] = getObj[i];}}}
catch(e){err=e;}
return (!err)? setObj : err;
}

function openWin2(url, width, height, opt1, opt2){
	if(opt1==null||opt2==null){opt1=0;opt2=1;}
	var win;
	var windowName;
	var params;
	windowName="btns";
	params="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+opt1+",resizable="+opt2+",top=50,left=50,width="+width+",height="+height;
	win=window.open(url, windowName, params);
}

function displayOff(nr){
	if (document.all)
		document.all[nr].style.display = 'none';
	else if (document.getElementById)
		document.getElementById(nr).style.display = 'none';
}

function displayOn(nr){
	if (document.all)
		document.all[nr].style.display = 'block';
	else if (document.getElementById)
		document.getElementById(nr).style.display = 'block';
}

var cvvWin;
function cvvOpenWin(u,id,f,df){
	if(eval(id)==null||eval(id+".closed")){
	eval(id+"=window.open('"+u+"','"+id+"','"+f+"')");eval(id+".focus()");}
	else if(df){eval(id+".focus()");}
	else{eval(id+"=window.open('"+u+"','"+id+"','"+f+"')");eval(id+".focus()");}
}

function P7_swapClass(){ //v1.4 by PVII
 var i,x,tB,j=0,tA=new Array(),arg=P7_swapClass.arguments;
 if(document.getElementsByTagName){for(i=4;i<arg.length;i++){tB=document.getElementsByTagName(arg[i]);
  for(x=0;x<tB.length;x++){tA[j]=tB[x];j++;}}for(i=0;i<tA.length;i++){
  if(tA[i].className){if(tA[i].id==arg[1]){if(arg[0]==1){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}else{tA[i].className=arg[2];}
  }else if(arg[0]==1 && arg[1]=='none'){if(tA[i].className==arg[2] || tA[i].className==arg[3]){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}
  }else if(tA[i].className==arg[2]){tA[i].className=arg[3];}}}}
}
end=('</a>')
MultiUserOnline=('<a href="http://apex.vtc.com/alltitles.php" rel=\"nofollow\">')
CompanyTrainingCd=('<a href="company-training-cd.htm" rel=\"nofollow\">')