/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 */

/**
 * lgallery.js
 *
 * JS for the selected works and on the boards section pages
 *
 * File Path: /scripts/
 *
 * $Id$
 *
 * @author      Edward Vermillion <evermillion@doggydoo.net>
 * @version     1.0
 */

LARUE.gallery = {
    
    image1: null,
    image2: null,
    image3: null,
    image4: null,
    image5: null,
    image6: null,
    
    copyContainer: null,
    copyContent: null,
    copyScroller: null,
    
    faders: {},
    
    currentImage: '1',
    
    swapImage: function (image) {
        
        if (image == this.currentImage) {
            return;
        }
        
        if (LARUE.gallery.faders[image] != 'undefined') {
            
            LARUE.gallery.thumbs.faders[this.currentImage].enable();
            LARUE.gallery.thumbs.faders[this.currentImage].fade();
            LARUE.gallery.thumbs.faders[image].disable();
            
            LARUE.gallery.faders[image].fade();
            LARUE.gallery.faders[this.currentImage].fade();
            
            this.currentImage = image;
        }
    },
    
    init: function () {
        
        this.image1 = document.getElementById('image1');
        if (this.image1 != null) {
            this.faders['1'] = new DDJS.Effects.Fader(this.image1);
        }
        
        this.image2 = document.getElementById('image2');
        if (this.image2 != null) {
            this.faders['2'] = new DDJS.Effects.Fader(this.image2);
        }
        
        this.image3 = document.getElementById('image3');
        if (this.image3 != null) {
            this.faders['3'] = new DDJS.Effects.Fader(this.image3);
        }
        
        this.image4 = document.getElementById('image4');
        if (this.image4 != null) {
            this.faders['4'] = new DDJS.Effects.Fader(this.image4);
        }
        
        this.image5 = document.getElementById('image5');
        if (this.image5 != null) {
            this.faders['5'] = new DDJS.Effects.Fader(this.image5);
        }
        
        this.image6 = document.getElementById('image6');
        if (this.image6 != null) {
            this.faders['6'] = new DDJS.Effects.Fader(this.image6);
        }
        
        this.copyContainer = document.getElementById('pageCopyContainer');
        this.copyContent = document.getElementById('pageCopyContent');
        this.copyScrollBar = document.getElementById('copyScrollBar');
        this.copyScroller = new DDJS.Effects.Scroller(this.copyContainer, this.copyContent);
        if (this.copyScroller.showScrollers()) {
            this.copyScrollBar.style.visibility = 'visible';
        }
    }
};

LARUE.gallery.thumbs = {
    
    thumb1: null,
    thumb2: null,
    thumb3: null,
    thumb4: null,
    thumb5: null,
    thumb6: null,
    
    faders: {},
    
    init: function () {
        
        this.thumb1 = document.getElementById('thumb1');
        if (this.thumb1 != null) {
            this.faders['1'] = new DDJS.Effects.Fader(this.thumb1);
            this.faders['1'].setMinOpacity(50);
        }
        
        this.faders['1'].fade();
        this.faders['1'].disable();
        
        this.thumb2 = document.getElementById('thumb2');
        if (this.thumb2 != null) {
            this.faders['2'] = new DDJS.Effects.Fader(this.thumb2);
            this.faders['2'].setMinOpacity(50);
        }
        
        this.thumb3 = document.getElementById('thumb3');
        if (this.thumb3 != null) {
            this.faders['3'] = new DDJS.Effects.Fader(this.thumb3);
            this.faders['3'].setMinOpacity(50);
        }
        
        this.thumb4 = document.getElementById('thumb4');
        if (this.thumb4 != null) {
            this.faders['4'] = new DDJS.Effects.Fader(this.thumb4);
            this.faders['4'].setMinOpacity(50);
        }
        
        this.thumb5 = document.getElementById('thumb5');
        if (this.thumb5 != null) {
            this.faders['5'] = new DDJS.Effects.Fader(this.thumb5);
            this.faders['5'].setMinOpacity(50);
        }
        
        this.thumb6 = document.getElementById('thumb6');
        if (this.thumb6 != null) {
            this.faders['6'] = new DDJS.Effects.Fader(this.thumb6);
            this.faders['6'].setMinOpacity(50);
        }
    }
};

