/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Internal variables. Should NOT be touched.
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    var _CONST_HorizontalSlider_HLPR_FirstPreview = 0;          // Keeps track of the first preview picture of the slide show
    var _CONST_HorizontalSlider_HLPR_VERSION      = 1.2;        // Version number.
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Main object.
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    function c_horizontalSlider() {
        this.fullSizeDirectory           = '';
        this.length                      = 0;
        this.name                        = '';
        this.nextImage                   = '';
        this.nextImageDimmed             = '';
        this.numberOfPreviewImages       = 3;
        this.oneSizeFitsAll              = 0;
        this.previewAndFullSizeSeparator = '<br /><br />';
        this.previewSizeDirectory        = '';
        this.previousImage               = '';
        this.previousImageDimmed         = '';
        this.showAltText                 = 1;
        this.showImageCount              = 1;
        this.showStatusMessage           = 0;
        this.specialStatusMessage        = '';
        this.supportDirectory            = '';
        this.VERSION                     = _CONST_HorizontalSlider_HLPR_VERSION;

        return this;
    }
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Helper object for preview image.
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    function _OBJ_HorizontalSlider_HLPR_PreviewImage(src, alt, w, h, psd) {
        this.width       = w;
        this.height      = h;
        this.alt         = alt;
        this.name        = src;
        this.picture     = new Image(w, h);
        this.picture.src = psd + src;

        return this;
    }
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Helper object for full size image.
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    function _OBJ_HorizontalSlider_HLPR_Picture(src, alt, w, h, pi_src, pi_alt, pi_w, pi_h, fsd, psd) {
        this.width        = w;
        this.height       = h;
        this.alt          = alt;
        this.name         = src;
        this.picture      = new Image(w, h);
        this.picture.src  = fsd + src;
        this.previewImage = new _OBJ_HorizontalSlider_HLPR_PreviewImage(pi_src, pi_alt, pi_w, pi_h, psd);

        return this;
    }
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Code to slide the preview pictures to the right.
    Extends c_horizontalSlider()
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    function _HorizontalSlider_HLPR_Previous() {
        if (_CONST_HorizontalSlider_HLPR_FirstPreview == 0) return;
        document.images['nextImage'].src = this.supportDirectory + this.nextImage;
        document.images['prevImage'].src = this.supportDirectory + this.previousImage;
        _CONST_HorizontalSlider_HLPR_FirstPreview--;
        if (_CONST_HorizontalSlider_HLPR_FirstPreview == 0) document.images['prevImage'].src = this.supportDirectory + this.previousImageDimmed;
        for (var i = _CONST_HorizontalSlider_HLPR_FirstPreview; i < _CONST_HorizontalSlider_HLPR_FirstPreview + this.numberOfPreviewImages; i++) {
            this._DoTheSlide(i);
        }
    }
    c_horizontalSlider.prototype.previous = _HorizontalSlider_HLPR_Previous;
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Code to slide the preview pictures to the left.
    Extends c_horizontalSlider()
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    function _HorizontalSlider_HLPR_Next() {
        if (_CONST_HorizontalSlider_HLPR_FirstPreview == this.length - this.numberOfPreviewImages) return;
        document.images['prevImage'].src = this.supportDirectory + this.previousImage;
        document.images['nextImage'].src = this.supportDirectory + this.nextImage;
        _CONST_HorizontalSlider_HLPR_FirstPreview++;
        if (_CONST_HorizontalSlider_HLPR_FirstPreview == this.length - this.numberOfPreviewImages) document.images['nextImage'].src = this.supportDirectory + this.nextImageDimmed;
        for (var i = _CONST_HorizontalSlider_HLPR_FirstPreview; i < _CONST_HorizontalSlider_HLPR_FirstPreview + this.numberOfPreviewImages; i++) {
            this._DoTheSlide(i);
        }
    }
    c_horizontalSlider.prototype.next = _HorizontalSlider_HLPR_Next;
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Shifts a single preview picture.
    Extends c_horizontalSlider()
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    function _HorizontalSlider_HLPR_DoTheSlide(index) {
        if (document.all && !this.oneSizeFitsAll) {
            document.images['preview_' + (index - _CONST_HorizontalSlider_HLPR_FirstPreview)].width = this[index].previewImage.width;
            document.images['preview_' + (index - _CONST_HorizontalSlider_HLPR_FirstPreview)].height = this[index].previewImage.height;
        }
        document.images['preview_' + (index - _CONST_HorizontalSlider_HLPR_FirstPreview)].src = this[index].previewImage.picture.src;
        if (this.showAltText && !document.layers) document.images['preview_' + (index - _CONST_HorizontalSlider_HLPR_FirstPreview)].alt = this[index].previewImage.alt + ((this.showImageCount && this[index].previewImage.alt != '') ? ' [' + (index + 1) + '/' + this.length + ']' : '');
    }
    c_horizontalSlider.prototype._DoTheSlide = _HorizontalSlider_HLPR_DoTheSlide;
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Adds a full size picture with a preview picture to an instance
    of c_horizontalSlider().
    Extends c_horizontalSlider()
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    function _HorizontalSlider_HLPR_Add(src, alt, w, h, pi_src, pi_alt, pi_w, pi_h) {
        this[this.length] = new _OBJ_HorizontalSlider_HLPR_Picture(src, alt, w, h, pi_src, pi_alt, pi_w, pi_h, this.fullSizeDirectory, this.previewSizeDirectory);
        this.length++;
    }
    c_horizontalSlider.prototype.add = _HorizontalSlider_HLPR_Add;
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Switches the full size image.
    Extends c_horizontalSlider()
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    function _HorizontalSlider_HLPR_ShowFullSize(index) {
        if (document.all && !this.oneSizeFitsAll) {
            document.images['fullsize'].width  = this[_CONST_HorizontalSlider_HLPR_FirstPreview + index].width;
            document.images['fullsize'].height = this[_CONST_HorizontalSlider_HLPR_FirstPreview + index].height;
        }
        document.images['fullsize'].src = this[_CONST_HorizontalSlider_HLPR_FirstPreview + index].picture.src;
        if (this.showAltText && !document.layers) document.images['fullsize'].alt = this[_CONST_HorizontalSlider_HLPR_FirstPreview + index].alt + ((this.showImageCount && this[_CONST_HorizontalSlider_HLPR_FirstPreview + index].alt != '') ? ' [' + (_CONST_HorizontalSlider_HLPR_FirstPreview + index + 1) + '/' + this.length + ']' : '');
    }
    c_horizontalSlider.prototype.showFullSize = _HorizontalSlider_HLPR_ShowFullSize;
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Writes the row of preview pictures, navigation and the full
    size picture on a web page.
    Extends c_horizontalSlider()
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    function _HorizontalSlider_HLPR_Write() {
        if (this.name == '') {
            // Error... "this.name" must be set to be able to write the A HREF tags.
            alert('You must set the value of "object.name" to the name of your instance of c_horizontalSlider() before calling "object.write()".');
            return;
        }
        document.write('<center>');
        if (this.length > this.numberOfPreviewImages) {
            document.write('<a href="javascript:' + this.name + '.previous();"' + ((this.showStatusMessage) ? ' onMouseOver="window.status=\'' + this.specialStatusMessage + '\';return true;" onClick="window.status=\'' + this.specialStatusMessage + '\';return true;" onMouseOut="window.status=\'\';return true;"' : '') + '><img name="prevImage" src="' + this.supportDirectory + this.previousImageDimmed + '" border="0" align="absmiddle" hidefocus="true" /></a>');
            for (var i = 0; i < this.numberOfPreviewImages; i++) {
                document.write('<a href="javascript:' + this.name + '.showFullSize(' + i + ');"' + ((this.showStatusMessage) ? ' onMouseOver="window.status=\'' + this.specialStatusMessage + '\';return true;" onClick="window.status=\'' + this.specialStatusMessage + '\';return true;" onMouseOut="window.status=\'\';return true;"' : '') + '><img name="preview_' + i + '" src="' + this.previewSizeDirectory + this[i].previewImage.name + '" ' + ((this.showAltText && !document.layers) ? 'alt="' + this[i].previewImage.alt + ((this.showImageCount && this[i].previewImage.alt != '') ? ' [' + (i + 1) + '/' + this.length + ']' : '') + '" ' : '') + 'width="' + this[i].previewImage.width + '" height="' + this[i].previewImage.height + '" border="0" align="absmiddle" hidefocus="true" /></a> ');
            }
            document.write('<a href="javascript:' + this.name + '.next();"' + ((this.showStatusMessage) ? ' onMouseOver="window.status=\'' + this.specialStatusMessage + '\';return true;" onClick="window.status=\'' + this.specialStatusMessage + '\';return true;" onMouseOut="window.status=\'\';return true;"' : '') + '><img name="nextImage" src="' + this.supportDirectory + this.nextImage + '" border="0" align="absmiddle" hidefocus="true" /></a>');
        } else {
            for (var i = 0; i < this.length; i++) {
                document.write('<a href="javascript:' + this.name + '.showFullSize(' + i + ');"' + ((this.showStatusMessage) ? ' onMouseOver="window.status=\'' + this.specialStatusMessage + '\';return true;" onClick="window.status=\'' + this.specialStatusMessage + '\';return true;" onMouseOut="window.status=\'\';return true;"' : '') + '><img name="preview_' + i + '" src="' + this.previewSizeDirectory + this[i].previewImage.name + '" ' + ((this.showAltText && !document.layers) ? 'alt="' + this[i].previewImage.alt + ((this.showImageCount && this[i].previewImage.alt != '') ? ' [' + (i + 1) + '/' + this.length + ']' : '') + '" ' : '') + 'width="' + this[i].previewImage.width + '" height="' + this[i].previewImage.height + '" border="0" align="absmiddle" hidefocus="true" /></a> ');
            }
        }
        document.write(this.previewAndFullSizeSeparator);
        document.write('<img name="fullsize" src="' + this.fullSizeDirectory + this[0].name + '" ' + ((this.showAltText && !document.layers) ? 'alt="' + this[0].alt + ((this.showImageCount && this[0].alt != '') ? ' [1/' + this.length + ']' : '') + '" ' : '') + 'width="' + this[0].width + '" height="' + this[0].height + '" border="0" />');
        document.write('</center>');
    }
    c_horizontalSlider.prototype.write = _HorizontalSlider_HLPR_Write;
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
