var flash;
function AssignFlash()
{
	if(navigator.appName.indexOf("Microsoft") != -1)
	{
		flash = window.main;
	}
	else
	{
		flash = window.document.main
	}
}

/*
 * ASCall - invoked implicity from Flash object.
 * This method just translates the call from flash to java script and executes it
 * arguments[0] is the name of the function to be called
 * left arguments are just arguments passed to the function.
 */

function ActionScriptCall()
{
  var functionToCall = eval(arguments[0]);
  var argArray = arguments[1];
  for(var i = 0; i<argArray.length; i++)
    if(argArray[i] == "null")
      argArray[i] = "";

  return functionToCall.apply(functionToCall, argArray);
}

/*
 * ASInvoke - invokes an function from JavaScript into Flash content.
 * arguments[0] is the name of the function in Flash to be called.
 * left arguments are just arguments passed to the function
 */
function ActionScriptInvoke()
{
	// var functionToCall = eval(arguments[1]);
  var argArray = new Array();
  for (var i = 1; i < arguments.length; ++i)
  {
  	argArray.push(arguments[i]);
  }
	var result = flash.JavaScriptCall(arguments[0],argArray);
	return result;
}
