/*------------------------------------------------------------------------
	This file will create and return an array where each element contains
	a filename/path pair for each video file.
	Additional functions are called from the web page to generate the
	Media Player and hyperlinks.
------------------------------------------------------------------------*/

//  See if we have an ASX object and create one if not
//  This is the object we will reference from the client
//  to get the array of filenames and paths that we create
//  below.
if(!window.ASX)
    ASX=new Object();
    
/////////////////////////////////////////////////////////////
//  ADD YOUR VIDEO FILES HERE                              //
/////////////////////////////////////////////////////////////
//  This function is where we create our array of 
//  of filenames and paths
ASX.files = function()
{
    var Files = new Array();
    //                    Display name,  Filename
    Files[0] = new oFile("The QuadDesk's Basic Features", "dkintlg.asx");
    Files[1] = new oFile("The QuadDesk's Options", "dkoptlg.asx")
    Files[2] = new oFile("Drag", "qtdrglg.asx")
    Files[3] = new oFile("Change Fonts", "qtftcglg.asx");
    Files[4] = new oFile("Scroll", "qtscrllg.asx");
    Files[5] = new oFile("Cut & Paste", "qtcutlg.asx");
    Files[6] = new oFile("Open Docs", "qtdoclg.asx");
    Files[7] = new oFile("Play Games", "qtgmlg.asx")
    Files[8] = new oFile("Resize Windows", "qtreszlg.asx")
    Files[9] = new oFile("Send & Get Email", "qtmallg.asx")
    Files[10] = new oFile("Palm Up Bicep Curl", "lgbicep.asx");
    Files[11] = new oFile("Reverse Curls", "lgrvcurl.asx");
    Files[12] = new oFile("Narrow Grip Chest Press", "lgnrchst.asx");
    Files[13] = new oFile("Wide Grip Chest Press", "lgwdchst.asx");
    Files[14] = new oFile("Deltoid Press", "lgdelt.asx");
    Files[15] = new oFile("Reverse Deltoid Press", "lgrvdelt.asx");
    Files[16] = new oFile("Lat Pull", "lglatpul.asx");
    Files[17] = new oFile("Rickshaw", "lgrick.asx");
    Files[18] = new oFile("Rowing", "lgrow.asx");
    Files[19] = new oFile("Lateral Shoulder Raises", "lgshrais.asx");
    Files[20] = new oFile("Reverse Lateral Shoulder Raises", "lgrvrase.asx");
    Files[21] = new oFile("Shoulder Depressors", "lgshdep.asx");
    Files[22] = new oFile("Shoulder Extensions", "lgshext.asx");
    Files[23] = new oFile("Shoulder External Rotation", "lgrot.asx");
    Files[24] = new oFile("Tricep Extensions", "lgtricep.asx");
    Files[25] = new oFile("Aerobic Workout", "lgarobic.asx")
    Files[26] = new oFile("Gripless TriPin System", "lgtripin.asx");
    Files[27] = new oFile("Unique Dual Resistance System", "lgresis.asx");
    Files[28] = new oFile("Quad Adjustable Stations", "lgadjst.asx");
    Files[29] = new oFile("Quad Adjustable Stations", "dkintsm.asx");
    Files[30] = new oFile("Quad Adjustable Stations", "dkoptsm.asx");
    Files[31] = new oFile("Uppertone", "lgutint.asx");
    ;
 return Files;
}

//  This method packs the filename and path into a
//  single object
function oFile(n,f){
    this.name = n;
    this.path = f;
}

//  This function is called from the client to get the
//  the array from the object above
function getVids(){
	return	ASX.files();
}

//	This method is used to extract the video filename from the URL
//	of the web page.
//	This is only called for NetScape browsers
function parseQuery() {
	var query = location.search.substring(1, location.search.length);
	for (var i=0; i<oFiles.length; i++) {
	  if (oFiles[i].path == query){
			return oFiles[i].path;
	  }
	}
	return 0;
}

//	This function composes a hyperlink to the video file.
function WriteURL(Name, URL){
	if(NS){
			var x = document.location.toString().split("/");
			var x =  x[x.length-1].toString().split("?");
			document.writeln('<a href=\"' + x[0] + '?' + URL + '\">' + Name +'</a>');
		}
	else{document.writeln('<a href=# onclick=\"PlayVid(\'' + URL + '\')\"; onmouseover=\"this.style.cursor=\'hand\'\" title=\'Play movie\'>' + Name +'</a>');}
}

//	This function will create a Media Player <OBJECT> tag for IE
//	OR an <EMBED> tag if the browser is NetScape.
function printPlugin(NS) {
	with (document) {
	  if(NS){
	      writeln('<EMBED TYPE="application/x-mplayer2"');
	      writeln('PLUGINSPAGE="http://microsoft.com/windows/mediaplayer/en/download/"');
	      writeln('ID=mediaPlayer');
	      writeln('NAME="mediaPlayer"');
	      writeln('DISPLAYSIZE="0"');		// Fit To Size
	      writeln('AUTOSIZE="0"');
	      writeln('BGCOLOR="darkblue"');
	      writeln('SHOWCONTROLS="-1" ');
	      writeln('SHOWTRACKER="-1"');
	      writeln('SHOWDISPLAY="0"');
	      writeln('SHOWSTATUSBAR="-1"');
	      writeln('VIDEOBORDER3D="-1"');
	      writeln('WIDTH=240');
	      writeln('HEIGHT=206');
	      if (parseQuery() == 0)   writeln('SRC="videos/lgalintr.asx"')
	      else writeln('SRC=' + server + parseQuery());
	      writeln('AUTOSTART="1" ');
	      writeln('DESIGNTIMESP="5311"');
	      writeln('>');
	      writeln('</EMBED>');
	      
		}else{
	      writeln('<OBJECT id="mediaPlayer" width=240 height=206');
	      writeln('  codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ');
	      writeln('type=application/x-oleobject');
	      writeln('standby="Loading Microsoft Windows Media Player components..."');
	      writeln('classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95>');
	      writeln('<param name="AudioStream" value="-1">');
	      writeln('<param name="AutoSize" value="0">');
	      writeln('<param name="AutoStart" value="1">');
	      writeln('<param name="AnimationAtStart" value="-1">');
	      writeln('<param name="AllowScan" value="0">');
	      writeln('<param name="AllowChangeDisplaySize" value="0">');
	      writeln('<param name="AutoRewind" value="0">');
	      writeln('<param name="Balance" value="0">');
	      writeln('<param name="BaseURL" value>');
	      writeln('<param name="BufferingTime" value="5">');
	      writeln('<param name="CaptioningID" value>');
	      writeln('<param name="ClickToPlay" value="0">');
	      writeln('<param name="CursorType" value="0">');
	      writeln('<param name="CurrentPosition" value="-1">');
	      writeln('<param name="CurrentMarker" value="0">');
	      writeln('<param name="DefaultFrame" value>');
	      writeln('<param name="DisplayBackColor" value="0">');
	      writeln('<param name="DisplayForeColor" value="16777215">');
	      writeln('<param name="DisplayMode" value="0">');
	      writeln('<param name="DisplaySize" value="0">');
	      writeln('<param name="Enabled" value="-1">');
	      writeln('<param name="EnableContextMenu" value="0">');
	      writeln('<param name="EnablePositionControls" value="0">');
	      writeln('<param name="EnableFullScreenControls" value="0">');
	      writeln('<param name="EnableTracker" value="-1">');
	      writeln('<param name="InvokeURLs" value="0">');
	      writeln('<param name="Language" value="-1">');
	      writeln('<param name="Mute" value="0">');
	      writeln('<param name="PlayCount" value="1">');
	      writeln('<param name="PreviewMode" value="0">');
	      writeln('<param name="Rate" value="1">');
	      writeln('<param name="SAMILang" value>');
	      writeln('<param name="SAMIStyle" value>');
	      writeln('<param name="SAMIFileName" value>');
	      writeln('<param name="SelectionStart" value="-1">');
	      writeln('<param name="SelectionEnd" value="-1">');
	      writeln('<param name="SendOpenStateChangeEvents" value="-1">');
	      writeln('<param name="SendWarningEvents" value="-1">');
	      writeln('<param name="SendErrorEvents" value="-1">');
	      writeln('<param name="SendKeyboardEvents" value="0">');
	      writeln('<param name="SendMouseClickEvents" value="0">');
	      writeln('<param name="SendMouseMoveEvents" value="0">');
	      writeln('<param name="SendPlayStateChangeEvents" value="0">');
	      writeln('<param name="ShowCaptioning" value="0">');
	      writeln('<param name="ShowControls" value="-1">');
	      writeln('<param name="ShowAudioControls" value="-1">');
	      writeln('<param name="ShowDisplay" value="0">');
	      writeln('<param name="ShowGotoBar" value="0">');
	      writeln('<param name="ShowPositionControls" value="0">');
	      writeln('<param name="ShowStatusBar" value="0">');
	      writeln('<param name="ShowTracker" value="-1">');
	      writeln('<param name="TransparentAtStart" value="0">');
	      writeln('<param name="VideoBorderWidth" value="0">');
	      writeln('<param name="VideoBorderColor" value="0">');
	      writeln('<param name="VideoBorder3D" value="0">');
	      writeln('<param name="Volume" value="-600">');
	      writeln('<param name="WindowlessVideo" value="0">');
	  	writeln('<param name="Filename" value="videos/lgalintr.asx">');
	  	  writeln('</object>');
	  	}
	}
}

/*
//	This function is not used
function change() {
	var list = document.playerCtrl.streams;
	var streamURL = list.options[list.selectedIndex].value;
	menuSelection = list.selectedIndex;
	//document.mediaPlayer.Stop();}
	document.displayMode.playOrPause.value = " Pause ";
	location.href = "sample.html" + "?" + '"' + streamURL + '"';
	return 0;
}
*/

//	This function is called from IE and loads the selected video
//	into the Media Player control
function PlayVid(n){
	if (!NS) {
		var P = document.getElementById("MediaPlayer");
		P.Enabled = true;
		P.AutoStart = true;
		P.FileName = server + n;
	}
}
