	var oBlanker;
	var oInfo;
	var oMyVid = document.getElementById('myvid');
	var oVidInfo = document.getElementById('vid_info');
	var oCloseButt = document.getElementById('close_butt');
	var oP1, oP2, oP3, oP4, oP5, oP6, oP7, oP8;
	var arData = new Array(), arTime = new Array(), arDL = new Array(), arIdx = new Array();
	var arThumbs = new Array();
	
	function setupParts() {
		oBlanker = document.getElementById('blanker');
		
		oMyVid = document.getElementById('myvid');
		oVidInfo = document.getElementById('vid_info');
		oCloseButt = document.getElementById('close_butt');

		oP1 = document.getElementById('p1');
		oP2 = document.getElementById('p2');
		oP3 = document.getElementById('p3');
		oP4 = document.getElementById('p4');
		oP5 = document.getElementById('p5');
		oP6 = document.getElementById('p6');
		oP7 = document.getElementById('p7');
		oP8 = document.getElementById('p8');
		
		arData[1] = 'Training Preview Videos';

		//lChapter = (lLesson * 8) + lChapter
		
		//Lesson 1 chapters
		arData[9] = 'Training Preview Videos';
		
		//Lesson 1, Chapter 1 topics
		arIdx[5] = ''; arData[5] = 'VanWrite&reg; Program Introduction';			arTime[5] = '[1:20]'; arDL[005] = 'd2ls71ck80lb59.cloudfront.net';		arThumbs[5] = 'd229rywax9tfo5.cloudfront.net';
		arIdx[6] = ''; arData[6] = 'High Impact Thinking Program Clips';			arTime[6] = '[2:26]'; arDL[006] = 'di6et0a00jyht.cloudfront.net';		arThumbs[6] = 'd3iprmv6ok4n1z.cloudfront.net';
		arIdx[7] = ''; arData[7] = 'Sentence Aerobics&reg; Program Clips';			arTime[7] = '[2:58]'; arDL[007] = 'd2lv68rap1svgw.cloudfront.net'; 		arThumbs[7] = 'dnm7lxq8w5bqz.cloudfront.net';
		arIdx[8] = ''; arData[8] = 'Software Preview';								arTime[8] = '[3:36]'; arDL[008] = 'dkckcfzlinriq.cloudfront.net';		arThumbs[8] = 'daq5qfob0feg3xxx.cloudfront.net';
		
		//showVideo(1, 1, 1);
		//alert(getPrevVideoInfo(1,2,1));
	}
	
	function showVideo(lLesson, lChapter, lTopic) {
		//NOTE incoming params are simple vals (i.e. 1,1,2 or 2,3,1 etc
		//	NOT full vals i.e. 1,9,81, etc

		oBlanker.style.display = 'block';	

		////Update current video as enabled/green
		//if (document.getElementById(gCurVideo)) {
		//	if (document.getElementById(gCurVideo).className != 'act_me') {
		//		document.getElementById(gCurVideo).className = 'hit_me';
		//		//document.getElementById(gCurVideo).onclick = function() { showVideo(parseInt(this.id.substr(0,1)), parseInt(this.id.substr(1,1)), parseInt(this.id.substr(2,1))); }
		//	}
		//}
		
		//Update proposed next video
		//if (gNextVideo < gMaxVideo) {
		//	if (document.getElementById(gNextVideo)) {
		//		document.getElementById(gNextVideo).className = 'hit_me';
		//		//document.getElementById(gNextVideo).onclick = function() { showVideo(parseInt(this.id.substr(0,1)), parseInt(this.id.substr(1,1)), parseInt(this.id.substr(2,1))); }
		//	}
		//} else {
		//	if (document.getElementById(gNextVideo)) {
		//		document.getElementById(gNextVideo).className = 'dis_me';
		//		//document.getElementById(gNextVideo).onclick = function() { showVideo(parseInt(this.id.substr(0,1)), parseInt(this.id.substr(1,1)), parseInt(this.id.substr(2,1))); }
		//	}
		//}
		
		
		//set new video to watch, now is current video
		gCurVideo = String(lLesson) + String(lChapter) + String(lTopic);
		if (gMaxVideo < gCurVideo) {
			gMaxVideo = gCurVideo;
		}
		
		////Update new video as current/blue
		//if (gCurVideo != gNextVideo) {
		//	if (document.getElementById(gCurVideo)) {
		//		document.getElementById(gCurVideo).className = 'cur_me';
		//		//document.getElementById(gCurVideo).onclick = function() { showVideo(parseInt(this.id.substr(0,1)), parseInt(this.id.substr(1,1)), parseInt(this.id.substr(2,1))); }
		//	}
		//}
		
		var lWidth = getWinWidth();
		var lHeight = getWinHeight();
		var lHScroll = getScrollTop();

		var lWidth2 = 720 + 20;						//video background
		var lHeight2 = (lHeight - (480 + 14 + 90)) / 2;
		
		oP1.style.backgroundColor = "#009940";
		oP1.style.top = lHeight2 + lHScroll + 'px';
		//oP2.style.top = lHeight2 + lHScroll + 'px';
		//oP3.style.top = lHeight2 + lHScroll + 'px';
		//oP4.style.top = lHeight2 + lHScroll + 'px';
		//oP5.style.top = lHeight2 + lHScroll + 'px';
		//oP6.style.top = lHeight2 + lHScroll + 'px';
		//oP7.style.top = lHeight2 + lHScroll + 'px';
		//oP8.style.top = lHeight2 + lHScroll + 'px';
			
		oP1.style.width = lWidth2 + 'px';
		//oP1.style.width = (lWidth2 * 0.22) + 'px';
		//oP2.style.width = (lWidth2 * 0.16) + 'px';
		//oP3.style.width = (lWidth2 * 0.08) + 'px';
		//oP4.style.width = (lWidth2 * 0.04) + 'px';
		//oP5.style.width = (lWidth2 * 0.04) + 'px';
		//oP6.style.width = (lWidth2 * 0.08) + 'px';
		//oP7.style.width = (lWidth2 * 0.16) + 'px';
		//oP8.style.width = (lWidth2 * 0.22) + 'px';

		oP1.style.display = 'block';
		//oP2.style.display = 'block';
		//oP3.style.display = 'block';
		//oP4.style.display = 'block';
		//oP5.style.display = 'block';
		//oP6.style.display = 'block';
		//oP7.style.display = 'block';
		//oP8.style.display = 'block';
			
		oP1.style.left = (lWidth - lWidth2) / 2 + 'px';
		//oP2.style.left = oP1.offsetLeft + oP1.offsetWidth + 0 + 'px';
		//oP3.style.left = oP2.offsetLeft + oP2.offsetWidth + 0 + 'px';
		//oP4.style.left = oP3.offsetLeft + oP3.offsetWidth + 0 + 'px';
		//oP5.style.left = oP4.offsetLeft + oP4.offsetWidth + 0 + 'px';
		//oP6.style.left = oP5.offsetLeft + oP5.offsetWidth + 0 + 'px';
		//oP7.style.left = oP6.offsetLeft + oP6.offsetWidth + 0 + 'px';
		//oP8.style.left = oP7.offsetLeft + oP7.offsetWidth + 0 + 'px';
			
		oMyVid.style.left = oP1.offsetLeft + 10 + 'px';
		oMyVid.style.top = lHeight2 + lHScroll + 14 + 'px';
		//alert(parseInt(String(lLesson) + String(lChapter) + String(lTopic)));
		
		var sVideo = String(lLesson) + String(lChapter) + String(lTopic);
		
		//alert(lTopic);
		//alert("http://" + arDL[parseInt(lTopic)] + "/eLearning/video/home/" + sVideo + ".mp4");

		//alert("http://" + arThumbs[parseInt(sVideo)] + "/eLearning/video/home/" + sVideo + ".jpg");
		jwplayer("f1").setup({
			controlbar: "bottom",
			dock: true,
			autostart: true,
			file: String(sVideo) + ".m4v", 
			image: "http://" + arThumbs[parseInt(lTopic)] + "/eLearning/video/home/" + sVideo + ".jpg",
			modes: [{
				type: "flash",
			    src: "jwplayer/player.swf"
			},{
			    type: "html5",
			    config: {
			       file: "http://" + arDL[parseInt(lTopic)] + "/eLearning/video/home/" + sVideo + ".mp4",
			       provider: "video"
			    }
			 }],
			 provider: "rtmp",
			 streamer: "rtmp://slo1k8czrmarb.cloudfront.net/cfx/st",
			 width: 720,
			 height: 480,
			 events: { 
				onComplete: function() { videoDone(); } 
			 } 
		});

		//oCloseButt.style.left = oP8.offsetLeft + oP8.offsetWidth - 24 + 'px';
		oCloseButt.style.left = oP1.offsetLeft + lWidth2 - 56 + 'px';
		//oCloseButt.style.top = oP8.offsetTop - 8 + 'px';
		oCloseButt.style.top = oP1.offsetTop - 10 + 'px';
		oCloseButt.style.display = 'block';

		oP1.style.height = 480 + 'px';
		//oP2.style.height = 480 + 'px';
		//oP3.style.height = 480 + 'px';
		//oP4.style.height = 480 + 'px';
		//oP5.style.height = 480 + 'px';
		//oP6.style.height = 480 + 'px';
		//oP7.style.height = 480 + 'px';
		//oP8.style.height = 480 + 'px';

		//if (lLesson > 0) {
			//alert('b' + [lLesson, lChapter, lTopic]);
			oInfo = getVideoInfo(lLesson, lChapter, lTopic);
			document.getElementById('vid_curr').innerHTML = '<nobr>Now Playing ' + oInfo[0] + '&nbsp;</nobr>';
			document.getElementById('vid_title').innerHTML = '<nobr>&nbsp;' + oInfo[1] + '&nbsp;</nobr>';
			document.getElementById('vid_time').innerHTML = oInfo[2];

			//if (parseInt(gCurVideo) == 8) {
			if (lTopic == 8) {
				//oInfo = ['', '', ''];
				oInfo = getPrevVideoInfo(0, 0, 5);
				oInfo = getPrevVideoText(oInfo[0], oInfo[1], oInfo[2]);
			} else {
				oInfo = getNextVideoInfo(lLesson, lChapter, lTopic);
				oInfo = getNextVideoText(oInfo[0], oInfo[1], oInfo[2]);
			}
			document.getElementById('vid_title_next').innerHTML = oInfo[0] + ' ' + oInfo[1] + ' ' + oInfo[2];
			
			//alert(lTopic);
			//if (parseInt(gCurVideo) == 5) {
			if (lTopic == 5) {
			//	//oInfo = ['', '', ''];
				oInfo = getNextVideoInfo(0, 0, 8-1);
				oInfo = getNextVideoText(oInfo[0], oInfo[1], oInfo[2]);
			} else {
				oInfo = getPrevVideoInfo(lLesson, lChapter, lTopic);
				oInfo = getPrevVideoText(oInfo[0], oInfo[1], oInfo[2]);
			}
			document.getElementById('vid_title_prev').innerHTML = oInfo[0] + ' ' + oInfo[1] + ' ' + oInfo[2];

			
			//if (parseInt(gCurVideo) == 5) {
			//	document.getElementById('prevButt').setAttribute('mydis', 'True');
			//	document.getElementById('prevButt').src = "images/Back_dis.gif";
			//} else {
				document.getElementById('prevButt').setAttribute('mydis', 'False');
				document.getElementById('prevButt').src = "images/Back.gif";
			//}
			
			//if (parseInt(gCurVideo) < 8) {
				document.getElementById('nextButt').setAttribute('mydis', 'False');
				document.getElementById('nextButt').src = "images/Forward.gif";
			//} else {
			//	document.getElementById('nextButt').setAttribute('mydis', 'True');
			//	document.getElementById('nextButt').src = "images/Forward_dis.gif";
			//}
			
			//if (parseInt(gCurVideo) == 8) {
			//	document.getElementById('nextButt').setAttribute('mydis', 'True');
			//	document.getElementById('nextButt').src = "images/Forward_dis.gif";
			//}

		//}
		
		oVidInfo.style.left = oP1.offsetLeft + 10 + 'px';
		oVidInfo.style.top = oP1.offsetTop + oP1.offsetHeight - 90 + 'px';
		oVidInfo.style.display = 'block';
		oVidInfo.style.width = 720 + 'px';
			
		oMyVid.style.display = 'block';
	}
		
	function videoDone() {
		return;
		var xhr = createXHR();
	    xhr.open('GET', 'vidsave_hit.asp?guidid=' + urlencode(gGuidID) + '&video=' + gCurVideo, false); xhr.send(null); 

	    if (xhr.status == 200) {
            if (parseInt(xhr.responseText) == 0) {
				//alert('saved');
				gMaxVideo = gCurVideo;
				
				if (gCurVideo == 111) {
					document.getElementById('prevButt').setAttribute('mydis', 'True');
					document.getElementById('prevButt').src = "images/Back_dis.gif";
				}
				
				//if (gCurVideo <= gMaxVideo) {
				//	document.getElementById('nextButt').setAttribute('mydis', 'False');
				//	document.getElementById('nextButt').src = "images/Forward.gif";
				//} else {
					document.getElementById('nextButt').setAttribute('mydis', 'False');
					document.getElementById('nextButt').src = "images/Forward.gif";
				//}

				//update the just watched video to enabled/green
				if (document.getElementById(gCurVideo)) {
					document.getElementById(gCurVideo).className = 'hit_me';
					//document.getElementById(gCurVideo).onclick = function() { showVideo(parseInt(this.id.substr(0,1)), parseInt(this.id.substr(1,1)), parseInt(this.id.substr(2,1))); }
				}
				
				if (gCurVideo < 222) {
					var sCurVideo = String(gCurVideo);

					var lLesson = parseInt(sCurVideo[0]);
					var lChapter = parseInt(sCurVideo[1]);
					var lTopic = parseInt(sCurVideo[2]);
							
					var vNext = getNextVideoInfo(lLesson, lChapter, lTopic);
		
					lLesson = vNext[0];
					lChapter = vNext[1];
					lTopic = vNext[2];

					vNext[1] = vNext[1] - (lLesson * 8);
					vNext[2] = vNext[2] - (lLesson * 64) - (vNext[1] * 16);			
			
					gNextVideo = parseInt(String(vNext[0]) + String(vNext[1]) + String(vNext[2]));

					//Update next video as current/blue
					if (document.getElementById(gNextVideo)) {
						document.getElementById(gNextVideo).className = 'act_me';
						document.getElementById(gNextVideo).onclick = function() { showVideo(parseInt(this.id.substr(0,1)), parseInt(this.id.substr(1,1)), parseInt(this.id.substr(2,1))); }
					}
				} else if (gCurVideo == 219) {
					document.getElementById('nextButt').setAttribute('mydis', 'True');
					document.getElementById('nextButt').src = "images/Forward_dis.gif";
					//document.getElementById('demo_link').innerHTML = "<a id='demo_link' href='#'>demo</a>";
				}
            } else {
				alert(xhr.responseText);
            }
        }

	}
	
	function closeVideo() {
		jwplayer("f1").remove();
			
		oMyVid.style.display = 'none';
		oCloseButt.style.display = 'none';
		oVidInfo.style.display = 'none';
			
		oP1.style.display = 'none';
		oP2.style.display = 'none';
		oP3.style.display = 'none';
		oP4.style.display = 'none';
		oP5.style.display = 'none';
		oP6.style.display = 'none';
		oP7.style.display = 'none';
		oP8.style.display = 'none';
			
		oBlanker.style.display = 'none';
	}

	function getVideoInfo2(lLesson, lChapter, lTopic) {		
		//lLesson = 1;	//2
		//lChapter = 1;	//17
		//lTopic = 1;	//41
		
		lChapter2 = (lLesson * 8) + lChapter;
		lTopic2 = (lLesson * 64) + (lChapter * 16) + lTopic;

		//alert(arData[lLesson] + " - " + arData[lChapter2] + " - " + arData[lTopic2])
				
		return [arData[lLesson], arData[lChapter2], arData[lTopic2], arTime[lTopic2]];
	}
	
	function getVideoInfo(lLesson, lChapter, lTopic) {		
		//lLesson = 1;	//2
		//lChapter = 1;	//17
		//lTopic = 1;	//41
		lChapter2 = (lLesson * 8) + lChapter;
		lTopic2 = (lLesson * 64) + (lChapter * 16) + lTopic;

		//alert(arData[lLesson] + " - " + arData[lChapter2] + " - " + arData[lTopic2])
				
		return [arIdx[lTopic2], arData[lTopic2], arTime[lTopic2]];
	}

	function getVideoInfoMin(lLesson, lChapter, lTopic) {		
		//lLesson = 1;	//2
		//lChapter = 1;	//17
		//lTopic = 1;	//41
						
		return [arData[lLesson], arData[lChapter2], arData[lTopic2], arTime[lTopic2]];
	}

	function getNextVideoInfo(lLesson, lChapter, lTopic) {		
		//lLesson = 2;	-> 2
		//lChapter = 1;	-> 2
		//lTopic = 3;	-> 1
		
		var lChapter2 = (lLesson * 8) + lChapter;
		var lTopic2 = (lLesson * 64) + (lChapter * 16) + lTopic + 1;

		if (arData[lTopic2]) {
			return [lLesson, lChapter2, lTopic2];
		} else {
			lChapter2 = (lLesson * 8) + (lChapter + 1);
			lChapter = lChapter + 1;
			
			if (arData[lChapter2]) {
				lTopic2 = (lLesson * 64) + (lChapter * 16) + 1;
			} else {
				lLesson = lLesson + 1;
				lChapter = 1;
				lChapter2 = (lLesson * 8) + 1;
				lTopic2 = (lLesson * 64) + (lChapter * 16) + 1;
			}
		}
		
		//alert(arData[lLesson] + " - " + arData[lChapter2] + " - " + arData[lTopic2])

		return [lLesson, lChapter2, lTopic2];
	}

	function getPrevVideoInfo(lLesson, lChapter, lTopic) {		
		//lLesson = 2;	-> 2
		//lChapter = 6;	-> 5
		//lTopic = 1;	-> 2
		
		//alert('passed ' + [lLesson, lChapter, lTopic]);
		
		var arL1 = new Array(), arL2 = new Array();
		
		arL1[1] = 4; arL1[2] = 4;
		arL1[3] = 4; arL1[4] = 4;

		arL2[1] = 4; arL2[2] = 4;
		arL2[3] = 4; arL2[4] = 4;
		arL2[5] = 4; arL2[6] = 4;
		
		lChapter2 = (lLesson * 8) + lChapter;
		lTopic2 = (lLesson * 64) + (lChapter * 16) + lTopic - 1;

		if (arData[lTopic2]) {
			return [lLesson, lChapter2, lTopic2];
		} else {
			lChapter2 = (lLesson * 8) + lChapter - 1;

			if (arData[lChapter2]) {
				//alert('lLesson: ' + lLesson);
				//alert('lChapter: ' + lChapter);
				//alert('lChapter2: ' + lChapter2);
				
				if (lLesson == 1) {
					lTopic2 = (lLesson * 64) + ((lChapter - 1) * 16) + arL1[lChapter - 1];
				} else {
					//alert('lLesson: ' + lLesson);		//2
					//alert('lChapter: ' + lChapter);		//6
					//alert('lChapter2: ' + lChapter2);	//21
					
					lTopic2 = (lLesson * 64) + ((lChapter - 1) * 16) + arL2[lChapter - 1];
				}
			} else {
				if (lLesson == 2) {
					lLesson = lLesson - 1;
					lChapter = 4;
					lTopic = arL1[lChapter];
					
					lChapter2 = (lLesson * 8) + lChapter;
					lTopic2 = (lLesson * 64) + (lChapter * 16) + lTopic;
				} else {
					//alert('f: ' + lLesson);
					//alert('f: ' + lChapter);
					lChapter2 = (lLesson * 8) + (lChapter);
					//alert('f: ' + lChapter2);
					lTopic2 = (lLesson * 64) + (lChapter * 16) + lTopic;
				
				}
				

			}
		}
		
		//alert(arData[lLesson] + " - " + arData[lChapter2] + " - " + arData[lTopic2])

		return [lLesson, lChapter2, lTopic2];
	}
	function getNextVideoText(lLesson, lChapter, lTopic) {		
		return [arIdx[lTopic], arData[lTopic], arTime[lTopic]];
	}

	function getPrevVideoText(lLesson, lChapter, lTopic) {		
		return [arIdx[lTopic], arData[lTopic], arTime[lTopic]];
	}
	

