/* Browser detection.  Makes sure that browser used is compatible with Javascript code */
var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion);


/* Checks to see if browser is compatible with code */
function browserOK()
{
	if ((browserName=="Netscape" && browserVer>=3) || (browserName=="Microsoft Internet Explorer" && browserVer>=4))
		return true;
	else
		return false;
}

  
/* Funtion to preload images */
var objCount = 0; // number of (changing) images on web-page
var pics = new Array();

function preloadImage(imgName, upImg, downImg)
{  
	// preload images and place them in an array
	if (browserOK())
	{
	    pics[objCount] = new Array(3);
	    pics[objCount][0] = new Image();
	    pics[objCount][0].src = upImg;
	    pics[objCount][1] = new Image();
	    pics[objCount][1].src = downImg;
	    pics[objCount][2] = imgName;
	    objCount++;
	}
}


/* Swap image on mouseOver() event */
function on(imgName)
{
	if (browserOK())
	{
    	for (i = 0; i < objCount; i++)
		{
	    	if (document.images[pics[i][2]] != null)
        		if (imgName != pics[i][2])
				{ 
          			// Restore all other pictures
          			document.images[pics[i][2]].src = pics[i][0].src;
        		}
				else
				{
           			// Display the second image
           			document.images[pics[i][2]].src = pics[i][1].src;
        		}
    	}
  	}
}

/* Restore image on mouseOut() event */
function off()
{
	if (browserOK())
	{
    	for (i = 0; i < objCount; i++)
		{
	    	// Restore all pictures
	    	if (document.images[pics[i][2]] != null) 
    		    document.images[pics[i][2]].src = pics[i][0].src;
    	}
  	}
}
  
/* Used on drop down menus.  Jumps to selected URL. */
function jumpURL(form)
{  
	if (browserOK())
		if (form.URL.selectedIndex != 0)
			location = form.URL.options[form.URL.selectedIndex].value;

	return true;
};


