	/*
		Designed and written by A. Taylor		
		Licensed to 'SoundsOrange.com - United Kingdom'		
		(c) Copyright A.Taylor 2006, 2007
		All rights reserved.

		Duplication, in whole or part is expressly forbidden.
		To report infringement contact:
		+44 (0)208 373 2361
		legal@SounndsOrange.com
	
		Version 2.0
		Last modified 27/02/2010
	*/
	
	// <![CDATA[
	
		var jsReady  = false;
		var lastPlay = 0;
		function isReady() 
		{
			return jsReady;
		}
		
		function pageInit() 
		{
			jsReady = true;
		}
		
		function thisMovie(movieName) 
		{
			if (navigator.appName.indexOf("Microsoft") != -1) 
			{
				return window[movieName];
			} else {
				return document[movieName];
			}
		}
		
		function playVideo(videoID)
		{
			thisMovie("SoundsPurpleVideo").playVideo(videoID);
		// change play button to stop button
			if (lastPlay != 0)
			{
			// change last played button from stop to play
				returnToPlay(lastPlay);
			}
			setToStop(videoID);
			lastPlay = videoID;
			window.frames.videoPlayed.location.href='modules/mod_videoPresentation_played.php?packageID='+videoID;
		}

		function returnToPlay(toChange)
		{
		// set up button
			var button = document.getElementById('z'+toChange);
			button.src = play_off.src;
			button.setAttribute('onmouseover','this.src=play_over.src');
			button.setAttribute('onmouseout','this.src=play_off.src');
		
		// set up link
			var linkTag = document.getElementById('l'+toChange);
			linkTag.setAttribute('onclick','javascript: playVideo(\''+toChange+'\')');
		}
		
		function setToStop(toChange)
		{
		// set up button
			var button = document.getElementById('z'+toChange);
			button.src = stop_off.src;
			button.setAttribute('onmouseover','this.src=stop_over.src');
			button.setAttribute('onmouseout','this.src=stop_off.src');

		// set up link
			var linkTag = document.getElementById('l'+toChange);
			linkTag.setAttribute('onclick','javascript: stopVideo(\''+toChange+'\')');
		}

		function stopVideo(videoID)
		{
			thisMovie("SoundsPurpleVideo").stopVideo(videoID);
			returnToPlay(videoID);
		}
		
		function playbackComplete()
		{
			returnToPlay(lastPlay);
			lastPlay = 0;
			return true;
		}
	// ]]>
