<!--
//=================================================================================================
function fncFesGetEnvironment()
//
// Function to return information about the client environment e.g. operating system, browser
// type etc.

// Browser Vendor and Version upward compatibility
//
// ns4up            - Netscape 4 or higher
// ns6up            - Netscape 6 or higher
// ns7up            - Netscape 7 or higher
// ie4up            - Microsoft Internet Explorer 4 or higher
// ie5up            - Microsoft Internet Explorer 5 or higher
// ie5_5up          - Microsoft Internet Explorer 5.5 or higher
// ie6up            - Microsoft Internet Explorer 6 or higher
// opera5up         - Opera 5 or higher
// opera6up         - Opera 6 or higher
// opera7up         - Opera 7 or higher
// hotjava3up       - HotJava 3 or higher

{
// Get the Navigator properties

    this.useragent = navigator.userAgent;
    this.appname = navigator.appName;
    this.appversion = navigator.appVersion;

// Get the user agent string and convert all characters to lowercase to simplify testing

    var loc_usragt = navigator.userAgent.toLowerCase();

//=================================================================================================
//
// Browser Information
//
//=================================================================================================

// Get the browser major and minor version id's

    this.major_version = parseInt(navigator.appVersion);
    this.minor_version = parseFloat(navigator.appVersion);

// Set up browser values
//
// ns = Netscape Navigator

// Opera and WebTV spoof Navigator so have to eliminate them via specific search for the browser
// names in the user agent.

    this.ns  = ((loc_usragt.indexOf("mozilla")!= -1) &&
                (loc_usragt.indexOf("spoofer") == -1) &&
                (loc_usragt.indexOf("compatible") == -1) &&
                (loc_usragt.indexOf("opera") == -1) &&
                (loc_usragt.indexOf("webtv") == -1) &&
                (loc_usragt.indexOf("safari") == -1) &&
                (loc_usragt.indexOf("hotjava") == -1));

    this.ns2 = (this.ns &&
               (this.major_version == 2));

    this.ns3 = (this.ns &&
               (this.major_version == 3));

    this.ns4 = (this.ns &&
               (this.major_version == 4));

// Although Netscape 6/7 should have major versions of 6/7 they actually report a major version
// of 5

    this.ns6 = (this.ns &&
                this.major_version == 5 &&
                loc_usragt.indexOf("netscape 7") == -1 &&
                loc_usragt.indexOf("netscape/7") == -1);

    this.ns7 = (this.ns &&
                this.major_version == 5 &&
               (loc_usragt.indexOf("netscape 7") != -1 ||
                loc_usragt.indexOf("netscape/7") != -1));

    this.ns4up = (this.ns &&
                 (this.major_version >= 4));

    this.ns6up = (this.ns &&
                 (this.major_version >= 5));

    this.ns7up = (this.ns &&
                  this.major_version == 5 &&
                 (loc_usragt.indexOf("netscape 7") != -1 ||
                  loc_usragt.indexOf("netscape/7") != -1));

    this.nsonly =  (this.ns &&
                  ((loc_usragt.indexOf(";nav") != -1) ||
                   (loc_usragt.indexOf("; nav") != -1)));

    this.gecko = (loc_usragt.indexOf("gecko") != -1 &&
                  loc_usragt.indexOf("safari") != -1);

// ie = Internet Explorer

    this.ie      = ((loc_usragt.indexOf("msie") != -1) &&
                    (loc_usragt.indexOf("opera") == -1));

    this.ie3     = (this.ie &&
                   (this.major_version < 4));

// Although Internet Explorer 4, 5, 5.5 and 6 should have a major versions of 4, 5, 5 and 6
// respectively they all report a major version of 4 so need to search the user agent string for
// specific names for each of them.

    this.ie4     = (this.ie &&
                   (this.major_version == 4) &&
                   (loc_usragt.indexOf("msie 4")!=-1));

    this.ie5     = (this.ie &&
                   (this.major_version == 4) &&
                   (loc_usragt.indexOf("msie 5.0")!=-1));

    this.ie5_5   = (this.ie &&
                   (this.major_version == 4) &&
                   (loc_usragt.indexOf("msie 5.5") !=-1));

    this.ie6     = (this.ie &&
                   (this.major_version == 4) &&
                   (loc_usragt.indexOf("msie 6.")!=-1) );

    this.ie4up   = (this.ie  &&
                   (this.major_version >= 4));

    this.ie5up   = (this.ie  &&
                   !this.ie3 &&
                   !this.ie4);

    this.ie5_5up = (this.ie &&
                   !this.ie3 &&
                   !this.ie4 &&
                   !this.ie5);

    this.ie6up   = (this.ie  &&
                   !this.ie3 &&
                   !this.ie4 &&
                   !this.ie5 &&
                   !this.ie5_5);

// aol = America Online - note that on AOL4 the test returns false if IE3 is the embedded browser
// or if this is the first browser window opened. Therefore the aol, aol3 and aol4 variables are
// not completely reliable

    this.aol   = (loc_usragt.indexOf("aol") != -1);

    this.aol3  = (this.aol &&
                  this.ie3);

    this.aol4  = (this.aol &&
                  this.ie4);

    this.aol5  = (loc_usragt.indexOf("aol 5") != -1);

    this.aol6  = (loc_usragt.indexOf("aol 6") != -1);

// opera = Opera

    this.opera =  (loc_usragt.indexOf("opera") != -1);

    this.opera2 = (loc_usragt.indexOf("opera 2") != -1 ||
                   loc_usragt.indexOf("opera/2") != -1);

    this.opera3 = (loc_usragt.indexOf("opera 3") != -1 ||
                   loc_usragt.indexOf("opera/3") != -1);

    this.opera4 = (loc_usragt.indexOf("opera 4") != -1 ||
                   loc_usragt.indexOf("opera/4") != -1);

    this.opera5 = (loc_usragt.indexOf("opera 5") != -1 ||
                   loc_usragt.indexOf("opera/5") != -1);

    this.opera6 = (loc_usragt.indexOf("opera 6") != -1 ||
                   loc_usragt.indexOf("opera/6") != -1);

    this.opera7 = (loc_usragt.indexOf("opera 7") != -1 ||
                   loc_usragt.indexOf("opera/7") != -1);

    this.opera5up = (this.opera &&
                    !this.opera2 &&
                    !this.opera3 &&
                    !this.opera4);

    this.opera6up = (this.opera &&
                    !this.opera2 &&
                    !this.opera3 &&
                    !this.opera4 &&
                    !this.opera5);

    this.opera7up = (this.opera &&
                    !this.opera2 &&
                    !this.opera3 &&
                    !this.opera4 &&
                    !this.opera5 &&
                    !this.opera6);
// safari = Safari

    this.safari = (loc_usragt.indexOf("safari") != - 1);

// webtv = WebTV

    this.webtv = (loc_usragt.indexOf("webtv") != -1);

    this.tvnavigator = ((loc_usragt.indexOf("navio") != -1) ||
                        (loc_usragt.indexOf("navio_aoltv") != -1));

    this.aoltv = this.tvnavigator;

// hotjava - HotJava (Sun)

    this.hotjava = (loc_usragt.indexOf("hotjava") != -1);

    this.hotjava3 = (this.hotjava &&
                    (this.major_version == 3));

    this.hotjava3up = (this.hotjava &&
                      (this.major_version >= 3));

}
//=================================================================================================

var pub_contextmenu_message="Sorry, this image is copyrighted";

//=================================================================================================

function fncFesHandleContextMenuForImages(prm_event)
//
// Function to disable right mouse click context menu for images only
//
// Arguments
//
//  prm_event - in this instance equates to mouse key pressed
//

{


// The script pops up an alert box with a 'message' or if no message is passed just returns
// without any action

// Internet Explorer 4 - test for mouse button press

    if (fes_environment.ie4)
    {
        if (event.button == 2 || event.button == 3)
        {
            if (event.srcElement.tagName == "IMG")
            {
                if (pub_contextmenu_message != "")
                {
                    alert(pub_contextmenu_message);

                }

                return false;

            }

        }

    }

// Internet Explorer 5 upwards

    else if (fes_environment.ie5up)
    {
        if (event.srcElement.tagName == "IMG")
        {
            if (pub_contextmenu_message != "")
            {
                alert(pub_contextmenu_message);

            }

            return false;

        }

    }

// Netscape 4 - test for mouse button press

    else if (fes_environment.ns4)
    {
        if (prm_event.which == 3)
        {
            if (pub_contextmenu_message != "")
            {
                alert(pub_contextmenu_message);

            }

            return false;

        }

    }

// Netscape 6

    else if (fes_environment.ns6up)
    {
        if (prm_event.target.tagName == "IMG")
        {
            if (pub_contextmenu_message != "")
            {
                alert(pub_contextmenu_message);

            }

            return false;

        }

    }

// Opera 6 upwards - not currently functional due to bug in Opera apparently

    else if (fes_environment.opera6up)
    {
        if (prm_event.which == 3 && prm_event.target.tagName == "IMG")
        {
            if (pub_contextmenu_message != "")
            {
                alert(pub_contextmenu_message);

            }

            return false;

        }

    }

}
//=================================================================================================

function fncFesAssociateImages()

//
// Function to associate mousedown event on images with context menu handler - used for Netscape
// 4 only.
//
// Arguments
//
//  None
//

{
    for(loc_counter = 0; loc_counter < document.images.length; loc_counter++)
    {
       document.images[loc_counter].onmousedown = fncFesHandleContextMenuForImages;

    }

}

//=================================================================================================

function fncFesDisableContextMenuForImages()

//
// Function to invoke the disabling of the right mouse click context menu for images only
//
// Arguments
//
//  None
//

{
    if (fes_environment.ie4)
    {
        document.onmousedown = fncFesHandleContextMenuForImages;

    }

    else if (fes_environment.ie5up)
    {
        document.oncontextmenu = fncFesHandleContextMenuForImages;

    }

    else if (fes_environment.ns6up)
    {
        document.oncontextmenu = fncFesHandleContextMenuForImages;

    }

    else if (fes_environment.opera6up)
    {
        document.onmouseup = fncFesHandleContextMenuForImages;

    }

    else if (fes_environment.ns4)
    {
        fncFesAssociateImages();

    }

}
//=================================================================================================

function fncFesDisableCopyText()

//
// Function to disable the copying of text via select and copy on an HTML page
//
// Arguments
//
//  None
//

{

// Note that there is currently a cludge in here for Safari - need to test when we can afford a Mac

    if ((fes_environment.ie4up ||
         fes_environment.opera6up) &&
         !fes_environment.safari)
    {
        document.onselectstart=new Function ("return false");

    }

    else if (fes_environment.ns6up &&
            !fes_environment.safari)
    {
        document.onmousedown=new Function ("return false");
        document.onclick=new Function ("return true");

    }

}

//=================================================================================================

// Set up environment object

    var fes_environment = new fncFesGetEnvironment();
//-->
