<!--
//
// Script    :   fes_rvl_functions.js
// Author    :   C.E. Berry
// Version   :   5.00.012
// Notes     :   Javascript function library for additional functions for Henry James
//               website
//
//               All material contained within is the intellectual property of SysExcel Ltd.
//               and as such may not be reproduced or modified in any way shape or form without
//               the prior consent of SysExcel Ltd.
//
// Amendment Log
//
//      Version      Date           Author              Notes
//      -------      ----           ------              -----
//
//      5.00.012     10/01/2011     C.E. Berry          Added special tab functions
//
//      5.00.010     20/07/2010     C.E. Berry          Added special mouseover functions
//
//      4.00.014     30/11/2008     P.I. Gunhouse       Creation
//
//=================================================================================================

function fncWkdAlignTables()
{
    if (!document.getElementById('wkdtabpage')) return;

    panel_height = 100

    if (document.getElementById('wkdnotes')) panel_height = Math.max(panel_height,document.getElementById('wkdnotes').clientHeight);
    if (document.getElementById('wkddetails')) panel_height = Math.max(panel_height,document.getElementById('wkddetails').clientHeight);
    if (document.getElementById('wkdsizing')) panel_height = Math.max(panel_height,document.getElementById('wkdsizing').clientHeight);
    if (document.getElementById('wkdtoorder')) panel_height = Math.max(panel_height,document.getElementById('wkdtoorder').clientHeight);
    if (document.getElementById('wkdpress')) panel_height = Math.max(panel_height,document.getElementById('wkdpress').clientHeight);

    panel_height += 20;

    document.getElementById('wkdtabpage').style.height = panel_height + 'px';
    document.getElementById('wkdtabpage').style.width = '400px';

    loc_left = fncFesGetAbsolutePosition(document.getElementById('wkdtabs')).left;
    loc_top = fncFesGetAbsolutePosition(document.getElementById('wkdtabs')).top;
    loc_height = document.getElementById('wkdtabs').clientHeight;

    if (document.getElementById('wkdnotes'))
    {
        document.getElementById('wkdnotes').style.left = (loc_left) + 'px';
        document.getElementById('wkdnotes').style.top = (loc_top + loc_height) + 'px';
        document.getElementById('wkdnotes').style.height = panel_height + 'px';
    }
    if (document.getElementById('wkddetails'))
    {
        document.getElementById('wkddetails').style.left = (loc_left) + 'px';
        document.getElementById('wkddetails').style.top = (loc_top + loc_height) + 'px';
        document.getElementById('wkddetails').style.height = panel_height + 'px';
    }
    if (document.getElementById('wkdsizing'))
    {
        document.getElementById('wkdsizing').style.left = (loc_left) + 'px';
        document.getElementById('wkdsizing').style.top = (loc_top + loc_height) + 'px';
        document.getElementById('wkdsizing').style.height = panel_height + 'px';
    }
    if (document.getElementById('wkdtoorder'))
    {
        document.getElementById('wkdtoorder').style.left = (loc_left) + 'px';
        document.getElementById('wkdtoorder').style.top = (loc_top + loc_height) + 'px';
        document.getElementById('wkdtoorder').style.height = panel_height + 'px';
    }
    if (document.getElementById('wkdpress'))
    {
        document.getElementById('wkdpress').style.left = (loc_left) + 'px';
        document.getElementById('wkdpress').style.top = (loc_top + loc_height) + 'px';
        document.getElementById('wkdpress').style.height = panel_height + 'px';
    }

    if      (document.getElementById('wkdnotes'))   document.getElementById('wkdnotes').style.visibility = 'visible';
    else if (document.getElementById('wkddetails')) document.getElementById('wkddetails').style.visibility = 'visible';
    else if (document.getElementById('wkdsizing'))  document.getElementById('wkdsizing').style.visibility = 'visible';
    else if (document.getElementById('wkdtoorder')) document.getElementById('wkdtoorder').style.visibility = 'visible';
    else if (document.getElementById('wkdpress'))   document.getElementById('wkdpress').style.visibility = 'visible';

}

//=================================================================================================

function fncWkdAlignMenus()
{
    var loc_left_margin = Math.max(0,(document.body.clientWidth - 800) / 2);
    var loc_button_width = 124;
    var loc_spacing = 8;
//    document.getElementById('wkdmenu1').style.left = loc_left_margin + (loc_spacing * 1) + (loc_button_width * 0) + "px";
//    document.getElementById('wkdmenu2').style.left = loc_left_margin + (loc_spacing * 2) + (loc_button_width * 1) + "px";
//    document.getElementById('wkdmenu3').style.left = loc_left_margin + (loc_spacing * 3) + (loc_button_width * 2) + "px";
//    document.getElementById('wkdmenu4').style.left = loc_left_margin + (loc_spacing * 4) + (loc_button_width * 3) + "px";

    if (document.getElementById('wkdsubmenu1')) document.getElementById('wkdsubmenu1').style.left = fncFesGetAbsolutePosition(document.getElementById('wkdmenu1')).left + "px";
    if (document.getElementById('wkdsubmenu2')) document.getElementById('wkdsubmenu2').style.left = fncFesGetAbsolutePosition(document.getElementById('wkdmenu2')).left + "px";
    if (document.getElementById('wkdsubmenu3')) document.getElementById('wkdsubmenu3').style.left = fncFesGetAbsolutePosition(document.getElementById('wkdmenu3')).left + "px";
    if (document.getElementById('wkdsubmenu4')) document.getElementById('wkdsubmenu4').style.left = fncFesGetAbsolutePosition(document.getElementById('wkdmenu4')).left + "px";

}

//=================================================================================================

function fncWkdPresetLayerMenus()
{
    var loc_top_margin = 115;
    document.body.vanishing_point_top = 340;
    document.getElementById('wkdmenu1').fes_opacity = 100;
    document.getElementById('wkdmenu2').fes_opacity = 100;
    document.getElementById('wkdmenu3').fes_opacity = 100;
    document.getElementById('wkdmenu4').fes_opacity = 100;

    if (document.getElementById('wkdsubmenu1')) document.getElementById('wkdsubmenu1').style.top = loc_top_margin - document.getElementById('wkdsubmenu1').offsetHeight + "px";
    if (document.getElementById('wkdsubmenu2')) document.getElementById('wkdsubmenu2').style.top = loc_top_margin - document.getElementById('wkdsubmenu2').offsetHeight + "px";
    if (document.getElementById('wkdsubmenu3')) document.getElementById('wkdsubmenu3').style.top = loc_top_margin - document.getElementById('wkdsubmenu3').offsetHeight + "px";
    if (document.getElementById('wkdsubmenu4')) document.getElementById('wkdsubmenu4').style.top = loc_top_margin - document.getElementById('wkdsubmenu4').offsetHeight + "px";
    document.getElementById('wkdmenu1').style.visibility = "visible";
    document.getElementById('wkdmenu2').style.visibility = "visible";
    document.getElementById('wkdmenu3').style.visibility = "visible";
    document.getElementById('wkdmenu4').style.visibility = "visible";

}

//=================================================================================================

function toggle_tab(page)
{
    if (document.getElementById('wkdtableft'))        document.getElementById('wkdtableft').style.borderColor = '#000000';
    if (document.getElementById('wkdnotes'))          document.getElementById('wkdnotes').style.visibility = 'hidden';
    if (document.getElementById('wkdnotestab'))       document.getElementById('wkdnotestab').style.backgroundColor = '#fbfecd';
    if (document.getElementById('wkdnotestab'))       document.getElementById('wkdnotestab').style.borderColor = '#000000';
    if (document.getElementById('wkdnotestableft'))   document.getElementById('wkdnotestableft').style.borderColor = '#000000';
    if (document.getElementById('wkddetails'))        document.getElementById('wkddetails').style.visibility = 'hidden';
    if (document.getElementById('wkddetailstab'))     document.getElementById('wkddetailstab').style.backgroundColor = '#fbfecd';
    if (document.getElementById('wkddetailstab'))     document.getElementById('wkddetailstab').style.borderColor = '#000000';
    if (document.getElementById('wkddetailstableft')) document.getElementById('wkddetailstableft').style.borderColor = '#000000';
    if (document.getElementById('wkdsizing'))         document.getElementById('wkdsizing').style.visibility = 'hidden';
    if (document.getElementById('wkdsizingtab'))      document.getElementById('wkdsizingtab').style.backgroundColor = '#fbfecd';
    if (document.getElementById('wkdsizingtab'))      document.getElementById('wkdsizingtab').style.borderColor = '#000000';
    if (document.getElementById('wkdsizingtableft'))  document.getElementById('wkdsizingtableft').style.borderColor = '#000000';
    if (document.getElementById('wkdtoorder'))        document.getElementById('wkdtoorder').style.visibility = 'hidden';
    if (document.getElementById('wkdtoordertab'))     document.getElementById('wkdtoordertab').style.backgroundColor = '#fbfecd';
    if (document.getElementById('wkdtoordertab'))     document.getElementById('wkdtoordertab').style.borderColor = '#000000';
    if (document.getElementById('wkdtoordertableft')) document.getElementById('wkdtoordertableft').style.borderColor = '#000000';
    if (document.getElementById('wkdpress'))          document.getElementById('wkdpress').style.visibility = 'hidden';
    if (document.getElementById('wkdpresstab'))       document.getElementById('wkdpresstab').style.backgroundColor = '#fbfecd';
    if (document.getElementById('wkdpresstab'))       document.getElementById('wkdpresstab').style.borderColor = '#000000';
    if (document.getElementById('wkdpresstableft'))   document.getElementById('wkdpresstableft').style.borderColor = '#000000';
    if (document.getElementById('wkdtabright'))       document.getElementById('wkdtabright').style.borderColor = '#000000';

    if (document.getElementById(page))              document.getElementById(page).style.visibility = 'visible';
    if (document.getElementById(page + 'tab'))      document.getElementById(page + 'tab').style.backgroundColor = '#fbfecd';
    if (document.getElementById(page + 'tab'))      document.getElementById(page + 'tab').style.borderColor = '#fbfecd';
    if (document.getElementById(page + 'tableft'))  document.getElementById(page + 'tableft').style.borderColor = '#fbfecd';

    if (page == "wkdnotes")
    {
        if      (document.getElementById('wkdtableft')) document.getElementById('wkdtableft').style.borderColor = '#fbfecd';

        if      (document.getElementById('wkddetailstableft')) document.getElementById('wkddetailstableft').style.borderColor = '#fbfecd';
        else if (document.getElementById('wkdsizingtableft')) document.getElementById('wkdsizingtableft').style.borderColor = '#fbfecd';
        else if (document.getElementById('wkdtoordertableft')) document.getElementById('wkdtoordertableft').style.borderColor = '#fbfecd';
        else if (document.getElementById('wkdpresstableft')) document.getElementById('wkdpresstableft').style.borderColor = '#fbfecd';
        else if (document.getElementById('wkdtabright')) document.getElementById('wkdtabright').style.borderColor = '#fbfecd';

        if      (document.getElementById('wkddetailstableftimg')) document.getElementById('wkddetailstableftimg').src = '../site_graphics/wkd_tab_left_on_top.gif';
        else if (document.getElementById('wkdsizingtableftimg')) document.getElementById('wkdsizingtableftimg').src = '../site_graphics/wkd_tab_left_on_top.gif';
        else if (document.getElementById('wkdtoordertableftimg')) document.getElementById('wkdtoordertableftimg').src = '../site_graphics/wkd_tab_left_on_top.gif';
        else if (document.getElementById('wkdpresstableftimg')) document.getElementById('wkdpresstableftimg').src = '../site_graphics/wkd_tab_left_on_top.gif';

    }

    if (page == "wkddetails")
    {
        if      (document.getElementById('wkddetailstableft')) document.getElementById('wkddetailstableft').style.borderColor = '#fbfecd';

        if      (document.getElementById('wkdsizingtableft')) document.getElementById('wkdsizingtableft').style.borderColor = '#fbfecd';
        else if (document.getElementById('wkdtoordertableft')) document.getElementById('wkdtoordertableft').style.borderColor = '#fbfecd';
        else if (document.getElementById('wkdpresstableft')) document.getElementById('wkdpresstableft').style.borderColor = '#fbfecd';
        else if (document.getElementById('wkdtabright')) document.getElementById('wkdtabright').style.borderColor = '#fbfecd';

        if      (document.getElementById('wkddetailstableftimg')) document.getElementById('wkddetailstableftimg').src = '../site_graphics/wkd_tab_right_on_top.gif';

        if      (document.getElementById('wkdsizingtableftimg')) document.getElementById('wkdsizingtableftimg').src = '../site_graphics/wkd_tab_left_on_top.gif';
        else if (document.getElementById('wkdtoordertableftimg')) document.getElementById('wkdtoordertableftimg').src = '../site_graphics/wkd_tab_left_on_top.gif';
        else if (document.getElementById('wkdpresstableftimg')) document.getElementById('wkdpresstableftimg').src = '../site_graphics/wkd_tab_left_on_top.gif';

    }

    if (page == "wkdsizing")
    {
        if      (document.getElementById('wkdsizingtableft')) document.getElementById('wkdsizingtableft').style.borderColor = '#fbfecd';

        if      (document.getElementById('wkdtoordertableft')) document.getElementById('wkdtoordertableft').style.borderColor = '#fbfecd';
        else if (document.getElementById('wkdpresstableft')) document.getElementById('wkdpresstableft').style.borderColor = '#fbfecd';
        else if (document.getElementById('wkdtabright')) document.getElementById('wkdtabright').style.borderColor = '#fbfecd';

        if      (document.getElementById('wkdsizingtableftimg')) document.getElementById('wkdsizingtableftimg').src = '../site_graphics/wkd_tab_right_on_top.gif';

        if      (document.getElementById('wkdtoordertableftimg')) document.getElementById('wkdtoordertableftimg').src = '../site_graphics/wkd_tab_left_on_top.gif';
        else if (document.getElementById('wkdpresstableftimg')) document.getElementById('wkdpresstableftimg').src = '../site_graphics/wkd_tab_left_on_top.gif';

    }

    if (page == "wkdtoorder")
    {
        if      (document.getElementById('wkdtoordertableft')) document.getElementById('wkdtoordertableft').style.borderColor = '#fbfecd';

        if      (document.getElementById('wkdpresstableft')) document.getElementById('wkdpresstableft').style.borderColor = '#fbfecd';
        else if (document.getElementById('wkdtabright')) document.getElementById('wkdtabright').style.borderColor = '#fbfecd';

        if      (document.getElementById('wkdtoordertableftimg')) document.getElementById('wkdtoordertableftimg').src = '../site_graphics/wkd_tab_right_on_top.gif';

        if      (document.getElementById('wkdpresstableftimg')) document.getElementById('wkdpresstableftimg').src = '../site_graphics/wkd_tab_left_on_top.gif';

    }

    if (page == "wkdpress")
    {
        if      (document.getElementById('wkdpresstableft')) document.getElementById('wkdpresstableft').style.borderColor = '#fbfecd';

        if      (document.getElementById('wkdtabright')) document.getElementById('wkdtabright').style.borderColor = '#fbfecd';

        if      (document.getElementById('wkdpresstableftimg')) document.getElementById('wkdpresstableftimg').src = '../site_graphics/wkd_tab_right_on_top.gif';

    }

}

function fncWkdToolTipOn(prm_element,prm_event,prm_id,prm_text)
{

    if (!document.getElementById(prm_id)) return;

    loc_div = document.getElementById(prm_id);

    loc_div.innerHTML = '<p>' + prm_text + '</p>';

    loc_div.style.visibility = "hidden";
    loc_div.style.display = "block";

    if (fncFesGetAbsolutePosition(prm_element).left > (fncFesGetWindowWidth() / 2)) // postion on the side with most room
    {
        loc_div.style.left = fncFesGetAbsolutePosition(prm_element).left - loc_div.clientWidth - 5 + "px" ;
    }
    else
    {
        loc_div.style.left = fncFesGetAbsolutePosition(prm_element).left + prm_element.clientWidth + 5 + "px" ;
    }

    loc_div.style.top = Math.max(Math.min(fncFesGetWindowHeight() + fncFesGetVerticalScroll() - loc_div.clientHeight,
                                          fncFesGetAbsolutePosition(prm_element).top - (loc_div.clientHeight / 3)),
                                 fncFesGetVerticalScroll()) + "px";

    loc_div.style.visibility = "visible";
    loc_div.style.display = "block";

}

//-------------------------------------------------------------------------------------------------

function fncWkdToolTipOff(prm_element,prm_event,prm_id)
{
    if (!document.getElementById(prm_id)) return;

    loc_div = document.getElementById(prm_id);

    loc_div.style.display = "none";

}

//-------------------------------------------------------------------------------------------------

var pub_fade_timer;

function roll_slideshow(prm_direction)
{
    loc_slideshow = document.getElementById("slideshow");

    if (typeof loc_slideshow.fes_slides === 'undefined')  // indicates first run
    {
        loc_slideshow.fes_slides = new Array();

        var loc_counter = 0;

        for (var loc_item = loc_slideshow.firstChild; loc_item; loc_item = loc_item.nextSibling)
        {
            if (loc_item.nodeName === "DIV")
            {
                loc_item.style.zIndex = 2;
                loc_slideshow.fes_slides[loc_counter++] = loc_item;
            }
        }

        loc_slideshow.fes_opacity = 0;
        loc_slideshow.fes_previous_index = loc_slideshow.fes_slides.length - 1;
        loc_slideshow.fes_current_index = 0;
        pub_fade_timer  = setTimeout('roll_slideshow(1)',1);

        return;
    }

    if (typeof prm_direction !== 'undefined' && !prm_direction) // indicates re-run
    {
        loc_slideshow.fes_opacity = 0;
        clearTimeout(pub_fade_timer);
        pub_fade_timer  = setTimeout('roll_slideshow(1)',3000);
    }

    if (prm_direction) // then we want to roll the next slide
    {
        loc_next_index = loc_slideshow.fes_current_index + prm_direction;

        if (loc_next_index >= loc_slideshow.fes_slides.length) loc_next_index = 0;
        if (loc_next_index < 0) loc_next_index = loc_slideshow.fes_slides.length - 1;

        loc_slideshow.fes_slides[loc_slideshow.fes_previous_index].style.display = 'none';
        loc_slideshow.fes_slides[loc_slideshow.fes_previous_index].style.zIndex = 2;

        loc_slideshow.fes_slides[loc_slideshow.fes_current_index].style.zIndex = 3;

        loc_slideshow.fes_slides[loc_next_index].style.opacity = 0;
        loc_slideshow.fes_slides[loc_next_index].style.zIndex = 4;
        loc_slideshow.fes_slides[loc_next_index].style.display = 'block';

        loc_slideshow.fes_previous_index = loc_slideshow.fes_current_index;
        loc_slideshow.fes_current_index = loc_next_index;

        loc_slideshow.fes_opacity = 0;
    }

    //if (loc_slideshow.fes_slides[loc_slideshow.fes_current_index].filters) loc_slideshow.fes_slides[loc_slideshow.fes_current_index].filters.alpha.opacity = pub_opacity;
    if (loc_slideshow.fes_slides[loc_slideshow.fes_current_index].filters)  loc_slideshow.fes_slides[loc_slideshow.fes_current_index].style.filter = 'alpha(opacity=' + loc_slideshow.fes_opacity + ')';
    if (loc_slideshow.fes_slides[loc_slideshow.fes_previous_index].filters) loc_slideshow.fes_slides[loc_slideshow.fes_previous_index].style.filter = 'alpha(opacity=' + (100 - loc_slideshow.fes_opacity) + ')';

    loc_slideshow.fes_slides[loc_slideshow.fes_current_index].style.opacity = loc_slideshow.fes_opacity/100;
    loc_slideshow.fes_slides[loc_slideshow.fes_previous_index].style.opacity = (100 - loc_slideshow.fes_opacity)/100;

    if (loc_slideshow.fes_opacity < 100)
    {
        loc_slideshow.fes_opacity += 5
        clearTimeout(pub_fade_timer);
        pub_fade_timer  = setTimeout('roll_slideshow()',1);
    }
    else if (!loc_slideshow.fes_hold)
    {
        clearTimeout(pub_fade_timer);
        pub_fade_timer  = setTimeout('roll_slideshow(1)',3000);
    }

}

function roll_pressslides(prm_direction)
{
    loc_slideshow = document.getElementById("pressslides");

    if (typeof loc_slideshow.fes_slides === 'undefined')  // indicates first run
    {
        loc_slideshow.fes_slides = new Array();

        var loc_counter = 0;

        for (var loc_item = loc_slideshow.firstChild; loc_item; loc_item = loc_item.nextSibling)
        {
            if (loc_item.nodeName === "DIV")
            {
                loc_item.style.zIndex = 2;
                loc_slideshow.fes_slides[loc_counter++] = loc_item;
            }
        }

        loc_slideshow.fes_opacity = 0;
        loc_slideshow.fes_previous_index = loc_slideshow.fes_slides.length - 1;
        loc_slideshow.fes_current_index = 0;
        //pub_fade_timer  = setTimeout('roll_pressslides(1)',1);

        //return;
    }

    if (typeof prm_direction !== 'undefined' && !prm_direction) // indicates re-run
    {
        loc_slideshow.fes_opacity = 0;
        clearTimeout(pub_fade_timer);
        pub_fade_timer  = setTimeout('roll_pressslides(1)',3000);
    }

    if (prm_direction) // then we want to roll the next slide
    {
        loc_next_index = loc_slideshow.fes_current_index + prm_direction;

        if (loc_next_index >= loc_slideshow.fes_slides.length) loc_next_index = 0;
        if (loc_next_index < 0) loc_next_index = loc_slideshow.fes_slides.length - 1;

        loc_slideshow.fes_slides[loc_slideshow.fes_previous_index].style.display = 'none';
        loc_slideshow.fes_slides[loc_slideshow.fes_previous_index].style.zIndex = 2;

        loc_slideshow.fes_slides[loc_slideshow.fes_current_index].style.zIndex = 3;

        loc_slideshow.fes_slides[loc_next_index].style.opacity = 0;
        loc_slideshow.fes_slides[loc_next_index].style.zIndex = 4;
        loc_slideshow.fes_slides[loc_next_index].style.display = 'block';

        loc_slideshow.fes_previous_index = loc_slideshow.fes_current_index;
        loc_slideshow.fes_current_index = loc_next_index;

        loc_slideshow.fes_opacity = 0;
    }

    //if (loc_slideshow.fes_slides[loc_slideshow.fes_current_index].filters) loc_slideshow.fes_slides[loc_slideshow.fes_current_index].filters.alpha.opacity = pub_opacity;
    if (loc_slideshow.fes_slides[loc_slideshow.fes_current_index].filters)  loc_slideshow.fes_slides[loc_slideshow.fes_current_index].style.filter = 'alpha(opacity=' + loc_slideshow.fes_opacity + ')';
    if (loc_slideshow.fes_slides[loc_slideshow.fes_previous_index].filters) loc_slideshow.fes_slides[loc_slideshow.fes_previous_index].style.filter = 'alpha(opacity=' + (100 - loc_slideshow.fes_opacity) + ')';

    loc_slideshow.fes_slides[loc_slideshow.fes_current_index].style.opacity = loc_slideshow.fes_opacity/100;
    loc_slideshow.fes_slides[loc_slideshow.fes_previous_index].style.opacity = (100 - loc_slideshow.fes_opacity)/100;

    if (loc_slideshow.fes_opacity < 100)
    {
        loc_slideshow.fes_opacity += 5
        clearTimeout(pub_fade_timer);
        pub_fade_timer  = setTimeout('roll_pressslides()',1);
    }
/*
    else if (!loc_slideshow.fes_hold)
    {
        clearTimeout(pub_fade_timer);
        pub_fade_timer  = setTimeout('roll_pressslides(1)',3000);
    }
*/

}

//=================================================================================================
//
// Functions for special menu image mouseover effects
//
//=================================================================================================

// pub_fes_mos_dir       - relative directory location of mouseover images
// pub_fes_mos_options   - associative array used to store image mouseover option information (e.g.
//                        button images)
// pub_fes_mos_preloaded - boolean to indicate whether all mouseover images are loaded into the
//                        image mouseover options array

var pub_fes_mos_dir  = '';
var pub_fes_mos_options = new Array();
var pub_fes_mos_preloaded = false;

//=================================================================================================

function fncFesMosPreLoad(prm_id,prm_img,prm_img2,prm_img3,prm_img4,prm_status)
//
// Function to preload images for mouseover effects
//
// Arguments
//
//  prm_id          string used to uniquely identify mouseover option in the array
//  prm_img         image name
//  prm_img2        image name for second mouseover image
//  prm_img3        image name for third mouseover image
//  prm_img4        image name for fourth mouseover image
//  prm_status      message to be displayed in window status bar when mouse is moved over image
//
{

    if(!document.images)
    {
        return false;

    }

    else
    {
        pub_fes_mos_options[prm_id] = new fncFesMosCreateOptionArrayElement(prm_id,prm_img,prm_img2,prm_img3,prm_img4,prm_status);
        return true;

    }

}

//=================================================================================================

function fncFesMosCreateOptionArrayElement(prm_id,prm_img,prm_img2,prm_img3,prm_img4,prm_status)
//
// Function to create new image mouseover option array element and load image button objects
// accordingly
//
// Arguments
//
//  prm_id          string used to uniquely identify mouseover option in the array
//  prm_img         image name
//  prm_img2        image name for second mouseover image
//  prm_img3        image name for third mouseover image
//  prm_img4        image name for fourth mouseover image
//  prm_status      message to be displayed in window status bar when mouse is moved over image
//
{
    this.Id = prm_id;
    this.Status = prm_status;
    this.ImgOff = new Image;
    this.ImgOff2 = new Image;
    this.ImgOff3 = new Image;
    this.ImgOn = new Image;
    this.ImgOn2 = new Image;
    this.ImgOn3 = new Image;

    if (prm_img4 != "")
    {
        this.ImgOn4 = new Image;
        this.ImgOff4 = new Image;

    }

// Split image file into name and file extension

    loc_image_name = pub_fes_mos_dir + prm_img;
    loc_file_ext = loc_image_name.substr(loc_image_name.lastIndexOf("."));
    loc_file_name = loc_image_name.substr(0,loc_image_name.lastIndexOf("."));
    loc_image_name2 = pub_fes_mos_dir + prm_img2;
    loc_file_ext2 = loc_image_name2.substr(loc_image_name2.lastIndexOf("."));
    loc_file_name2 = loc_image_name2.substr(0,loc_image_name2.lastIndexOf("."));
    loc_image_name3 = pub_fes_mos_dir + prm_img3;
    loc_file_ext3 = loc_image_name3.substr(loc_image_name3.lastIndexOf("."));
    loc_file_name3 = loc_image_name3.substr(0,loc_image_name3.lastIndexOf("."));

    if (prm_img4 != "")
    {
        loc_image_name4 = pub_fes_mos_dir + prm_img4;
        loc_file_ext4 = loc_image_name4.substr(loc_image_name4.lastIndexOf("."));
        loc_file_name4 = loc_image_name4.substr(0,loc_image_name4.lastIndexOf("."));

    }

// Set up properties for image without mouseover and image with mouseover

    this.ImgOff.src = loc_file_name + loc_file_ext;
    this.ImgOn.src = loc_file_name + '_on' + loc_file_ext;
    this.ImgOff2.src = loc_file_name2 + loc_file_ext2;
    this.ImgOn2.src = loc_file_name2 + '_on' + loc_file_ext2;
    this.ImgOff3.src = loc_file_name3 + loc_file_ext3;
    this.ImgOn3.src = loc_file_name3 + '_on' + loc_file_ext3;

    if (prm_img4 != "")
    {
        this.ImgOff4.src = loc_file_name4 + loc_file_ext4;
        this.ImgOn4.src = loc_file_name4 + '_on' + loc_file_ext4;
    }

}

//=================================================================================================

function fncFesMosChangeState(prm_action, prm_id, prm_id2, prm_id3, prm_id4, prm_imgswap)
//
// Function to create perform image swapping for mouseover and mouseout events
//
// Arguments
//
//  prm_action      1 - mouseover, 0 - mouseout
//  prm_id          string used to uniquely identify menu option
//  prm_id2         string used to uniquely identify 2nd mouseover image
//  prm_id3         string used to uniquely identify 3rd mouseover image
//  prm_id4         string used to uniquely identify 4th mouseover image
//  prm_imgswap     1 - swap image, 0 - don't swap image (just alter window status text)
//
{

    if (document.images && pub_fes_mos_preloaded==true)
    {
        if (prm_action)
        {
            if (typeof(window.wkd_timers) !== "undefined")
            {
                clearTimeout(window.wkd_timers[prm_id]);

            }

            if (prm_imgswap)
            {
                document[prm_id].src = pub_fes_mos_options[prm_id].ImgOn.src;
                document[prm_id2].src = pub_fes_mos_options[prm_id].ImgOn2.src;
                document[prm_id3].src = pub_fes_mos_options[prm_id].ImgOn3.src;

                if(prm_id4 != "")
                {
                    document[prm_id4].src = pub_fes_mos_options[prm_id].ImgOn4.src;

                }

            }

            window.status = pub_fes_mos_options[prm_id].Status;

        }

        else
        {
            if (prm_imgswap)
            {
                if (typeof(window.wkd_timers) === "undefined")
                {
                    window.wkd_timers = new Object();

                }

                window.wkd_timers[prm_id]  = setTimeout('fncFesMosChangeStateOff(\'' + prm_id + '\',\'' + prm_id2 + '\',\'' + prm_id3 + '\',\'' + prm_id4 + '\')',200);

            }

            window.status = '';

        }

    }

    return true;
}

//=================================================================================================

function fncFesMosChangeStateOff(prm_id, prm_id2, prm_id3, prm_id4)
//
// Function to switch images off on  mouseout
//
// Arguments
//
//  prm_id          string used to uniquely identify menu option
//  prm_id2         string used to uniquely identify 2nd mouseover image
//  prm_id3         string used to uniquely identify 3rd mouseover image
//  prm_id4         string used to uniquely identify 4th mouseover image
//
{

    document[prm_id].src = pub_fes_mos_options[prm_id].ImgOff.src;
    document[prm_id2].src = pub_fes_mos_options[prm_id].ImgOff2.src;
    document[prm_id3].src = pub_fes_mos_options[prm_id].ImgOff3.src;

    if (prm_id4 != "")
    {
        document[prm_id4].src = pub_fes_mos_options[prm_id].ImgOff4.src;

    }

    return true;
}

var pub_fes_tab_options = new Array();
var pub_fes_tab_preloaded = false;
var pub_fes_tab_active = 4;

// Preload tab images

// Parameters:

//      prm_id = name of image tag
//      prm_img = name of GIF to be associated

//=================================================================================================

function fncFesTabPreLoad(prm_id,prm_img)
//
// Function to preload images for tab effects
//
// Arguments
//
//  prm_id          string used to uniquely identify tab option in the array
//  prm_img         image name
//
{

    if(!document.images)
    {
        return false;

    }

    else
    {
        pub_fes_tab_options[prm_id] = new fncFesTabCreateOptionArrayElement(prm_id,prm_img);
        return true;

    }

}

//=================================================================================================

function fncFesTabCreateOptionArrayElement(prm_id,prm_img)
//
// Function to create new image tab option array element and load image button objects
// accordingly
//
// Arguments
//
//  prm_id          string used to uniquely identify tab option in the array
//  prm_img         image name
//
{
    this.Id = prm_id;
    this.ImgOff = new Image;
    this.ImgOn = new Image;

// Split image file into name and file extension

    loc_image_name = prm_img;
    loc_file_ext = loc_image_name.substr(loc_image_name.lastIndexOf("."));
    loc_file_name = loc_image_name.substr(0,loc_image_name.lastIndexOf("."));

// Set up properties for image without tab and image with tab

    this.ImgOff.src = loc_file_name + loc_file_ext;
    this.ImgOn.src = loc_file_name + '_on' + loc_file_ext;

}

//=================================================================================================

function fncFesTabChangeState(prm_base_id,prm_tabno)
//
// Function to create perform image swapping for tab and mouseout events
//
// Arguments
//
//  prm_base_id          string used to uniquely identify tab group
//  prm_tabno            number of tab clicked
//
{

    if (document.images && pub_fes_tab_preloaded==true)
    {
        pub_fes_tab_active = prm_tabno;

        for (loc_tab = 1; loc_tab < 5; loc_tab++)
        {
            if (loc_tab == prm_tabno)
            {
                document[prm_base_id + loc_tab].src = pub_fes_tab_options[prm_base_id + loc_tab].ImgOn.src;
                document.getElementById(prm_base_id + loc_tab + 'text').style.display = "Block"
            }

            else
            {
                document[prm_base_id + loc_tab].src = pub_fes_tab_options[prm_base_id + loc_tab].ImgOff.src;
                document.getElementById(prm_base_id + loc_tab + 'text').style.display = "None"

            }

        }

    }

    return true;

}

//=================================================================================================

function fncFesTabMouseoverState(prm_base_id,prm_tabno,prm_on)
//
// Function to create perform image swapping for tab and mouseout events
//
// Arguments
//
//  prm_base_id          string used to uniquely identify tab group
//  prm_tabno            number of tab clicked
//
{

    if (document.images && pub_fes_tab_preloaded==true)
    {
        if (prm_on)
        {
            document[prm_base_id + prm_tabno].src = pub_fes_tab_options[prm_base_id + prm_tabno].ImgOn.src;
        }
        else
        {
            if (prm_tabno != pub_fes_tab_active)
            {
                document[prm_base_id + prm_tabno].src = pub_fes_tab_options[prm_base_id + prm_tabno].ImgOff.src;

            }

        }

    }

    return true;

}

//=================================================================================================

function fncFesToggleZoomerVideo(prm_id,prm_visible)
//
// Function to create perform image swapping for tab and mouseout events
//
// Arguments
//
//  prm_base_id          string used to uniquely identify tab group
//  prm_tabno            number of tab clicked
//
{

    loc_video = document.getElementById(prm_id);

    if (!loc_video) return false;

    if (prm_visible)
    {
debugDump(prm_id,"Setting block on");

        loc_video.style.display = "block";
    }
    else
    {
debugDump(prm_id,"Setting none on");

        loc_video.style.display = "none";
    }

    return true;

}

//-->
