var OFFLINE_MODE = true;
var DEBUG_AGENTS = false;

$(document).ready( function() {
		if( OFFLINE_MODE == true )
			$('.temporary-archive-link').remove();
	});

function runAgent( agentId, xmlPath ) {
    var agent = createAgent( agentId, xmlPath );
    agent.autoplay = true;
    agent.setOnPlayStop( function () { agent.dragBox.hide(); });
    if( agent.dragBox == null ) {
		agent.createDragBox();
    }
    agent.dragBox.handleScroll = false;
    agent.dragBox.show();
    return false;
}

function createAgent( agentId, xmlPath ) {
    if( DEBUG_AGENTS ) alert( "path: '" + xmlPath + "'" );
    FlashApplet.ID_REGISTRY = new Object();
    FlashApplet.NAME_REGISTRY = new Object();
    var agent;
    if( OFFLINE_MODE ) {
        agent = new FlashAgent( agentId, 
                                './agents/v5/', 
                                './agents/shared/', 
                                xmlPath );
        agent.ttsPath = './agents/cache/';
    } else {
        agent = new FlashAgent( agentId, 
                                'http://agents.cast.org/v5/', 
                                'http://agents.cast.org/shared/', 
                                xmlPath );
    }
    agent.cssPath = 'indira://indira/css/agentStyle.css';
    return agent;
}

