/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

                     UDC.c_horizontalSlider.js
                        v 1.2, 2002-02-17
    
                             -~|~-

    Copyright (c) Samuel Trygger. All Rights Reserved. You may use
    this code if and only if this entire copyright notice appears
    unchanged.

    Contact samuel@trygger.nu for all other uses.

                             -~|~-

    Description : Javascript object that creates a horizontal
                  slide show. Check the example code to see how
                  it works
    Requires    : Nothing in particular. It is self contained.
    Tested with : Microsoft Internet Explorer 6.0.2600.0000     Win2000
                  Netscape Communicator 4.79                    Win2000
                  Netscape 4.7                                  MacOS 8.6
                  Netscape 6.2                                  Win2000
    Author      : Samuel Trygger
    Contact     : samuel@trygger.nu
    Home Page   : http://samuel.trygger.nu/devzone/javascript/

    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */

/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    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.
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */
    
// BrowserCheck Object
// provides most commonly needed browser checking variables
// 19990326

// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynapi/


    function c_horizontalSlider() {
        this.fullSizeDirectory           = '';
        this.length                      = 0;
        this.name                        = '';
        this.nextImage                   = '';
        this.nextImageDimmed             = '';
        this.numberOfPreviewImages       = 5;
        this.oneSizeFitsAll              = 1;
        this.previewAndFullSizeSeparator = '';
        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,description,urltxt) {
        this.width       = w;
        this.height      = h;
        this.alt         = alt;
        this.name        = src;
        this.picture     = new Image(w, h);
        this.picture.src = psd + src;
        this.picture.description = description;
        this.picture.urltxt      = urltxt;
        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,description,urltxt) {
        this.width        = w;
        this.height       = h;
        this.alt          = alt;
        this.name         = src;
        this.picture      = new Image(w, h);
        this.picture.src  = fsd + src;
        this.picture.description = description;
        this.picture.urltxt      = urltxt;
        this.previewImage = new _OBJ_HorizontalSlider_HLPR_PreviewImage(pi_src, pi_alt, pi_w, pi_h, psd,description,urltxt);

        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 + ']' : '');
        document.images['preview_' + (index - _CONST_HorizontalSlider_HLPR_FirstPreview)].title = document.images['preview_' + (index - _CONST_HorizontalSlider_HLPR_FirstPreview)].alt;
        }
    }
    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,description,urltxt) {
        this[this.length] = new _OBJ_HorizontalSlider_HLPR_Picture(src, alt, w, h, pi_src, pi_alt, pi_w, pi_h, this.fullSizeDirectory, this.previewSizeDirectory,description,urltxt);
        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;
        document.getElementById("description_title").innerHTML = this[_CONST_HorizontalSlider_HLPR_FirstPreview + index].alt;
        document.getElementById("description_txt").innerHTML = this[_CONST_HorizontalSlider_HLPR_FirstPreview + index].picture.description;
        document.getElementById("url_txt").innerHTML = this[_CONST_HorizontalSlider_HLPR_FirstPreview + index].picture.urltxt;

        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 + ']' : '');
        document.images['fullsize'].title = document.images['fullsize'].alt;
        }
        if (this[_CONST_HorizontalSlider_HLPR_FirstPreview + index].picture.urltxt !=""){
              if (is.ie) {
                document.getElementById("url_txt").style.cursor = 'hand';
                document.getElementById("url_txt").setAttribute("onclick", function anonymous(){window.open(document.getElementById("url_txt").innerHTML)});
                document.getElementById("url_txt").setAttribute("onmouseover", function anonymous(){this.style.paddingLeft='5px'});
                document.getElementById("url_txt").setAttribute("onmouseout", function anonymous(){this.style.paddingLeft='0px'});
              }
              if (!is.ie) {
                document.getElementById("url_txt").style.cursor = 'pointer';
                document.getElementById("url_txt").setAttribute("onclick", 'window.open(document.getElementById("url_txt").innerHTML)');
                document.getElementById("url_txt").setAttribute("onmouseover", "this.style.paddingLeft='5px';");
                document.getElementById("url_txt").setAttribute("onmouseout", "this.style.paddingLeft='0px';");
              }
        } else {
        document.getElementById("url_txt").style.cursor = 'default';
        document.getElementById("url_txt").removeAttribute("onmouseover");
        document.getElementById("url_txt").removeAttribute("onmouseout");
        document.getElementById("url_txt").removeAttribute("onclick");
        }

    }
    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('<div style="height:351px;width:489px;background-repeat:repeat-y;background-image: url(html_version/pics/bg_portfolio.jpg);text-align:left;">');
        document.write('<div style="float:left;width:300px;padding-top:40px;padding-left:8px;"><img name="fullsize" src="' + this.fullSizeDirectory + this[0].name + '" ' + ((this.showAltText && !document.layers) ? 'title="'+this[0].alt+ ((this.showImageCount && this[0].alt != '') ? ' [1/' + this.length + ']' : '')+'" alt="' + this[0].alt + ((this.showImageCount && this[0].alt != '') ? ' [1/' + this.length + ']' : '') + '" ' : '') + 'width="' + this[0].width + '" height="' + this[0].height + '" style="border:1px solid #5896AF;" /></div>');
        document.write('<div style="float:right;padding-top:3px;text-align:left;width:165px;color:#2D3851;font-size:14pt;font-weight:bold;" id="portfolio_title">PORTFOLIO</div>');
        document.write('<div style="float:right;padding-top:6px;text-align:left;width:165px;color:#000000;font-size:10px;font-weight:bold;" id="description_title">'+this[0].alt+'</div>');
        document.write('<div style="float:right;text-align:left;width:163px;padding-top:5px;;font-size:10px;" id="description_txt">'+this[0].picture.description+'</div>');
        document.write('<div id="url_txt" style="position:relative;top:8px;left:10px;clear:both;white-space: nowrap;width:10%;height:10px;font-size:10px;color:#366988;text-align:left;">'+this[0].picture.urltxt+'</div>');

        if (this[0].picture.urltxt !=""){
              if (is.ie) {
                document.getElementById("url_txt").style.cursor = 'hand';
                document.getElementById("url_txt").setAttribute("onclick", function anonymous(){window.open(document.getElementById("url_txt").innerHTML)});
                document.getElementById("url_txt").setAttribute("onmouseover", function anonymous(){this.style.paddingLeft='5px'});
                document.getElementById("url_txt").setAttribute("onmouseout", function anonymous(){this.style.paddingLeft='0px'});
              }
              if (!is.ie) {
                document.getElementById("url_txt").style.cursor = 'pointer';
                document.getElementById("url_txt").setAttribute("onclick", 'window.open(document.getElementById("url_txt").innerHTML)');
                document.getElementById("url_txt").setAttribute("onmouseover", "this.style.paddingLeft='5px';");
                document.getElementById("url_txt").setAttribute("onmouseout", "this.style.paddingLeft='0px';");
              }
        } else {
        document.getElementById("url_txt").style.cursor = 'default';
        document.getElementById("url_txt").removeAttribute("onmouseover");
        document.getElementById("url_txt").removeAttribute("onmouseout");
        document.getElementById("url_txt").removeAttribute("onclick");
        }

        document.write('<div style="text-align:left;padding-top:42px;">');
        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 + '" title="' + this[i].previewImage.alt + ((this.showImageCount && this[i].previewImage.alt != '') ? ' [' + (i + 1) + '/' + this.length + ']' : '') + '" ' : '') + 'width="' + this[i].previewImage.width + '" height="' + this[i].previewImage.height + '" style="border:1px solid #5896AF;" 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 + '" title="' + 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" style="border:1px solid #5896AF;" align="absmiddle" hidefocus="true" /></a> ');
            }
        }
        //document.write(this.previewAndFullSizeSeparator);
        document.write('</div></div>');
    }
    c_horizontalSlider.prototype.write = _HorizontalSlider_HLPR_Write;
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */

