	var jsReady = false;
	var videoPlaying = "";
	var allVideos = [];
	
	function Maestro(){
	}
	
	Maestro.getElementById = function(tag, id) {
		var el, i, objs = document.getElementsByTagName(tag);
		for (i = objs.length; --i >= 0 && (el = objs[i]);)
			if (el.id == id)
				return el;
			return null;
	};
	
	

     function isReady() {
         return jsReady;
     }
     function pageInit() {
         jsReady = true;
		 
	 }
	 function onVideoPlay(x){
		 videoPlaying = x;
		 var n = allVideos.length;
		 for(var i=0;i<n;i++){
			  document.getElementById(allVideos[i]+"_playing").style.display = allVideos[i] == videoPlaying ? '' : 'none'; 
		 }
	 }
	 function addVideo(x){
		 
		 allVideos.push(x);
	 }
	 function calcNextVideo(){
		
		 var n = allVideos.length;
		 for(var i=0;i<n;i++){
			 if(videoPlaying==allVideos[i]){
				 var k = i;
				 if(k==(n-1)){
					 return allVideos[0];
				 }else{
					 return allVideos[k+1];
				 }
			 }
		 }
	 }
     function thisMovie(movieName) {
         if (navigator.appName.indexOf("Microsoft") != -1) {
             return window[movieName];
         } else {
             return document[movieName];
         }
     }
     function sendToActionScript(value) {
         thisMovie("video").sendToActionScript(value);
     }
     function sendToJavaScript(value) {
         alert("ActionScript says: " + value);
     }