﻿//-----------------------------------------------------
//Copyright (C) SFosterMurray. All rights reserved.
//-----------------------------------------------------
//Web 2.0 open source javascript. Read the code, then
//make sure you understand the code, then steal it!
//-----------------------------------------------------
//LvbPianoSonatasRule.js

//These references are for the VS2008 JavaScript ItelliSense...
/// <reference name="MicrosoftAjax.debug.js" />
/// <reference name="MicrosoftAjaxTimer.debug.js" />
/// <reference name="MicrosoftAjaxWebForms.debug.js" />
/// <reference name="PreviewScript.debug.js" assembly="Microsoft.Web.Preview" />
/// <reference name="PreviewGlitz.debug.js" assembly="Microsoft.Web.Preview" />
/// <reference path="..\BiteMeHereDotCOM\VS2008JSRefSet\Common\Common.js" />
/// <reference path="..\BiteMeHereDotCOM\VS2008JSRefSet\Accordion\AccordionBehavior.js" />
/// <reference path="..\BiteMeHereDotCOM\VS2008JSRefSet\Animation\AnimationBehavior.js" />
/// <reference path="..\BiteMeHereDotCOM\VS2008JSRefSet\Tabs\Tabs.js" />

//-----------------------------------------------------
//This is who we are!
//-----------------------------------------------------
var BiteMeHereInfo="Copyright &copy; 2008 Steven Foster Murray... <a href='mailto:PleaseBiteMeHere@comcast.net'>send us email</a>";
//-----------------------------------------------------
//Just give me some space.
//-----------------------------------------------------
var zapGiveMeSomeSpace1="&nbsp&nbsp&nbsp&nbsp";
var zapGiveMeSomeSpace2="&nbsp&nbsp&nbsp&nbsp&nbsp";
//-----------------------------------------------------
//'Session Keep Alive' Information. The ASP.NET session
//is set at 30 minutes... which can easily time-out
//during a movie. KEEP US ALIVE!
//-----------------------------------------------------
var SessionKeepAliveCounter=0;
var SessionKeepAliveValue=3000;
//-----------------------------------------------------
//Animated POPUP Info Panel Control Stuff...
//-----------------------------------------------------
var PopUpInUse=false;
var ButtonObject=null;
var videoButtonObject=null;
var PopUpDynamicContent=null;
var PopUpMagicNumberWidth=0;
var PopUpMagicNumberHeight=0;
//-----------------------------------------------------
//Need Video Button access to enable/disable.
//-----------------------------------------------------
var VideoButtonSet=new Array(32);
//-----------------------------------------------------
//Popup Pager Animation...
//-----------------------------------------------------
var PopupPagerAnimation=null;
var FadeInDelegate=null;
var FinalizeDelegate=null;
//-----------------------------------------------------
//User Access Control Information.
//-----------------------------------------------------
var UserAuthenticated=0;
//-----------------------------------------------------
//Movie Picker MMS URL Fetch WAIT Information;
//-----------------------------------------------------
var MoviePickerWaitInProgress=false;
var MoviePickerWaitInterval=0;
//-----------------------------------------------------
//Timer Management Movie hh:mm:ss update interval!
//-----------------------------------------------------
var MovieTimeUpdateInterval=0;
//-----------------------------------------------------
//Mode dependent [default] Movie MMS URI collection.
//-----------------------------------------------------
var DefaultMovieMMSVideoURI="mms://Blade.Balmydaze.com/CoolBreeze/24_Jimi.wmv";
//-----------------------------------------------------
//HIDDEN, FIXED POSITION MOVIE PLAYER stuff.
//-----------------------------------------------------
var isVideoPlaying=false;
var isVideoPaused=false;
var CurrentBandWidth=-1;
var showTheMovietime=0;
var BandWidthChangeRequest=false;
var ThisMovieMMSVideoURI=null;
var NextMovieMMSVidoeURI=null;
var LVBPianoSonataVideoIndex=-1;
//-----------------------------------------------------
//LVB Piano [indexed] Selection Info: Popup WxH.
//-----------------------------------------------------
var PopUpFullWideMagicNumberSet=new Array(32);
var PopUpFullHighMagicNumberSet=new Array(32);
//....Sonata 1
PopUpFullWideMagicNumberSet[0]=678;
PopUpFullHighMagicNumberSet[0]=659;
//....Sonata 2
PopUpFullWideMagicNumberSet[1]=678;
PopUpFullHighMagicNumberSet[1]=625;
//....Sonata 3
PopUpFullWideMagicNumberSet[2]=678;
PopUpFullHighMagicNumberSet[2]=629;
//....Sonata 4
PopUpFullWideMagicNumberSet[3]=678;
PopUpFullHighMagicNumberSet[3]=560;
//....Sonata 5
PopUpFullWideMagicNumberSet[4]=678;
PopUpFullHighMagicNumberSet[4]=761;
//....Sonata 6
PopUpFullWideMagicNumberSet[5]=678;
PopUpFullHighMagicNumberSet[5]=490;
//....Sonata 7
PopUpFullWideMagicNumberSet[6]=678;
PopUpFullHighMagicNumberSet[6]=529;
//....Sonata 8
PopUpFullWideMagicNumberSet[7]=678;
PopUpFullHighMagicNumberSet[7]=619;
//....Sonata 9
PopUpFullWideMagicNumberSet[8]=678;
PopUpFullHighMagicNumberSet[8]=479;
//....Sonata 10
PopUpFullWideMagicNumberSet[9]=678;
PopUpFullHighMagicNumberSet[9]=427;
//....Sonata 11
PopUpFullWideMagicNumberSet[10]=678;
PopUpFullHighMagicNumberSet[10]=429;
//....Sonata 12
PopUpFullWideMagicNumberSet[11]=678;
PopUpFullHighMagicNumberSet[11]=801;
//....Sonata 13
PopUpFullWideMagicNumberSet[12]=678;
PopUpFullHighMagicNumberSet[12]=510;
//....Sonata 14
PopUpFullWideMagicNumberSet[13]=678;
PopUpFullHighMagicNumberSet[13]=610;
//....Sonata 15
PopUpFullWideMagicNumberSet[14]=678;
PopUpFullHighMagicNumberSet[14]=821;
//....Sonata 16
PopUpFullWideMagicNumberSet[15]=678;
PopUpFullHighMagicNumberSet[15]=757;
//....Sonata 17
PopUpFullWideMagicNumberSet[16]=678;
PopUpFullHighMagicNumberSet[16]=564;
//....Sonata 18
PopUpFullWideMagicNumberSet[17]=678;
PopUpFullHighMagicNumberSet[17]=499;
//....Sonata 19
PopUpFullWideMagicNumberSet[18]=678;
PopUpFullHighMagicNumberSet[18]=401;
//....Sonata 20
PopUpFullWideMagicNumberSet[19]=678;
PopUpFullHighMagicNumberSet[19]=553;
//....Sonata 21
PopUpFullWideMagicNumberSet[20]=678;
PopUpFullHighMagicNumberSet[20]=679;
//....Sonata 22
PopUpFullWideMagicNumberSet[21]=678;
PopUpFullHighMagicNumberSet[21]=698;
//....Sonata 23
PopUpFullWideMagicNumberSet[22]=678;
PopUpFullHighMagicNumberSet[22]=797;
//....Sonata 24
PopUpFullWideMagicNumberSet[23]=678;
PopUpFullHighMagicNumberSet[23]=412;
//....Sonata 25
PopUpFullWideMagicNumberSet[24]=678;
PopUpFullHighMagicNumberSet[24]=665;
//....Sonata 26
PopUpFullWideMagicNumberSet[25]=678;
PopUpFullHighMagicNumberSet[25]=728;
//....Sonata 27
PopUpFullWideMagicNumberSet[26]=678;
PopUpFullHighMagicNumberSet[26]=799;
//....Sonata 28
PopUpFullWideMagicNumberSet[27]=678;
PopUpFullHighMagicNumberSet[27]=777;
//....Sonata 29
PopUpFullWideMagicNumberSet[28]=678;
PopUpFullHighMagicNumberSet[28]=765;
//....Sonata 30
PopUpFullWideMagicNumberSet[29]=678;
PopUpFullHighMagicNumberSet[29]=734;
//....Sonata 31
PopUpFullWideMagicNumberSet[30]=678;
PopUpFullHighMagicNumberSet[30]=717;
//....Sonata 32
PopUpFullWideMagicNumberSet[31]=678;
PopUpFullHighMagicNumberSet[31]=633;
//-----------------------------------------------------
//Quasi-Class: Popup Multi-pager...
//-----------------------------------------------------
function MultiPager(elementName)
{
	//Base DIV [string] name.
	this.mpageElementName=elementName;
	//Entry *ACTIVE* flag.
	this.mpageActive=false;
	//Page information...
	this.mpageCurrentPage=0;
	this.mpagePageCount=0;
	//Page height array.
	this.mpageHeight=new Array(10);
}
//-----------------------------------------------------
//Popup Multi-pager configuration.
//-----------------------------------------------------
var PopupPagerSet=new Array(32);
var CurrentPopupPager=null;
//-----------------------------------------------------
//Local User Credentials Information...
//-----------------------------------------------------
var LightningToken=null;
//-----------------------------------------------------
//Global XMLHttpRequest object reference.
//-----------------------------------------------------
var GetLVBPianoSonataVideoXHR=CreateXmlHttpRequestObject();
var LocalUserCredentialManagerXHR=CreateXmlHttpRequestObject();
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//All Web Service Routines... BEGIN HERE.
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//-----------------------------------------------------
//WS CALL... Get the [Session] Lightning Token.
//-----------------------------------------------------
function GetSessionLightningTokenFromWS()
{
	//Better have the XmlHttpRequest Object!
	if(LocalUserCredentialManagerXHR)
	{
		//Invalidate the current token...
		LightningToken=null;
		//Grab the Website from the FULL PATH... upto the last '/'.
		var WebSite=location.pathname;
		var endChar=WebSite.lastIndexOf("/");
			WebSite=WebSite.substring(0, endChar+1);
		//Full URL to target WebService.
		var currentHostURL="http://"+location.host+WebSite+"wsLocalUserCredentialService.asmx/CreateSessionLightningToken";
		//We want this XmlHttpRequest asynchronous.
		try 
		{
			//Never go cross-domain.
			LocalUserCredentialManagerXHR.open("POST", currentHostURL, true);
		}
		catch(e)
		{
			//Trouble!
			writeDebug("Error in GetSessionLightningTokenFromWS ["+e.name+"]: "+e.message,true); 
			//Later dude!
			return;
		}
		//OK so far... go ask the server for the DATA!
		try
		{
			//This is the ASYNC Response Handler.
			LocalUserCredentialManagerXHR.onreadystatechange=onGetSessionLightningTokenFromWSComplete;
			//Execute the request... Fire at will!
			LocalUserCredentialManagerXHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			LocalUserCredentialManagerXHR.send();
		}
		catch(e)
		{
			//Trouble!
			writeDebug("Error in GetSessionLightningTokenFromWS ["+e.name+"]: "+e.message,true); 
		}
	}
}
//-----------------------------------------------------
//WS Return CALL... [Session] Lightning Token fetch is
//(hopefully) complete.
//-----------------------------------------------------
function onGetSessionLightningTokenFromWSComplete() 
{
	try
	{
		//We only care about READYSTATE_COMPLETE Ready State (4).
		if(LocalUserCredentialManagerXHR.readyState==READYSTATE_COMPLETE)
		{
			//GOOD: the request was OK (equal to a Http Status code of 200).
			if(LocalUserCredentialManagerXHR.status==HTTPSTATUS_OK)
			{
					//Deal with the Response as XML formatted Data.
					var xmlDoc=LocalUserCredentialManagerXHR.responseXML;
					if(xmlDoc!=null)
					{
						//This is real fucked-up... Get the XML doc element...
						var docElment=xmlDoc.documentElement;
						//Get the 'string' Element... 
						var AllStringElements=xmlDoc.getElementsByTagName("string");
						LightningToken=AllStringElements[0].firstChild.nodeValue;
					}
			} 
			else
			{
				//Never Happen: Trouble, Tell the USER!
				var Bugs=LocalUserCredentialManagerXHR.responseText;
				writeDebug("Error in onGetSessionLightningTokenFromWSComplete! "+Bugs,true); 
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in onGetSessionLightningTokenFromWSComplete ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//WS CALL... [Protected] User Authenticator via WS.
//-----------------------------------------------------
function ProtectedUserAuthenticateViaWS(cryptoData)
{
	//Better have the XmlHttpRequest Object!
	if(LocalUserCredentialManagerXHR)
	{
		//Grab the Website from the FULL PATH... upto the last '/'.
		var WebSite=location.pathname;
		var endChar=WebSite.lastIndexOf("/");
			WebSite=WebSite.substring(0, endChar+1);
		//Full URL to target WebService.
		var currentHostURL="http://"+location.host+WebSite+"wsLocalUserCredentialService.asmx/AuthenticatelLocalUser";
		//We want this XmlHttpRequest asynchronous.
		try 
		{
			//Never go cross-domain.
			LocalUserCredentialManagerXHR.open("POST", currentHostURL, true);
		}
		catch(e)
		{
			//Trouble!
			writeDebug("Error in ProtectedUserAuthenticateViaWS ["+e.name+"]: "+e.message,true); 
			//Later dude!
			return;
		}
		//OK so far... go ask the server for the DATA!
		try
		{
			//This is the ASYNC Response Handler.
			LocalUserCredentialManagerXHR.onreadystatechange=onProtectedUserAuthenticateViaWSComplete;
			//Execute the request... Fire at will!
			LocalUserCredentialManagerXHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			LocalUserCredentialManagerXHR.send("cryptoData="+cryptoData);
		}
		catch(e)
		{
			//Trouble!
			writeDebug("Error in ProtectedUserAuthenticateViaWS ["+e.name+"]: "+e.message,true); 
		}
	}
}
//-----------------------------------------------------
//WS Return CALL... [Protected] User Authenticator is
//(hopefully) complete.
//-----------------------------------------------------
function onProtectedUserAuthenticateViaWSComplete() 
{
	try
	{
		//We only care about READYSTATE_COMPLETE Ready State (4).
		if(LocalUserCredentialManagerXHR.readyState==READYSTATE_COMPLETE)
		{
			//GOOD: the request was OK (equal to a Http Status code of 200).
			if(LocalUserCredentialManagerXHR.status==HTTPSTATUS_OK)
			{
					//Deal with the Response as XML formatted Data.
					var xmlDoc=LocalUserCredentialManagerXHR.responseXML;
					if(xmlDoc!=null)
					{
						//This is real fucked-up... Get the XML doc element...
						var docElment=xmlDoc.documentElement;
						//Get the 'string' Element... 
						var AllStringElements=xmlDoc.getElementsByTagName("boolean");
						var AuthenticationResult=AllStringElements[0].firstChild.nodeValue;
						//DID WE AUTHENTICATE?
						wsLoginCallback(AuthenticationResult);
					}
			} 
			else
			{
				//Never Happen: Trouble, Tell the USER!
				var Bugs=LocalUserCredentialManagerXHR.responseText;
				writeDebug("Error in onProtectedUserAuthenticateViaWSComplete! "+Bugs,true); 
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in onProtectedUserAuthenticateViaWSComplete ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//WS CALL... [Protected] User Authorization via WS.
//-----------------------------------------------------
function ProtectedUserAuthorizeViaWS(cryptoData, role)
{
	//Better have the XmlHttpRequest Object!
	if(LocalUserCredentialManagerXHR)
	{
		//Grab the Website from the FULL PATH... upto the last '/'.
		var WebSite=location.pathname;
		var endChar=WebSite.lastIndexOf("/");
			WebSite=WebSite.substring(0, endChar+1);
		//Full URL to target WebService.
		var currentHostURL="http://"+location.host+WebSite+"wsLocalUserCredentialService.asmx/AuthorizeLocalUserInRole";
		//We want this XmlHttpRequest asynchronous.
		try 
		{
			//Never go cross-domain.
			LocalUserCredentialManagerXHR.open("POST", currentHostURL, true);
		}
		catch(e)
		{
			//Trouble!
			writeDebug("Error in ProtectedUserAuthorizeViaWS ["+e.name+"]: "+e.message,true); 
			//Later dude!
			return;
		}
		//OK so far... go ask the server for the DATA!
		try
		{
			//This is the ASYNC Response Handler.
			LocalUserCredentialManagerXHR.onreadystatechange=onProtectedUserAuthorizeViaWSComplete;
			//Execute the request... Fire at will!
			LocalUserCredentialManagerXHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			LocalUserCredentialManagerXHR.send("cryptoData="+cryptoData+"&role="+role);
		}
		catch(e)
		{
			//Trouble!
			writeDebug("Error in ProtectedUserAuthorizeViaWS ["+e.name+"]: "+e.message,true); 
		}
	}
}
//-----------------------------------------------------
//WS Return CALL... [Protected] User Authorization is
//(hopefully) complete.
//-----------------------------------------------------
function onProtectedUserAuthorizeViaWSComplete() 
{
	try
	{
		//We only care about READYSTATE_COMPLETE Ready State (4).
		if(LocalUserCredentialManagerXHR.readyState==READYSTATE_COMPLETE)
		{
			//GOOD: the request was OK (equal to a Http Status code of 200).
			if(LocalUserCredentialManagerXHR.status==HTTPSTATUS_OK)
			{
					//Deal with the Response as XML formatted Data.
					var xmlDoc=LocalUserCredentialManagerXHR.responseXML;
					if(xmlDoc!=null)
					{
						//This is real fucked-up... Get the XML doc element...
						var docElment=xmlDoc.documentElement;
						//Get the 'string' Element... 
						var AllStringElements=xmlDoc.getElementsByTagName("boolean");
						var AuthorizationResult=AllStringElements[0].firstChild.nodeValue;
						//DID WE GET PROPER AUTHORIZATION?
						wsRoleServiceCallback(AuthorizationResult);
					}
			} 
			else
			{
				//Never Happen: Trouble, Tell the USER!
				var Bugs=LocalUserCredentialManagerXHR.responseText;
				writeDebug("Error in onProtectedUserAuthorizeViaWSComplete! "+Bugs,true); 
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in onProtectedUserAuthorizeViaWSComplete ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//WS CALL... Get the 'LVB Piano Sonata' Video MMS URI.
//-----------------------------------------------------
function GetNextLVBPianoSonataVideoMMSaccessURIFromWS()
{
	//Better have the XmlHttpRequest Object!
	if(GetLVBPianoSonataVideoXHR)
	{
		//Grab the Website from the FULL PATH... upto the last '/'.
		var WebSite=location.pathname;
		var endChar=WebSite.lastIndexOf("/");
			WebSite=WebSite.substring(0, endChar+1);
		//Full URL to target WebService.
		var currentHostURL="http://"+location.host+WebSite+"wsLVBPianoSonataMovieService.asmx/GetLVBPianoSonataMMSAccessURI";
		//We want this XmlHttpRequest asynchronous.
		try 
		{
			//Never go cross-domain.
			GetLVBPianoSonataVideoXHR.open("POST", currentHostURL, true);
		}
		catch(e)
		{
			//Trouble!
			writeDebug("Error in GetNextLVBPianoSonataVideoMMSaccessURIFromWS ["+e.name+"]: "+e.message,true); 
			//Later dude!
			return;
		}
		//OK so far... go ask the server for the DATA!
		try
		{
			//This is the ASYNC Response Handler.
			GetLVBPianoSonataVideoXHR.onreadystatechange=onGetNextLVBPianoSonataVideoMMSaccessURIComplete;
			//Execute the request... Fire at will!
			GetLVBPianoSonataVideoXHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			GetLVBPianoSonataVideoXHR.send("index="+LVBPianoSonataVideoIndex);
		}
		catch(e)
		{
			//Trouble!
			writeDebug("Error in GetNextLVBPianoSonataVideoMMSaccessURIFromWS ["+e.name+"]: "+e.message,true); 
		}
	}
}
//-----------------------------------------------------
//WS Return CALL... 'LVB Piano Sonata' Video  MMS URI
//fetch is (hopefully) complete.
//-----------------------------------------------------
function onGetNextLVBPianoSonataVideoMMSaccessURIComplete() 
{
	try
	{
		//We only care about READYSTATE_COMPLETE Ready State (4).
		if(GetLVBPianoSonataVideoXHR.readyState==READYSTATE_COMPLETE)
		{
			//GOOD: the request was OK (equal to a Http Status code of 200).
			if(GetLVBPianoSonataVideoXHR.status==HTTPSTATUS_OK)
			{
					//Deal with the Response as XML formatted Data.
					var xmlDoc=GetLVBPianoSonataVideoXHR.responseXML;
					if(xmlDoc!=null)
					{
						//This is real fucked-up... Get the XML doc element...
						var docElment=xmlDoc.documentElement;
						//Get the 'string' Element... 
						var AllStringElements=xmlDoc.getElementsByTagName("string");
						var cryptoNextMovieMMSVidoeURI=AllStringElements[0].firstChild.nodeValue;
						//Get the AES [GUID] session key from the lightning token.
						var lightningTokenBytes=System.Convert.FromBase64String(LightningToken, false);
						var lightningTokenBytesReverse=lightningTokenBytes.reverse();
						var lightninghGuid=new System.Guid(lightningTokenBytesReverse);
						var lightninghGuidString=lightninghGuid.ToString();
						//Decrypt the Movie MMS URI... 
						NextMovieMMSVidoeURI=DecryptFromBase64(lightninghGuidString, 
															   cryptoNextMovieMMSVidoeURI);
					}
			} 
			else
			{
				//Never Happen: Trouble, Tell the USER!
				var Bugs=GetLVBPianoSonataVideoXHR.responseText;
				writeDebug("Error in onGetNextLVBPianoSonataVideoMMSaccessURIComplete! "+Bugs,true); 
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in onGetNextLVBPianoSonataVideoMMSaccessURIComplete ["+e.name+"]: "+e.message,true); 
	}
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//All UTILITY JS Methods... BEGIN HERE.
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//-----------------------------------------------------
//Add shuffle to core js array functionality.
//-----------------------------------------------------
(function () {                                                                  
    var swapper=function (suffleMe,el,all) 
    {  
		//Random index from full array!
		var ran=Math.floor(Math.random()*all);  
		//Get the current element. 
		var saver=suffleMe[el];  
		//Replace it with the random selection.
		suffleMe[el]=suffleMe[ran]; 
		//Swap current to random slot.
		suffleMe[ran]=saver;                                                           
	};
	//Add shuffle to Array base object.
    Array.prototype.shuffle=function()
    {                                                           
		var i=this.length; 
		var Total=i;  
		while (i--)
		{
			swapper(this,i,Total);   
		}
	};                                                                      
})();
//-----------------------------------------------------
//General Purpose [ACT-Animation] FADER... Fade away!
//-----------------------------------------------------
function JustFadeAwayDude()
{
	try
	{
		//Fade in after we fade out!
		PopupPagerAnimation.remove_ended(FinalizeDelegate);
		PopupPagerAnimation.add_ended(FadeInDelegate);
		//Show the Flyout DIV... hidden behind the PopUp.
		$get('flyoutDiv').style.display="block";
		$get('flyoutDiv').style.visibility="visible";
		//Fade out the PopUp... leaving just the Flyout DIV.
		PopupPagerAnimation.set_effect($AA.FadeEffect.FadeOut);    
		//Do it!                            
		PopupPagerAnimation.play();
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in JustFadeAwayDude ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//General Purpose [ACT-Animation] FADER... Fade back!
//-----------------------------------------------------
function JustFadeBackDude()
{
	try
	{
		//Finalize after we fade in!
		PopupPagerAnimation.remove_ended(FadeInDelegate);
		PopupPagerAnimation.add_ended(FinalizeDelegate);
		//Figure out the new page to show...
		CurrentPopupPager.mpageCurrentPage++;
		if(CurrentPopupPager.mpageCurrentPage>=CurrentPopupPager.mpagePageCount)
		{
			CurrentPopupPager.mpageCurrentPage=0;
		}
		//Adjust the Flyout DIV...
		var thenewHeight=CurrentPopupPager.mpageHeight[CurrentPopupPager.mpageCurrentPage];
		$get('flyoutDiv').style.height=thenewHeight+"px";
		//Build the Dynamic DIV ID string.
		var DIVSourceID=CurrentPopupPager.mpageElementName;
		if(CurrentPopupPager.mpageCurrentPage!=0)
		{
			DIVSourceID+=CurrentPopupPager.mpageCurrentPage;
		}
		//Dynamically set the Info popup CONTENT!
		$get("MainContent").innerHTML=$get(DIVSourceID).innerHTML
		//Fade in the PopUp... in front of the Flyout DIV.
		PopupPagerAnimation.set_effect($AA.FadeEffect.FadeIn);    
		//Do it!                            
		PopupPagerAnimation.play();
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in JustFadeBackDude ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//General Purpose [ACT-Animation] FADER... Finalize!
//-----------------------------------------------------
function FaderFinalize()
{
	try
	{
		//Hide the Flyout DIV... we are done with it.
		$get('flyoutDiv').style.display="none";
		$get('flyoutDiv').style.visibility="hidden";
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in FaderFinalize ["+e.name+"]: "+e.message,true); 
	}
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//All USER CONTROL JS Methods... BEGIN HERE.
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//-----------------------------------------------------
//Do the actual USER Authentication.
//-----------------------------------------------------
function GoDoTheUserAuthenticate()
{
	try
	{	
		//MUST HAVE A LIGHTNING TOKEN...
		if(LightningToken==null)
		{
			//Trouble...
			$get("theMoviesErrorInfoBannerID").innerHTML="Sorry... Missing or invalid lightning token. Try again.";
			$get("theMoviesErrorInfoBannerID").style.display="block";
			$get("theMoviesErrorInfoBannerID").style.visibility="visible";
			//Try to refresh the token...
			GetSessionLightningTokenFromWS();
			//Later...
			return;
		}
		//Step ONE: Build the authentication token... UTF-8!
		var UserName=$get("UserNameBoxID").value;
		var Password=$get("PassWordBoxID").value;
		var AuthenticationToken="Userid="+UserName+";Password="+Password+";Site=LVB Piano Sonatas Rule";	
		//Step TWO: Get the AES [GUID] session key from the lightning token.
		var lightningTokenBytes=System.Convert.FromBase64String(LightningToken, false);
		var lightningTokenBytesReverse=lightningTokenBytes.reverse();
		var lightninghGuid=new System.Guid(lightningTokenBytesReverse);
		var lightninghGuidString=lightninghGuid.ToString();
		//Step THREE: Encrypt the Authentication token... 
		var encryptAuthenticationToken=EncryptToBase64(lightninghGuidString, 
													   AuthenticationToken);
		//Step FOUR: Some base64 chars will not pass thru the XHR HTTP 'POST'...
		//	-convert the base64 string [A-Z, a-z, 0-9 +/=] to a byte array.
		//	-convert the byte array to a HEX string [0-9, a-f]. SAFE!
		var encryptAuthenticationTokenBYTES=System.Convert.FromBase64String(encryptAuthenticationToken,
																			true);
		var encryptAuthenticationTokenHEXString=System.Convert.BytesToHexString(encryptAuthenticationTokenBYTES);
		//Step FIVE: Let the main server do the work.
		ProtectedUserAuthenticateViaWS(encryptAuthenticationTokenHEXString);	
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in GoDoTheUserAuthenticate ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//AuthenticationService callback... Check the login!
//-----------------------------------------------------
function wsLoginCallback(WeAreLoggedIn) 
{
	try
	{
		//Are we ready for ACTION?
		if (WeAreLoggedIn=='true')
		{
			//MUST HAVE A LIGHTNING TOKEN...
			if(LightningToken==null)
			{
				//Trouble...
				$get("theMoviesErrorInfoBannerID").innerHTML="Sorry... Missing or invalid lightning token. Try again.";
				$get("theMoviesErrorInfoBannerID").style.display="block";
				$get("theMoviesErrorInfoBannerID").style.visibility="visible";
				//Try to refresh the token...
				GetSessionLightningTokenFromWS();
				//Later...
				return;
			}
			//Step ONE: Build the authorization token... UTF-8!
			var UserName=$get("UserNameBoxID").value;
			var AuthorizationToken="Userid="+UserName+";Site=LVB Piano Sonatas Rule";	
			//Step TWO: Get the AES [GUID] session key from the lightning token.
			var lightningTokenBytes=System.Convert.FromBase64String(LightningToken, false);
			var lightningTokenBytesReverse=lightningTokenBytes.reverse();
			var lightninghGuid=new System.Guid(lightningTokenBytesReverse);
			var lightninghGuidString=lightninghGuid.ToString();
			//Step THREE: Encrypt the Authorization token... 
			var encryptAuthorizationToken=EncryptToBase64(lightninghGuidString, 
														  AuthorizationToken);
			//Step FOUR: Some base64 chars will not pass thru the XHR HTTP 'POST'...
			//	-convert the base64 string [A-Z, a-z, 0-9 +/=] to a byte array.
			//	-convert the byte array to a HEX string [0-9, a-f]. SAFE!
			var encryptAuthorizationTokenBYTES=System.Convert.FromBase64String(encryptAuthorizationToken,
																			   true);
			var encryptAuthorizationTokenHEXString=System.Convert.BytesToHexString(encryptAuthorizationTokenBYTES);
			//Step FIVE: Let the main server do the work.
			ProtectedUserAuthorizeViaWS(encryptAuthorizationTokenHEXString,'movieMaster');	
		}
		else
		{
			//No luck... Tell'em to try again.
			if($get("theMoviesErrorInfoBannerID")!=null)
			{
				$get("theMoviesErrorInfoBannerID").innerHTML="Sorry... Invalid Username or Password!";
				$get("theMoviesErrorInfoBannerID").style.display="block";
				$get("theMoviesErrorInfoBannerID").style.visibility="visible";
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in wsLoginCallback ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//RoleService callback... Check the authorization!
//-----------------------------------------------------
function wsRoleServiceCallback(AuthorizationResult) 
{
	try
	{
		if(AuthorizationResult=='true')
		{
			//They have not selected a Video yet!
			LVBPianoSonataVideoIndex=-1;
			//Always... Make sure all other PANELS are hidden.
			if($get("theMoviesAuthenticateID")!=null)
			{
				$get("theMoviesAuthenticateID").style.display="none";
				$get("theMoviesAuthenticateID").style.visibility="hidden";
			}
			//Always... Make sure the 'LVB Piano Sonata' Accordion PANEL is visible.
			if($get("lvbpsAccordionCascadeID")!=null)
			{
				$get("lvbpsAccordionCascadeID").style.display="block";
				$get("lvbpsAccordionCascadeID").style.visibility="visible";
			}
			//Mark this User as Authenticated.
			UserAuthenticated=1;
		}
		else
		{
			//No luck... Tell'em to try again.
			if($get("theMoviesErrorInfoBannerID")!=null)
			{
				$get("theMoviesErrorInfoBannerID").innerHTML="Sorry... You are not authorized to access this resource!";
				$get("theMoviesErrorInfoBannerID").style.display="block";
				$get("theMoviesErrorInfoBannerID").style.visibility="visible";
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in loadRolesSuccessful ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//General Purpose LVB Sonata Video LAUNCHER...
//-----------------------------------------------------
function ShowLVBPinaoSonataVideo()
{
	try
	{
		//Not while the Popup is Visible.
		if(PopUpInUse==true)
		{
			return;
		}
		//Did they select an Video yet...
		if(LVBPianoSonataVideoIndex==-1)
		{
			return;
		}
		//We better know who this is!!!
		if (UserAuthenticated==1)
		{
			//Collapse the 'LVB Piano Sonata' Accordion.
			if($get("LVBPianoSonataAccordion").AccordionBehavior!=null)
			{
				$get("LVBPianoSonataAccordion").AccordionBehavior.set_SelectedIndex(-1);
			}
			//Always... Make sure all other PANELS are hidden.
			if($get("theMoviesID")!=null)
			{
				$get("theMoviesID").style.display="none";
				$get("theMoviesID").style.visibility="hidden";
			}
			if($get("theMovieSliderBar")!=null)
			{
				$get("theMovieSliderBar").style.display="none";
				$get("theMovieSliderBar").style.visibility="hidden";
			}
			//Unbelievable fuck-up... this thing will not go away!
			if($get("sl0slider")!=null)
			{
				$get("sl0slider").style.display="none";
				$get("sl0slider").style.visibility="hidden";
			}
			//Always... Make sure the Waiting PANEL is visible.
			if($get("theWaitingMasterID")!=null)
			{
				$get("theWaitingMasterID").style.display="block";
				$get("theWaitingMasterID").style.visibility="visible";
			}
			//Hide the 'Modal Popup Drag Handle' Title...
			if($get("ClickHereAndDragID")!=null)
			{
				$get("ClickHereAndDragID").style.visibility="hidden";
			}
			//Show the ajaxToolkit ModalPopupExtender!
			if($find('ModalPopupBehaviorID')!=null)
			{
				$find('ModalPopupBehaviorID').show();
			}
			//Start the 'LVB Piano Sonata' Video MMS URL Fetch.
			NextMovieMMSVidoeURI=null;
			GetNextLVBPianoSonataVideoMMSaccessURIFromWS();
			//Make'em wait.... fuck'em!
			MoviePickerWaitInProgress=true;
			MoviePickerWaitInterval=0;
		}		
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in ShowLVBPinaoSonataVideo ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Movie Player: Done with the wait... Play the Film!
//-----------------------------------------------------
function TimeToWatchLVBPianoSonataFilm()
{
	try
	{
		//We better know who this is!!!
		if (UserAuthenticated==1)
		{
			//Always... Make sure all other PANELS are hidden.
			if($get("theWaitingMasterID")!=null)
			{
				$get("theWaitingMasterID").style.display="none";
				$get("theWaitingMasterID").style.visibility="hidden";
			}
			//Always... Make sure the Movie Viewer PANEL is visible.
			if($get("theMoviesID")!=null)
			{
				$get("theMoviesID").style.display="block";
				$get("theMoviesID").style.visibility="visible";
			}
			if($get("theMovieSliderBar")!=null)
			{
				$get("theMovieSliderBar").style.display="block";
				$get("theMovieSliderBar").style.visibility="visible";
			}
			//Unbelievable fuck-up... bring the sucker back!
			if($get("sl0slider")!=null)
			{
				$get("sl0slider").style.display="block";
				$get("sl0slider").style.visibility="visible";
			}
			//Show the 'Modal Popup Drag Handle' Title...
			if($get("ClickHereAndDragID")!=null)
			{
				$get("ClickHereAndDragID").style.visibility="visible";
			}
			//YES... Go watch the Film!
			GoToTheMovies();
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in TimeToWatchLVBPianoSonataFilm ["+e.name+"]: "+e.message,true); 
	}
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//All HIDDEN MOVIE JS Methods... BEGIN HERE.
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//-----------------------------------------------------
//Video Player Launch...
//-----------------------------------------------------
function GoToTheMovies()
{
	//Just do it once.
	if(isVideoPlaying)
	{
		return;
	}
	try
	{
		//Initialize the Video Player Interface.
		var TheMoviesDIV=$get("theMoviesID");
		if(TheMoviesDIV!=null)
		{
			//Set the Movie Mode [dependent] width/height.
			TheMoviesDIV.style.width="922px";
			TheMoviesDIV.style.height="608px";
			//Show the main movie div container.
			TheMoviesDIV.style.display="block";
			TheMoviesDIV.style.visibility="visible";
			//Always... Make sure the 'Next Film' button is visible.
			var TheNextButton=$get("theNextMovie");
			if(TheNextButton!=null)
			{
				TheNextButton.style.display="inline";
				TheNextButton.style.visibility="visible";
			}
			//Always... Make sure the Scrubber Input is hidden.
			var TheScrubberInput=$get("sliderValue1");
			if(TheScrubberInput!=null)
			{
				TheScrubberInput.style.display="none";
				TheScrubberInput.style.visibility="hidden";
			}
		}
		//Screwy Louie, dandy Randy... access the Video Player.
		var thePLAYER=$get("VideoZap");
		//Set the current mode Video Player SIZE...
		thePLAYER.width="852";
		thePLAYER.height="480";
		if(NextMovieMMSVidoeURI!=null)
		{
			ThisMovieMMSVideoURI=NextMovieMMSVidoeURI;
			NextMovieMMSVidoeURI=null;
		}
		else
		{
			ThisMovieMMSVideoURI=DefaultMovieMMSVideoURI;
		}
		//Whatever... slam it in.
		thePLAYER.URL=ThisMovieMMSVideoURI;
		//Do the 'LVB Piano Sonata' Video index maintenance.
		LVBPianoSonataVideoIndex++;
		if(LVBPianoSonataVideoIndex<0 || LVBPianoSonataVideoIndex>31)
		{
			LVBPianoSonataVideoIndex=0;
		}
		//WS call... try to get the next Video URI.
		GetNextLVBPianoSonataVideoMMSaccessURIFromWS();
		//Now... we are ACTIVE.
		isVideoPlaying=true;
		isVideoPaused=false;
		//Start the Video Player.
		thePLAYER.controls.play();
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in GoToTheMovies ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//EXIT Button Handler... Hide the entire mess!
//-----------------------------------------------------
function WeAreDone()
{
	try
	{
		//Cancel any pending wait!
		MoviePickerWaitInProgress=false;
		MoviePickerWaitInterval=0;
		//Shut down the Video player.
		isVideoPlaying=false;
		isVideoPaused=false;
		//Clear the Movie Time...
		TheMovieTimeDIV=$get("theMovieTime");
		if(TheMovieTimeDIV!=null)
		{
			//Tell'em the MOVIE time!
			TheMovieTimeDIV.innerHTML="";
		}
		//Reset the Movie Scrubber to 0.
		window.A_SLIDERS[0].f_setValue(0,1);
		//Screwy Louie, dandy Randy... access the Video Player.
		var thePLAYER=$get("VideoZap");
		thePLAYER.controls.stop();
		thePLAYER.close();
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in WeAreDone ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//PLAY Button Handler... Restart the current Video.
//-----------------------------------------------------
function PleasePlayTheMovie()
{
	try
	{
		//Screwy Louie, dandy Randy... access the Video Player.
		var thePLAYER=$get("VideoZap");
		//Just do the [re]Start.
		thePLAYER.controls.play();
		//We are back in ACTION!
		isVideoPlaying=true;
		isVideoPaused=false;
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in PleasePlayTheMovie ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Rewind Button Handler... REW (<<) the current Video.
//-----------------------------------------------------
function PleaseFastReverseTheMovie()
{
	try
	{
		//We must be PLAYING the MOVIE!
		if(isVideoPlaying||isVideoPaused)
		{
			//Screwy Louie, dandy Randy... access the Video Player.
			var thePLAYER=$get("VideoZap");
			if(thePLAYER.controls.isAvailable('FastReverse'))
			{
				//From normal rate to -5X...
				if(thePLAYER.settings.rate==1)
				{
					thePLAYER.controls.fastReverse();
				} 
				//From normal rate to -10X...
				else if(thePLAYER.settings.rate==-5)
				{
					thePLAYER.settings.rate==-10;
				}
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in PleaseRewindTheMovie ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Rewind Button Handler... FF (>>) the current Video.
//-----------------------------------------------------
function PleaseFastForwardTheMovie()
{
	try
	{
		//We must be PLAYING the MOVIE!
		if(isVideoPlaying||isVideoPaused)
		{
			//Screwy Louie, dandy Randy... access the Video Player.
			var thePLAYER=$get("VideoZap");
			if(thePLAYER.controls.isAvailable('FastForward'))
			{
				//From normal rate to 5X...
				if(thePLAYER.settings.rate==1)
				{
					thePLAYER.controls.fastForward();
				} 
				//From normal rate to 10X...
				else if(thePLAYER.settings.rate==5)
				{
					thePLAYER.settings.rate==10;
				}
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in PleaseFastForwardTheMovie ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//PAUSE Button Handler... Pause, but keep this Video.
//-----------------------------------------------------
function PleasePauseTheMovie()
{
	try
	{
		//Must be PLAYING to PAUSE!
		if(isVideoPlaying||isVideoPaused)
		{
			//Screwy Louie, dandy Randy... access the Video Player.
			var thePLAYER=$get("VideoZap");
			thePLAYER.controls.pause();
			//OK... enter PAUSE State.
			isVideoPlaying=false;
			isVideoPaused=true;
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in PleasePauseTheMovie ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//NEXT Button Handler... On to the next Video.
//-----------------------------------------------------
function NextMoviePlease()
{
	try
	{
		//Clear the Movie Time...
		TheMovieTimeDIV=$get("theMovieTime");
		if(TheMovieTimeDIV!=null)
		{
			//Tell'em the MOVIE time!
			TheMovieTimeDIV.innerHTML="";
		}
		//Screwy Louie, dandy Randy... access the Video Player.
		var thePLAYER=$get("VideoZap");
		if(isVideoPlaying||isVideoPaused)
		{
			//We need a HARD STOP!
			thePLAYER.controls.stop();
		}
		//Try to get the next Video...
		if(NextMovieMMSVidoeURI!=null)
		{
			ThisMovieMMSVideoURI=NextMovieMMSVidoeURI;
			NextMovieMMSVidoeURI=null;
		}
		else
		{
			ThisMovieMMSVideoURI=DefaultMovieMMSVideoURI;
		}
		//Whatever... slam it in.
		thePLAYER.URL=ThisMovieMMSVideoURI;
		//Do the 'LVB Piano Sonata' Video index maintenance.
		LVBPianoSonataVideoIndex++;
		if(LVBPianoSonataVideoIndex<0 || LVBPianoSonataVideoIndex>31)
		{
			LVBPianoSonataVideoIndex=0;
		}
		//WS call... try to get the next Video URI.
		GetNextLVBPianoSonataVideoMMSaccessURIFromWS();
		//Reset the Movie Scrubber to 0.
		window.A_SLIDERS[0].f_setValue(0,1);
		//We are playing the next FILM now!
		isVideoPlaying=true;
		isVideoPaused=false;
		//Start the Video Player.
		thePLAYER.controls.play();
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in NextMoviePlease ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//STOP Button Handler...
//-----------------------------------------------------
function PleaseStopTheMovie()
{
	try
	{
		//Hide the Movie Time...
		TheMovieTimeDIV=$get("theMovieTime");
		if(TheMovieTimeDIV!=null)
		{
			//Tell'em the MOVIE time!
			TheMovieTimeDIV.innerHTML="";
		}
		//Must be PLAYING or PAUSED to STOP!
		if(isVideoPlaying||isVideoPaused)
		{
			//Screwy Louie, dandy Randy... access the Video Player.
			var thePLAYER=$get("VideoZap");
			thePLAYER.controls.stop();
		}
		//Reset the Movie Scrubber to 0.
		window.A_SLIDERS[0].f_setValue(0,1);
		//Finally... we are idle.
		isVideoPlaying=false;
		isVideoPaused=false;
		//Do we have a pending BANDWIDTH change???
		if(BandWidthChangeRequest)
		{
			BandWidthChangeRequest=false;
			TheBandWidthMsgDIV=$get("BandWidthMessage");
			if(TheBandWidthMsgDIV!=null)
			{
				//Blow away the USER message... we got it!
				TheBandWidthMsgDIV.style.display="none";
				TheBandWidthMsgDIV.style.visibility="hidden";
				TheBandWidthMsgDIV.innerHTML="";
			}
			try
			{
				//Screwy Louie, dandy Randy... access the Video Player.
				thePLAYER=$get("VideoZap");
				//Tricky... Must CLOSE the Player to change the BANDWIDTH!
				thePLAYER.close();
				thePLAYER.network.maxBandwidth=CurrentBandWidth;
			}
			catch(e)
			{
				writeDebug("Trouble in PleaseStopTheMovie()... could not set maxBandwidth! ["+e.name+"]: "+e.message,true); 
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in PleaseStopTheMovie ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Bandwidth Radio Control Handler...
//-----------------------------------------------------
function SetNewMaxBandwidth()
{
	try
	{
		var thisForm=document.forms[0];
		if(thisForm!=null)
		{
			//Grab the Bandwidth Value that is checked.
			for(i=0;i<thisForm.clampmaxbandwidth.length;i++)
			{
				if(thisForm.clampmaxbandwidth[i].checked) 
				{
					break;
				}
			}
			//Do it only if it CHANGED!
			if(thisForm.clampmaxbandwidth[i].value!=CurrentBandWidth)
			{
				//Save it for later!
				CurrentBandWidth=thisForm.clampmaxbandwidth[i].value;
				BandWidthChangeRequest=true;
				//Try to save it in the DOM cookie object.
				setCookie("BandWidth", CurrentBandWidth, 100);
				TheBandWidthMsgDIV=$get("BandWidthMessage");
				if(TheBandWidthMsgDIV!=null)
				{
					//Tell the USER to STOP the Player to EFFECT the change.
					TheBandWidthMsgDIV.style.display="block";
					TheBandWidthMsgDIV.style.visibility="visible";
					//The Text Color is mode dependent...
					TheBandWidthMsgDIV.style.color="#ffff00";
					TheBandWidthMsgDIV.style.fontSize="18";
					TheBandWidthMsgDIV.style.fontWeight="Bold";
					TheBandWidthMsgDIV.innerHTML="Please Stop the Video Player to change the Bandwidth";
				}
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in SetNewMaxBandwidth ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Someone is moving the Movie Scrubber...
//-----------------------------------------------------
function scrubberMouseMove()
{
	try
	{
		//Find the Video Player..
		var thePLAYER=$get("VideoZap");
		if(thePLAYER!=null)
		{
			//Must be either PLAY, FF or REW... or even BUFFERING.
			if(thePLAYER.playState==3||thePLAYER.playState==4||thePLAYER.playState==5||thePLAYER.playState==6)
			{
				//Grab the scrubber VALUE [1-100].
				var currentScrubberValue=$get('sliderValue1').value;
				//Grab current time as percentage of total time!
				var scrubberTime=thePLAYER.currentMedia.duration*(currentScrubberValue/100);
				//Clamp to seconds.
				var scrubSecs=Math.ceil(scrubberTime);
				var scrubMins=0;
				var scrubHours=0;
				//CRACK the time in SECONDS to H/M/S!
				if(scrubSecs>=60)
				{
					scrubMins=parseInt(scrubSecs/60);
					scrubSecs-=(parseInt(scrubMins*60));
					if(scrubMins>=60)
					{
						scrubHours=parseInt(scrubMins/60);
						scrubMins-=(parseInt(scrubHours*60));
					}
				}
				//Format time to HH:MM:SS/
				var timeString;
				//HOURS...
				if(scrubHours==0)
				{
					timeString="";
				}
				else if(scrubHours<10)
				{
					timeString="0"+scrubHours.toString()+":";
				}
				else
				{
					timeString=scrubHours.toString()+":";
				}
				//MINUTES...
				if(scrubMins<10)
				{
					timeString+="0"+scrubMins.toString()+":";
				}
				else
				{
					timeString+=scrubMins.toString()+":";
				}
				//SECONDS...
				if(scrubSecs<10)
				{
					timeString+="0"+scrubSecs.toString();
				}
				else
				{
					timeString+=scrubSecs.toString();
				}
				//Update the Movie hh:mm:ss div control.
				TheMovieTimeDIV=$get("theMovieTime");
				if(TheMovieTimeDIV!=null)
				{
					//Tell'em the MOVIE time!
					if(thePLAYER.controls.currentPositionString!="")
					{
						TheMovieTimeDIV.innerHTML=timeString;
						TheMovieTimeDIV.innerHTML+="/";
						TheMovieTimeDIV.innerHTML+=thePLAYER.currentMedia.durationString;
					}
				}
			}
		}
	}
	catch(e)
	{
		writeDebug("ERROR in scrubberMouseMove() ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Done moving the Movie Scrubber...
//-----------------------------------------------------
function scrubberMouseUp()
{
	try
	{
		//Find the Video Player..
		var thePLAYER=$get("VideoZap");
		if(thePLAYER!=null)
		{
			//Must be either PLAY, FF or REW... or even BUFFERING.
			if(thePLAYER.playState==3||thePLAYER.playState==4||thePLAYER.playState==5||thePLAYER.playState==6)
			{
				//Grab the scrubber VALUE [1-100].
				var currentScrubberValue=$get('sliderValue1').value;
				//Grab current time as percentage of total time!
				var scrubberTime=thePLAYER.currentMedia.duration*(currentScrubberValue/100);
				//Slam it home... go to the new time.
				thePLAYER.controls.currentPosition=Math.ceil(scrubberTime);
			}
		}
	}
	catch(e)
	{
		writeDebug("ERROR in scrubberMouseUp() ["+e.name+"]: "+e.message,true); 
	}
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//POPUP Animation Control JS Methods... BEGIN HERE.
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//-----------------------------------------------------
//Move 'top' element directly on top of 'bottom'
//element (and optionally make it the same size).
//-----------------------------------------------------
function Cover(bottomTarget, topTarget, ignoreSize) 
{
	try
	{
		//This is the target location.
		var	thisLocation=Sys.UI.DomElement.getLocation(bottomTarget);
		//Swooooosh... move the element to be animated.
		topTarget.style.position='absolute';
		topTarget.style.top=thisLocation.y+'px';
		topTarget.style.left=thisLocation.x+'px';
		//Optionally... make the target the same size.
		if (!ignoreSize) 
		{
			topTarget.style.height=bottomTarget.offsetHeight+'px';
			topTarget.style.width=bottomTarget.offsetWidth+'px';
		}
	}
	catch(e)
	{
		writeDebug("ERROR in Cover() ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Move 'top' element directly on top of BUTTON
//element (and optionally make it the same size).
//-----------------------------------------------------
function CoverButton(topTarget, ignoreSize) 
{
	try
	{
		//This is the target location.
		var thisLocation=Sys.UI.DomElement.getLocation(ButtonObject);
		//Swooooosh... move the element to be animated.
		topTarget.style.position='absolute';
		topTarget.style.top=thisLocation.y+'px';
		topTarget.style.left=thisLocation.x+'px';
		//Optionally... make the target the same size.
		if (!ignoreSize) 
		{
			topTarget.style.height=ButtonObject.offsetHeight+'px';
			topTarget.style.width=ButtonObject.offsetWidth+'px';
		}
	}
	catch(e)
	{
		writeDebug("ERROR in CoverButton() ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Dynamic Info popup Button Handler. Real slick, make
//the button that fired this EVENT the target of the
//Open Animation so the Info popup DIV fades in from
//this button. Make the button the taget of the Close
//Animation EnableAction as well. COOL Stuff! Oh ya,
//and then *RUN* the fucking Open Animation.
//-----------------------------------------------------
function showModalPopupViaTargetButton(ev) 
{
	try
	{
		//Do not do the 'normal' stuff.
		ev.preventDefault();
		//Just one Info popup at a time.
		if(PopUpInUse==true)
		{
			return;
		}
		//Dynamically set the Info popup CONTENT!
		$get("MainContent").innerHTML=PopUpDynamicContent.innerHTML
		//This button's location is the animation starting point.
		ButtonObject=ev.target;
		//Grab the OpenAnimation object.
		var openAnimationBehavior=$find('OpenAnimation');
		var openAnimationClickBehavior=openAnimationBehavior.get_OnClickBehavior();
		var openAnimation=openAnimationClickBehavior.get_animation();
		var openAnimationSet=openAnimation.get_animations();
		//Grab the CloseAnimation object and get the ANIMATIONS array.
		var closeAnimationBehavior=$find('CloseAnimation');
		var closeAnimationClickBehavior=closeAnimationBehavior.get_OnClickBehavior();
		var closeAnimation=closeAnimationClickBehavior.get_animation();
		var closeAnimationSet=closeAnimation.get_animations();
		//MAKE THIS BUTTON THE TARGET OF THE OpenAnimation. 
		openAnimation.set_target(ev.target);
		//TACKY... The Parallel Animation is the 4th animation child
		//of the OpenAnimation.
		var ParallelAnimation=openAnimationSet[3];
		var ParallelAnimationSet=ParallelAnimation.get_animations();
		//Calculate the Popup top centered.
		var vertTopCentered=screen.availHeight/2-PopUpMagicNumberHeight/2;
		//Move the Popup to this vertical location!
		var vertLocation=vertTopCentered-ev.clientY;
		//TACKY... The 1st animation child of the Parallel Animation
		//is the Move property... set the horz/vert positions.
		ParallelAnimationSet[0].set_horizontal(-250);
		ParallelAnimationSet[0].set_vertical(vertLocation);
		//TACKY... The 2nd animation child of the Parallel Animation
		//is the Resize property... set the width and height.
		ParallelAnimationSet[1].set_width(PopUpMagicNumberWidth);
		ParallelAnimationSet[1].set_height(PopUpMagicNumberHeight);
		//TACKY... The EnableAction is the 8th animation child
		//of the CloseAnimation. Make this BUTTON its target.
		closeAnimationSet[7].set_target(ev.target);
		//BANG! Start the OpenAnimation running!
		openAnimationClickBehavior.play();
		//We are busy!
		PopUpInUse=true;
		//No [related] video when the Popup is visible!
		videoButtonObject.disabled=true;
	}
	catch(e)
	{
		writeDebug("ERROR in showModalPopupViaTargetButton() ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//An Accordion just closed... Kill the Popup Window!
//-----------------------------------------------------
function MakeSureThePopUpWindowIsClosed() 
{
	try
	{
		//Nope!.
		if(PopUpInUse==false)
		{
			return;
		}
		//BANG! Start the CloseAnimation running!
		$find('CloseAnimation').get_OnClickBehavior().play();
	}
	catch(e)
	{
		writeDebug("ERROR in MakeSureThePopUpWindowIsClosed() ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Post-Aniamtion Cleanup....
//-----------------------------------------------------
function TheShowIsOver() 
{
	//Re-enable the [related] video button.
	videoButtonObject.disabled=false;
	//DONE!
	PopUpInUse=false;
	//Reset the current Popup pager... it may be empty.
	CurrentPopupPager.mpageCurrentPage=0;
}
//-----------------------------------------------------
//Deal with the Accordion Selection Change...
//-----------------------------------------------------
function LVBPianoSonataAccordionSelectChange(target, event)
{
	try
	{
		//Accordion Selection HIT: Blow away the Popup.
		MakeSureThePopUpWindowIsClosed();
		if(event.get_selectedIndex()!=-1)
		{
			//Just in case they want to watch this video.
			LVBPianoSonataVideoIndex=event.get_selectedIndex();
			//Make sure the former Video button in enabled.
			if(videoButtonObject!=null)
			{
				if(videoButtonObject.disabled==true)
				{
					videoButtonObject.disabled=false;
				}
			}
			//Get the related panel Video button...
			videoButtonObject=VideoButtonSet[event.get_selectedIndex()];
			//Set the current Popup pager... it may be empty.
			CurrentPopupPager=PopupPagerSet[event.get_selectedIndex()];
			CurrentPopupPager.mpageCurrentPage=0;
			//Also... point to the Popup dynamic content.
			var LVBIndex=LVBPianoSonataVideoIndex+1;
			PopUpDynamicContent=$get("LVBSonata"+LVBIndex+"Content");
			//Also... this really sucks, set the width/height.
			PopUpMagicNumberWidth=PopUpFullWideMagicNumberSet[LVBPianoSonataVideoIndex];
			PopUpMagicNumberHeight=PopUpFullHighMagicNumberSet[LVBPianoSonataVideoIndex];
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in LVBPianoSonataAccordionSelectChange ["+e.name+"]: "+e.message,true); 
	}
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//INTERVAL RESPONSE JS Methods... BEGIN HERE.
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//-----------------------------------------------------
// Timer Manager DUDE!
//-----------------------------------------------------
function DoTimerPOP()
{
	//.................................................
	//[Timer POP Processing 01] Waiting for a FILM??
	//.................................................
	if(MoviePickerWaitInProgress==true)
	{
		//Update the wait interval by 100ms.
		MoviePickerWaitInterval+=100;
		//Is the Movie MMS URI here from the Server???
		if(NextMovieMMSVidoeURI!=null)
		{
			//MUST WAIT 10 seconds... always!
			if(MoviePickerWaitInterval>=10000)
			{
				//DONE... go watch the Movie.
				MoviePickerWaitInProgress=false;
				MoviePickerWaitInterval=0;
				TimeToWatchLVBPianoSonataFilm();
			}
		}
	}
	//.................................................
	//[Timer POP Processing 02] Movie Time Display.
	//.................................................
	//Watching a MOVIE? Play, FF or REW... show the TIME and
	//also [carefully] update the MOVIE Scrubber.
	try
	{
		//Don't run this block of code every timer-pop....
		MovieTimeUpdateInterval++;
		if(MovieTimeUpdateInterval>=2)
		{
			MovieTimeUpdateInterval=0;
			//We must not be dragging the Movie 'scrubber'...
			if(window.n_activeSliderId==null) 
			{
				//Find the Video Player..
				var thePLAYER=$get("VideoZap");
				if(thePLAYER!=null)
				{
					//Must be either PLAY, FF or REW... or even BUFFERING.
					if(thePLAYER.playState==3||thePLAYER.playState==4||thePLAYER.playState==5||thePLAYER.playState==6)
					{
						//Update the Movie hh:mm:ss div control.
						TheMovieTimeDIV=$get("theMovieTime");
						if(TheMovieTimeDIV!=null)
						{
							//Tell'em the MOVIE time!
							if(thePLAYER.controls.currentPositionString!="")
							{
								TheMovieTimeDIV.innerHTML=thePLAYER.controls.currentPositionString;
								TheMovieTimeDIV.innerHTML+="/";
								TheMovieTimeDIV.innerHTML+=thePLAYER.currentMedia.durationString;
							}
						}
						//SIMPLE... Update the Movie Scrubber with a percentage value!!
						var timeDiff=thePLAYER.controls.currentPosition/thePLAYER.currentMedia.duration;
						window.A_SLIDERS[0].f_setValue(timeDiffpercent=timeDiff*100,1);
					}
				}
			}
		}
	}
	catch(e)
	{
		writeDebug("ERROR in DoTimerPOP() Setting the Movie Time: ["+e.name+"]: "+e.message,true); 
	}
	//.................................................
	//[Timer POP Processing 03] Try to keep the ASP.NET
	//Session ALIVE...
	//.................................................
	SessionKeepAliveCounter++;
	if(SessionKeepAliveCounter>=SessionKeepAliveValue)
	{
		try
		{
			//Reset to wait for the next interval...
			SessionKeepAliveCounter=0;
			//Need a unique number for each handler call to fool the MSIE cache.
			var TimeStamp=new Date();
			var Seconds=TimeStamp.getTime();
			//Just fucking do it!
			$get("ImageOne").src="whKeepSessionAliveHandler.ashx?&time="+Seconds;
		}
		catch(e)
		{
			writeDebug("ERROR in DoTimerPOP() ASP.NET Session Keep Alive: ["+e.name+"]: "+e.message,true); 
		}
	}
	// Schedule the next call to method DoTimerPOP().
	window.setTimeout('DoTimerPOP()', 100);
}
//-----------------------------------------------------
//ASP.NET AJAX has indicated that all external files
//have been fully loaded, similar to the way ASP.NET
//executes the server-side Page_Load() method. Is safe
//to access AJAX js objects... be carful!
//-----------------------------------------------------
function pageLoad()
{
    //Setup the [hidden] Debug DIV.
	clearDebug();
	//Setup all the Popup Pager delegates...
	FadeInDelegate=Function.createDelegate(this, this.JustFadeBackDude);
	FinalizeDelegate=Function.createDelegate(this, this.FaderFinalize);
	//We need a local Popup Pager animator...
	try
	{
		//ACT Animation [shortcut] object... better be ready!
		if($AA.Animation!=null)
		{
			//Build the Animation... change the fade in-out on the fly.
			PopupPagerAnimation=new $AA.FadeAnimation($get("info"), 
													  .5, 
													  40, 
													  AjaxControlToolkit.Animation.FadeEffect.FadeOut, 
													  0, 
													  1, 
													  false);
			//Get started... add this so we can remove it [1st].
			PopupPagerAnimation.add_ended(FinalizeDelegate);
			//Let them get started.
            PopupPagerAnimation.initialize();
		}
	}
	//This control should be generated by the ASP.NET Ajax framework.
	catch(e)
	{
		//Trouble.
		writeDebug("Error in pageLoad(MovieAnimationSetup) ["+e.name+"]: "+e.message,true); 
	}
	//Wire-up all the Popup Info Panel Button Handlers.
	$addHandler($get("Button1"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button3"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button5"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button7"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button9"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button11"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button13"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button15"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button17"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button19"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button21"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button23"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button25"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button27"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button29"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button31"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button33"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button35"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button37"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button39"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button41"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button43"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button45"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button47"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button49"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button51"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button53"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button55"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button57"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button59"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button61"), 'click', showModalPopupViaTargetButton);
	$addHandler($get("Button63"), 'click', showModalPopupViaTargetButton);
	//Wire-up the LVB Piano Sonata Accordion Select Changed EVENT.
	var thisBehavior=$get("LVBPianoSonataAccordion").AccordionBehavior;
	if(thisBehavior!=null)
	{
		thisBehavior.add_selectedIndexChanged(LVBPianoSonataAccordionSelectChange);
	}
	//Build the Video button array.
	for(i=0;i<32;i++)
	{
		var targetButt="Button"+(i+1)*2;
		VideoButtonSet[i]=$get(targetButt);
	}
	//Build the Popup Multi-pager array.
	for(i=0;i<=32;i++)
	{
		var nextIndex=i+1;
		PopupPagerSet[i]=new MultiPager("LVBSonata"+nextIndex+"Content");
	}
	//Setup the LVB Sonata 1 Multi-pager...
	PopupPagerSet[0].mpageActive=true;
	PopupPagerSet[0].mpageCurrentPage=0;
	PopupPagerSet[0].mpagePageCount=2;
	PopupPagerSet[0].mpageHeight[0]=659;
	PopupPagerSet[0].mpageHeight[1]=579;
	//Setup the LVB Sonata 2 Multi-pager...
	PopupPagerSet[1].mpageActive=true;
	PopupPagerSet[1].mpageCurrentPage=0;
	PopupPagerSet[1].mpagePageCount=2;
	PopupPagerSet[1].mpageHeight[0]=625;
	PopupPagerSet[1].mpageHeight[1]=567;
	//Setup the LVB Sonata 8 Multi-pager...
	PopupPagerSet[7].mpageActive=true;
	PopupPagerSet[7].mpageCurrentPage=0;
	PopupPagerSet[7].mpagePageCount=2;
	PopupPagerSet[7].mpageHeight[0]=619;
	PopupPagerSet[7].mpageHeight[1]=613;
	//Setup the LVB Sonata 12 Multi-pager...
	PopupPagerSet[11].mpageActive=true;
	PopupPagerSet[11].mpageCurrentPage=0;
	PopupPagerSet[11].mpagePageCount=2;
	PopupPagerSet[11].mpageHeight[0]=801;
	PopupPagerSet[11].mpageHeight[1]=805;
	//Setup the LVB Sonata 14 Multi-pager...
	PopupPagerSet[13].mpageActive=true;
	PopupPagerSet[13].mpageCurrentPage=0;
	PopupPagerSet[13].mpagePageCount=2;
	PopupPagerSet[13].mpageHeight[0]=610;
	PopupPagerSet[13].mpageHeight[1]=658;
	//Setup the LVB Sonata 21 Multi-pager...
	PopupPagerSet[20].mpageActive=true;
	PopupPagerSet[20].mpageCurrentPage=0;
	PopupPagerSet[20].mpagePageCount=2;
	PopupPagerSet[20].mpageHeight[0]=679;
	PopupPagerSet[20].mpageHeight[1]=611;
	//Setup the LVB Sonata 28 Multi-pager...
	PopupPagerSet[27].mpageActive=true;
	PopupPagerSet[27].mpageCurrentPage=0;
	PopupPagerSet[27].mpagePageCount=2;
	PopupPagerSet[27].mpageHeight[0]=777;
	PopupPagerSet[27].mpageHeight[1]=645;
	//Setup the LVB Sonata 29 Multi-pager...
	PopupPagerSet[28].mpageActive=true;
	PopupPagerSet[28].mpageCurrentPage=0;
	PopupPagerSet[28].mpagePageCount=2;
	PopupPagerSet[28].mpageHeight[0]=765;
	PopupPagerSet[28].mpageHeight[1]=781;
	//Setup the LVB Sonata 31 Multi-pager...
	PopupPagerSet[30].mpageActive=true;
	PopupPagerSet[30].mpageCurrentPage=0;
	PopupPagerSet[30].mpagePageCount=2;
	PopupPagerSet[30].mpageHeight[0]=717;
	PopupPagerSet[30].mpageHeight[1]=637;
	//Setup the LVB Sonata 32 Multi-pager...
	PopupPagerSet[31].mpageActive=true;
	PopupPagerSet[31].mpageCurrentPage=0;
	PopupPagerSet[31].mpagePageCount=2;
	PopupPagerSet[31].mpageHeight[0]=633;
	PopupPagerSet[31].mpageHeight[1]=495;
	//Start the BALL ROLLING!
	DoTimerPOP();
}
//-----------------------------------------------------
//The HTML document load has completes... but perhaps
//not all ASP.NET Ajax objects... be carful!
//-----------------------------------------------------
function load() 
{
	//Set the XHR Domain cookie exchange identifier.
	setCookie("XHRDomain", "SFosterMurray", 100);
	//Deal with any potential USER Bandwidth preferences.
	try
	{
		//Try to get the BandWidth cookie from the DOM.
		var cookieBandWidth=getCookie("BandWidth");
		if(cookieBandWidth!=null)
		{
			var OldCheck=-1;
			var NewCheck=-1;
			var thisForm=document.forms[0];
			if(thisForm!=null)
			{
				//Locate the current check and the new value.
				for(i=0;i<thisForm.clampmaxbandwidth.length;i++)
				{
					if(thisForm.clampmaxbandwidth[i].checked) 
					{
						OldCheck=i;
					}
					if(thisForm.clampmaxbandwidth[i].value==cookieBandWidth) 
					{
						NewCheck=i;
					}
				}
				//Simple... just plug'em in the control.
				if(OldCheck!=-1 && NewCheck!=-1)
				{
					thisForm.clampmaxbandwidth[OldCheck].checked=false;
					thisForm.clampmaxbandwidth[NewCheck].checked=true;
				}
			}
		}
		//No cookie... just use the default.
		else
		{
			cookieBandWidth=350000;
		}
		//Finally... Set the Player maximum bandwidth.
		try
		{
			var thePLAYER=$get("VideoZap");
			thePLAYER.close();
			thePLAYER.network.maxBandwidth=cookieBandWidth;
		}
		catch(e)
		{
			//Trouble.
			writeDebug("Trouble in load(cookieBandWidth)... could not set maxBandwidth!",true);
		}
	}
	catch(e)
	{
		//Trouble.
		writeDebug("Error in load(cookieBandWidth) ["+e.name+"]: "+e.message,true); 
	}
	//Get the session Lightning Token...
	GetSessionLightningTokenFromWS();
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//DEBUG JS Routines... BEGIN HERE.
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//-----------------------------------------------------
//SPECIAL [HIDDEN] DEBUG WINDOW JS SUPPORT.
//-----------------------------------------------------
var debugDiv=null;
var debugSpan=null;
var debugShow=false;
//-----------------------------------------------------
//DEBUG SUPPORT: Called from Main page footer [X].
//-----------------------------------------------------
function toggleDebugView() 
{
	try
	{
		if(debugShow)
		{
			debugShow=false;
			hideDebug();
		}
		else
		{
			debugShow=true;
			showDebug();
		}
	}
	catch(e)
	{
		alert("toggleDebugView() call failed");
	}
}
//-----------------------------------------------------
//DEBUG SUPPORT: Show the Debug DIV above the footer.
//-----------------------------------------------------
function showDebug() 
{
	try
	{
		//May sure we can see the hunk of crap!
		debugDiv=$get("debugDivContent");
		if(debugDiv!=null)
		{
			debugDiv.style.display="block";
			debugDiv.style.visibility="visible";
		}
	}
	catch(e)
	{
		alert("showDebug() call failed");
	}
}
//-----------------------------------------------------
//DEBUG SUPPORT: Hide the Debug DIV... we are done.
//-----------------------------------------------------
function hideDebug() 
{
	try
	{
		//May sure we can not see the hunk of crap!
		debugDiv=$get("debugDivContent");
		if(debugDiv!=null)
		{
			debugDiv.style.display="none";
			debugDiv.style.visibility="hidden";
		}
	}
	catch(e)
	{
		alert("hideDebug() call failed");
	}
}
//-----------------------------------------------------
//DEBUG SUPPORT: Clear the Debug DIV/add clear link.
//-----------------------------------------------------
function clearDebug() 
{
	try
	{
		//May sure the hunk of crap is empty!
		debugDiv=$get("debugDivContent");
		if(debugDiv!=null)
		{
			debugDiv.innerHTML="";
			writeClearLink();
		}
		//Clear the alert in the footer: No Messages.
		debugSpan=$get("debugSpanContent");
		if(debugSpan!=null)
		{
			debugSpan.style.color="#009900";
		}
	}
	catch(e)
	{
		alert("clearDebug() call failed");
	}
}
//-----------------------------------------------------
//DEBUG SUPPORT: Add the data to the Debug DIV.
//-----------------------------------------------------
function writeDebug(MessageOut, AddTime) 
{
	try
	{
		//Default... no time!
		if(AddTime==null||AddTime=="")
		{
			AddTime=false;
		}
		//Grab the Debug DIV!
		debugDiv=$get("debugDivContent");
		if(debugDiv!=null)
		{
			if(AddTime)
			{
				debugDiv.innerHTML+=Date()+"<br\/>"+MessageOut+"<br\/>";
			}
			else
			{
				debugDiv.innerHTML+=MessageOut+"<br\/>";
			}
		}
		//Show the alert in the footer: Message ready.
		debugSpan=$get("debugSpanContent");
		if(debugSpan!=null && debugSpan.style.color!="#990000")
		{
			debugSpan.style.color="#990000";
		}
	}
	catch(e)
	{
		alert("writeDebug() call failed");
	}
}
//-----------------------------------------------------
//DEBUG SUPPORT: Add the code expression to the Debug
//DIV... writeEval("document.location"); will output
//"document.location = http://www.BiteMeHere.com"
//-----------------------------------------------------
function writeEval(code) 
{
	writeDebug(code+" = "+eval(code),true);
}
//-----------------------------------------------------
//DEBUG SUPPORT: Write all properties of the object.
//-----------------------------------------------------
function writeDebugObject(myobject)
{
	var strCollection="";
	//Just examine the TOP Level only.
	for(curObj in myobject)
	{
		if(typeof myobject[curObj]=="object") 
		{
			strCollection+=curObj+": "+myobject[curObj]+"<br\/>";
		}
		else
		{
			try
			{
				strCollection+=curObj+": "+myobject[curObj]+"<br\/>";
			}
			catch(e)
			{
				strCollection+=curObj+": Unable to evaluate!<br\/>";
			}
		}
	}
	writeDebug(strCollection,false);
}
//-----------------------------------------------------
//DEBUG SUPPORT: Write the Debug DIV 'Clear' link.
//-----------------------------------------------------
function writeClearLink() 
{
	writeDebug("<a href='#' title='Cleanup this mess!' onclick='clearDebug(); return false;'>Clear the Debug Window!</a>",false);
}
//-----------------------------------------------------
//DEBUG SUPPORT: Just dump the OBJECT to a PopUp.
//-----------------------------------------------------
function dumpToPopup(x)
{
	var win=window.open();
	for(var i in x)
	{
		try
		{
			win.document.write(i+" = "+x[i]+"<br>");
		}
		catch(e)
		{
			win.document.write(i+": Unable to evaluate!<br>");
		}
	}
}