// Functions implementing a javascript Book object.
// version $Id: book.js,v 1.5 2007/07/11 15:18:46 tcouch Exp $

function Book(name, code, deployed, downloadable) {
	this.name         = name;
	this.code         = code;
	this.deployed     = deployed;
	this.downloadable = downloadable;
	this.coveredAreas = null;

    this.setCoveredAreas = function(coveredAreas) {
        this.coveredAreas = coveredAreas;
    }
    this.getCoveredAreas = function() {
        return this.coveredAreas;
    }
    this.getName = function() {
        return this.name;
    }
    this.getCode = function() {
        return this.code;
    }
    this.getDeployed = function() {
        return this.deployed;
    }
    this.getDownloadable = function() {
        return this.downloadable;
    }
    this.linkButtonsHtml = function() {
        var content = new Array();
        if ((this.deployed) || (this.downloadable)) {
            if (this.deployed) {
                content.push(viewActivDirectoryLink(this.code));
            }
            if (this.downloadable) {
                content.push(downloadActivDirectoryLink(this.code));
            }
        } else {
            content.push(noActivDirectoryLinks());
        }
        content.push(displayMapLink());
        return $E('div', {}, content);
    }
    
    this.header = function() {
        return $E('div', {css_textAlign:'left', css_padding:'4px', css_fontSize:'14px'},
                  $E('span', {}, 
                     'Locations covered by the ', 
                     $E('b',{}, this.name), 
                     ' directory:'));
    }

}
