/* =========================================================================

CLASS: JSFCommunicator
AUTHOR: Abdul Qabiz 
DATE  : 12/13/2003

============================================================================ */

function JSFCommunicator(flashMovie)
{	
	this.init(flashMovie);
}

JSFCommunicator.prototype.init = function(flashMovie) {

	if(flashMovie=="undefined") {
		var flashMovie = null;
	 }
	this.setMovie(flashMovie);
	this.functionToCall = null;
	this.functionLocationinFlash = null;
	this.functionArgs = null;
}

JSFCommunicator.prototype.setMovie = function(flashMovie)
{
	this.flashMovie = flashMovie;
}

JSFCommunicator.prototype.setVariable  = function(propName, propValue) {
	this.flashMovie.SetVariable(propName,propValue);
}

JSFCommunicator.prototype.getVariable  = function(propName) {
	var result = this.flashMovie.GetVariable(propName);
	return result;
}


JSFCommunicator.prototype.callFunction = function(fnLocation,fnName,fnArgs) {
	if(this.flashMovie==null) {	return false; }
	
	var flag = this.getVariable("/:triggerFn");
	var result = false;

	if(fnName=="") {return false; }
	if(fnLocation=="") {
		var fnLocation = "_level0";
	}

	this.setVariable("/:fnLocation",fnLocation);
	this.setVariable("/:fnName",fnName);
	
	if(typeof(fnArgs)=="object") {
		this.setVariable("/:fnArgs",fnArgs.join("$@$$"));
	}else if(typeof(fnArgs)=="number" || typeof(fnArgs)=="string") {
		this.setVariable("/:fnArgs",fnArgs);
	}
	
	this.setVariable("/:triggerFn",!flag);
	result = this.getVariable("triggerFnStatus");
	this.setVariable("/:triggerFnStatus",false);
	return result;
}

