/**
 * This file contains functions that relate to flash and javascript communication. Add functions here that relate to
 * both flash and javascript.
 * 
 * @author Kavih Williams
 * @package Shared
 */

/**
 * This will write flash content to the page through javascript, so that IE doesn't perform its security on it.
 *
 * @param string theContent    The flash html content to write to the page.
 * @return bool         Always returns true
 */
function writeFlashToPage(theContent)
{
	document.write(theContent);
	
	return true;
}

/**
 * Pass in the id of the flash object and it will return the reference to that object. The reference can then be used
 * to resize it and even better, call actionscript methods from javascript (using actionscript's ExternalInterface).
 *
 * @param string movieId               The id of the object to retrieve reference to.
 * @return HTMLElementObject    Always returns a reference to an HTML Element Object.
 */
function thisMovie(movieId)
{
    if (navigator.appName.indexOf("Microsoft") != -1)
    {
        return window[movieId];
    }
    
    return document[movieId];
}

/**
 * An easy way to debug actionscript code while viewing a movie on a webpage. Using the actionscript 
 * ExternalInterface.call() method, just call this function with a message whenever you want.
 *
 * @param string message    The message to alert.
 * @return bool             Always returns true.
 */
function alerter(message)
{
    alert(message);
    
    return true;
}