/***************************************************
* Class: AuctionFlashMovie
* Created: 2009-01-23
* Modified: 2009-01-23
* Author: Raido Orumets
*
* Example: http://www.permadi.com/tutorial/flashjscommand/
*
* Copyright © PixmaSoft OÜ
* info@pixmasoft.ee 
* http://www.pixmasoft.ee
***************************************************/

AuctionFlashMovie = {
	
	object_name: "auction_flash_movie",
	
	setObjectName: function(object_name){
		this.object_name = object_name;
	},
	
	getObject: function(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);
		}
	},

	Stop: function(){
		var flash_movie = this.getObject(AuctionFlashMovie.object_name);
		flash_movie.StopPlay();
	},

	Play: function(){
		var flash_movie = this.getObject(AuctionFlashMovie.object_name); 
		flash_movie.Play();
		//embed.nativeProperty.anotherNativeMethod();
	},

	Rewind: function(){
		var flash_movie = this.getObject(this.object_name);
		flash_movie.Rewind();
	},

	NextFrame: function(){
		var flash_movie = this.getObject(this.object_name);
		// 4 is the index of the property for _currentFrame
		var currentFrame = flash_movie.TGetProperty("/", 4);
		var nextFrame = parseInt(currentFrame);
		if (nextFrame >= 10)
			nextFrame = 0;
		flash_movie.GotoFrame(nextFrame);		
	},


	ZoomIn: function(){
		var flash_movie = this.getObject(this.object_name);
		flash_movie.Zoom(90);
	},

	ZoomOut: function(){
		var flash_movie = this.getObject(this.object_name);
		flash_movie.Zoom(110);
	},


	SendData: function(text){
		var flash_movie = this.getObject(this.object_name);
		flash_movie.SetVariable("/:message", text);
	},

	ReceiveData: function(){
		var flash_movie = this.getObject(this.object_name);
		return flash_movie.GetVariable("/:message");
	}

}
