Added functionality to verify that the swf is loaded and ready and that the js api is ready

Try and keep curly braces on the same line as the statement, e.g.

    if (cond) {

rather than

    if (cont)
    {