// Shows the popover window.
function showModal(url) {
    if(!url) return; 
    // Pause the video player
    getMovieName("flash_player").pauseVideo(true); 

    // Open Thickbox Manually
    var t = 'Related Story';
    var a = url + '?keepThis=true&TB_iframe=true&height=585&width=550';
    var g = false;
    tb_show(t,a,g);
}

// Hides the popover window
function hideModal()
{    
    // Resume the video player
    //getMovieName("flash_player").pauseVideo(false);
} 

// Used to load a video in the Flash movie.
function playID(idString) {
    // Make sure the Flash player is ready
    if( typeof getMovieName("flash_player").loadVideo != "function" ) {
      self.setTimeout('playID(' + idString + ')', 100);
    } else {
      getMovieName("flash_player").loadVideo(idString);
    }
} 

// Activated by Flash movie whenever a tag is clicked. Passes the name of the tag.
function tagClick(tagName) {
    // Adjust images
    $("div.innerButtons a.search img").attr("src", "http://www.ubs.com/2/e/medlib/group/graduates/videos/profiles/btn_search_portraits.gif");
    $("div.innerButtons a.browse img").attr("src", "http://www.ubs.com/2/e/medlib/group/graduates/videos/profiles/btn_browse_on.gif");
    // Adjust layers
    $("#searchControls").fadeOut("fast");
    // Adjust button actions
    removeClick( $("div.innerButtons a.browse") ); 
    bindProfileSearch();
    // Show the profiles matching the tag
    showProfiles( tagName );
} 

// Used to find the Flash movie in the DOM in order to communicate with it.
function getMovieName(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    } else {
        return document[movieName];
    }
} 
