/*
 * Copyright (c) 2006-2007 Collactive. All rights reserved.
 */
// Washington Post Site Automation API
WashingtonPost = function() {
	this._createAssistant = function() {
		return new Collactive.Assistant("washington_post",
			[],
			this._storage, this._ui);
	};

    this.emailStory = this._assistedFunction({
       	navigateFirst: true,
        clientOnly: false,
        serverOnly: false
    }, function(url, recipients, senderName, senderAddress, message, callback) {
		this._storage.clearSession();
		this._saAPI.emailStory(url, recipients, senderName, senderAddress, message,
			this._asyncCallback(function (status) {
				callback(status);
			})
		);
    });

    // Called from below to navigate without a referrer
	this.onNavigateURL = function(url) {
	    if (Collactive.SSAUtils.isActive()) {
	        url = Collactive.ProxyUtils.proxify(url);
	    }
	    this.elem.src = url;
	};

	//overriding the following to help animations work faster
	this._displayListener = function(displayed, smallmode) {
		
        this._uiDisplayed = displayed;
        if (this._saAPI == null) {
            return;
        }
		
        if (smallmode) {
            this._saAPI.enterSmallMode();        
        } else {
	        if (this._uiDisplayed) {
	            this._saAPI.invisiblize();
	        } else {
	            this._saAPI.visiblize();
	        }
		}
	};	

	return this;
};

WashingtonPost.prototype = new SiteAutomationFacade('washington_post');