﻿// JScript File

	var imagepreload = new Array();
	
	function showhidedetails()
    {
        var details;
        var button;
        details = document.getElementById('details');
        button = document.getElementById('showhidedetails');
        if (details != undefined)
        {
            if (details.style.display == 'none')
            {
                details.style.display = 'block';
                button.src = 'images/button_minus.gif';
            }
            else
            {
                details.style.display = 'none'
                button.src = 'images/button_plus.gif';
            }
        }        
    }

	function initialise()
	{
	    //start with details hidden (but only if javascript is enabled!)
        showhidedetails();

	    for (var i=0;i<imagepreload.length;i++)
	    {
		    //When the image objects source is set, the browser will load (and cache) the image.
		    var img1 = new Image();
		    img1.src = imagepreload[i];
	    }

	}

	//NOTE: uses naming convention to make highlight and unhoghlight easier
	
	function autoonmouseover(imagebutton) {
	    var imagepath;
	    imagepath = imagebutton.src;
	    imagebutton = imagebutton.src = imagepath.replace('dark','highlight');
	}

	function autoonmouseout(imagebutton) {
	    var imagepath;
	    imagepath = imagebutton.src;
	    imagebutton = imagebutton.src = imagepath.replace('highlight', 'dark');
	}

	function autoonmouseoverthumbnail(imagebutton) {
	    var imagepath;
	    imagepath = imagebutton.src;
	    imagebutton = imagebutton.src = imagepath.replace('_closeup_thumbnail', '_thumbnail');
	}

	function autoonmouseoutthumbnail(imagebutton) {
	    var imagepath;
	    imagepath = imagebutton.src;
	    imagebutton = imagebutton.src = imagepath.replace('_thumbnail', '_closeup_thumbnail');
	}

	function autoonclickbutton(imagebutton) {
	    var imagepath;
	    imagepath = imagebutton.src;
	    document.images['mainimage'].src = imagepath.replace('_button', '');
	}

    //These functions below called as last thing done on a page... so browser preloads mouse rollover images so when hover the image changes imediately
	
	function preloadmainmenuimages() {
	    var imagepreload = new Array();
	    imagepreload[0] = 'images/button_info_collection_highlight.gif';
	    imagepreload[1] = 'images/button_info_contact_highlight.gif';
	    imagepreload[2] = 'images/button_info_news_highlight.gif';
	    imagepreload[3] = 'images/button_info_samples_highlight.gif';
	    for (var i = 0; i < imagepreload.length; i++) {
	        //When the image objects source is set, the browser will load (and cache) the image.
	        var img1 = new Image();
	        img1.src = imagepreload[i];
	    }
	}

	function preloadthumbnailimages() {
	    var imagepreload = new Array();
	    imagepreload[0] = 'images/glove1_thumbnail.jpg';
	    imagepreload[1] = 'images/glove2_thumbnail.jpg';
	    imagepreload[2] = 'images/glove3_thumbnail.jpg';
	    imagepreload[3] = 'images/glove4_thumbnail.jpg';
	    imagepreload[4] = 'images/glove5_thumbnail.jpg';
	    imagepreload[5] = 'images/glove6_thumbnail.jpg';
	    imagepreload[6] = 'images/headpiece10_thumbnail.jpg';
	    imagepreload[7] = 'images/square_highlight.gif';
	    imagepreload[8] = 'images/info_reverse.gif';
	    imagepreload[9] = 'images/button_1_highlight.gif';
	    imagepreload[10] = 'images/button_2_highlight.gif';
	    imagepreload[11] = 'images/button_menu_highlight.gif';
	    imagepreload[12] = 'images/button_next_highlight.gif';
	    imagepreload[13] = 'images/button_previous_highlight.gif';
	    imagepreload[14] = 'images/home_reverse.gif';
	    for (var i = 0; i < imagepreload.length; i++) {
	        //When the image objects source is set, the browser will load (and cache) the image.
	        var img1 = new Image();
	        img1.src = imagepreload[i];
	    }
	}

	function preloadimageforbutton(imagebutton) {
	    var imagepath;
	    imagepath = imagebutton.src;
	    var img1 = new Image();
	    img1.src = imagepath.replace('_button', '')
	}
