	var requiredMajorVersion 	= 9;
	var requiredMinorVersion 	= 0;
	var requiredRevision 		= 45;
	
	var params = HttpUtils.getQueryAsObject();
	
	var dsregEx;
	var dsreplace;
	var dsconfigPath;
	
	var showID;	
	var freeWheelSectionID;
	var pageUrl;	
	var pageDomain;

	var dsConfigInfo;					
	
	var ndsEpisodesByCategoryPath;
	var ndsEpisodesByShowPath;
	var ndsVideoPlayListPath;
	var ndsRatingsPath;
	var ndsGetTimeStamp;
	
	var dsEpisodesByCategory;
	
	var ndsCategoryByFullEp;
	var ndsCategoryByFullEpSeasons;
	var ndsCategoryRecentlyAdded;
	var ndsCategoryRecentlyAddedIDs;
	var ndsCategoryClips;
	var ndsCategoryTopRated;
	var ndsCategoryTopRatedIDs;
	var ndsCategoryMostViewed;
	var ndsCategoryMostViewedIDs;

	var loadedCategoryByFullEp			= false;
	var loadedCategoryByFullEpSeasons	= false;
	var loadedCategoryRecentlyAdded		= false;
	var loadedCategoryRecentlyAddedIDs	= false; 
	var loadedCategoryClips				= false;	
	var loadedCategoryTopRated			= false;
	var loadedCategoryTopRatedIDs		= false;
	var loadedCategoryMostViewed		= false;
	var loadedCategoryMostViewedIDs		= false;
			
	var dsEpisodesByShow;

	var configObserver = new Object;
	
	var loadedEpisodesByCategory 		= false;
	var loadedEpisodesByShow 			= false;
	var loadedTimeStamp 				= false;
	var loadedEpisodesByCategoryPath 	= false;
	var loadedVideoPlaylistPath 		= false;
	var loadedRatingsPath 				= false;

	var pathEpisodesByCategory;
	var pathRatings;
	var pathEpisodeByShow;
	var pathVideoPlayList;
	var pathVideoPlayListQueryString;
	var timeStampNextGen;
	var resultsLimit;
	var previous_btn 	= "previous";
	var next_btn 		= "next";
		
	var flashVideoCommunication = new FlashVideoCommunication();
	
	var videoConfigFlashVars	= null;

	var videoList 				= new Array(0);
	 
	var videoListIndex 			= 0;
	var videoListSegmentIndex 	= 0;
	var reachedPlayListEnd		= false;
	var continuousPlayEnabled 	= false;
	var autoPlayList			= new Array(0);
	
	var nodeFullEp				= new Array(2);
	var nodeFullEpSeasons		= new Array(0);
	var nodeClipsSeasons		= new Array(0);
	var nodeRecent				= new Array(2);
	var nodeClips				= new Array(2);
	var nodeTopRated 			= new Array(2);
	var nodeMostViewed			= new Array(2);
	
	var rankingList				= new Array(0);
	
	var sp1;
	var thumbnailStart 			= 0;
	var thumbnailEnd			= 0;
	var validDeepLinkEpisode	= false;
	var videoTimer;
	var initialPlay				= true;

	//querystring vars -----------------------------------------------------------------------------------------------------------------------------------------------//

//	if(params.section != null) 		videoConfigFlashVars = "FLASHVARS_defaultSection=" 		+ params.section;
//	if(params.categoryID != null) 	videoConfigFlashVars = "FLASHVARS_defaultCategoryID=" 	+ params.categoryID;
	

//	if(params.segmentID != null) 	videoConfigFlashVars = "FLASHVARS_defaultSegmentID=" 	+ params.segmentID;	
	//end querystring vars -----------------------------------------------------------------------------------------------------------------------------------------------//
	
	
	//spry and episode data ------------------------------------------------------------------------------------------------------------------------------------------//
	function episodeData(p_id, p_thumb, p_title, p_description, p_morebutton, p_episodeType, p_collectionTitle, p_ranking, p_collectionId, p_epiSeasonNumber, p_epiSeasonName, p_epiRatingImage, p_numberOfViews, p_epiOverlayURL){
		
		if(p_ranking > 5){
			p_ranking = 5;
		}
		
		this.id 				= p_id;
		this.thumb 				= p_thumb;
		this.title 				= p_title;
		this.description 		= p_description;
		this.morebutton			= p_morebutton;
		this.episodeType 		= p_episodeType;
		this.collectionTitle	= p_collectionTitle;
		this.ranking			= p_ranking;
		this.collectionId		= p_collectionId;
		this.epiSeasonNumber	= p_epiSeasonNumber;
		this.epiSeasonName		= p_epiSeasonName;
		this.epiRatingImage		= p_epiRatingImage;
		this.epiOverlayURL		= p_epiOverlayURL;
		this.numberOfViews		= p_numberOfViews;
			

		this.recentlyAdded		= false;
		this.topRated			= false;
		this.mostViewed			= false;
		
		this.segment 			= new Array();
		this.duration 			= new Array();
		this.thumbnailUrl 		= new Array();

	}
	
	function seasonData(p_seasonNumber, p_seasonName){
		
		this.seasonNumber 		= p_seasonNumber;
		this.seasonName			= p_seasonName;

	}
		
	function configObserverFunc(notificationType, dataSet, data){
		
		if (notificationType == "onLoadError"){
			alert("Couldnt Load Data. Please reload page. Error 100")
		}
	
		if (notificationType == "onPostLoad"){

			if(dataSet == dsConfigInfo){
				dsConfigInfo.removeObserver(configObserverFunc);
				
				getNestedConfigData();
			}

			if(dataSet == ndsGetTimeStamp){
				ndsGetTimeStamp.removeObserver(configObserverFunc);

				timeStampNextGen = getConfigNode(ndsGetTimeStamp, "@value");

				loadedTimeStamp = true;
			}

			if(dataSet == ndsEpisodesByShowPath){
				ndsEpisodesByShowPath.removeObserver(configObserverFunc);

				pathEpisodeByShow = getConfigNode(ndsEpisodesByShowPath, "@url");

				pathEpisodeByShow = pathEpisodeByShow.replace(dsregEx, dsreplace);

				resultsLimit = getConfigNode(ndsEpisodesByShowPath, "@limit");

				loadedEpisodesByShow = true;
			}
			
			if(dataSet == ndsVideoPlayListPath){
				ndsVideoPlayListPath.removeObserver(configObserverFunc);
				
				pathVideoPlayList = getConfigNode(ndsVideoPlayListPath, "@url");
				
				pathVideoPlayList = pathVideoPlayList.replace(dsregEx, dsreplace);
				
				loadedVideoPlaylistPath = true;
			}
			
			if(dataSet == ndsRatingsPath){
				ndsRatingsPath.removeObserver(configObserverFunc);
				
				pathRatings = getConfigNode(ndsRatingsPath, "@url");
				
				pathRatings = pathRatings.replace(dsregEx, dsreplace);
				
				loadedRatingsPath = true;
			}

			if(dataSet == ndsEpisodesByCategoryPath){
				ndsEpisodesByCategoryPath.removeObserver(configObserverFunc);
				
				pathEpisodesByCategory = getConfigNode(ndsEpisodesByCategoryPath, "@url");
				
				pathEpisodesByCategory = pathEpisodesByCategory.replace(dsregEx, dsreplace);
				
				loadedEpisodesByCategoryPath = true;
			}
			
			if(loadedEpisodesByShow && loadedTimeStamp && loadedVideoPlaylistPath && loadedRatingsPath && loadedEpisodesByCategoryPath){

				pathVideoPlayList = pathVideoPlayList + "&r=" + timeStampNextGen; 

				getShowData();
			}
		}
		
	}
	
	function showEpisodeObserverFunc(notificationType, dataSet, data){

		if (notificationType == "onLoadError"){
			alert("Couldnt Load Data. Please reload page. Error 200")
		}

		if (notificationType == "onPostLoad"){
			
			if(dataSet == dsEpisodesByShow){

				dsEpisodesByShow.removeObserver(showEpisodeObserverFunc);
			
				var rows = dsEpisodesByShow.getData();

				var currentRow;
				var segments 			= new Array();
				var duration			= new Array();
				var thumb				= new Array();
				var newID				= true;
				var matchingIndex		= 0;
				
				for(var i=0; i <= rows.length - 1; i++){
					currentRow = dsEpisodesByShow.getData()[i]["ds_RowID"];
					dsEpisodesByShow.setCurrentRow(currentRow);

					for(var n=0; n <= videoList.length - 1; n++){
						if(rows[i]["@id"] == videoList[n].id){
							newID = false;
							matchingIndex = n;
						}
					}
					
					if(newID || videoList.length == 0){
						var newEPType = rows[i]["@episodeType"];
						newEPType = newEPType.substring(0, 3);
						
						var newDescr = rows[i]["description"];
						newDescr = doReplaceSpecialChar(newDescr);
						
						var newTitle = rows[i]["@title"];
						newTitle = doReplaceSpecialChar(newTitle);
						
						var newEP = new episodeData(rows[i]["@id"], rows[i]["@thumbnailUrl"], newTitle, newDescr, rows[i]["@contentTags"], newEPType, rows[i]["@collectionTitle"], rows[i]["@ranking"], rows[i]["@collectionId"], rows[i]["@epiSeasonNumber"], rows[i]["@epiSeasonName"], rows[i]["@epiRatingImageUrl"], rows[i]["@numberOfViews"], rows[i]["@epiOverlayURL"]);
						videoList.push(newEP);
						matchingIndex = videoList.length == 0 ? 0 : videoList.length -1;
					}

					videoList[matchingIndex].segment.push(rows[i]["segments/segment/@id"]);
					videoList[matchingIndex].duration.push(rows[i]["segments/segment/@duration"]);
					videoList[matchingIndex].thumbnailUrl.push(rows[i]["segments/segment/@thumbnailUrl"]);
					
					newID = true;
				}
						
				getCategoryData();
			}
		}
	}
	
	
	function getShowData(){
		
		var s = pathEpisodeByShow  + "&id=" + showID + "&limit=" + resultsLimit + "&offset=0&r=" + timeStampNextGen

		dsEpisodesByShow = new Spry.Data.XMLDataSet(s, "/episodes/episode", { subPaths: [ "segments/segment"], entityEncodeStrings: false });
		dsEpisodesByShow.addObserver(showEpisodeObserverFunc);
		dsEpisodesByShow.loadData();

	}

	function categoryObserverFunc(notificationType, dataSet, data){

		if (notificationType == "onLoadError"){
			alert("Couldnt Load Data. Please reload page. Error 300")
		}

		if (notificationType == "onPostLoad"){
			
			if(dataSet == dsEpisodesByCategory){
				
				dsEpisodesByCategory.removeObserver(categoryObserverFunc);

				getNestedData();
			
			}else if(dataSet == ndsCategoryRecentlyAdded){
				ndsCategoryRecentlyAdded.removeObserver(categoryObserverFunc);
				
				var rowsRA = ndsCategoryRecentlyAdded.getData();
				ndsCategoryRecentlyAdded.setCurrentRow(0);
				nodeRecent[0] = rowsRA[0]["@totalItems"];
				nodeRecent[1] = rowsRA[0]["@recentlyAddedName"];
				
				loadedCategoryRecentlyAdded = true;
				
			}else if(dataSet == ndsCategoryRecentlyAddedIDs){
				ndsCategoryRecentlyAddedIDs.removeObserver(categoryObserverFunc);
				
				var rowsRA = ndsCategoryRecentlyAddedIDs.getData();

				var currentRow;

				for(var i=0; i <= rowsRA.length - 1; i++){

					currentRow = ndsCategoryRecentlyAddedIDs.getData()[i]["ds_RowID"];
					ndsCategoryRecentlyAddedIDs.setCurrentRow(currentRow);
					
					var isRecentlyAdded = rowsRA[i]["@id"];

					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].id == isRecentlyAdded){
							videoList[n].recentlyAdded = true;
						}
					}

				}
				
				loadedCategoryRecentlyAddedIDs = true;
				
			}else if(dataSet == ndsCategoryByFullEp){
				ndsCategoryByFullEp.removeObserver(categoryObserverFunc);
				
				var rowsCBS = ndsCategoryByFullEp.getData();
				
				ndsCategoryByFullEp.setCurrentRow(0);
				nodeFullEp[0] = rowsCBS[0]["@totalItems"];
				nodeFullEp[1] = rowsCBS[0]["@episodesBySeasonsName"];
				
				loadedCategoryByFullEp = true;
				
				
			}else if(dataSet == ndsCategoryByFullEpSeasons){
				ndsCategoryByFullEpSeasons.removeObserver(categoryObserverFunc);
				
				var rowsCBFES = ndsCategoryByFullEpSeasons.getData();
				
				var currentRow;
				
				for(var i=0; i <= rowsCBFES.length - 1; i++){

					currentRow = ndsCategoryByFullEpSeasons.getData()[i]["ds_RowID"];
					ndsCategoryByFullEpSeasons.setCurrentRow(currentRow);
					
					var newSeasonData = new seasonData(rowsCBFES[i]["@seasonNumber"], rowsCBFES[i]["@seasonName"]);
					
					nodeFullEpSeasons.push(newSeasonData);

				}

				loadedCategoryByFullEpSeasons = true;
				
			}else if(dataSet == ndsCategoryClips){
				ndsCategoryClips.removeObserver(categoryObserverFunc);
				
				var rowsCLP = ndsCategoryClips.getData();
				ndsCategoryClips.setCurrentRow(0);
				nodeClips[0] = rowsCLP[0]["@totalItems"];
				nodeClips[1] = rowsCLP[0]["@clipsName"];
			
				loadedCategoryClips = true;
				
			}else if(dataSet == ndsCategoryClipsSeasons){
				ndsCategoryClipsSeasons.removeObserver(categoryObserverFunc);
				
				var rows = ndsCategoryClipsSeasons.getData();
				
				var currentRow;
				
				for(var i=0; i <= rows.length - 1; i++){

					currentRow = ndsCategoryClipsSeasons.getData()[i]["ds_RowID"];
					ndsCategoryClipsSeasons.setCurrentRow(currentRow);
					
					var newSeasonData = new seasonData(rows[i]["@seasonNumber"], rows[i]["@seasonName"]);

					nodeClipsSeasons.push(newSeasonData);

				}

				loadedCategoryClipsSeasons = true;
				
			}else if(dataSet == ndsCategoryTopRated){
				ndsCategoryTopRated.removeObserver(categoryObserverFunc);
				
				var rowsCLP = ndsCategoryTopRated.getData();
				ndsCategoryTopRated.setCurrentRow(0);
				nodeTopRated[0] = rowsCLP[0]["@totalItems"];
				nodeTopRated[1] = rowsCLP[0]["@topRatedName"];
			
				loadedCategoryTopRated = true;
				
			}else if(dataSet == ndsCategoryTopRatedIDs){
				ndsCategoryTopRatedIDs.removeObserver(categoryObserverFunc);
				
				var rowsTRID = ndsCategoryTopRatedIDs.getData();

				var currentRow;

				for(var i=0; i <= rowsTRID.length - 1; i++){

					currentRow = ndsCategoryTopRatedIDs.getData()[i]["ds_RowID"];
					ndsCategoryTopRatedIDs.setCurrentRow(currentRow);
					
					var isTopRated = rowsTRID[i]["@id"];

					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].id == isTopRated){
							videoList[n].topRated = true;
						}
					}

				}
				
				loadedCategoryTopRatedIDs = true;
				
			}else if(dataSet == ndsCategoryMostViewed){
				ndsCategoryMostViewed.removeObserver(categoryObserverFunc);
				
				var rowsCLP = ndsCategoryMostViewed.getData();
				ndsCategoryMostViewed.setCurrentRow(0);
				nodeMostViewed[0] = rowsCLP[0]["@totalItems"];
				nodeMostViewed[1] = rowsCLP[0]["@mostViewedName"];
				
				loadedCategoryMostViewed = true;
				
			}else if(dataSet == ndsCategoryMostViewedIDs){
				ndsCategoryMostViewedIDs.removeObserver(categoryObserverFunc);
				
				var rowsMVID = ndsCategoryMostViewedIDs.getData();

				var currentRow;

				for(var i=0; i <= rowsMVID.length - 1; i++){

					currentRow = ndsCategoryMostViewedIDs.getData()[i]["ds_RowID"];
					ndsCategoryMostViewedIDs.setCurrentRow(currentRow);
					
					var isMostViewed = rowsMVID[i]["@id"];

					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].id == isMostViewed){
							videoList[n].mostViewed = true;
						}
					}

				}
				
				loadedCategoryMostViewedIDs = true;
				
			}
			
			if(loadedCategoryByFullEp && loadedCategoryByFullEpSeasons && loadedCategoryRecentlyAdded &&loadedCategoryClips && ndsCategoryClipsSeasons &&	loadedCategoryTopRated && loadedCategoryMostViewed){
				
				getNestedCategoryData();

			}
		}
	}
	
	//////////////////////////////
	
	
	function nestedCategoryObserverFunc(notificationType, dataSet, data){

		if (notificationType == "onLoadError"){
			alert("Couldnt Load Data. Please reload page. Error 400");
		}

		if (notificationType == "onPostLoad"){
			
			if(dataSet == ndsCategoryRecentlyAddedIDs){
				ndsCategoryRecentlyAddedIDs.removeObserver(categoryObserverFunc);
				
				var rowsRA = ndsCategoryRecentlyAddedIDs.getData();

				var currentRow;

				for(var i=0; i <= rowsRA.length - 1; i++){

					currentRow = ndsCategoryRecentlyAddedIDs.getData()[i]["ds_RowID"];
					ndsCategoryRecentlyAddedIDs.setCurrentRow(currentRow);
					
					var isRecentlyAdded = rowsRA[i]["@id"];

					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].id == isRecentlyAdded){
							videoList[n].recentlyAdded = true;
						}
					}

				}
				
				loadedCategoryRecentlyAddedIDs = true;
				
			}else if(dataSet == ndsCategoryTopRatedIDs){
				ndsCategoryTopRatedIDs.removeObserver(categoryObserverFunc);
				
				var rowsTRID = ndsCategoryTopRatedIDs.getData();

				var currentRow;

				for(var i=0; i <= rowsTRID.length - 1; i++){

					currentRow = ndsCategoryTopRatedIDs.getData()[i]["ds_RowID"];
					ndsCategoryTopRatedIDs.setCurrentRow(currentRow);
					
					var isTopRated = rowsTRID[i]["@id"];

					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].id == isTopRated){
							videoList[n].topRated = true;
						}
					}

				}
				
				loadedCategoryTopRatedIDs = true;
				
			}else if(dataSet == ndsCategoryMostViewedIDs){
				ndsCategoryMostViewedIDs.removeObserver(categoryObserverFunc);
				
				var rowsMVID = ndsCategoryMostViewedIDs.getData();

				var currentRow;

				for(var i=0; i <= rowsMVID.length - 1; i++){

					currentRow = ndsCategoryMostViewedIDs.getData()[i]["ds_RowID"];
					ndsCategoryMostViewedIDs.setCurrentRow(currentRow);
					
					var isMostViewed = rowsMVID[i]["@id"];

					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].id == isMostViewed){
							videoList[n].mostViewed = true;
						}
					}

				}
				
				loadedCategoryMostViewedIDs = true;
				
			}

			
			if(loadedCategoryRecentlyAddedIDs && loadedCategoryTopRatedIDs && loadedCategoryMostViewedIDs){

/*				var validSegment = false;

				if(params.segmentID != null){
					for(var f=0; f <= videoList.length - 1; f++){
						for(var t=0; t <= videoList[f].segment.length - 1; t++){
							if(videoList[f].segment[t] == params.segmentID){
								videoListIndex = f;
								validSegment = true;
							}
						}
					}
				}
*/

				var vdSect = "RECENT";
				var vdepType = "ALL";
				var vdepType = "ALL";
				
				if(nodeMostViewed[0] != "0"){
					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].mostViewed == true){
							videoListIndex = n;
							break;
						}
					}
					 
					vdSect = "MOSTVIEWED";
				}
				if(nodeTopRated[0] != "0"){
					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].topRated == true){
							videoListIndex = n;
							break;
						}
					}

					vdSect = "TOPRATED";
				}
				if(nodeClips[0] != "0"){
				
					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].episodeType == "CLI"){
							videoListIndex = n;
							break;
						}
					}
				
					vdSect = "CLIPS";
					vdepType = "CLI";
					vdseasonNumber = nodeClipsSeasons[0].seasonNumber;
				}
				if(nodeFullEp[0] != "0"){

					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].episodeType == "EPI"){
							videoListIndex = n;
							break;
						}
					}

					vdSect = "FULLEP";				
					vdepType = "EPI";
					vdseasonNumber = nodeFullEpSeasons[0].seasonNumber;
				}
				if(nodeRecent[0] != "0"){
					for(var n=0; n <= videoList.length - 1; n++){
						if(videoList[n].recentlyAdded == true){
							videoListIndex = n;
							break;
						}
					}
					
					vdSect = "RECENT";
				}
				
				
				if(params.episodeID != null){

					for(var f=0; f <= videoList.length - 1; f++){
						if(videoList[f].id == params.episodeID){
							videoListIndex = f;
							validDeepLinkEpisode = true;
						}
					}
					
					vdSect = (validDeepLinkEpisode) ? "DEEPLINK" : "RECENT";

				}
				
				writeVideoNavigationLinks();
				initializeAndPlayVideo();
				initVideo(vdSect, vdepType, vdseasonNumber);
				showSectionPlaying (vdSect);

			}
			
		}
	}
	
	//////////////////
	
	
	function getCategoryData(){
		var s = pathEpisodesByCategory  + "&id=multiCat&filterByCollectionId=" + showID + "&limit=" + resultsLimit + "&offset=0&r=" + timeStampNextGen

		dsEpisodesByCategory = new Spry.Data.XMLDataSet(s, "/episodes", { entityEncodeStrings: false });
		
		dsEpisodesByCategory.addObserver(categoryObserverFunc);
		dsEpisodesByCategory.loadData();

	}
	
	function getNestedData(){

		ndsCategoryByFullEp 		= new Spry.Data.NestedXMLDataSet(dsEpisodesByCategory, "/episodes/episodesBySeasons", { entityEncodeStrings: false });
		ndsCategoryByFullEpSeasons	= new Spry.Data.NestedXMLDataSet(dsEpisodesByCategory, "/episodes/episodesBySeasons/Season", { entityEncodeStrings: false });
		ndsCategoryRecentlyAdded 	= new Spry.Data.NestedXMLDataSet(dsEpisodesByCategory, "/episodes/recentlyAdded", { entityEncodeStrings: false });
		ndsCategoryClips 			= new Spry.Data.NestedXMLDataSet(dsEpisodesByCategory, "/episodes/clips", { entityEncodeStrings: false });
		ndsCategoryClipsSeasons		= new Spry.Data.NestedXMLDataSet(dsEpisodesByCategory, "/episodes/clips/Season", { entityEncodeStrings: false });
		ndsCategoryTopRated 		= new Spry.Data.NestedXMLDataSet(dsEpisodesByCategory, "/episodes/topRated", { entityEncodeStrings: false });
		ndsCategoryMostViewed 		= new Spry.Data.NestedXMLDataSet(dsEpisodesByCategory, "/episodes/mostViewed", { entityEncodeStrings: false });

		ndsCategoryByFullEp.addObserver(categoryObserverFunc);
		ndsCategoryByFullEpSeasons.addObserver(categoryObserverFunc);
		ndsCategoryRecentlyAdded.addObserver(categoryObserverFunc);
		ndsCategoryClips.addObserver(categoryObserverFunc);
		ndsCategoryClipsSeasons.addObserver(categoryObserverFunc);
		ndsCategoryTopRated.addObserver(categoryObserverFunc);
		ndsCategoryMostViewed.addObserver(categoryObserverFunc);
		
		ndsCategoryByFullEp.loadData();
		ndsCategoryByFullEpSeasons.loadData();
		ndsCategoryRecentlyAdded.loadData();
		ndsCategoryClips.loadData();
		ndsCategoryClipsSeasons.loadData()
		ndsCategoryTopRated.loadData();
		ndsCategoryMostViewed.loadData();
		
	}

	function getNestedCategoryData(){

		ndsCategoryRecentlyAddedIDs	= new Spry.Data.NestedXMLDataSet(dsEpisodesByCategory, "/episodes/recentlyAdded/episode", { entityEncodeStrings: false });
		ndsCategoryTopRatedIDs 		= new Spry.Data.NestedXMLDataSet(dsEpisodesByCategory, "/episodes/topRated/episode", { entityEncodeStrings: false });
		ndsCategoryMostViewedIDs	= new Spry.Data.NestedXMLDataSet(dsEpisodesByCategory, "/episodes/mostViewed/episode", { entityEncodeStrings: false });

		ndsCategoryRecentlyAddedIDs.addObserver(nestedCategoryObserverFunc);
		ndsCategoryTopRatedIDs.addObserver(nestedCategoryObserverFunc);
		ndsCategoryMostViewedIDs.addObserver(nestedCategoryObserverFunc);
		
		ndsCategoryRecentlyAddedIDs.loadData();
		ndsCategoryTopRatedIDs.loadData();
		ndsCategoryMostViewedIDs.loadData();
	
	}
	
	function getConfigData(){
		
		dsConfigInfo 					= new Spry.Data.XMLDataSet(dsconfigPath, "/config", { entityEncodeStrings: false });					
	
		dsConfigInfo.addObserver(configObserverFunc);

		dsConfigInfo.loadData();
		
	}
	
	function getNestedConfigData(){
	
		ndsEpisodesByCategoryPath	= new Spry.Data.NestedXMLDataSet(dsConfigInfo, "services/episodesByCategory", { entityEncodeStrings: false });
		ndsEpisodesByShowPath		= new Spry.Data.NestedXMLDataSet(dsConfigInfo, "services/episodesByShow", { entityEncodeStrings: false });
		ndsVideoPlayListPath		= new Spry.Data.NestedXMLDataSet(dsConfigInfo, "services/getVideoPlaylist", { entityEncodeStrings: false });
		ndsRatingsPath				= new Spry.Data.NestedXMLDataSet(dsConfigInfo, "services/rankEpisode", { entityEncodeStrings: false });
		ndsGetTimeStamp				= new Spry.Data.NestedXMLDataSet(dsConfigInfo, "timestamp", { entityEncodeStrings: false });

		ndsEpisodesByShowPath.addObserver(configObserverFunc);
		ndsVideoPlayListPath.addObserver(configObserverFunc);
		ndsRatingsPath.addObserver(configObserverFunc);
		ndsEpisodesByCategoryPath.addObserver(configObserverFunc);
		ndsGetTimeStamp.addObserver(configObserverFunc);

		ndsEpisodesByShowPath.loadData();
		ndsVideoPlayListPath.loadData();
		ndsRatingsPath.loadData();
		ndsEpisodesByCategoryPath.loadData();
		ndsGetTimeStamp.loadData();
	
	}
	
	function getConfigNode(dsName, nodeName){

		var rows = dsName.getData(); 
		return rows[0][nodeName];

	}

	function startVideoLoad(p_showID, p_freeWheelSectionID, p_pageUrl){

		var vidEnvironment = (document.URL.indexOf("staging.cartoonnetwork.com") > -1) == true ? "stg" : "prd"; 

		switch(vidEnvironment){
			case "stg" :
				dsregEx 				= /ctn\dcma\d.\d\d\d\d/;
				dsreplace				= "staging.cartoonnetwork.com/cnvideosvc2";
				dsconfigPath			= "http://staging.cartoonnetwork.com/cnvideosvc2/staged/CN2.staging.configuration.xml?r="  + getRandomNumber();
				pageDomain				= "http://staging.cartoonnetwork.com";
			break;
			
			default :
				dsregEx 				= /cnvideosvc2.cartoonnetwork.com/;
				dsreplace				= "www.cartoonnetwork.com/cnvideosvc2";
				dsconfigPath			= "http://www.cartoonnetwork.com/video/staged/CN2.configuration.xml?r="  + getRandomNumber();
				pageDomain				= "http://www.cartoonnetwork.com";
			break;

		}

		showID = p_showID;	
		
		if(params.showID != null) 		showID = params.showID;

		freeWheelSectionID = p_freeWheelSectionID;		

		pageUrl = p_pageUrl;	
	
	
		if(showID.length > 0 && freeWheelSectionID.length > 0 && pageUrl.length > 0){
			setTimeout("getConfigData()",100);
		}else{
			alert("Couldnt Load Data. Please reload page. Error 10");
		}

	}
	//end spry and episode data --------------------------------------------------------------------------------------------------------------------------//
	
	//Navigation controls --------------------------------------------------------------------------------------------------------------------------------//
	
	function initializeAndPlayVideo(){

		if(flashVideoCommunication.episodeId != videoList[videoListIndex].id){
		
			var num1 = videoList.length;
			num1 = num1 - 1;
			
			var num2 = videoList[videoListIndex].segment.length;
			num2 = num2 - 1;
			 
			flashVideoCommunication.segments = new Array();	
	
			for(var x=0; x <= videoList[videoListIndex].segment.length - 1; x++){
				var segDuration = videoList[videoListIndex].duration[x];	
				var segID 		= videoList[videoListIndex].segment[x];
				var segThumb 	= videoList[videoListIndex].thumbnailUrl[x];
				
				flashVideoCommunication.addSegment(segDuration, segID, segThumb);
			}			
			 
			flashVideoCommunication.collectionId		= videoList[videoListIndex].collectionId;
			flashVideoCommunication.collectionTitle		= videoList[videoListIndex].collectionTitle;
			flashVideoCommunication.episodeId			= videoList[videoListIndex].id;
			flashVideoCommunication.episodeType 		= videoList[videoListIndex].episodeType;
			flashVideoCommunication.episodeTitle 		= videoList[videoListIndex].title;
			flashVideoCommunication.pageUrl 			= pageUrl; 
			flashVideoCommunication.pathVideoPlayList	= pathVideoPlayList;
			flashVideoCommunication.playEndSlate 		= (videoListIndex == num1 && videoListSegmentIndex == num2) ? true : false;
			flashVideoCommunication.ranking 			= "0";
			flashVideoCommunication.sectionId 			= freeWheelSectionID;
		 
			doDelayinitializeAndPlayVideo()

		}

	}
	
	function doDelayinitializeAndPlayVideo(){
		if(videoPlayerIsReady()){
			if(initialPlay){
				initialPlay = false;
			}else{
				hidePlayNowGraphic();
				flashVideoCommunication.playVideo();
			}
		}else{
			videoTimer = setTimeout("doDelayinitializeAndPlayVideo()",200);
		}
		
	}
	
	function videoPlayerIsReady(){

		if(flashVideoCommunication.swfIsReady == false || flashVideoCommunication.videoAdPlaying){
			return false;
		}else{
			return true;
		}
		
	}

	function initVideo(p_cat, p_epType, p_seasonNumber){
		
		writeTitle();
		writeDescription();
		writeMoreButton();
		
		createRating();
		
		writeNavigation(p_cat, p_epType, p_seasonNumber); 
		//doUpdateContent(p_cat, p_epType, p_seasonNumber)

		highlightThumbnail(videoListIndex, true);
		
		document.tv_rating_img.src = videoList[videoListIndex].epiRatingImage;

		reachedPlayListEnd = autoPlayList.length == 1 ? true : false;

	}
	
	
	function playVideo(val){

		if(videoPlayerIsReady()){

			highlightThumbnail(videoListIndex, false); 

			
			if(val.toString() == "next"){
				videoListIndex = locateNextVideo();
			}else{
				videoListIndex = parseInt(val);
			}
			
			hasReachPlayListEnd();
	
			initializeAndPlayVideo();
			
			highlightThumbnail(videoListIndex, true);
	
			document.tv_rating_img.src = videoList[videoListIndex].epiRatingImage;
	
			writeTitle();
			writeDescription();
			writeMoreButton();
			
			createRating();
		}

	}
	
	function locateNextVideo(){
		
		var nextAutoPlayIndex = autoPlayList[0];
		
		for(var x=0; x <= autoPlayList.length - 1; x++){

			if(videoListIndex == autoPlayList[x]){			
				nextAutoPlayIndex = x == autoPlayList.length - 1 ? autoPlayList[x] : autoPlayList[x + 1];
			}
		
		}
		
		return nextAutoPlayIndex;
		
	}
	
	function hasReachPlayListEnd(){
			
		var nextAutoPlayIndex = autoPlayList[0];
		
		for(var x=0; x <= autoPlayList.length - 1; x++){
			
			if(videoListIndex == autoPlayList[x]){

				if(x == autoPlayList.length - 1){
					reachedPlayListEnd = true;
				}else{
					reachedPlayListEnd = false;
				}
			}
		}			
	}
	
	
	
	function highlightThumbnail(num, state){
	
		var elmID = "thumb" + num.toString();
			
		if(document.getElementById(elmID)){
			document.getElementById(elmID).src = (state) ? "/tools/img/video/playing.gif" : "http://i.cdn.turner.com/toon/tools/img/pixel.gif";
		}
	}
	
	function highlightVidCell(num, state){
		document.getElementById("panel" + num).style.background = (state) ? "/tools/img/bkgdVidCell.jpg" : "http://i.cdn.turner.com/toon/tools/img/pixel.gif";	
	}
	
	function rolloverThumbnail(obj){
		obj.className = "thumbgraphic_over";
	}
	
	function rolloutThumbnail(obj){
		obj.className = "thumbgraphic";
	}

	function writeVideoNavigationLinks(){
		
		var content = "";

		if(nodeRecent[0] != "0"){
			
			content += "<a href=" + '"' + "JavaScript:showHideVideoNavDiv('dsVidNav_recent'); doUpdateContent('RECENT', 'ALL','ALL');" + '" ';
			content += "id='recentvideolink' class='videoNavLinks'";
			content += ">" + nodeRecent[1] + " (" + nodeRecent[0] + ")</a><br />";		

			document.getElementById("dsVidNav_recent").innerHTML = content;
		}
		
		content = "";
		
		if(nodeFullEp[0] != "0"){
			
			content += "<a href=" + '"' + "JavaScript:showHideVideoNavDiv('dsVidNav_fullEp'); doUpdateContent('FULLEP', 'EPI','" + nodeFullEpSeasons[0].seasonNumber +  "');" + '" ';
			content += "id='fullepvideolink' class='videoNavLinks'";
			content += ">" + nodeFullEp[1] + " (" + nodeFullEp[0] + ")</a><br />";
				
			document.getElementById("dsVidNav_fullEp").innerHTML = content;
			content = "";
						
			for(n=0; n <= nodeFullEpSeasons.length - 1; n++){
			
				content += "&nbsp;&nbsp;&nbsp;<a href=" + '"' + "JavaScript:doUpdateContent('FULLEP', 'EPI','" + nodeFullEpSeasons[n].seasonNumber +  "');" + '"' + " class='videoNavLinks'>" + nodeFullEpSeasons[n].seasonName + "</a><br />";
			
			}
			
			document.getElementById("dsVidNav_fullEpSeasons").innerHTML = content;

			
		}

		content = "";
			
	
		if(nodeClips[0] != "0"){
			content += "<a href=" + '"' + "JavaScript:showHideVideoNavDiv('dsVidNav_clips'); doUpdateContent('CLIPS', 'CLI','" + nodeClipsSeasons[0].seasonNumber +  "');" + '" ';
			content += "id='clipsvideolink' class='videoNavLinks'";
			content += ">" + nodeClips[1] + " (" + nodeClips[0] + ")</a><br />";

			document.getElementById("dsVidNav_clips").innerHTML = content;
			content = "";
				
			
			for(n=0; n <= nodeClipsSeasons.length - 1; n++){
				
				content += "&nbsp;&nbsp;&nbsp;<a href=" + '"' + "JavaScript:doUpdateContent('CLIPS', 'CLI','" + nodeClipsSeasons[n].seasonNumber +  "');" + '"' + " class='videoNavLinks'>" + nodeClipsSeasons[n].seasonName + "</a><br />";		
			
			}
			
			document.getElementById("dsVidNav_clipsSeasons").innerHTML = content;
			
			
		}
		
		content = "";

		if(nodeTopRated[0] != "0"){
			content += "<a href=" + '"' + "JavaScript:showHideVideoNavDiv('dsVidNav_TopRated'); doUpdateContent('TOPRATED', 'ALL','ALL');" + '" ';
			content += "id='topratedvideolink' class='videoNavLinks'";
			content += ">" + nodeTopRated[1] + " (" + nodeTopRated[0] + ")</a><br />";
			
			document.getElementById("dsVidNav_TopRated").innerHTML = content;
				
		}
		
		content = "";
		
		if(nodeMostViewed[0] != "0"){
			content += "<a href=" + '"' + "JavaScript:showHideVideoNavDiv('dsVidNav_MostViewed'); doUpdateContent('MOSTVIEWED', 'ALL','ALL');" + '" ';
			content += "id='mostviewedvideolink' class='videoNavLinks'";
			content += ">" + nodeMostViewed[1] + " (" + nodeMostViewed[0] + ")</a><br />";
				
			document.getElementById("dsVidNav_MostViewed").innerHTML = content;
			
		}

		content = "";

	}
	
	function doReplaceSpecialChar(p_str){
	


		var str_regEx 		= /\Wamp\Wamp\W/;
		var str_replace		= "&";
		var str_VidCopy		= p_str;
		
		while(str_VidCopy.indexOf("&amp;amp;") > -1){

			str_VidCopy = str_VidCopy.replace(str_regEx, str_replace);
		
		}
		
		str_regEx 		= /\Wamp\W\W39\W/;
		str_replace		= "'";
		
		while(str_VidCopy.indexOf("&amp;#39;") > -1){

			str_VidCopy = str_VidCopy.replace(str_regEx, str_replace);
		
		}

		str_regEx 		= /\Wamp\Wquot\W/;
		str_replace		= "&quot;"

		while(str_VidCopy.indexOf("&amp;quot;") > -1){

			str_VidCopy = str_VidCopy.replace(str_regEx, str_replace);
		
		}

		return str_VidCopy;
				
	}
	
	function showHideVideoNavDiv (styleObj) {
	
		switch(styleObj){
			case "dsVidNav_clips" :
				document.getElementById("dsVidNav_fullEpSeasons").style.display = "none";
				document.getElementById("dsVidNav_clipsSeasons").style.display = document.getElementById("dsVidNav_clipsSeasons").style.display == "none" ? "block" : "none";			
			break;
			
			case "dsVidNav_fullEp" :
				document.getElementById("dsVidNav_clipsSeasons").style.display = "none";						
				document.getElementById("dsVidNav_fullEpSeasons").style.display = document.getElementById("dsVidNav_fullEpSeasons").style.display == "none" ? "block" : "none";
			break;
			
			default :
				if(document.getElementById("dsVidNav_clipsSeasons").style.display == "block"){
					document.getElementById("dsVidNav_clipsSeasons").style.display = "none";
				}
				if(document.getElementById("dsVidNav_fullEpSeasons").style.display == "block"){
					document.getElementById("dsVidNav_fullEpSeasons").style.display = "none";
				}

			break;

		}
		
	}
	
	function showSectionPlaying (styleObj) {

		if(document.getElementById("recentvideolink")){
			document.getElementById("recentvideolink").className		= "videoNavLinks";
		}
		if(document.getElementById("fullepvideolink")){
			document.getElementById("fullepvideolink").className		= "videoNavLinks";
		}
		if(document.getElementById("clipsvideolink")){
			document.getElementById("clipsvideolink").className			= "videoNavLinks";
		}
		if(document.getElementById("topratedvideolink")){
			document.getElementById("topratedvideolink").className 		= "videoNavLinks";
		}
		if(document.getElementById("topratedvideolink")){
			document.getElementById("topratedvideolink").className 		= "videoNavLinks";
		}
		if(document.getElementById("mostviewedvideolink")){
			document.getElementById("mostviewedvideolink").className 	= "videoNavLinks";
		}
		


		switch(styleObj){
			
			case "RECENT" :
				if(document.getElementById("recentvideolink")){
					document.getElementById("recentvideolink").className = "videoNavLinkActive";
				}
			break;
			
			case "FULLEP" :
				if(document.getElementById("fullepvideolink")){
					document.getElementById("fullepvideolink").className = "videoNavLinkActive";
				}
			break;

			case "CLIPS" :
				if(document.getElementById("clipsvideolink")){
					document.getElementById("clipsvideolink").className = "videoNavLinkActive";
				}
			break;
			
			case "TOPRATED" :
				if(document.getElementById("topratedvideolink")){
					document.getElementById("topratedvideolink").className = "videoNavLinkActive";
				}
			break;
			
			case "MOSTVIEWED" :
				if(document.getElementById("mostviewedvideolink")){
					document.getElementById("mostviewedvideolink").className = "videoNavLinkActive";
				}
			break;

		}
		
	}


	function writeNavigation(p_cat, p_epType, p_seasonNumber){

		var content = "";

		autoPlayList = null;
		autoPlayList = new Array(0);

		switch (p_cat) {
		
			case "RECENT" :

				for(n=0; n <= videoList.length - 1; n++){
					if(videoList[n].recentlyAdded){
						autoPlayList.push(n);
						content += returnNavigationString(n, p_cat);
					}
				}
				autoPlayList.reverse
			
			break;

			case "FULLEP" :
				
				for(n=0; n <= videoList.length - 1; n++){
					if(p_seasonNumber == videoList[n].epiSeasonNumber && p_epType == videoList[n].episodeType){
						autoPlayList.push(n);
						content += returnNavigationString(n, p_cat);
					}
				}
				autoPlayList.reverse
				
			break;

			case "CLIPS" :
				
				for(n=0; n <= videoList.length - 1; n++){
					if(p_seasonNumber == videoList[n].epiSeasonNumber && p_epType == videoList[n].episodeType){
						autoPlayList.push(n);
						content += returnNavigationString(n, p_cat);
					}
				}
				autoPlayList.reverse
			
			break;

			case "TOPRATED" :

				for(n=0; n <= videoList.length - 1; n++){
					if(videoList[n].topRated){
						autoPlayList.push(n);
						content += returnNavigationString(n, p_cat);
					}
				}
				autoPlayList.reverse
			
			break;
			
			case "MOSTVIEWED" :
			
				for(n=0; n <= videoList.length - 1; n++){
					if(videoList[n].mostViewed){
						autoPlayList.push(n);
						content += returnNavigationString(n, p_cat);
					}
				}
				autoPlayList.reverse
			
			break;
			
			case "DEEPLINK" :
			
				for(n=0; n <= videoList.length - 1; n++){
					if(videoList[n].id == params.episodeID){
						autoPlayList.push(n);
						content += returnNavigationString(n, p_cat);
					}
				}
				autoPlayList.reverse
			
			break;
			
			default:
				
				for(n=0; n <= videoList.length - 1; n++){
					autoPlayList.push(n);
					content += returnNavigationString(n, p_cat);
				}
				autoPlayList.reverse
				
			break;
		
		}
		
		content += "<div><img src='http://i.cdn.turner.com/toon/tools/img/pixel.gif' border='0' height='15' width='80'></div>" 
		document.getElementById('videoSlidingPanelsContentGroup').innerHTML = content;
		
		for(i=0; i<= autoPlayList.length - 1; i++){
 
			var rateNameStr = "videolistrating_" + videoList[autoPlayList[i]].id;
			var rateNameStr2 = "videolistrating_" + videoList[autoPlayList[i]].id + "_2";

			var rateVal		= videoList[autoPlayList[i]].ranking;

			var widgetname = new Spry.Widget.Rating(rateNameStr,{ratingValue:rateVal, readOnly:true}); 
			var widgetname = new Spry.Widget.Rating(rateNameStr2,{ratingValue:rateVal, readOnly:true}); 

		}
		
		doVideoScroller();
		
		
	}

	
	function returnNavigationString(n, p_section){

		var s = "";
		s += "<div id='vid" + videoList[n].id + "VidHover' style='display:none;'>";
		s += "	<div class='vidHoverStyleVert'>";
		s += "		<div class='vidHoverImgWrapperVert' >";

		s += "	<div  style='background: url("+ videoList[n].thumb +") no-repeat; overflow:hidden; height:45px; width:80px; float:left; position: absolute;'>";
		s += "		<img width='80' height='45' border='0' src='"
		s += videoList[n].epiOverlayURL == "" ? "http://i.cdn.turner.com/toon/tools/img/pixel.gif" : videoList[n].epiOverlayURL;
		s += "'/>";
		s += "	</div>";

		
		s += "		</div>";
		s += "		<div class='vidHoverTextWrapperVert'>";
		s += "			<div class='vidHoverTitleVert'>" + videoList[n].title + "</div>";
		s += "			<div class='vidHoverDescriptionVert'>" + videoList[n].description + "</div>";
		s += "			<div class='vidHoverStatsVert'>"+ returnRatingsString(videoList[n].ranking, videoList[n].id + "_2") + " <br clear='all' /><br clear='all' /> " + videoList[n].numberOfViews + " VIEWS</div>";
		s += "		</div>";
		s += "		<br clear='all' />";
		s += "	</div>";
		s += "</div>";

		
		s += "<div class='videoSlidingPanelsContent'  onmouseover='rolloverThumbnail(thumb" + n +");' onmouseout='rolloutThumbnail(thumb" + n +");'>";

		s += "	<div  style='background: url("+ videoList[n].thumb +") 2px 2px no-repeat; margin: 2px; overflow:hidden; height:49px; width:84px; float:left; position: absolute;'>";
		s += "		<img class='thumbgraphic' width='45' height='80' border='0' src='"
		s += videoList[n].epiOverlayURL == "" ? "http://i.cdn.turner.com/toon/tools/img/pixel.gif" : videoList[n].epiOverlayURL;
		s += "'/>";
		s += "	</div>";

		s += "	<div id='video_nav_cell' style='margin: 2px; overflow:hidden; height:49px; width:84px; float:left; position: absolute;'>";
		s += "		<img class='thumbgraphic' id='thumb" + n +"' name='thumb" + n +"' src='http://i.cdn.turner.com/toon/tools/img/pixel.gif' border='0' height='45' width='80'>";
		s += "	</div>";		
	
		s += "	<div id='html_title2' style='width:200px; height:45px; position: absolute; margin-left: 84px;'>";			
		s +=  		videoList[n].title + "<br>";
		s += "		<div style='position: relative; width: 150px; margin-top: 12px;'>" + returnRatingsString(videoList[n].ranking, videoList[n].id) + "</div><div style='position: relative; float: right; margin-top: 2px;'> " + videoList[n].numberOfViews + " VIEWS </div>";	
		s += "	</div>";		

		s += "	<div style='height:51px; width:320px; float:left; position: absolute;'>";
		s += "		<a href='javascript:playVideo(" + n + "); showSectionPlaying(" + '"' + p_section + '"' + ");' class='showTip vid" + videoList[n].id +"VidHover'><img src='http://i.cdn.turner.com/toon/tools/img/pixel.gif' border='0' height='51' width='300'></a>";
		s += "	</div>";		

		s += "</div>";
		
		return s;
	
	}
	
	function returnRatingsString(rank, rankName){

		var s = "";

		s += "<span id='videolistrating_" + rankName + "' class='ratingContainer'>";
		s += "	<span class='ratingButton'></span>";
		s += "	<span class='ratingButton'></span>";
		s += "	<span class='ratingButton'></span>";
		s += "	<span class='ratingButton'></span>";
		s += "	<span class='ratingButton'></span>";
		s += "</span>";

		return s;
		
	}

	function writeNavButtons(){

		if(videoList.length > 40){
			var s = "";
		
			s += "<a id='videoA' href='#' onclick='sp1.showPreviousPanel(); return false;' style='float:left;'>&lt; Back</a>";
			s += "<a id='videoA' href='#' onclick='sp1.showNextPanel(); return false;'  style='float:right;'>Next &gt;</a>";
				
			document.getElementById('video_nav_btns').innerHTML = s;	
		}
	
	}
	
	function writeTitle(){

		var content = videoList[videoListIndex].title;
		
		document.getElementById('html_title').innerHTML = content; 

	}
	
	function writeMoreButton(){

		var content
		
		if(videoList[videoListIndex].morebutton != ""){
			content = "<a href='" + videoList[videoListIndex].morebutton + "'>Browse All &gt;</a>";
		}else{
			content = " ";
		}

		document.getElementById('html_morebutton').innerHTML = content; 

	}
	
	function writeDescription(){

		var content = videoList[videoListIndex].description;
		
		var content_regEx 				= /\&amp\Wapos\W/;
		var content_replace				= "'"
		
		var content_regEx 				= /’/
		var content_replace				= "'"
		
		var content_regEx 				= /\&amp\W#146\W/;
		var content_replace				= "'"
		
		var content_regEx 				= /\&amp\W#39\W/;
		var content_replace				= "'"
	
		content = content.replace(content_regEx, content_replace);
		
		document.getElementById('rating_init').value = videoList[videoListIndex].ranking;
		
		document.getElementById('html_description').innerHTML = content; 

	}
	
	function getRandomNumber(){
		var randomNumber;
		
		var m   	= new Date().getMonth() + 1;
		var d  		= new Date().getDate();
		var yr  	= new Date().getFullYear();
		var h 	 	= new Date().getHours();
		var min 	= new Date().getMinutes();
		var newMin 	= "00";
		
		if(min >= 0 && min <= 15){
			newMin = "00";
		}
		
		if(min >= 16 && min <= 30){
			newMin = "15";
		}
		
		if(min >= 31 && min <= 45){
			newMin = "30";
		}
		
		if(min >= 46 && min <= 59){
			newMin = "45";
		}
		
		randomNumber = m + "" + d + "" + yr + "" + h + "" + newMin;
		
		return randomNumber;        	
	}
	
	function videoContinuousPlay(){

		if(continuousPlayEnabled){
			continuousPlayEnabled = false;
			document.getElementById('img_continuousplay').src = "/tools/img/video/contplayoff.gif"
		}else{
			continuousPlayEnabled = true;
			document.getElementById('img_continuousplay').src = "/tools/img/video/contplay.gif";
		}

	}
	
	function continuousPlayOver(){
		
		if(continuousPlayEnabled){
			document.getElementById('img_continuousplay').src = "/tools/img/video/contplayoff.gif";
		}else{
			document.getElementById('img_continuousplay').src = "/tools/img/video/contplay.gif";
		}

	}

	function continuousPlayOut(){
		
		if(continuousPlayEnabled){
			document.getElementById('img_continuousplay').src = "/tools/img/video/contplay.gif";
		}else{
			document.getElementById('img_continuousplay').src = "/tools/img/video/contplayoff.gif";
		}

	}

	function createRating(){
										
		var rate = new Spry.Widget.Rating("spryrating", {rateHandler: ratingMsg,allowMultipleRating: false, ratingValueElement: 'rating_init', postData: 'id=' + videoList[videoListIndex].id  + '&rating=@@ratingValue@@', saveUrl:pathRatings});

	}
	
	function ratingMsg(){	
		
		document.getElementById('rating_thanks').style.display = "block";
		
		setTimeout("clearRatingMsg()", 5000);
	}
		
	function clearRatingMsg(){
		document.getElementById('rating_thanks').style.display = "none" 
	}
	
	function hidePlayNowGraphic(){
		document.getElementById('video_play_now_graphic').style.display = "none" 
	}
	
	function doPlayNowGraphic(){
		initialPlay = false;
		hidePlayNowGraphic();
		flashVideoCommunication.playVideo();
	}
	
	//end navigation controls ------------------------------------------------------------------------------------------------------------------------------//

	//flash communication ----------------------------------------------------------------------------------------------------------------------------------//

	flashVideoCommunication.onVideoStateChange = function (val){
		
		if(val == "ENDED" && reachedPlayListEnd == false && continuousPlayEnabled){
			playVideo("next");
		}else if(val == "ENDED"){
			flashVideoCommunication.onShowEndSlate();	
		}

	}
	
	//end flash communication --------------------------------------------------------------------------------------------------------------------------------//

