/*

<CFHEADER NAME="Expires" VALUE="-250">
<CFHEADER NAME="Pragma" VALUE="no-cache">
<CFHEADER NAME="cache-control" VALUE="no-cache, no-store, must-revalidate">

<CF_INIFILE Srcfile="#Application.IniSrcFile#" 
        Section="Application.Variables" 
        Keyname="Valid_Referer">
		
<CFSET #Variables.Valid_Referer# = "#FULL#">

<cfset RefererIsFound = "">

<cfif Find(",",Variables.Valid_Referer) NEQ 0>
	
	<cfloop delimiters="," list="#Variables.Valid_Referer#" index="Referer">
		<cfif FindNoCase(Referer,CGI.HTTP_REFERER)>
			<cfset RefererIsFound = "yes">
		</cfif>
	</cfloop>
<cfelse>
	<cfif FindNoCase(Variables.Valid_Referer,CGI.HTTP_REFERER)>
		<cfset RefererIsFound = "yes">
	</cfif>
</cfif>

<cfif RefererIsFound NEQ "">		

*/

var bolIsPlayerLoaded=false;
var bolIsPlaying=false;
var bolIsPaused=false;
var bolIsFunctionMaxed=false;
var bolIsVideoFullScreen=false;

var intVolumeBarState=5;
var intActiveFunction=0;
var strActiveFunction;
var i=0;

// MIKE C CHANGED
var intNextCueMarker=0;
var idClockInterval=0;
// END

var strTopicLinkColor="black";

// WINDOWS MEDIA PLAYER CONSTANTS
var mpStopped = 0;					//Playback is stopped.
var mpPaused = 1;					//Playback is paused.
var mpPlaying = 2;					//Stream is playing.
var mpWaiting = 3;					//Waiting for stream to begin.
var mpScanForward = 4;				//Stream is scanning forward.
var mpScanReverse = 5;				//Stream is scanning in reverse.
var mpSkipForward = 6;				//Skipping to next.
var mpSkipReverse = 7;				//Skipping to previous.
var mpClosed = 8;					//Stream is not open.
// END CONSTANTS



// -- Image Swap Function
function imageChange(imgName, strState) {
	document.images[imgName].src = eval(imgName + "_" + strState + ".src");
	return true;
	}
	
function CheckWindowSize() {
	// make sure the window is the size we want . . .
	var height = document.body.offsetHeight;
	var width = document.body.offsetWidth;
	var curX = window.screenLeft;
	var curY = window.screenTop;

	if (!bolIsVideoFullScreen) {
		if (height > 567 || width > 800) {
			parent.resizeTo(811,597);
			parent.moveTo(100,100);
			}
		}

	}
	
	
function top_menu_action (click_target) {
	topnav_image.src = click_target.src;
	top_on_now = 1;
	}

function top_menu_scroll (click_target_scroll, pass_to_switch) {

	switch (pass_to_switch) {

	 	case "file_sub_menu" :
		close_current_window (top_on_now);
		top_on_now = '1';
		file_submenu_layer.style.visibility = 'visible';
		break;

		case "edit_sub_menu" :
		close_current_window (top_on_now);
		top_on_now = '2';
		edit_submenu_layer.style.visibility = 'visible';
		break;

		case "test_sub_menu" :
		close_current_window (top_on_now);
		top_on_now = '3';
		test_submenu_layer.style.visibility = 'visible';
		break;

		case "contact_sub_menu" :
		close_current_window (top_on_now);
		top_on_now = '4';
		contact_submenu_layer.style.visibility = 'visible';
		break;

		case "help_sub_menu" :
		close_current_window (top_on_now);
		top_on_now = '5';
		help_submenu_layer.style.visibility = 'visible';
		break;
		}
	}

function close_current_window (open_window) {

	switch (top_on_now) {

		case "1" :
		file_submenu_layer.style.visibility = 'hidden';
		break;

		case "2" :
		edit_submenu_layer.style.visibility = 'hidden';
		break;

		case "3" :
		test_submenu_layer.style.visibility = 'hidden';
		break;

		case "4" :
		contact_submenu_layer.style.visibility = 'hidden';
		break;

		case "5" :
		help_submenu_layer.style.visibility = 'hidden';
		break;

		}

	}
// End Menu Bar Functions

/*
Function Names: changePauseState, changeStopState, changePlayState)
Function Paramiters: image name and to change state
Function Returns: nothing
Calling Functions: All pause, stop, and play buttons, respectively.
Function Description:
These functions check to see if the button is turned "on" before doing a mouseover / mouseout.
*/

function changePauseState(imgName, strState)
{
if ((bolIsPlayerLoaded) && (!bolIsPaused))
	imageChange(imgName, strState);

}

function changeStopState(imgName, strState)
{
if ((bolIsPlaying) || (bolIsPaused))
	imageChange(imgName, strState);

}

function changePlayState(imgName, strState)
{
if (!bolIsPlaying)
	imageChange(imgName, strState);

}

function loadPlayer() {

	//  **PC try linking to .rpm file via <embed> tag

	// WINDOWS MEDIA PLAYER OBJECT STRINGS
	var strPlayerClassID = "CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6"; // Player ClassID, based on player version 7.x
	var strPlayerObject = "<OBJECT ID='objMediaPlayer' name='objMediaPlayer' WIDTH=320 HEIGHT=240 CLASSID='CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6' STANDBY='Loading Microsoft® Windows Media™ Player components...' TYPE='application/x-oleobject'><PARAM NAME='URL' VALUE='" + strSrcMedia + "'><PARAM NAME='ShowControls' VALUE='False'><PARAM NAME='AutoRewind' VALUE='True'><PARAM NAME='AutoStart' VALUE='False'><embed name='objMediaPlayer' type='application/x-oleobject' autostart='false' width='320' height='240' SRC='" + strSrcMedia + "' CONSOLE='_unique' CONTROLS='ImageWindow' ></embed></OBJECT>";
	// var strPlayerClassID = "CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"; // Player ClassID
	// var strPlayerObject = "<OBJECT ID='objMediaPlayer' name='objMediaPlayer' WIDTH=320 HEIGHT=240 CLASSID='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95' CODEBASE='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715'  STANDBY='Loading Microsoft® Windows Media™ Player components...' TYPE='application/x-oleobject'><PARAM NAME='FileName' VALUE='" + strSrcMedia + "'><PARAM NAME='ShowControls' VALUE='False'><PARAM NAME='AutoRewind' VALUE='True'><PARAM NAME='AutoStart' VALUE='False'><embed name='objMediaPlayer' type='application/x-oleobject' autostart='false' width='320' height='240' SRC='" + strSrcMedia + "' CONSOLE='_unique' CONTROLS='ImageWindow' ></embed></OBJECT>";
	// alert(strPlayerObject);
	
	PlayerDiv.innerHTML = strPlayerObject;
	bolIsPlayerLoaded = true;

	return true;

	}


/*
Function Name: unLoadPlayer
Function Paramiters: none
Function Returns: nothing
Calling Functions: videoStop()
Function Description:
unLoadPlayer writes the WatchIT.com logo image to the same space as the ActiveX control.
This allows the WatchIT.com logo to be displayed in the same space as the video while video is not playing.
*/

function unLoadPlayer() {

	PlayerDiv.innerHTML = strLogo;
	bolIsPlayerLoaded = false;
	clearVideoTime(idBufferClockInterval);
	clearVideoTime(idClockInterval);
	}
	
/*
Function Name: videoClock
Function Paramiters: none
Function Returns: nothing
Calling Functions: videoPlay(), videoClock()
Function Description:
videoClock retrieves the time elapsed from a playing stream. It will then convert from milliseconds into
the standard 00:00:00 time format. It will then update the clock on the screen and recall itself.

--NOTE-- OverDrive Media, Inc. Proprietary Function
*/

//  MIKE C CHANGED 082800
function videoClock(thisMessage) {

	if (bolIsPlayerLoaded) {
		//if (objMediaPlayer.DisplaySize != 3) {
		if (objMediaPlayer.uiMode != 'full') {
			bolIsVideoFullScreen = false;
			}
		}

	if (!bolIsVideoFullScreen) {

		if (typeof(thisMessage) == "undefined") {
			if (bolIsPlayerLoaded) {  // check to make sure player loaded
				//var intTempTimeElapsed = objMediaPlayer.CurrentPosition; // get the time elapsed IN SECONDS
				var intTempTimeElapsed = objMediaPlayer.controls.currentPosition;
				if (intTempTimeElapsed == -1 || (!bolIsPaused && !bolIsPlaying)) {
					intTempTimeElapsed = 0;
					}
				}
			else {
				var intTempTimeElapsed = 0;
				}

			// Calculations to convert from seconds into standard 0:00:00 time format
			var intTimeElapsed = intTempTimeElapsed;
			var intHours = Math.floor(intTimeElapsed/3600); // get hours
			var intMinutes = Math.floor(intTimeElapsed/60); // get minutes
			var intSeconds = Math.floor(intTimeElapsed%60); // get seconds

			var strHours = (intHours).toString();
			var strMinutes = (intMinutes).toString();
			var strSeconds = (intSeconds).toString();

			// insert zeros in front of time elapsed where necessary ( < 10 ) to preserve 00:00:00 format
			if (intSeconds < 10) {
				strSeconds = "0" + strSeconds;
				}
			if (intMinutes < 10) {
				strMinutes = "0" + strMinutes;
				}
			if (intHours < 10) {
				strHours = "0" + strHours;
				}

			var strTime = strHours + ":" + strMinutes + ":" + strSeconds; // create time string
			}
		else {
			var strTime = thisMessage; // create time string
			}

		VideoClockDiv.innerHTML = strTime;  // update clock div

		// MIKE C CHANGE
		if (intTempTimeElapsed > intNextCueMarker) {
			handleCue(intTempTimeElapsed);
			}
	
		}
	else {

			if (objMediaPlayer.DisplaySize != 3) {
				bolIsVideoFullScreen = false;
				videoClock();
				}

			}		
	}
// END
//  END MIKE C CHANGED 082800 - TIGHTENED CODE

function showVideoTime() {
	clearVideoTime(idClockInterval);
	idClockInterval = window.setInterval("videoClock()",IPV_clockInterval); //  .2 sec
	//idBufferClockInterval = window.setInterval("videoClock('Buffering')",500);
	//**pc
	//	idClockInterval = window.setInterval("videoClock()",15000); // 15 secs. PC**
	}

// clear video time


function showTotalTime() {

	clearVideoTime(idClockInterval);

	var intTotalTime = ProgramDuration; // get the total running time
	intTotalTime = intTotalTime * 60 * 1000;  //convert to milliseconds

	// Calculations to convert from milliseconds into standard 0:00:00 time format
	intTotalTime = Math.floor(intTotalTime/1000); // round up to the nearest integer
	var intHours = Math.floor(intTotalTime/3600); // get hours
	var intMinutes = Math.floor(intTotalTime/60); // get minutes
	var intSeconds = (intTotalTime%60); // get seconds

	var strHours = intHours.toString();
	var strMinutes = intMinutes.toString();
	var strSeconds = intSeconds.toString();

	// insert zeros in front of time elapsed where necessary ( < 10 ) to preserver 00:00:00 format
	if (intSeconds < 10) {
		strSeconds="0" + strSeconds;
		}
	if (intMinutes < 10) {
		strMinutes="0" + strMinutes;
		}
	if (intHours < 10) {
		strHours="0" + strHours;
		}

	var strTime = strHours + ":" + strMinutes + ":" + strSeconds;  // create time string

	clearVideoTime(idClockInterval);
	VideoClockDiv.innerHTML = strTime;  // update clock DIV
	}

function clearVideoTime(idThisClockInterval) {
	window.clearInterval(idThisClockInterval);
	}

function videoOnly() {
	bolIsVideoFullScreen=true;
	if ((bolIsPlayerLoaded) && (bolIsPlaying)) {
		if (pm == 7) {
			var keys = 'TAB';
		} else {
			var keys = 'ALT+ENTER';
		}			
	
	if (objMediaPlayer.playState == 3) {
		alert('To exit full-screen mode, please press ' + keys + ' on your keyboard.');
		if(pm>=7){
				objMediaPlayer.fullScreen = true;
			} else {
				objMediaPlayer.DisplaySize = 3;
			}
	} else {
		alert("Video is still buffering and can't be watched in a full screen mode.");
	}
	} 
}

// MIKE C CHANGED - 080200
function videoPlay() {
	if ((bolIsPlayerLoaded) && (!bolIsPlaying)) {
		if (bolIsPaused) {
			if (intStoredTopicIndex != intCurrentTopicIndex) {
				setTimeout("updateMediaMarker(intCurrentTopicIndex)",800);
				}
			}
		objMediaPlayer.uiMode = 'none';
		//objMediaPlayer.Network.setProxySettings('HTTP',0);
		bolIsPlaying=true;
		bolIsPaused=false;
		//objMediaPlayer.URL = strSrcMedia;
		objMediaPlayer.controls.Play();
		imageChange('imgPause', 'off');
		imageChange('imgStop', 'off');
		imageChange('imgPlay', 'grey');
		}

	if (!bolIsPlayerLoaded) {
		imgLogoMain.style.visibility = "hidden";

		if (loadPlayer()) {
			
			objMediaPlayer.uiMode = 'none';
			//alert(objMediaPlayer.Network.getProxySettings('HTTP'))
			//objMediaPlayer.Network.setProxySettings('HTTP',0);
			bolIsPlaying=true;
			bolIsPaused=false;
			setVolume(intVolumeBarState);
			showVideoTime(); //MIKE C CHANGED - SETTING INTERVAL FOR TIMER
			videoClock();
			objMediaPlayer.controls.Play();
			imageChange('imgPause', 'off');
			imageChange('imgStop', 'off');
			imageChange('imgPlay', 'grey');
			setTimeout("updateMediaMarker(intCurrentTopicIndex)",800);
			}
		}
		Stoper.start();
	}
// MIKE C CHANGED - 080200

// MIKE C CHANGED - 080200
function videoStop() {

	if (bolIsPlayerLoaded) {
		objMediaPlayer.uiMode = 'none';
		//objMediaPlayer.Network.setProxySettings('HTTP',0);
		objMediaPlayer.controls.Stop();

		bolIsPlaying=false;
		bolIsPaused=false;

		clearVideoTime(idClockInterval);  // MIKE C CHANGED - MUST CLEAR INTERVAL
		videoClock();  // MIKE C CHANGED - NEEDS TO RESET TO ZERO AFTER STOP

		imageChange('imgStop', 'grey');
		imageChange('imgPause', 'grey');
		imageChange('imgPlay', 'off');

		unLoadPlayer();
		updateAll(0);
		}
	
	Stoper.stop();
	
	}
// MIKE C CHANGED - 080200

intStoredTopicIndex = 0;

function videoPause() {

	if ((bolIsPlayerLoaded) && (!bolIsPaused)) {
		objMediaPlayer.uiMode = 'none';
		//objMediaPlayer.Network.setProxySettings('HTTP','0');
		objMediaPlayer.controls.Pause();
		intStoredTopicIndex = intCurrentTopicIndex;

		bolIsPaused=true;
		bolIsPlaying=false;

		imageChange('imgPause','grey');
		imageChange('imgPlay', 'off');

		}
	Stoper.stop();
	}

function videoFastForward() {
if(bolHasTranscript)
	nextPageNumber();
else
	alert('A transcript for this program is not available.'+
		'\n      Fast forward has been disabled.');
}

function videoRewind()	{
if(bolHasTranscript)
	{
	if((objMediaPlayer.CurrentPosition) <= (intTranscriptCueStart[intCurrentTopicIndex] + 2))
		prevPageNumber();
	else
		updateAll(intCurrentTopicIndex);

	}
else
	alert('A transcript for this program is not available.'+
		'\n       Rewind has been disabled.');
}

// Volume Control Functions
function setVolume(intVolume) {
	// intVolume = intVolume * 14.28;
	if (intVolume == 0) {
		//intVolume = -10000; 
		intVolume = 0; // WMT version 7. Volume is skewed from 0 to 100
		}
	else {
		intVolume = (intVolume * (100/7));
		//intVolume = (-3000) + (intVolume * (3000/7)); // WMT VERSION ranges from -10000 (quiet) to 0 (loud)
		// NOTE this volume is skewed from -3000 to 0, with automatic cutoff to -10000 when at lowest
		}

	objMediaPlayer.settings.Volume = intVolume;
	}

function volumeChange(strChangeDir) {

	var strDiv="VolumeBarDiv";
	var strEval;

	if ((strChangeDir=="increase") && (intVolumeBarState < 7)) {
		intVolumeBarState++;
			if (intVolumeBarState < 4) {
				strBarColor="33cc00";
				}
			if ((intVolumeBarState > 3) && (intVolumeBarState < 6)) {
				strBarColor="yellow";
				}
			if ((intVolumeBarState > 5) && (intVolumeBarState < 8)) {
				strBarColor="red";
				}
		strEval = "VolumeBarDiv" + intVolumeBarState + ".style.backgroundColor=strBarColor;";
		eval(strEval);
		}

	if ((strChangeDir=="decrease") && (intVolumeBarState > 0)) {
		strBarColor="#000099";
		strEval = "VolumeBarDiv" + intVolumeBarState + ".style.backgroundColor=strBarColor;";
		eval(strEval);
		intVolumeBarState--;
		}

	if (bolIsPlayerLoaded) {
		setVolume(intVolumeBarState);
		}
	}

function changeFButtons(strName, strState) {

	var imgName;

	if ((bolIsFunctionMaxed) && (strName != strActiveFunction)) {
		imgName = "img" + strName;
		imageChange(imgName, strState);
		}

	if (!bolIsFunctionMaxed) {
		imgName="img" + strName;
		imageChange(imgName, strState);
		}

	if ((bolIsFunctionMaxed) && (strName == strActiveFunction)) {
		// do nothing
		}
	}

function showFunctions(strName)
{

	var imgName;
	var strEval;

	if (!bolIsFunctionMaxed)
	{
		imageChange('imgFunctionsBack', 'over');
		imgMax.style.visibility = "hidden";
		imgMin.style.visibility = "visible";

		strActiveFunction=strName;

		imgName="img" + strName;

		imageChange(imgName, "on");

		bringToFront(strActiveFunction);

		bolIsFunctionMaxed=true;
		white_curve_left.style.visibility="visible";
		}
	else {
		imgName = "img" + strActiveFunction;
		imageChange(imgName, "off");

		imgName = "img" + strName;
		imageChange(imgName, "on");

		sendToBack(strActiveFunction);

		strActiveFunction=strName;

		bringToFront(strActiveFunction);
		white_curve_left.style.visibility="visible";
		}
	}
function hideFunctions() {
	var strEval;

	imageChange('imgFunctionsBack', 'off');
	imgMax.style.visibility="visible";
	imgMin.style.visibility="hidden";

	turnRollOn();

	bolIsFunctionMaxed=false;

	strEval="Functions" + strActiveFunction + "Div.style.zIndex=1;";
	eval(strEval);

	strActiveFunction="";
	}

function bringToFront(strName) {
	var strEval;
	strEval="Functions" + strName + "Div.style.zIndex=10;";
	eval(strEval);
	}

function sendToBack(strName) {
	var strEval;
	strEval="Functions" + strName + "Div.style.zIndex=1;";
	eval(strEval);
	}

function turnRollOn() {
	imgTopics.src = imgTopics_off.src;
	imgSearch.src = imgSearch_off.src;
	imgGlossary.src = imgGlossary_off.src;
	imgWeblinks.src = imgWeblinks_off.src;
	imgPresenter.src = imgPresenter_off.src;
	imgResources.src = imgResources_off.src;
	//The following commented for removal of MyWatchIT button. To re-implement uncomment following code as well
	//as the image in the FunctionsBoxDiv
	//imgMywatchit.src = "../images/function_mywatchit_off.gif";

	white_curve_left.style.visibility = "hidden";
	}

// Functions Box Javascript

function updateContextualGlossaryDef(intPointerID) {
	var strFull="";
	
	for (i=0;i<=strContextualGlossaryDef.length;i++) {
		if (intPointerID == intContextualGlossaryPointer[i])
		{
			strFull=strContextualGlossaryDef[i];
		}
	}

	FunctionsGlossaryDiv2.innerHTML = strFull;
	<!--- MK --->
	addrid(intContextualGlossaryrid[i]);

	showFunctions("Glossary");
	searchSelect.style.visibility='hidden';
	}

function updateGlossaryDefinition(intItem) {
	var strFull;

	strFull = "<a name='GlossaryDef'></a>" + strGlossaryDef[intItem];

	FunctionsGlossaryDiv2.innerHTML = strFull;
	<!--- MK --->
	addrid(intGlossaryDefrid[intItem]);
	searchSelect.style.visibility='hidden';
	return true;
	}
function updatePresenterInformation(intItem)
{
var strFull="";

strFull = strPresenterInfo[intItem] + "<br><br>" + strPresenterBio[intItem] + "<br>";

if (strFull == "")
	strFull = "There is no information for this presenter";

FunctionsPresenterDiv2.innerHTML = strFull;

return true;

}

function updateSearch()
{
var strFull;

if (txtSearchBox=="")
	{
	return false;
	}

<!-- Will need to search through MC's array -->

}

<!-- MIKE C FUNCTIONS -->
// MIKE C CHANGED 073100
function updateAll(intTopicIndex) {
	if (intCurrentTopicIndex != intTopicIndex) {
		intCurrentTopicIndex = intTopicIndex;
		}
	updateMediaMarker(intTopicIndex);
	updateTopicTitle(intTopicIndex, 1);
	updateTopicText(intTopicIndex);
	updateTopicPageNum(intTopicIndex);

	}
// MIKE C CHANGED 073100

function updateTopicTitle(intTopicIndex, fromCue) {
if(bolHasTranscript) 
	{
	var strFull;
	strFull = "";

	if (intTopicIndex >= 0 && intTopicIndex <= intTopicIndexMax) {
		strFull = strTranscriptTitles[intTopicIndex];

		if ((strFull != strTranscriptTitles[intTopicIndex-1]) && (fromCue==1))
			updateTopicLink(intTopicIndex);

		}

	TrackInfoDiv.innerHTML = strFull;
	}
}

function updateTopicText(intTopicIndex) {
if(bolHasTranscript)
	{
	var strFull;
	strFull = "";

	if (intTopicIndex >= 0 && intTopicIndex <= intTopicIndexMax) {
		strFull = strTranscriptText[intTopicIndex];
			if (strTranscriptPrepTest[intTopicIndex] != "") {
				videoPause();
				if (ask_page_ref != strTranscriptPrepTest[intTopicIndex]) {
					//IPVTestWindow(IPVTestURL + '&test=postTest&ask_page_ref='+strTranscriptPrepTest[intTopicIndex]);
					IPVTestWindow(IPVTestURL + '&test=Review%20Questions&ask_page_ref=' + strTranscriptPrepTest[intTopicIndex] + "&programIsCPE=" + programIsCPE);
				}
				ask_page_ref = strTranscriptPrepTest[intTopicIndex];
			}		
		}

	TranscriptTextDiv.innerHTML = strFull;
	}
}

function updateTopicPageNum(intTopicIndex) {
	document.formPages.intPageNum.value = intTranscriptPageNums[intTopicIndex];
	}

function updateTopicLink(intTopicIndex) {
if(bolHasTranscript && eval("typeof TopicLink"+intTopicIndex) != "undefined")
	{
	var strFull;

	strFull= "TopicLink" + intTopicIndex;
	eval(strFull + ".style.color='Gray'");

	}
}

function updateMediaMarker(intTopicIndex) {
//alert(intTopicIndex);
//alert(intTranscriptCueStart[intTopicIndex]);

	if ((bolIsPlayerLoaded) && (!bolIsPaused) && (bolHasTranscript) && intNextCueMarker != -1) {
		//objMediaPlayer.CurrentPosition = intTranscriptCueStart[intTopicIndex];
		objMediaPlayer.controls.currentPosition = intTranscriptCueStart[intTopicIndex];
		//videoPlay();

		for (var i = 0; i <= intTopicIndexMax; i++) {
			if (intTranscriptCueStart[intTopicIndex] <= intTranscriptCueStart[i]) {
				intNextCueMarker = intTranscriptCueStart[i];

				break;
				}
			}
		}
	}

function nextPageNumber() {
if(bolHasTranscript)
	{
	if (intTopicIndexMax > intCurrentTopicIndex) {
		intCurrentTopicIndex++;
		}
	updateAll(intCurrentTopicIndex);
	}
else
	alert('A transcript for this program is not available.'+
		'\n  The page forward button has been disabled.');
}

function prevPageNumber() {
if(bolHasTranscript)
	{
	if (intCurrentTopicIndex > 0) {
		intCurrentTopicIndex--;
		}
	updateAll(intCurrentTopicIndex);
	}
else
	alert('A transcript for this program is not available.'+
		'\n  The page backward button has been disabled.');
}

// MIKE C CHANGED 080200
function jumpPageNumber() {
if(bolHasTranscript)
	{	
	var i, blnFound;
	blnFound = false;
	if (document.formPages) {
		if (document.formPages.intPageNum) {
			if (isNaN(document.formPages.intPageNum.value)) {
				return false;
				}
			else {
				for (i = 0; i <= intTopicIndexMax; i++) {
					if (parseInt(intTranscriptPageNums[i]) == parseInt(document.formPages.intPageNum.value)) {
						blnFound = true;
						intCurrentTopicIndex = i;
						updateAll(intCurrentTopicIndex);
						return false;
						}
					}
				}
			}
		}
	}
}
// MIKE C CHANGED 080200

// MIKE C CHANGED 080200
function handleCue(intCurrentTimeElapsed) {
if(bolHasTranscript)
	{
	var tempNextCueMarker;
	for (var i = 0; i <= intTopicIndexMax; i++) {
		if (intCurrentTimeElapsed < intTranscriptCueStart[i]) {
			tempNextCueMarker = intTranscriptCueStart[i];
			break;
			}
		}
	if (i == intTopicIndexMax && intCurrentTimeElapsed > tempNextCueMarker) {
		intNextCueMarker = -1;
		}
	else {
		intNextCueMarker = tempNextCueMarker;
		intCurrentTopicIndex = i - 1;
		updateTopicTitle(intCurrentTopicIndex, 1);
		updateTopicText(intCurrentTopicIndex);
		updateTopicPageNum(intCurrentTopicIndex);
		}
	}
}
// MIKE C CHANGED 080200

function onloadSettings() {
	<!-- marco changed -->
	TranscriptTextDiv.innerHTML = strTranscriptText[0];
	<!-- end marco changed -->
	var strTopicIndexMax = (intTranscriptPageNums[intTopicIndexMax]).toString();
	GoToPageText2Div.innerText = "of " + strTopicIndexMax;
	}


function replace(argvalue, x, y) {

  if ((x == y) || (parseInt(y.indexOf(x)) > -1)) {
    errmessage = "replace function error: \n";
    errmessage += "Second argument and third argument could be the same ";
    errmessage += "or third argument contains second argument.\n";
    errmessage += "This will create an infinite loop as it's replaced globally.";
    alert(errmessage);
    return false;
  }
    
  while (argvalue.indexOf(x) != -1) {
    var leading = argvalue.substring(0, argvalue.indexOf(x));
    var trailing = argvalue.substring(argvalue.indexOf(x) + x.length, 
	argvalue.length);
    argvalue = leading + y + trailing;
  }

  return argvalue;

}
	
	
function findText(strSearchText) {

	var searchOption = formSearch.searchOption.selectedIndex;
	
		for (var i=0; i < strSearchText.length; i++) {
			var letter = strSearchText.charAt(i).toLowerCase();
			if (letter == '"') {
				
				strSearchText = replace(strSearchText,' ','+');
			}
			
		}
	
	//alert(strSearchText);
	
	if (strSearchText != "") {
			
			if (searchOption == 1) {
				var url = "loading.cfm?CourseAck=" + CourseAck + "&strSearchText=" + strSearchText;
				window.open(url, 'NewWindow','width=520,height=500,scrollbars=yes');
				}
			else if (searchOption == 2) {
				var url_1 = "choose_program.cfm?CourseAck=" + CourseAck + "&strSearchText=" + strSearchText;
				window.open(url_1,'NewWin','width=520,height=500,scrollbars=yes');
			}
			else if (searchOption == 0) {

			var intIndexValue = 0;
			var strFull="";
			var strTranscriptLowerCase
		
			strSearchText = strSearchText.toLowerCase();
			for(var i=0; i < intTopicIndexMax + 1; i++)
				{
				strTranscriptLowerCase = strTranscriptText[i].toLowerCase();
				strTranscriptLowerCase = removeHTML(strTranscriptLowerCase);
				intIndexValue = strTranscriptLowerCase.indexOf(strSearchText);
		
				if (intIndexValue != -1)
					{
					strFull = strFull + "<a href='#null' onClick='javascript: updateAll(" + i + "); intCurrentTopicIndex=" + i + ";'>" + "Page " + (i+1)  + ", " + strTranscriptTitles[i] + "</a><br>";
					}
		
				}
		
			if (strFull == "")
				strFull = "No matching items were found.";
		
			FunctionsSearchDiv2.innerHTML=strFull;
			}
		}
}
	
function newBrowserWindow(strURL, strRefferer)
{
window.open(strURL);
}

// **PC -- a new function - opens a single window for all emails
function emailWindow( windowURL, windowName, windowFeatures ) {
	return window.open( windowURL, windowName, windowFeatures );
}

function surveyWindow ( windowURL, windowName, windowFeatures ) {
	var totalLength = ProgramDuration * 60;
	var currentPoint = objMediaPlayer.controls.currentPosition;
	var whereAreWe = Math.floor(currentPoint * 100 / totalLength);
	var whereIsStoper = Math.floor(Stoper.time/ totalLength * 0.1);
	//alert(whereIsStoper)
	//alert(currentPoint)whereAreWe > 70 || 
	//alert(Stoper.time);
	if (whereIsStoper > 50) {
		return window.open( windowURL, windowName, windowFeatures );
	} else {
		return this.window;
	}
	
	}

function about(){
	alert(' WatchIT Knowledge Navigator'+
		'\n Version 1.0, Copyright© 2000 - 2002'+
		'\n WatchIT.com(TM) Inc.'+
		'\n\n Designed and Developed by:'+
		'\n Steve Eisenoff, CIO'+
		'\n Jeff Goldstein, Vice President of Development'+
		'\n Eric Grimm, Senior Software Engineer'+
		'\n Julia Gavrilova, Senior Software Engineer'+
		'\n Paul Costello, Senior Software Engineer'+		
		'\n Mike Kluzek, Senior Software Engineer'+
		'\n Dina Kovar, Software Developer'+
		'\n Davinder Singh, Software Developer'+
		'\n Marco Bianco, Consultant');
}

// Remove HTML function
function removeHTML(strTranscriptHTML)
{

	start = strTranscriptHTML.indexOf("<");
	stop = strTranscriptHTML.indexOf(">");

	HTMLlen = strTranscriptHTML.length;

	c = strTranscriptHTML.substring(0, start);

	if(stop == -1)
		stop = start;

	d = strTranscriptHTML.substring((stop + 1), HTMLlen);

	strTranscriptNoHTML = c + d;

	tmp = strTranscriptNoHTML.indexOf("<");

	if(tmp != -1)
		strTranscriptNoHTML = removeHTML(strTranscriptNoHTML);

	return strTranscriptNoHTML;
}

var IPVTest_window;

function IPVTestWindow(strURL) {
	videoPause();
	if (!window.IPVTest_window || window.IPVTest_window.closed) {
		IPVTest_window = window.open(strURL+"&knskinid="+knskinid,'IPVTest_window','height=567,width=793,left=80,top=80,scrollbars=no,resizable=no,toolbar=no,status=no');
	} else {
		videoPause();
		IPVTest_window.focus();
	}
}

function CloseIPVTestWindow() {
	if (window.IPVTest_window) {
		IPVTest_window.close();
	}
}

function OpenHelpWindow() {
			//alert('Coming Soon');
			var url = 'IPVhelp.cfm';
			IPVHelpWindow = window.open(url, 'IPVHelpWindow','height=567,width=793,left=120,top=120,scrollbars=yes,resizable=no,toolbar=no,status=no');
		}
		
		

	
/*

</cfif>

<cfif FindNoCase(Valid_Referer, CGI.HTTP_REFERER) eq 0>
// We're sorry, you have attempted to load this page in an invalid manner. 
</cfif>

*/
