// JavaScript Document

var PlayMovie = 

{
	
	playThis: function(theMovie)

	{
		
		thePlayer = document.qt_featured_media;
		thePlayer.SetResetPropertiesOnReload(false);
		thePlayer.SetURL(theMovie);
		
	},
	
	playNext: function()

	{
		
		thePlayer = document.qt_featured_media;
		thePlayer.SetResetPropertiesOnReload(false);
		nextMovie = thePlayer.GetQTNEXTUrl(1);
		nextMovie = (nextMovie.substring(1,(nextMovie.length-10)));
		thePlayer.SetURL(nextMovie);
		thePlayer.SetQTNEXTUrl(1, '<snoop.mov>T<myself>')
		
		
		
	}
	
};




var ListenUp =

{
	
	init: function()
	
	{
		
		/*
		
		*/
		
		
	},
	
	preventDefaultBehaviour: function(event)
	
	{
		
		event.preventDefault();
		
	},
	
	mouseOver: function(element, linkClass, hoverClass)
	
	{
		
		if (Core.hasClass(element, linkClass))
		
		{
			
			Core.removeClass(element, linkClass);
			Core.addClass(element, hoverClass);
			
		}
			
	},
	
	mouseOut: function(element, linkClass, hoverClass)
	
	{
				
		if (Core.hasClass(element, hoverClass))
		
		{
			
			Core.removeClass(element, hoverClass);
			Core.addClass(element, linkClass);
			
		}
		
	},
	
	setStage: function(showId, episodeNumber, i, qtNextiFrame) {
		
		if (qtNextiFrame) {
				
			window.location.href = "../<? echo $_SESSION['base_URL']; ?>index.php?mode=stage&show_id=" + showId + "&episode_number=" + episodeNumber + "&i=" + i;
			window.frames['related_view_iframe'].location = "../related_view.php?mode=stage&show_id=" + showId + "&i=" + i;
			
		}
		
	},
	
	setMode: function(mode) {
		
		window.location.href = "<? echo $_SESSION['base_URL']; ?>index.php?mode=" + mode;
		
	},
	
	setRelatedDelayed: function(showId) {
		
		setTimeout(function(thisObj) { thisObj.setRelated(showId); }, 100, this);
		
	},
	
	setRelated: function(showId, i, nextCategoryId, upNextShowId) {
		
		window.related_view_iframe.location.href = "related_view.php?mode=stage&show_id=" + showId + "&up_next_show_id=" + upNextShowId + "&i=" + i + "&next_category_id=" + nextCategoryId;
		
	},
	
	setShow: function(token) {
		
		window.location.href = "<? echo $_SESSION['base_URL']; ?>index.php?mode=stage&view=viewer&viewer_size=large&token=" + token;
		
		//window.center_pane_header.location.href = "center_pane_header.php?mode=shows&view=show&show_id=" + showId;
		//window.center_pane_content.location.href = "center_pane_content.php?mode=stage&view=viewer&viewer_size=large&show_id=" + showId;
		//window.related_view_iframe.location.href = "related_view.php?mode=shows&show_id=" + showId;
		
	},
	
	showCase: function(i, showId) {
		
		
		window.location.href = "<? echo $_SESSION['base_URL']; ?>index.php?mode=show_case&i=" + i + "&show_id=" + showId;
		window.related_view_iframe.location.href = "related_view.php?show_id=" + showId;
		
	},
	
	backHistory: function() {
		
		history.go(-1);
		
	},
	
	jumpToCurrent: function(ms) {
		
		setTimeout("window.location='<? echo $_SESSION['base_URL']; ?>index.php?mode=shows'"	, ms)
		
	},
	
	switchViewer: function(baseURL, i, showToken, episodeNumber, viewerSize) {
		
		ListenUp.stopMovie();
		
		theTime = window.center_pane_content.document.qt_featured_media.GetTime();
		
		//alert(theTime);
		
		window.location = baseURL + 'index.php?mode=stage&view=viewer&viewer_size=' + viewerSize + '&token=' + showToken + '&episode_number=' + episodeNumber + '&time=' + theTime;
		
		//window.center_pane_content.document.qt_featured_media.SetTime(theTime);
		
	},
	
	playTime: function(time) {
		
		window.center_pane_content.document.qt_featured_media.SetTime(time);
		
	},
	
	stopMovie: function() {
		
		window.center_pane_content.document.qt_featured_media.Stop();
		
	}
	
};

Core.start(ListenUp);
