/**
 * This is essentially the public static void main of this page (or so I like to think)
 * Should be the first method called when the page loads.  It creates the SWF object, and then 
 * the MapController JS object which then takes charge of the page and listens for events from the SWF object
 * 
 * The values of the mapString and controllerString are hard-coded in here
 */
function main() {
    landingPage = new LandingPage("activityMap", "activityPlayer");
}
var landingPage = null;
Behaviour.addLoadEvent(main);

var LandingPage = Class.create();
LandingPage.prototype = {
    initialize: function(swfElement) {
        this.swfElement = $(swfElement);
    
        this.addFlashObject();
    },

    /**
     * Adds the flash based map controller to the page
     */
    addFlashObject: function() {
        //create flash object
        var so = new SWFObject(localPath + "/image/main/banner.swf", "landingBanner", "980", "270", "8.0.0", "#FFFFFF", true);
    	so.addParam("wmode", "transparent");
    	
    	//if flash isn't installed, display the Get Flash picture instead
    	if( !so.write("controllerContainer") ){
    		var img = document.createElement("img");
    		img.src = trailWebAddress + "/site/images/get_flash.jpg";
    		img.alt = "Download the Free Flash Player now!";
    
    		var link = document.createElement("a");
    		link.href = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
    		link.appendChild( img );
    		
    		$("controllerContainer").appendChild(link);
    	}
    },
    
    toString: function() {
        return "LandingPage. swf: " + this.swfElement;
    }
};