
var flashIsPlay = false;


function FlashMovie(flashObjectName,flash_div,flash_container)
{
	if (!flashIsPlay)
		PlayFlashMovie(flashObjectName,flash_div,flash_container);	
	else
		StopFlashMovie(flashObjectName,flash_div,flash_container);
}

function StopFlashMovie(flashObjectName,flash_div)
{
	var flashMovie=getFlashMovieObject(flashObjectName);
	flashMovie.StopPlay();
	flashIsPlay = false;
	stopmove(flash_div);
	RewindFlashMovie(flashObjectName); //HA LEÁLLÍTOM A FLASHT AZ ELEJÉRE TEKERI AZ ANIMÁCIÓT
}

function PlayFlashMovie(flashObjectName,flash_div,flash_container)
{
	document.getElementById(flash_container).style.width="0px";
	document.getElementById(flash_container).style.height="0px";	
	var flashMovie=getFlashMovieObject(flashObjectName);
	flashMovie.Play();
	flashIsPlay = true;
	startmove(flash_div);
	//embed.nativeProperty.anotherNativeMethod();
}

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 RewindFlashMovie(flashObjectName)
{
	var flashMovie=getFlashMovieObject(flashObjectName);
	flashMovie.Rewind();
}

/* 
function SendDataToFlashMovie()
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	flashMovie.SetVariable("/:message", document.controller.Data.value);
}

function ReceiveDataFromFlashMovie()
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	var message=flashMovie.GetVariable("/:message");  
	document.controller.Data.value=message; 
}*/

// function setmove(left,top)
// {
    // document.getElementById(flash_div).style.left=left+"px";
    // document.getElementById(flash_div).style.top=top+"px";
// }
function startmove(flash_div)
{
			// var l = Math.floor(Math.random()*901);
			// var t = Math.floor(Math.random()*501);
			// alert(l+" "+t);
			new Effect.Move(flash_div, {x:500,y:300,duration:1});
			// setTimeout("setmove(Math.floor(Math.random()*901),Math.floor(Math.random()*501))",5000);
}

function stopmove(flash_div)
{
    document.getElementById(flash_div).style.left=50+"px";
    document.getElementById(flash_div).style.top=50+"px";
}