
function flashmod($fm_path,$fm_source,$fm_width,$fm_height,$fm_version,$fm_quality,$fm_wmode,$fm_loop,$fm_name) {
	
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000');
document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="' + $fm_version + '"'); 
document.write(' width="' + $fm_width + '"'); 
document.write(' height="' + $fm_height + '"');
if ($fm_name != '') document.write(' id="' + $fm_name + '"');
document.write('>');
document.write(' <param name="movie" value="' + $fm_path + $fm_source + '"/>');
document.write(' <param name="quality" value="' + $fm_quality + '" />');
if ($fm_wmode != 'window') document.write('echo <param name="wmode" value="' + $fm_wmode + '" />');
if ($fm_loop == 'false') document.write(' <param name="loop" value="' + $fm_loop + '" />');
document.write('<embed src="' + $fm_path + $fm_source + '"'); 
document.write(' quality="' + $fm_quality + '"');
document.write(' pluginspage="http://www.macromedia.com/go/getflashplayer"'); 
document.write(' type="application/x-shockwave-flash"');
document.write(' width="' + $fm_width + '"'); 
document.write(' height="' + $fm_height + '"');
if ($fm_wmode != 'window') document.write(' wmode="' + $fm_wmode + '"');
if ($fm_loop == 'false') document.write(' loop="' + $fm_loop + '"');
if ($fm_name != '') document.write(' name="' + $fm_name + '"');
document.write ('></embed>');
document.write('</object>');
}

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 {
    return document.getElementById(movieName);
  }
}

function StopFlashMovie(){
  var flashMovie=getFlashMovieObject("myFlashMovie");
  flashMovie.StopPlay();
}

var b = true;

function PlayFlashMovie(){
  var flashMovie=getFlashMovieObject("myFlashMovie");
  // if (document.getElementById('Play').src = "play.png") {
  if (b) {
	  flashMovie.Play();
	  b = false;
	  document.getElementById('Play').src = "modules/mod_flashmod/pause.png";
  }
  else {
	  flashMovie.StopPlay();
	  b = true;
  	  document.getElementById('Play').src = "modules/mod_flashmod/play.png";
  }
}

function RewindFlashMovie(){
  var flashMovie=getFlashMovieObject("myFlashMovie");
  flashMovie.Rewind();
  b = true;
  document.getElementById('Play').src = "modules/mod_flashmod/play.png";
}

function NextFrameFlashMovie(){
  var flashMovie=getFlashMovieObject("myFlashMovie");
  var currentFrame=flashMovie.TGetProperty("/", 4);
  var nextFrame=parseInt(currentFrame);
  flashMovie.GotoFrame(nextFrame);		
  b = true;
  document.getElementById('Play').src = "modules/mod_flashmod/play.png";
}

function PrevFrameFlashMovie(){
  var flashMovie=getFlashMovieObject("myFlashMovie");
  var currentFrame=flashMovie.TGetProperty("/", 4);
  var nextFrame=parseInt(currentFrame);
  nextFrame=nextFrame-2;
  flashMovie.GotoFrame(nextFrame);		
  b = true;
  document.getElementById('Play').src = "modules/mod_flashmod/play.png";
}

function ZoominFlashMovie(){
  var flashMovie=getFlashMovieObject("myFlashMovie");
  flashMovie.Zoom(90);
}

function ZoomoutFlashMovie(){
  var flashMovie=getFlashMovieObject("myFlashMovie");
  flashMovie.Zoom(110);
}

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;
}
