﻿//var playing = 0;

function dispalyOpenFrame(movieName, theFrame) 
{  
  if (movieIsLoaded(thisMovie(movieName))) 
  {
    thisMovie(movieName).GotoFrame(theFrame);
  }
}

function thisMovie(movieName) 
{
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) 
  {    return window[movieName]  }	
  else {  return document[movieName] }
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) 
{
  if (typeof(theMovie) != "undefined") 
  { return theMovie.PercentLoaded() == 100; } 
  else { return false; }
}

function playmovie(movieName) 
{
  if (movieIsLoaded(thisMovie(movieName))) {thisMovie(movieName).Play();}
}

function stopmovie(movieName) 
{
  if (movieIsLoaded(thisMovie(movieName))) 
  {
    thisMovie(movieName).StopPlay();
  }
}

function play(movieName)
{
	if(thisMovie(movieName).IsPlaying())
	{stopmovie(movieName);}
	else
	{
		var CurrentFrame;
		CurrentFrame = thisMovie(movieName).TCurrentFrame("_level0/");		  
		if (movieIsLoaded(thisMovie(movieName))) 
		{
		// for 3 movies in eLearning/default.asp
		  if ((movieName=="Movie_1") && (CurrentFrame==280))
		  {
		  	go("Movie_1",5);
		  }
		  else if ((movieName=="Movie_2") && (CurrentFrame==645))
		  {
		  	go("Movie_2",5);
		  }
		  else if ((movieName=="Movie_3") && (CurrentFrame==1080))
		  {
		  	go("Movie_3",5);
		  }
		  else
		  thisMovie(movieName).Play();
		}
	}
}

function go(movieName, theFrame) 
{
  if (movieIsLoaded(thisMovie(movieName))) 
  {
    thisMovie(movieName).GotoFrame(theFrame);
    playmovie(movieName);
  }
} 

////////////////////////////////////OPEN MOVIE IN BIG SCRREN//////////////////////
function openCenteredFlashPopup(sourceURL, width, height)
{					
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	winSTR = 'toolbar=no,address=no,status=no,resizable=yes,alwayRaised=yes,width='+width+',height='+height+',left=' + winl + ',top=' + wint;
	myWin = window.open(sourceURL,'',winSTR);		
}