<!--

//
// Script    :   fes_fg_functions.js
// Author    :   C.E. Berry
// Version   :   5.00.007
// Notes     :   Javascript function library for addional functions for Fantasy Pantied website.
//
//               All material contained within is the intellectual property of SysExcel Ltd.
//               and as such may not be reproduced in any way shape or form without the prior
//               consent of SysExcel Ltd.
//
// Amendment Log
//
//      Version     Date           Author              Notes
//      -------     ----           ------              -----
//
//      5.00.007    10/03/2010     C.E. Berry           Amended to fes_fg_functions.js from
//                                                      fes_fg_functions.php - making it generic to
//                                                      the FG sites
//
//      1.00        14/06/2006     C.E. Berry           Creation
//
//=================================================================================================
//
// 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;

// Preload images

// Parameters:

//      prm_id = name of image tag
//      prm_img = name of GIF to be associated
//      prm_status = text for the status line
//      prm_top = 1 for top level page, 0 for other

//=================================================================================================

function fncFesMosPreLoad(prm_id,prm_img,prm_img2,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_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_status);
        return true;

    }

}

//=================================================================================================

function fncFesMosCreateOptionArrayElement(prm_id,prm_img,prm_img2,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_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.ImgOn = new Image;
    this.ImgOn2 = 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("."));

// 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;

}

//=================================================================================================

function fncFesMosChangeState(prm_action, prm_id, prm_id2, 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_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 (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;

            }

            window.status = pub_fes_mos_options[prm_id].Status;

        }

       else
        {
            if (prm_imgswap)
            {
                document[prm_id].src = pub_fes_mos_options[prm_id].ImgOff.src;
                document[prm_id2].src = pub_fes_mos_options[prm_id].ImgOff2.src;

            }

            window.status = '';

        }

    }

    return true;
}


//-->
