// SEAICE_CONFIG
// This file is used to store configuration information for the Sea Ice Index.
// This will allow these to be more easily modified, as well as removing them
// from the code itself.


// captionText
// This array stores the various possible captions.  The code will look for 
// the mathing timeType to display the caption.  This timeType will be found
// in the individual image information below.
// To add a new timeType, if necessary:
//   1) Add a comma (,) immediately after the closing brace (}) of the last 
//      entry in the list.
//   2) Add a new caption object, which will be in the following format:
//          {                           <-- opening brace for object
//              id      : '[TYPE]',     <-- replace [TYPE] with the identifier for the caption
//              header  : '[HEAD]',     <-- replace [HEAD] with the header text of the caption
//              caption : '[CAPTION]'   <-- replace [CAPTION] with the caption text
//          }                           <-- closing brace for object
//      The [BRACKET] values should be replaced as described.  Don't forget
//      to include the single quote (') and comma (,) characters shown above!
var captionText = new Array(
    {
        id      : 'daily',
        header  : 'Daily Sea Ice Images',
        caption : 'These images, derived from passive microwave satellite data, depict the most recent daily sea ice conditions. Extent images show the total area of ocean covered with at least 15% ice. Concentration images show varying degrees of ice coverage, from 15 to 100%. Monthly images are more indicative of trends than daily images.<br /><br /> The graphs at right, Sea Ice Trends in Extent, show short-term or long-term trends in ice extent. Read <a href="/data/seaice_index/about_images.html">About the Sea Ice Index images</a> for more information.'
    },

    {
        id      : 'monthly',
        header  : 'Monthly Sea Ice Images',
        caption : 'These images, derived from passive microwave satellite data, depict average sea ice conditions for last month. Extent images show the total area of ocean covered with at least 15% ice.  Concentration images show varying degrees of ice coverage, from 15 to 100%. Concentration trend and anomaly images highlight decadal variances.<br /><br /> The graphs at right, Sea Ice Trends in Extent, show short-term or long-term trends in ice extent. Read <a href="/data/seaice_index/about_images.html">About the Sea Ice Index images</a> for more information.'
    },

    {
        id      : 'monthlyNA',
        header  : 'Monthly Sea Ice Images',
        caption : 'Monthly images are currently not available in Blue Marble View. Please use Standard View to see monthly images.'
    }
); // end captionText array



var indexOptions = new Array(
);       


var noDataImageFile = '/data/seaice_index/images/bm_no_data.png';
var noDataThumbnail = '/data/seaice_index/images/bm_no_data_tmb.png';
var noDataHiresFile = '/data/seaice_index/images/3D_w_text.png';


function seaiceImage(dimension, timetype, ns, imagetype, imagefile, hiresfile, thumbnail, thumbclass) {

    this.dimension  = dimension;
    this.timetype   = timetype;
    this.ns         = ns;
    this.imagetype  = imagetype;
    this.imagefile  = imagefile;
    this.hiresfile  = hiresfile;
    this.thumbnail  = thumbnail;
    this.thumbclass = thumbclass;

    this.matches = function(dimension, timetype, ns, imagetype) {
        return (dimension == this.dimension &&
            timetype  == this.timetype  &&
            ns        == this.ns        &&
            imagetype == this.imagetype)
    };  // end matches

    this.getID = function() {
        id = this.dimension + '_'
           + this.timetype  + '_'
           + this.ns        + '_'
           + this.imagetype;

        return id;
    };  // end getID

    this.getThumbImg = function() {
        img = '<img src="' + this.thumbnail + '" '
                 + 'class="' + this.thumbclass + '" '
                 + 'id="' + this.getID() + '" '
                 + 'onclick="clickThumbnail(this.id);" />';

        return img;
    };  // end getThumbImg
};  // end seaiceImage object definition



var seaiceImageList = {

    images : new Array(),

    addImage : function(newImage) {
        this.images.push(newImage);
    },  // end addImage

    buildThumbList : function (dimension, timetype) {
        var thumbList = '';
    
        for (i = 0; i < this.images.length; i++) {
            if (this.images[i].dimension == dimension 
                && this.images[i].timetype == timetype) {
                thumbList += this.images[i].getThumbImg() + ' ';
            }
        } // end for loop

        return thumbList;
    },  // end buildImageList    

    getImage : function (dimension, timetype, ns, imagetype) {
        var img = null;

        for (i = 0; i < this.images.length; i++) {
            if (this.images[i].matches(dimension, timetype, ns, imagetype)) {
                img = this.images[i];
                break;
            }
        }

        return img;
    }  // end getImage
};  // end seaiceImageList object




// ADDING SEA ICE IMAGE INFORMATION TO LIST
var dim, time, ns;
var dir = '/data/seaice_index/images';

// 2D IMAGES
dim = '2d';
// 2D MONTHLY IMAGES
time = 'monthly';
// 2D MONTHLY NORTH IMAGES
ns = 'north';

seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'extent', dir+'/n_extn.png', dir+'/n_extn_hires.png', dir+'/n_extn_tmb.png', 'thumbFixed2D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'concentration', dir+'/n_conc.png', dir+'/n_conc_hires.png', dir+'/n_conc_tmb.png', 'thumbFixed2D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'anomalies', dir+'/n_anom.png', dir+'/n_anom_hires.png', dir+'/n_anom_tmb.png', 'thumbFixed2D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'trends', dir+'/n_trnd.png', dir+'/n_trnd_hires.png', dir+'/n_trnd_tmb.png', 'thumbFixed2D'));

// 2D MONTHLY SOUTH IMAGES
ns = 'south';

seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'extent', dir+'/s_extn.png', dir+'/s_extn_hires.png', dir+'/s_extn_tmb.png', 'thumbFixed2D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'concentration', dir+'/s_conc.png', dir+'/s_conc_hires.png', dir+'/s_conc_tmb.png', 'thumbFixed2D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'anomalies', dir+'/s_anom.png', dir+'/s_anom_hires.png', dir+'/s_anom_tmb.png', 'thumbFixed2D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'trends', dir+'/s_trnd.png', dir+'/s_trnd_hires.png', dir+'/s_trnd_tmb.png', 'thumbFixed2D'));

// 2D DAILY IMAGES
time = 'daily';
// 2D DAILY NORTH IMAGES
ns = 'north';

seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'extent', dir+'/daily_images/N_daily_extent.png', dir+'/daily_images/N_daily_extent_hires.png', dir+'/daily_images/N_daily_extent_dthumb.png', 'thumbFixed2D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'concentration', dir+'/daily_images/N_daily_concentration.png', dir+'/daily_images/N_daily_concentration_hires.png', dir+'/daily_images/N_daily_concentration_dthumb.png', 'thumbFixed2D'));

// 2D DAILY SOUTH IMAGES
ns = 'south';

seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'extent', dir+'/daily_images/S_daily_extent.png', dir+'/daily_images/S_daily_extent_hires.png', dir+'/daily_images/S_daily_extent_dthumb.png', 'thumbFixed2D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'concentration', dir+'/daily_images/S_daily_concentration.png', dir+'/daily_images/S_daily_concentration_hires.png', dir+'/daily_images/S_daily_concentration_dthumb.png', 'thumbFixed2D'));
                        

// 3D IMAGES
dim = '3d';
// 3D MONTHLY IMAGES
time = 'monthly';
// 3D MONTHLY NORTH IMAGES
ns = 'north';

seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'extent', dir+'/N_monthly_bm_extent_web.png', dir+'/N_monthly_bm_extent.png', dir+'/N_monthly_bm_extent_thumb.png', 'thumbFixed3D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'concentration', dir+'/N_monthly_bm_conc_web.png', dir+'/N_monthly_bm_conc.png', dir+'/N_monthly_bm_conc_thumb.png', 'thumbFixed3D'));

// 3D MONTHLY SOUTH IMAGES
ns = 'south';

seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'extent', dir+'/S_monthly_bm_extent_web.png', dir+'/S_monthly_bm_extent.png', dir+'/S_monthly_bm_extent_thumb.png', 'thumbFixed3D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'concentration', dir+'/S_monthly_bm_conc_web.png', dir+'/S_monthly_bm_conc.png', dir+'/S_monthly_bm_conc_thumb.png', 'thumbFixed3D'));

// 3D DAILY IMAGES
time = 'daily';
// 3D DAILY NORTH IMAGES
ns = 'north';

seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'extent', dir+'/daily_images/N_bm_web_file.png', dir+'/daily_images/N_bm_extent.png', dir+'/daily_images/N_bm_thumb_file.png', 'thumbFixed3D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'concentration', dir+'/daily_images/N_bm_conc_web_file.png', dir+'/daily_images/N_bm_conc.png', dir+'/daily_images/N_bm_conc_thumb_file.png', 'thumbFixed3D'));

// 3D DAILY NORTH IMAGES
ns = 'south';

seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'extent', dir+'/daily_images/S_bm_web_file.png', dir+'/daily_images/S_bm_extent.png', dir+'/daily_images/S_bm_thumb_file.png', 'thumbFixed3D'));
seaiceImageList.addImage(new seaiceImage(dim, time, ns, 'concentration', dir+'/daily_images/S_bm_conc_web_file.png', dir+'/daily_images/S_bm_conc.png', dir+'/daily_images/S_bm_conc_thumb_file.png', 'thumbFixed3D'));

// END ADDING IMAGES
