﻿var activeMovie = false;


/**************** revised method ****************/
function MovieRev2(DivID, MovieDivID, MovieURL, Width, Height, BgColor) {
    if (BgColor === undefined) {
        BgColor = '#000000'; 
    }

var object1 = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' class='somemovie' viewastext='' width='"+Width+"' height='"+Height+"'>";
var param1 = "<param name='allowScriptAccess' value='sameDomain'>"
var param2 = "<param name='movie' value='"+MovieURL+"'>"
var param3 = "<param name='quality' value='high'>"
var param4 = "<param name='bgcolor' value='"+BgColor+"'>"
var embed = "<embed src='" + MovieURL + "' quality='high' bgcolor='" + BgColor + "' name='somemovie' allowscriptaccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' width='" + Width + "' height='" + Height + "'>";
var close = "</object>";

var movieCode = object1 + param1 + param2 + param3 + param4 + embed + close;

	this.movieContainer = document.getElementById(DivID);
	this.movieDiv = document.getElementById(MovieDivID);
				
	this.show = function()
	{
		if(!activeMovie)
		{
		    Effect.Appear(parent.movieContainer, { duration: 0.3 });
		    parent.movieContainer.style.display = 'block';
			parent.movieDiv.innerHTML = movieCode;
			activeMovie = true;
		}
		return; 
	}
				
	this.hide = function()
	{
		if(activeMovie)
		{
		    Effect.Fade(parent.movieContainer, { duration: 0.2 });
		    parent.movieContainer.style.display = '';
			activeMovie = false;
			parent.movieDiv.innerHTML = '';
		}
		return; 
	}

	return this;
}

function setIFrameSRC(src) {
    var iframeCode = "<iframe id='frame1' width='606' height='390' src='" + src + "' scrolling='no' noresize='noresize' frameborder='0' marginwidth='10' marginheight='10'></iframe>";


    //Effect.Appear(parent.movieContainer, { duration: 0.3 });
    document.getElementById('WebCast').style.display = 'block';
    document.getElementById('WebCastVid').innerHTML = iframeCode;
    activeMovie = true;



}

function hideIframe() {
    //Effect.Fade(parent.movieContainer, { duration: 0.2 });
    document.getElementById('WebCast').style.display = 'none';
    document.getElementById('WebCastVid').innerHTML = '';
    activeMovie = false;
}


/**************** old method ****************/

			
function Movie(DivID, MovieID)
{

	this.movieContainer = document.getElementById(DivID);
	this.movie = document.getElementById(MovieID);
				

				
	this.movieContainer.fadeIn = function()
	{


		Effect.Appear(parent.movieContainer, {duration: 0.5});

	}
				
	this.movieContainer.fadeOut = function()
	{


		//parent.movieContainer.style.display = "none";
		Effect.Fade(parent.movieContainer, {duration: 0.5});
		RewindFlashMovie(parent.movie.id);
		
	}
				
	this.show = function()
	{
		if(!activeMovie)
		{

			//parent.movieContainer.style.display = "";
			Effect.Appear(parent.movieContainer, {duration: 0.3});

			activeMovie = true;
		}
		return; 
	}
				
	this.hide = function()
	{
		if(activeMovie)
		{
			//parent.movieContainer.style.display = "none";
			Effect.Fade(parent.movieContainer, {duration: 0.2});
			activeMovie = false;
		}
		return; 
	}

	return this;
}




function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function StopFlashMovie(id)
{
	var flashMovie=getFlashMovieObject(id);
	flashMovie.StopPlay();
}

function PlayFlashMovie(id)
{
	var flashMovie=getFlashMovieObject(id);
	flashMovie.Play();
	//embed.nativeProperty.anotherNativeMethod();
}

function RewindFlashMovie(id)
{
	var flashMovie=getFlashMovieObject(id);
	flashMovie.Rewind();
}

function NextFrameFlashMovie(id)
{
	var flashMovie=getFlashMovieObject(id);
	// 4 is the index of the property for _currentFrame
	var currentFrame=flashMovie.TGetProperty("/", 4);
	var nextFrame=parseInt(currentFrame);
	if (nextFrame>=10)
		nextFrame=0;
	flashMovie.GotoFrame(nextFrame);	
}
