﻿// ------- Private vars -------
var jsReady = false;
var swfReady = false;

// ------- functions called by ActionScript -------
// called to check if the page has initialized and JavaScript is available
function isReady() {
    return jsReady;
}

// called to notify the page that the SWF has set it's callbacks
function setSWFIsReady() {
    // record that the SWF has registered it's functions (i.e. that JavaScript
    // can safely call the ActionScript functions)
    swfReady = true;
    try {
        LoadPhotos();
    } catch (e) { }
}

// ------- event handling -------
// called by the onload event of the <body> tag
function pageInit() {
    // record that JavaScript is ready to go.
    jsReady = true;
}

// Gets a reference to the specified SWF file by checking which browser is
// being used and using the appropriate JavaScript.
// Unfortunately, newer approaches such as using getElementByID() don't
// work well with Flash Player/ExternalInterface.
function getSWF(movieName) 
{
    if (window[movieName]) {
        return window[movieName];
    } else {
        return document[movieName];
    }
}

Event.observe(window, 'load', pageInit, false);