﻿//-----------------------------------------------------
//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!
//-----------------------------------------------------
//USCivilWar.js

//These references are for the VS2008 JavaScript ItelliSense...
/// <reference name="MicrosoftAjax.debug.js" />
/// <reference name="MicrosoftAjaxTimer.debug.js" />
/// <reference name="MicrosoftAjaxWebForms.debug.js" />

//-----------------------------------------------------
//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;
var SessionDummyImage=null;
//-----------------------------------------------------
//User Access Control Information.
//-----------------------------------------------------
var UserAuthenticated=0;
//-----------------------------------------------------
//Movie Picker MMS URL Fetch WAIT Information;
//-----------------------------------------------------
var MoviePickerWaitInProgress=false;
var MoviePickerWaitInterval=0;
//-----------------------------------------------------
//The World of Movies... Screen initially hidden.
//-----------------------------------------------------
var MovieScreenVisible=false;
//-----------------------------------------------------
//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 CivilWarIsHellVideoIndex=-1;
//-----------------------------------------------------
//Julia Ward Howe content management...
//-----------------------------------------------------
var jwhContentIndex=0;
var jwhIntervalCount=0;
//-----------------------------------------------------
//Julia Ward Howe Text Animation...
//-----------------------------------------------------
var whTextAnimation=null;
//-----------------------------------------------------
//Image Pop-up Modal Viewer control information.
//-----------------------------------------------------
var imagePopupViewerIsVisible=false;
var imageSwapperInterval=0;
//-----------------------------------------------------
//Image Management Global STUFF!
//-----------------------------------------------------
var ImageSetInterval=0;
var ImageSetIntervalValue=160;
var ImageObject=null;
//-----------------------------------------------------
//Image Management... Special case, PAUSE EVERYTHING!
//-----------------------------------------------------
var QuicklyPauseTheSlideShow=false;
//-----------------------------------------------------
//Image Management... New Image 'round-robin' scheme.
//-----------------------------------------------------
var ImageNewURL=new Array(2);
var ImageNewURLIndex=0;
//-----------------------------------------------------
//Image Transition ActiveX Global STUFF!
//-----------------------------------------------------
var IrisTransition=false;
var ApplyIrisOut=false;
var ApplyIrisIn=false;
var BlindsTransition=false;
var BlindsRandom=false;
var FadeTransition=false;
var ImageFadeIn=false;
var ImageFadeOut=false;
var ImageFadeCount=0;
//-----------------------------------------------------
//Iris Transition TYPES Global STUFF!
//-----------------------------------------------------
var IrisXFormType=new Array(6);
IrisXFormType[0]="circle";
IrisXFormType[1]="star";
IrisXFormType[2]="diamond";
IrisXFormType[3]="cross";
IrisXFormType[4]="plus";
IrisXFormType[5]="square";
//-----------------------------------------------------
//Blinds Transition TYPES Global STUFF!
//-----------------------------------------------------
var BlindsXFormType=new Array(4);
BlindsXFormType[0]="left";
BlindsXFormType[1]="right";
BlindsXFormType[2]="up";
BlindsXFormType[3]="down";
//-----------------------------------------------------
//The Album Photo Details SET!
//-----------------------------------------------------
var AlbumPhotoDetailSet;
var AlbumPhotoCount=0;
var AlbumPhotoIndex;
var AlbumPhotoShuffleArray;
var BusyGettingAlbumPhotosFromTheServer=false;
//-----------------------------------------------------
//Local User Credentials Information...
//-----------------------------------------------------
var LightningToken=null;
//-----------------------------------------------------
//Global XMLHttpRequest object reference.
//-----------------------------------------------------
var GetCivilWarIsHellVideoXHR=CreateXmlHttpRequestObject();
var LocalUserCredentialManagerXHR=CreateXmlHttpRequestObject();
var AlbumPhotoDetailsXHR=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 Next 'Civil War is Hell' MMS URI.
//-----------------------------------------------------
function GetNextCivilWarIsHellVideoMMSaccessURIFromWS()
{
	//Better have the XmlHttpRequest Object!
	if(GetCivilWarIsHellVideoXHR)
	{
		//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+"wsCiivilWarMovieService.asmx/GetCivilWarIsHellVideoMMSAccessURI";
		//We want this XmlHttpRequest asynchronous.
		try 
		{
			//Never go cross-domain.
			GetCivilWarIsHellVideoXHR.open("POST", currentHostURL, true);
		}
		catch(e)
		{
			//Trouble!
			writeDebug("Error in GetNextCivilWarIsHellVideoMMSaccessURIFromWS ["+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.
			GetCivilWarIsHellVideoXHR.onreadystatechange=onGetNextCivilWarIsHellVideoMMSaccessURIComplete;
			//Execute the request... Fire at will!
			GetCivilWarIsHellVideoXHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			GetCivilWarIsHellVideoXHR.send("index="+CivilWarIsHellVideoIndex);
		}
		catch(e)
		{
			//Trouble!
			writeDebug("Error in GetNextCivilWarIsHellVideoMMSaccessURIFromWS ["+e.name+"]: "+e.message,true); 
		}
	}
}
//-----------------------------------------------------
//WS Return CALL... Next 'Civil War Is Hell' Video  MMS
//URI fetch is (hopefully) complete.
//-----------------------------------------------------
function onGetNextCivilWarIsHellVideoMMSaccessURIComplete() 
{
	try
	{
		//We only care about READYSTATE_COMPLETE Ready State (4).
		if(GetCivilWarIsHellVideoXHR.readyState==READYSTATE_COMPLETE)
		{
			//GOOD: the request was OK (equal to a Http Status code of 200).
			if(GetCivilWarIsHellVideoXHR.status==HTTPSTATUS_OK)
			{
					//Deal with the Response as XML formatted Data.
					var xmlDoc=GetCivilWarIsHellVideoXHR.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=GetCivilWarIsHellVideoXHR.responseText;
				writeDebug("Error in onGetNextCivilWarIsHellVideoMMSaccessURIComplete! "+Bugs,true); 
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in onGetNextCivilWarIsHellVideoMMSaccessURIComplete ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
// WS CALL... Get the entire Album Photo Details Set.
//-----------------------------------------------------
function GetAlbumPhotoDetails(albumTitle)
{
	//Better have the XmlHttpRequest Object!
	if(AlbumPhotoDetailsXHR)
	{
		//Assume we have NOTHING!
		AlbumPhotoCount=0;
		//WE ARE BUSY... No more requests until we get the data!
		BusyGettingAlbumPhotosFromTheServer=true;
		//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+"wsLinqAlbumPhotoDetailsService.asmx/GetAlbumPhotoDetails";
		//We want this XmlHttpRequest asynchronous.
		try 
		{
			//Never go cross-domain.
			AlbumPhotoDetailsXHR.open("POST", currentHostURL, true);
		}
		catch(e)
		{
			//NOT BUSY ANYMORE!
			BusyGettingAlbumPhotosFromTheServer=false;
			//Trouble!
			writeDebug("Error in GetAlbumPhotoDetails ["+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.
			AlbumPhotoDetailsXHR.onreadystatechange=onAlbumPhotoDetailsComplete;
			//Execute the request... Fire at will!
			AlbumPhotoDetailsXHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			AlbumPhotoDetailsXHR.send("AlbumTitle="+albumTitle);
		}
		catch(e)
		{
			//NOT BUSY ANYMORE!
			BusyGettingAlbumPhotosFromTheServer=false;
			//Trouble!
			writeDebug("Error in GetAlbumPhotoDetails ["+e.name+"]: "+e.message,true); 
		}
	}
}
//-----------------------------------------------------
// WS Return CALL... Save the Album Photo Details Set.
//-----------------------------------------------------
function onAlbumPhotoDetailsComplete() 
{
	try
	{
		//We only care about READYSTATE_COMPLETE Ready State (4).
		if(AlbumPhotoDetailsXHR.readyState==READYSTATE_COMPLETE)
		{
			//GOOD: the request was OK (equal to a Http Status code of 200).
			if(AlbumPhotoDetailsXHR.status==HTTPSTATUS_OK)
			{
				//Deal with the Response as JSON formatted Data.
				var JSONResponse=AlbumPhotoDetailsXHR.responseText;
				//AlbumPhotoDetailSet=JSONResponse.parseJSON();
				AlbumPhotoDetailSet=Sys.Serialization.JavaScriptSerializer.deserialize(JSONResponse);
				//Get the Album Photo Count... and init the index.
				if(AlbumPhotoDetailSet!=null)
				{
					//Grab the details about the new Album Photo set.
					AlbumPhotoCount=AlbumPhotoDetailSet.length;
					AlbumPhotoIndex=-1;
					//Dump the current picture...
					ImageSetInterval=500;
					//Create a Album Photo Set shuffle array.
					AlbumPhotoShuffleArray=new Array(AlbumPhotoCount);
					for(var i=0;i<AlbumPhotoCount;i++)
					{
						AlbumPhotoShuffleArray[i]=i;
					}
					//Shuffle'em DUDE!
					AlbumPhotoShuffleArray.shuffle();
					//NOT BUSY ANYMORE!
					BusyGettingAlbumPhotosFromTheServer=false;
				}
			} 
			else
			{
				//NOT BUSY ANYMORE!
				BusyGettingAlbumPhotosFromTheServer=false;
				//Never Happen: Trouble, Tell the USER!
				var Bugs=AlbumPhotoDetailsXHR.responseText;
				writeDebug("Error in onAlbumPhotoDetailsComplete! "+Bugs,true); 
			}
		}
	}
	catch(e)
	{
		//NOT BUSY ANYMORE!
		BusyGettingAlbumPhotosFromTheServer=false;
		//Trouble!
		writeDebug("Error in onAlbumPhotoDetailsComplete ["+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);   
		}
	};                                                                      
})();
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//Primary Page Support JS Methods... BEGIN HERE.
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//-----------------------------------------------------
//Julia Ward Howe Text Animation Complete Handler...
//-----------------------------------------------------
function WeAreDoneAnimating()
{
	try
	{
		if(whTextAnimation.WeNeedToSwapTheText)
		{
			//Go to the next div index...
			jwhContentIndex++;
			if(jwhContentIndex>5)
			{
				jwhContentIndex=0;
			}
			//Next stanza of verse please...
			var SourceDIVNamedID="JuliaWardHowe"+jwhContentIndex+"Content";
			//Slam it home...
			$get("uscwJuliaWardHoweProseID").innerHTML=$get(SourceDIVNamedID).innerHTML;
			//Do the full [fade-in] animation.
			if(whTextAnimation!=null)
			{
				whTextAnimation.set_effect($AA.FadeEffect.FadeIn);
				whTextAnimation.set_duration(.9);
				whTextAnimation.WeNeedToSwapTheText=false;
				whTextAnimation.play();
			}
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in WeAreDoneAnimating ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Show this 'click' IMAGE in the Modal Pop-up.
//-----------------------------------------------------
function ShowImageInModalPopup(imgObject)
{
	//The Image Pop-up Modal Viewer has control now...
	imagePopupViewerIsVisible=true;
	imageSwapperInterval=0
	//Try to hide the previous img...
	$get("masterPhotoImage").style.visibility="hidden";
	$get("masterPhotoImage").style.display="none";
	//Show the ajaxToolkit ModalPopupExtender!
	if($find('ModalPopupBehaviorID')!=null)
	{
		$find('ModalPopupBehaviorID').show();
	}
	//Duplicate the image src URI...
	var imageURI=src=imgObject.src;
	imageURI=imageURI.split('&');
	//Rebuilt with size=XL...
	var newImageUri=imageURI[0]+"&Size=XL&"+imageURI[2];
	//Plug the URI into the modal pop-ip img...
	$get("masterPhotoImage").src=newImageUri;
	$get("masterPhotoImage").style.visibility="visible";
	$get("masterPhotoImage").style.display="block";
}
//-----------------------------------------------------
//Show the next IMAGE in the Modal Pop-up.
//-----------------------------------------------------
function ShowNextImageInModalPopup()
{
	//Reset the Image swapper interval...
	imageSwapperInterval=0
	//Need a unique number for each handler call to fool the MSIE cache.
	var TimeStampTwo=new Date();
	var SecondsTwo=TimeStampTwo.getTime();
	//Bump the index to the next Image in the Photo Shuffle Array.
	AlbumPhotoIndex++;
	if(AlbumPhotoIndex>=AlbumPhotoCount)
	{
		AlbumPhotoIndex=0;
	}
	//Build the blasted SRC URL String...
	var imageURI="whdBaseLinqImgHandler.ashx?PhotoID=";
		imageURI+=AlbumPhotoDetailSet[AlbumPhotoShuffleArray[AlbumPhotoIndex]].PhotoID;
		imageURI+="&Size=XL";
		imageURI+="&isPublic=true";
		imageURI+="&time=";
		imageURI+=SecondsTwo;
	//Plug the URI into the modal pop-ip img...
	$get("masterPhotoImage").src=imageURI;
}
//-----------------------------------------------------
//EXIT Button Handler... Hide the entire mess!
//-----------------------------------------------------
function WeAreDonePopingUp()
{
	try
	{
		//The Image Pop-up Modal Viewer is done...
		imagePopupViewerIsVisible=false;
		imageSwapperInterval=0
		//Clear the IMAGE...
		$get("masterPhotoImage").src="./images/Black.png";
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in WeAreDone ["+e.name+"]: "+e.message,true); 
	}
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//All USER CONTROL JS Methods... BEGIN HERE.
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//-----------------------------------------------------
//This is the start of a USER Authentication CYCLE.
//-----------------------------------------------------
function UserAuthenticate()
{
	try
	{
		//Always... Make sure all other PANELS are hidden.
		if($get("theMoviesPickerID")!=null)
		{
			$get("theMoviesPickerID").style.display="none";
			$get("theMoviesPickerID").style.visibility="hidden";
		}
		if($get("theMoviesPickerEpisode1ID")!=null)
		{
			$get("theMoviesPickerEpisode1ID").style.display="none";
			$get("theMoviesPickerEpisode1ID").style.visibility="hidden";
		}
		if($get("theMoviesPickerEpisode2ID")!=null)
		{
			$get("theMoviesPickerEpisode2ID").style.display="none";
			$get("theMoviesPickerEpisode2ID").style.visibility="hidden";
		}
		if($get("theMoviesPickerEpisode3ID")!=null)
		{
			$get("theMoviesPickerEpisode3ID").style.display="none";
			$get("theMoviesPickerEpisode3ID").style.visibility="hidden";
		}
		if($get("theMoviesPickerEpisode4ID")!=null)
		{
			$get("theMoviesPickerEpisode4ID").style.display="none";
			$get("theMoviesPickerEpisode4ID").style.visibility="hidden";
		}
		if($get("theMoviesPickerEpisode5ID")!=null)
		{
			$get("theMoviesPickerEpisode5ID").style.display="none";
			$get("theMoviesPickerEpisode5ID").style.visibility="hidden";
		}
		if($get("theMoviesPickerEpisode6ID")!=null)
		{
			$get("theMoviesPickerEpisode6ID").style.display="none";
			$get("theMoviesPickerEpisode6ID").style.visibility="hidden";
		}
		if($get("theMoviesPickerEpisode7ID")!=null)
		{
			$get("theMoviesPickerEpisode7ID").style.display="none";
			$get("theMoviesPickerEpisode7ID").style.visibility="hidden";
		}
		if($get("theMoviesPickerEpisode8ID")!=null)
		{
			$get("theMoviesPickerEpisode8ID").style.display="none";
			$get("theMoviesPickerEpisode8ID").style.visibility="hidden";
		}
		if($get("theMoviesPickerEpisode9ID")!=null)
		{
			$get("theMoviesPickerEpisode9ID").style.display="none";
			$get("theMoviesPickerEpisode9ID").style.visibility="hidden";
		}
		if($get("theMoviesID")!=null)
		{
			$get("theMoviesID").style.display="none";
			$get("theMoviesID").style.visibility="hidden";
		}
		//Always... Make sure the Authentication PANEL is visible.
		if($get("theMoviesAuthenticateID")!=null)
		{
			$get("theMoviesAuthenticateID").style.display="block";
			$get("theMoviesAuthenticateID").style.visibility="visible";
		}
		//No trouble just yet.
		if($get("theMoviesErrorInfoBannerID")!=null)
		{
			$get("theMoviesErrorInfoBannerID").style.display="none";
			$get("theMoviesErrorInfoBannerID").style.visibility="hidden";
		}
		//Mark this User as not Authenticated.
		UserAuthenticated=0;	
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in UserAuthenticate ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Finally... 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(jsUserNameBoxIDAccess).value;
		var Password=$get(jsPassWordBoxIDAccess).value;
		var AuthenticationToken="Userid="+UserName+";Password="+Password+";Site=US Civil War";	
		//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(jsUserNameBoxIDAccess).value;
			var AuthorizationToken="Userid="+UserName+";Site=US Civil War";	
			//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 an Episode yet!
			CivilWarIsHellVideoIndex=-1;
			//Always... Make sure all other PANELS are hidden.
			if($get("theMoviesAuthenticateID")!=null)
			{
				$get("theMoviesAuthenticateID").style.display="none";
				$get("theMoviesAuthenticateID").style.visibility="hidden";
			}
			if($get("theMoviesID")!=null)
			{
				$get("theMoviesID").style.display="none";
				$get("theMoviesID").style.visibility="hidden";
			}
			//Always... Make sure the Movie Picker PANEL is visible.
			if($get("theMoviesPickerID")!=null)
			{
				$get("theMoviesPickerID").style.display="block";
				$get("theMoviesPickerID").style.visibility="visible";
			}
			//Always... Make sure the Movie Picker Wait DIV is hidden.
			if($get("theMoviesPickerWaitID")!=null)
			{
				$get("theMoviesPickerWaitID").style.visibility="hidden";
			}
			//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); 
	}
}
//-----------------------------------------------------
//Movie Player: Done with the wait... Play the Film!
//-----------------------------------------------------
function TimeToWatchTheCivilWarIsHellFilm()
{
	try
	{
		if (UserAuthenticated==1)
		{
			//Always... Make sure all other PANELS are hidden.
			if($get("theMoviesPickerID")!=null)
			{
				$get("theMoviesPickerID").style.display="none";
				$get("theMoviesPickerID").style.visibility="hidden";
			}
			if($get("theMoviesAuthenticateID")!=null)
			{
				$get("theMoviesAuthenticateID").style.display="none";
				$get("theMoviesAuthenticateID").style.visibility="hidden";
			}
			//Always... Make sure the Movie Picker Wait DIV is hidden.
			if($get("theMoviesPickerWaitID")!=null)
			{
				$get("theMoviesPickerWaitID").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";
			}
			//Setup the Movie 'time-scrubber' now...
			var TheScrubberDIV=$get("theMovieSliderBar");
			if(TheScrubberDIV!=null)
			{
				TheScrubberDIV.style.display="block";
				TheScrubberDIV.style.visibility="visible";
			}
			//Unbelievable fuck-up... ok to show the slider!
			if($get("sl0slider")!=null)
			{
				$get("sl0slider").style.display="block";
				$get("sl0slider").style.visibility="visible";
			}
			//YES... Go watch the Film!
			GoToTheMovies();
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in TimeToWatchTheCivilWarIsHellFilm ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Movie Picker: Request the Selected Episode and wait!
//-----------------------------------------------------
function GoFetchTheFilmMMSUrlAndWait(filmIndex)
{
	try
	{
		//Watch out for trouble...
		if(filmIndex<0)
		{
			filmIndex=0;
		}
		else if(filmIndex>8)
		{
			filmIndex=8;
		}
		//This is the requested film...
		CivilWarIsHellVideoIndex=filmIndex;
		//Always... Make sure the Movie Picker Wait DIV is visible.
		if($get("theMoviesPickerWaitID")!=null)
		{
			$get("theMoviesPickerWaitID").style.visibility="visible";
		}
		//Start the 'Civil War Is Hell' Episode MMS URL Fetch.
		NextMovieMMSVidoeURI=null;
		GetNextCivilWarIsHellVideoMMSaccessURIFromWS();
		//Make'em wait.... fuck'em!
		MoviePickerWaitInProgress=true;
		MoviePickerWaitInterval=0;
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in GoFetchTheFilmMMSUrlAndWait ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Movie Picker: Show more info for this episode!
//-----------------------------------------------------
function LearnMoreAboutEpisodeX(episodeIndex)
{
	try
	{
		//Watch out for trouble...
		if(episodeIndex<1)
		{
			episodeIndex=1;
		}
		else if(episodeIndex>9)
		{
			episodeIndex=9;
		}
		//Always... Make sure the main 'picker' panel is hidden.
		if($get("theMoviesPickerID")!=null)
		{
			$get("theMoviesPickerID").style.display="none";
			$get("theMoviesPickerID").style.visibility="hidden";
		}
		//Show'em the information on this episode...
		var episodeDIV="theMoviesPickerEpisode"+episodeIndex+"ID";
		if($get(episodeDIV)!=null)
		{
			$get(episodeDIV).style.display="block";
			$get(episodeDIV).style.visibility="visible";
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in LearnMoreAboutEpisodeX ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Movie Picker: Go back to the main movie picker panel!
//-----------------------------------------------------
function BackToMoviePickerPanel(episodeIndex)
{
	try
	{
		//Watch out for trouble...
		if(episodeIndex<1)
		{
			episodeIndex=1;
		}
		else if(episodeIndex>9)
		{
			episodeIndex=9;
		}
		//Hide the information on this episode...
		var episodeDIV="theMoviesPickerEpisode"+episodeIndex+"ID";
		if($get(episodeDIV)!=null)
		{
			$get(episodeDIV).style.display="none";
			$get(episodeDIV).style.visibility="hidden";
		}
		//Always... Make sure the main 'picker' panel is visible.
		if($get("theMoviesPickerID")!=null)
		{
			$get("theMoviesPickerID").style.display="block";
			$get("theMoviesPickerID").style.visibility="visible";
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in GoFetchTheFilmMMSUrlAndWait ["+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=document.getElementById("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=document.getElementById("theNextMovie");
			if(TheNextButton!=null)
			{
				TheNextButton.style.display="inline";
				TheNextButton.style.visibility="visible";
			}
			//Always... Make sure the Scrubber Input is hidden.
			var TheScrubberInput=document.getElementById("sliderValue1");
			if(TheScrubberInput!=null)
			{
				TheScrubberInput.style.display="none";
				TheScrubberInput.style.visibility="hidden";
			}
		}
		//Screwy Louie, dandy Randy... access the Video Player.
		var thePLAYER=document.getElementById("VideoZap");
		//Set the current mode Video Player SIZE...
		thePLAYER.width="640";
		thePLAYER.height="480";
		if(NextMovieMMSVidoeURI!=null)
		{
			ThisMovieMMSVideoURI=NextMovieMMSVidoeURI;
			NextMovieMMSVidoeURI=null;
		}
		else
		{
			ThisMovieMMSVideoURI=DefaultMovieMMSVideoURI;
		}
		//Whatever... slam it in.
		thePLAYER.URL=ThisMovieMMSVideoURI;
		//Do the 'Civil War Is Hell' Video index maintenance.
		CivilWarIsHellVideoIndex++;
		if(CivilWarIsHellVideoIndex<0 || CivilWarIsHellVideoIndex>8)
		{
			CivilWarIsHellVideoIndex=0;
		}
		//WS call... try to get the next Video URI.
		GetNextCivilWarIsHellVideoMMSaccessURIFromWS();
		//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=document.getElementById("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=document.getElementById("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=document.getElementById("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=document.getElementById("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=document.getElementById("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=document.getElementById("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=document.getElementById("theMovieTime");
		if(TheMovieTimeDIV!=null)
		{
			//Tell'em the MOVIE time!
			TheMovieTimeDIV.innerHTML="";
		}
		//Screwy Louie, dandy Randy... access the Video Player.
		var thePLAYER=document.getElementById("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 'Civil War Is Hell' Video index maintenance.
		CivilWarIsHellVideoIndex++;
		if(CivilWarIsHellVideoIndex<0 || CivilWarIsHellVideoIndex>8)
		{
			CivilWarIsHellVideoIndex=0;
		}
		//WS call... try to get the next Video URI.
		GetNextCivilWarIsHellVideoMMSaccessURIFromWS();
		//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=document.getElementById("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=document.getElementById("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=document.getElementById("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=document.getElementById("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=document.getElementById("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=document.getElementById("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=document.getElementById('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=document.getElementById("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=document.getElementById("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=document.getElementById('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]
//INTERVAL RESPONSE JS Methods... BEGIN HERE.
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[JS CODE GROUP]
//-----------------------------------------------------
// Timer Manager DUDE!
//-----------------------------------------------------
function DoTimerPOP()
{
	//.................................................
	//[Timer POP Processing 01] Waiting for a FILM??
	//-------------------------------------------------
	//Only in movie mode...
	if(MovieScreenVisible==true)
	{
		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;
					TimeToWatchTheCivilWarIsHellFilm();
				}
			}
		}
	}
	//.................................................
	//[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
	{
		//Only in movie mode...
		if(MovieScreenVisible==true)
		{
			//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=document.getElementById("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=document.getElementById("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] Text Fader.
	//-------------------------------------------------
	//Only when the movie is hidden...
	if(MovieScreenVisible==false)
	{
		//The Battle Hymn of the Republic text management.
		jwhIntervalCount++;
		if(jwhIntervalCount>300)
		{
			jwhIntervalCount=0;
			//Do the full [fade-out] animation.
			if(whTextAnimation!=null)
			{
				whTextAnimation.set_effect($AA.FadeEffect.FadeOut);
				whTextAnimation.set_duration(2.0);
				whTextAnimation.WeNeedToSwapTheText=true;
				whTextAnimation.play();
			}
		}
	}
	//.................................................
	//[Timer POP Processing 04] Slide Show.
	//-------------------------------------------------
	//Only when the movie is hidden...
	if(MovieScreenVisible==false)
	{
		//WAR Image SLIDE SHOW PROCESSING... [start]
		if(!QuicklyPauseTheSlideShow)
		{
			//Deal the the ImageSet interval
			ImageSetInterval++;
			if(ImageSetInterval>=ImageSetIntervalValue)
			{
				ImageSetInterval=0;
				if(AlbumPhotoCount>0)
				{
					RefreshImageCache();
				}
			}
			//Deal with Image Fade in.
			else if(FadeTransition && ImageFadeIn)
			{
				JustFadeIn();
			}
			//Deal with Iris OUT Image Transition.
			else if(IrisTransition  && ApplyIrisOut)
			{
				DoTheIrisOut();
			}
			//Deal with Iris IN Image Transition.
			else if(IrisTransition  && ApplyIrisIn)
			{
				DoTheIrisIn();
			}
			//Deal with Random Blinds Image Transition.
			else if(BlindsTransition && BlindsRandom)
			{
				DoTheBlindsThing();
			}
			//Is it time to fade away DUDE!
			if(FadeTransition && ImageSetInterval==ImageSetIntervalValue-20)
			{
				//Perpare the fader... MSIE v6.0 or later!	
				if(broswerId=="msie") 
				{
					ImageObject.opacity=100;
					ImageFadeIn=false;
					ImageFadeOut=true;
					ImageFadeCount=0;
				}
			}
			//deal with Image Fade out.
			if(FadeTransition && ImageFadeOut)
			{
				JustFadeOut();
			}
		}
		//Is the Image Pop-up Modal Viewer visible?
		if(imagePopupViewerIsVisible)
		{
			//Time to swap the image?
			imageSwapperInterval++
			if(imageSwapperInterval>100)
			{
				imageSwapperInterval=0;
				ShowNextImageInModalPopup();
			}
		}
	}
	//.................................................
	//[Timer POP Processing 05] 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!
	        SessionDummyImage.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);
}
//-----------------------------------------------------
//Keep the dBase Photo Images coming from the SERVER.
//-----------------------------------------------------
function RefreshImageCache()
{
	//MUST HAVE A Comix TO PROCEED WITH THE dBASE ACCESS.
	if(AlbumPhotoCount>0)
	{
		//Start of the album... good time to clean up!
		if(AlbumPhotoIndex==-1)
		{
			//New Album: TRASH ALL CACHED PHOTO IMAGES!
			ImageNewURL[0]=null;
			ImageNewURL[1]=null;
		}
		//IMAGE Cache ENTRY 0 Management...
		if(ImageNewURL[0]==null)
		{
			try
			{
				//Get a new Image object.
				ImageNewURL[0]=new Image();
				//Need a unique number for each handler call to fool the MSIE cache.
				var TimeStampOne=new Date();
				var SecondsOne=TimeStampOne.getTime();
				//Bump the index to the next Image in the Photo Shuffle Array.
				AlbumPhotoIndex++;
				if(AlbumPhotoIndex>=AlbumPhotoCount)
				{
					AlbumPhotoIndex=0;
				}
				//Build the blasted SRC URL String...
				var srcTargetOne="whdBaseLinqImgHandler.ashx?PhotoID=";
					srcTargetOne+=AlbumPhotoDetailSet[AlbumPhotoShuffleArray[AlbumPhotoIndex]].PhotoID;
					srcTargetOne+="&Size=ML";
					srcTargetOne+="&isPublic=true";
					srcTargetOne+="&time=";
					srcTargetOne+=SecondsOne;
				//Ask'em for the DATA!
				ImageNewURL[0].src=srcTargetOne;
			}
			catch(e)
			{
				writeDebug("Error in RefreshImageCache(IMAGE Cache ENTRY 0 Management)",true); 
			}
		}
		//IMAGE Cache ENTRY 1 Management...
		if(ImageNewURL[1]==null)
		{
			try
			{
				//Get a new Image object.
				ImageNewURL[1]=new Image();
				//Need a unique number for each handler call to fool the MSIE cache.
				var TimeStampTwo=new Date();
				var SecondsTwo=TimeStampTwo.getTime();
				//Bump the index to the next Image in the Photo Shuffle Array.
				AlbumPhotoIndex++;
				if(AlbumPhotoIndex>=AlbumPhotoCount)
				{
					AlbumPhotoIndex=0;
				}
				//Build the blasted SRC URL String...
				var srcTargetTwo="whdBaseLinqImgHandler.ashx?PhotoID=";
					srcTargetTwo+=AlbumPhotoDetailSet[AlbumPhotoShuffleArray[AlbumPhotoIndex]].PhotoID;
					srcTargetTwo+="&Size=ML";
					srcTargetTwo+="&isPublic=true";
					srcTargetTwo+="&time=";
					srcTargetTwo+=SecondsTwo;
				//Ask'em for the DATA!
				ImageNewURL[1].src=srcTargetTwo;
			}
			catch(e)
			{
				writeDebug("Error in RefreshImageCache(IMAGE Cache ENTRY 1 Management)",true); 
			}
		}
		//Perpare the fader... MSIE v6.0 or later!	
		if(broswerId=="msie") 
		{
			//Fade /in/out/...
			if(FadeTransition) 
			{
				ImageObject.opacity=0;
				ImageFadeIn=true;
				ImageFadeOut=false;
				ImageFadeCount=0;
			}
			//Iris /in/out/...
			else if(IrisTransition)
			{
				//ApplyIrisIn=true;
				ApplyIrisOut=true
			}
			//Blinds /left/right/up/down/...
			else if(BlindsTransition)
			{
				BlindsRandom=true;
			}
		}
		//All other browsers... just do it!	
		else 
		{
			//Ya! Save the newly arrived Image.
			ImageObject.src=ImageNewURL[ImageNewURLIndex].src;
			//We are done with the TEMP Image Obj
			ImageNewURL[ImageNewURLIndex]=null;
			//Point to the next Image.
			ImageNewURLIndex++;
			if(ImageNewURLIndex>=ImageNewURL.length)
			{
				ImageNewURLIndex=0;
			}
			FadeTransition=false;
			ImageFadeIn=false;
			ImageFadeOut=false;
			ImageFadeCount=0;
		}
	}
}
//-----------------------------------------------------
//Set the IMAGE Opacity.
//-----------------------------------------------------
function SetImageOpacity(imgName, step)
{
	try
	{
		//MSIE v6.0 and better my friends!
		if(broswerId=="msie")
		{
			var img=document.images[imgName];
			img.opacity += step;
			img.style.filter='alpha(opacity = ' + img.opacity + ')'; 	
		}
	}
	catch(e)
	{
		writeDebug("Error in SetImageOpacity()",true); 
	}
}
//-----------------------------------------------------
//Image Fade-In Handler.
//-----------------------------------------------------
function JustFadeIn()
{
	try
	{
		//Do not start until the new IMG has arrived!
		if(ImageNewURL[ImageNewURLIndex]!=null)
		{
			if(ImageNewURL[ImageNewURLIndex].readyState=='complete')
			{
				//Chnage the look of the IMAGE...
				if(ImageObject.style.border=="")
				{
					ImageObject.style.border="inset";
					ImageObject.style.paddingTop="0px";
				}
				//Ya! Save the newly arrived Image.
				ImageObject.src=ImageNewURL[ImageNewURLIndex].src;
				//Need some help...
				//writeDebug(ImageObject.src,true); 
				//Tell'em how to see the next Image!
				ImageObject.title="Click for a bigger pix...";
				//SFM 16NOV07... Make sure we can see the sucker!
				ImageObject.style.visibility="visible";
				//Make sure we have the proper height/width
				ImageObject.width=ImageNewURL[ImageNewURLIndex].width;
				ImageObject.height=ImageNewURL[ImageNewURLIndex].height;
				//MouseOver: I want to see the Image URL!
				ImageObject.alt=ImageObject.src;
				//DEBUG: Just a test... track the filenames.	
				//window.status=ImageObject.src;
				//We have the full IMG... 1st time.
				//clip width
				if(ImageObject.width>ImageObject.parentElement.clientWidth)
					ImageObject.width=(ImageObject.parentElement.clientWidth-20);
				//clip height
				if(ImageObject.height>ImageObject.parentElement.clientHeight)
					ImageObject.height=(ImageObject.parentElement.clientHeight-20);
				//Center vertically-try to leave more space at the bottom!
				var vert=(ImageObject.parentElement.clientHeight-ImageObject.height)/2;
				if(vert>0)
					ImageObject.style.marginTop=vert-(vert/10);
				//Finally... We are done with the TEMP Image Obj
				ImageNewURL[ImageNewURLIndex]=null;
				//Point to the next Image.
				ImageNewURLIndex++;
				if(ImageNewURLIndex>=ImageNewURL.length)
				{
					ImageNewURLIndex=0;
				}
			}
		}
		else 
		{
			//Deal with the FADE-IN Operation.
			SetImageOpacity('imgview', 10);
			ImageFadeCount++;
			if(ImageFadeCount>=10)
			{
				ImageFadeIn=false;
				ImageFadeOut=false;
				ImageFadeCount=0;
			}
		}
	}
	catch(e)
	{
		writeDebug("Error in JustFadeIn()",true); 
	}
}
//-----------------------------------------------------
//Image Fade-Out Handler.
//-----------------------------------------------------
function JustFadeOut()
{
	//Deal with the FADE-OUT Operation.
	SetImageOpacity('imgview', -10);
	ImageFadeCount++;
	if(ImageFadeCount>=10)
	{
		ImageFadeIn=false;
		ImageFadeOut=false;
		ImageFadeCount=0;
	}
}
//-----------------------------------------------------
//Image IRIS Transition [Out] Handler.
//-----------------------------------------------------
function DoTheIrisOut()
{
	try
	{
		//Do not start until the new IMG has arrived!
		if(ImageNewURL[ImageNewURLIndex]!=null)
		{
			if(ImageNewURL[ImageNewURLIndex].readyState=='complete')
			{
				//Chnage the look of the IMAGE...
				if(ImageObject.style.border=="")
				{
					ImageObject.style.border="inset";
					ImageObject.style.paddingTop="0px";
				}
				//Generate a random INDEX [circle/star/diamond/cross/plus/square]
				var IrisStyleIndex=Math.floor(Math.random()*6);
				//Default Iris Transition (secs)... bumped for real quick 'plus' etc.
				var IrisDuration=1;
				if(IrisXFormType[IrisStyleIndex]=="plus" || IrisXFormType[IrisStyleIndex]=="cross")
					IrisDuration=1;
				//Setup the IRIS-OUT Filter...
				ImageObject.style.filter="progid:DXImageTransform.Microsoft.Iris(irisstyle="+IrisXFormType[IrisStyleIndex]+",motion=out,duration="+IrisDuration+")";
				//Apply the Filter and stop all motion...
				ImageObject.filters(0).Apply();
				//Ya! Save the newly arrived Image.
				ImageObject.src=ImageNewURL[ImageNewURLIndex].src;
				//Need some help...
				//writeDebug(ImageObject.src,true); 
				//Tell'em how to see the next Image!
				ImageObject.title="Click for a bigger pix...";
				//SFM 16NOV07... Make sure we can see the sucker!
				ImageObject.style.visibility="visible";
				//Let the sucker RIP...
				ImageObject.filters(0).Play();
				//Done with this one for now!
				ApplyIrisOut=false;
				//Make sure we have the proper height/width
				ImageObject.width=ImageNewURL[ImageNewURLIndex].width;
				ImageObject.height=ImageNewURL[ImageNewURLIndex].height;
				//MouseOver: I want to see the Image URL!
				ImageObject.alt=ImageObject.src;
				//We are done with the TEMP Image Obj
				ImageNewURL[ImageNewURLIndex]=null;
				//Point to the next Image.
				ImageNewURLIndex++;
				if(ImageNewURLIndex>=ImageNewURL.length)
				{
					ImageNewURLIndex=0;
				}
				//DEBUG: Just a test... track the filenames.	
				//window.status=ImageObject.src;
				//We have the full IMG... 1st time.
				//clip width
				if(ImageObject.width>ImageObject.parentElement.clientWidth)
					ImageObject.width=(ImageObject.parentElement.clientWidth-20);
				//clip height
				if(ImageObject.height>ImageObject.parentElement.clientHeight)
					ImageObject.height=(ImageObject.parentElement.clientHeight-20);
				//Center vertically-try to leave more space at the bottom!
				var vert=(ImageObject.parentElement.clientHeight-ImageObject.height)/2;
				if(vert>0)
					ImageObject.style.marginTop=vert-(vert/10);
				//SFM 16NOV07... Just toggle between the two modes for now.
				IrisTransition=false;
				BlindsTransition=true;
			}
		}
	}
	catch(e)
	{
		writeDebug("Error in DoTheIrisOut()",true); 
	}
}
//-----------------------------------------------------
//Image IRIS Transition [In] Handler.
//-----------------------------------------------------
function DoTheIrisIn()
{
	try
	{
		//Do not start until the new IMG has arrived!
		if(ImageNewURL[ImageNewURLIndex]!=null)
		{
			if(ImageNewURL[ImageNewURLIndex].readyState=='complete')
			{
				//Chnage the look of the IMAGE...
				if(ImageObject.style.border=="")
				{
					ImageObject.style.border="inset";
					ImageObject.style.paddingTop="0px";
				}
				//Generate a random INDEX [circle/star/diamond/cross/plus/square]
				var IrisStyleIndex=Math.floor(Math.random()*6);
				//Default Iris Transition (secs)... bumped for real quick 'plus'
				var IrisDuration=1;
				if(IrisXFormType[IrisStyleIndex]=="plus" || IrisXFormType[IrisStyleIndex]=="cross")
					IrisDuration=1;
				//Setup the IRIS-IN Filter...
				ImageObject.style.filter="progid:DXImageTransform.Microsoft.Iris(irisstyle="+IrisXFormType[IrisStyleIndex]+",motion=in,duration="+IrisDuration+")";
				//Apply the Filter and stop all motion...
				ImageObject.filters(0).Apply();
				//Ya! Save the newly arrived Image.
				ImageObject.src=ImageNewURL[ImageNewURLIndex].src;
				//Need some help...
				//writeDebug(ImageObject.src,true); 
				//Tell'em how to see the next Image!
				ImageObject.title="Click for a bigger pix...";
				//SFM 16NOV07... Make sure we can see the sucker!
				ImageObject.style.visibility="visible";
				//Let the sucker RIP...
				ImageObject.filters(0).Play();
				//Done with this one for now!
				ApplyIrisIn=false;
				//Make sure we have the proper height/width
				ImageObject.width=ImageNewURL[ImageNewURLIndex].width;
				ImageObject.height=ImageNewURL[ImageNewURLIndex].height;
				//MouseOver: I want to see the Image URL!
				ImageObject.alt=ImageObject.src;
				//We are done with the TEMP Image Obj
				ImageNewURL[ImageNewURLIndex]=null;
				//Point to the next Image.
				ImageNewURLIndex++;
				if(ImageNewURLIndex>=ImageNewURL.length)
				{
					ImageNewURLIndex=0;
				}
				//DEBUG: Just a test... track the filenames.	
				//window.status=ImageObject.src;
				//We have the full IMG... 1st time.
				//clip width
				if(ImageObject.width>ImageObject.parentElement.clientWidth)
					ImageObject.width=(ImageObject.parentElement.clientWidth-20);
				//clip height
				if(ImageObject.height>ImageObject.parentElement.clientHeight)
					ImageObject.height=(ImageObject.parentElement.clientHeight-20);
				//Center vertically-try to leave more space at the bottom!
				var vert=(ImageObject.parentElement.clientHeight-ImageObject.height)/2;
				if(vert>0)
					ImageObject.style.marginTop=vert-(vert/10);
				//SFM 16NOV07... Just toggle between the two modes for now.
				IrisTransition=false;
				BlindsTransition=true;
			}
		}
	}
	catch(e)
	{
		writeDebug("Error in DoTheIrisIn()",true); 
	}
}
//-----------------------------------------------------
//Image Blinds Transition Handler.
//-----------------------------------------------------
function DoTheBlindsThing()
{
	try
	{
		//Do not start until the new IMG has arrived!
		if(ImageNewURL[ImageNewURLIndex]!=null)
		{
			if(ImageNewURL[ImageNewURLIndex].readyState=='complete')
			{
				//Chnage the look of the IMAGE...
				if(ImageObject.style.border=="")
				{
					ImageObject.style.border="inset";
					ImageObject.style.paddingTop="0px";
				}
				//Generate a random INDEX [up/down/left/right]
				var BlindsTypeIndex=Math.floor(Math.random()*4);
				//Generate a random Band Count [1-10]
				var BlindsBands=Math.floor(Math.random()*10);
				if(BlindsBands<=0)
					BlindsBands=1;
				else if(BlindsBands>10)
					BlindsBands=10;
				//Setup the new [up/down/left/right] Blinds Filter...
				ImageObject.style.filter="progid:DXImageTransform.Microsoft.Blinds(direction="+BlindsXFormType[BlindsTypeIndex]+",bands="+BlindsBands+",duration=1)";
				//Apply the Filter and stop all motion...
				ImageObject.filters(0).Apply();
				//Ya! Save the newly arrived Image.
				ImageObject.src=ImageNewURL[ImageNewURLIndex].src;
				//Need some help...
				//writeDebug(ImageObject.src,true); 
				//Tell'em how to see the next Image!
				ImageObject.title="Click for a bigger pix...";
				//SFM 16NOV07... Make sure we can see the sucker!
				ImageObject.style.visibility="visible";
				//Let the sucker RIP...
				ImageObject.filters(0).Play();
				//Done with this one for now!
				BlindsRandom=false;
				//Make sure we have the proper height/width
				ImageObject.width=ImageNewURL[ImageNewURLIndex].width;
				ImageObject.height=ImageNewURL[ImageNewURLIndex].height;
				//MouseOver: I want to see the Image URL!
				ImageObject.alt=ImageObject.src;
				//We are done with the TEMP Image Obj
				ImageNewURL[ImageNewURLIndex]=null;
				//Point to the next Image.
				ImageNewURLIndex++;
				if(ImageNewURLIndex>=ImageNewURL.length)
				{
					ImageNewURLIndex=0;
				}
				//DEBUG: Just a test... track the filenames.	
				//window.status=ImageObject.src;
				//We have the full IMG... 1st time.
				//clip width
				if(ImageObject.width>ImageObject.parentElement.clientWidth)
					ImageObject.width=(ImageObject.parentElement.clientWidth-20);
				//clip height
				if(ImageObject.height>ImageObject.parentElement.clientHeight)
					ImageObject.height=(ImageObject.parentElement.clientHeight-20);
				//Center vertically-try to leave more space at the bottom!
				var vert=(ImageObject.parentElement.clientHeight-ImageObject.height)/2;
				if(vert>0)
					ImageObject.style.marginTop=vert-(vert/10);
				//SFM 16NOV07... Just toggle between the two modes for now.
				IrisTransition=true;
				BlindsTransition=false;
			}
		}
	}
	catch(e)
	{
		writeDebug("Error in DoTheBlindsThing()",true); 
	}
}
//-----------------------------------------------------
//Toggle the Movie Screen Accordion Title... Show/Hide
//-----------------------------------------------------
function ToggleMovieScreenAccordionTitle(target, event)
{
	try
	{
		//We are hiding this Accordion Panel...
		if(MovieScreenVisible)
		{
			//Deal with the Accordion button...
			var MovieScreenAccordionTitle=$get("MovieScreenButtonID");
			if(MovieScreenAccordionTitle!=null)
			{
				//Toggle to SHOW-HIDE Mode!
				MovieScreenVisible=false;
				MovieScreenAccordionTitle.innerHTML="Click here to open the Movie Screen and watch History!";
				//Unbelievable fuck-up... this thing will not go away!
				if($get("sl0slider")!=null)
				{
					$get("sl0slider").style.display="none";
					$get("sl0slider").style.visibility="hidden";
				}
				//Make sure the movie is off!
				PleaseStopTheMovie();
			}
			//Show the all Civil War Container Panels.
			$get("uscwSideRegimentalFlagBlockID").style.display="block";
			$get("uscwSideRegimentalFlagBlockID").style.visibility="visible";
			$get("uscwTextAnimationFaderID").style.display="block";
			$get("uscwTextAnimationFaderID").style.visibility="visible";
			$get("uscwCivilWarPhotoShowID").style.display="block";
			$get("uscwCivilWarPhotoShowID").style.visibility="visible";
			//Start the Civil War Battle Flag Panel TIMER.
			StartFlagPanelTimer();
		}
		//We are showing this Accordion Panel...
		else
		{
			//Stop the Civil War Battle Flag Panel TIMER.
			StopFlagPanelTimer();
			//Deal with the Accordion button...
			var MovieScreenAccordionTitle=$get("MovieScreenButtonID");
			if(MovieScreenAccordionTitle!=null)
			{
				//Toggle to SHOW-HIDE Mode!
				MovieScreenVisible=true;
				MovieScreenAccordionTitle.innerHTML="Enough already... click here to hide the Movie Screen!";
			}
			//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 formPhoto=document.forms[0];
					if(formPhoto!=null)
					{
						//Locate the current check and the new value.
						for(i=0;i<formPhoto.clampmaxbandwidth.length;i++)
						{
							if(formPhoto.clampmaxbandwidth[i].checked) 
							{
								OldCheck=i;
							}
							if(formPhoto.clampmaxbandwidth[i].value==cookieBandWidth) 
							{
								NewCheck=i;
							}
						}
						//Simple... just plug'em in the control.
						if(OldCheck!=-1 && NewCheck!=-1)
						{
							formPhoto.clampmaxbandwidth[OldCheck].checked=false;
							formPhoto.clampmaxbandwidth[NewCheck].checked=true;
						}
					}
				}
				//No cookie... just use the default.
				else
				{
					cookieBandWidth=350000;
				}
				//Finally... Set the Player maximum bandwidth.
				try
				{
					var thePLAYER=document.getElementById("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); 
			}
			//Hide the Photo Mosaic View Container.
			$get("uscwSideRegimentalFlagBlockID").style.display="none";
			$get("uscwSideRegimentalFlagBlockID").style.visibility="hidden";
			$get("uscwTextAnimationFaderID").style.display="none";
			$get("uscwTextAnimationFaderID").style.visibility="hidden";
			$get("uscwCivilWarPhotoShowID").style.display="none";
			$get("uscwCivilWarPhotoShowID").style.visibility="hidden";
			//Make sure we can see the logger panel...
			UserAuthenticate();
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in TogglePhotoShowAccordionTitle ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Civil War Battle Flag Panel TIMER Control... START.
//-----------------------------------------------------
function StartFlagPanelTimer()
{
	try
	{
		//Try to find the fucking timer...
	    var flagTimer=$find(jsTimerXPopoffAccess); 
		if(flagTimer!=null)
		{
			//Just enable the sucker...
			flagTimer.set_enabled(true);
			//Start the timer...
			flagTimer._startTimer(); 
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in StartFlagPanelTimer ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Civil War Battle Flag Panel TIMER Control... STOP.
//-----------------------------------------------------
function StopFlagPanelTimer()
{
	try
	{
		//Try to find the fucking timer...
	    var flagTimer=$find(jsTimerXPopoffAccess); 
		if(flagTimer!=null)
		{
			//Just disable the sucker...
			flagTimer.set_enabled(false);
			//Start the timer...
			flagTimer._stopTimer(); 
		}
	}
	catch(e)
	{
		//Trouble!
		writeDebug("Error in StopFlagPanelTimer ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//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()
{
    //.................................................
    //Hook into the App INIT Event chain.
    //.................................................
    try
    {
        Sys.Application.add_init(application_init);
    }
    catch (e)
    {
        //Trouble.
        writeDebug("Error in pageLoad(Sys.Application.add_init call) [" + e.name + "]: " + e.message, true);
    }
    //.................................................
	//We need a Julia Ward Howe Text animator...
	//.................................................
	try
	{
		//ACT Animation [shortcut] object... better be ready!
		if($AA.Animation!=null)
		{
			//Just do it once...
			if(whTextAnimation==null)
			{
				//Build the Animation... change the fade in-out on the fly.
				whTextAnimation=new $AA.FadeAnimation($get("uscwJuliaWardHoweProseID"), 
													  .0,
													  40, 
													  AjaxControlToolkit.Animation.FadeEffect.FadeOut, 
													  0, 
													  1.0, 
													  false);
				//We need know if it is time to swap the div content.
				whTextAnimation.WeNeedToSwapTheText=true;
				whTextAnimation.add_ended(Function.createDelegate(this, this.WeAreDoneAnimating));
				//Let them get started.
				whTextAnimation.initialize();
			}
		}
	}
	//This control should be generated by the ASP.NET Ajax framework.
	catch(e)
	{
		//Trouble.
		writeDebug("Error in pageLoad(whTextAnimation Setup) ["+e.name+"]: "+e.message,true); 
	}
}
//-----------------------------------------------------
//Application INIT Event...
//-----------------------------------------------------
function application_init()
{
    //.................................................
    //Get a ref to the Page Request Manager.
    //.................................................
    var prm=Sys.WebForms.PageRequestManager.getInstance();
    //Hook into events of interest.
    prm.add_beginRequest(prm_beginRequest);
    prm.add_endRequest(prm_endRequest);
    prm.add_pageLoaded(prm_pageLoaded);
}
//-----------------------------------------------------
//Event fired before the UpdatePanel async request.
//-----------------------------------------------------
function prm_beginRequest(sender, args)
{
}
//-----------------------------------------------------
//Event fired after the UpdatePanel async request.
//-----------------------------------------------------
function prm_endRequest(sender, args)
{
}
//-----------------------------------------------------
//Event fired after full UpdatePanel update completion.
//-----------------------------------------------------
function prm_pageLoaded(sender, args)
{
    //.................................................
    //CW[fix]Fall08... Reinit the Slider Control.
    //.................................................
    try
    {
        //Set all scrubber OPTIONS.
        var scrubberOptions=
		{
		    'b_vertical': false,
		    'b_watch': true,
		    'n_controlWidth': 490,
		    'n_controlHeight': 16,
		    'n_sliderWidth': 16,
		    'n_sliderHeight': 15,
		    'n_pathLeft': 1,
		    'n_pathTop': 1,
		    'n_pathLength': 473,
		    's_imgControl': './Images/HorzWhiteBar.gif',
		    's_imgSlider': './Images/GelSlider.gif',
		    'n_zIndex': 1
		}
        //Scrubber INITIALIZATION Parameters.
        var scrubberInit =
		{
		    's_form': 0,
		    's_name': 'sliderValue1',
		    'n_minValue': 0,
		    'n_maxValue': 100,
		    'n_value': 0,
		    'n_step': .1
		}
		//CW[fix]Fall08... Reinit the Slider [as 'sl0slider'].
        new slider(scrubberInit, scrubberOptions);
    }
    catch (e)
    {
        //Trouble.
        writeDebug("Error in prm_pageLoaded(Slider code Setup) [" + e.name + "]: " + e.message, true);
    }
}
//-----------------------------------------------------
//The HTML document load has completes... but perhaps
//not all ASP.NET Ajax objects... be carful!
//-----------------------------------------------------
function load()
{
    //Setup the [hidden] Debug DIV.
    clearDebug();
    //Setup the Movie 'time-scrubber' now...
    var TheScrubberDIV=$get("theMovieSliderBar");
    if(TheScrubberDIV!=null)
    {
        TheScrubberDIV.style.display="block";
        TheScrubberDIV.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";
    }
    //Unbelievable fuck-up... this thing will not go away!
    if($get("sl0slider")!=null)
    {
        $get("sl0slider").style.display="none";
        $get("sl0slider").style.visibility="hidden";
    }
    //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 formPhoto=document.forms[0];
            if(formPhoto!=null)
            {
                //Locate the current check and the new value.
                for(i=0;i<formPhoto.clampmaxbandwidth.length;i++)
                {
                    if(formPhoto.clampmaxbandwidth[i].checked)
                    {
                        OldCheck=i;
                    }
                    if(formPhoto.clampmaxbandwidth[i].value==cookieBandWidth)
                    {
                        NewCheck=i;
                    }
                }
                //Simple... just plug'em in the control.
                if(OldCheck!=-1&&NewCheck!=-1)
                {
                    formPhoto.clampmaxbandwidth[OldCheck].checked=false;
                    formPhoto.clampmaxbandwidth[NewCheck].checked=true;
                }
            }
        }
        //No cookie... just use the default.
        else
        {
            cookieBandWidth=350000;
        }
        //Finally... Set the Player maximum bandwidth.
        try
        {
            var thePLAYER=document.getElementById("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);
    }
    //IMAGE access using the DOM...	We use this everywhere.
    try
    {
        ImageObject=document.getElementById('imgview');
        //We do not have any IMAGES yet... 
        ImageNewURL[0]=null;
        ImageNewURL[1]=null;
        //We will start with this IMAGE!
        ImageNewURLIndex=0;
        //Perpare the fader... MSIE v6.0 or later!	
        if(broswerId=="msie")
        {
            ImageObject.opacity=0;
            IrisTransition=true;
            ApplyIrisOut=true;
        }
    }
    catch(e)
    {
        writeDebug("Trouble in load(getElementById)... ImageObject Setup!",true);
    }
    //Create the DUMMY Image used to keep the ASP.NET Session alive.
    try
    {
        SessionDummyImage=new Image();
    }
    catch(e)
    {
        writeDebug("Trouble in load(SessionDummyImage)!",true);
    }
    //Get the session Lightning Token...
    GetSessionLightningTokenFromWS();
    //We only want one Album: CivilWarImages!
    GetAlbumPhotoDetails("CivilWarImages");
    //Start the BALL ROLLING!
    DoTimerPOP();
}
//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="#000000";
		}
	}
	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>");
		}
	}
}