// declare our variables, fairly self explanatory

var image_directory = 'Media/Images/';
var extension = 'gif';
var rollover_state = new Array('out','over');

function preLoadImages()
{
	// Does the browser understand image objects?
	if(document.images)
	{
		var argLength = arguments.length;
	    for(var i = 0; i < argLength; i++)
	    {
	    	var arg = arguments[i];
	      	var stateLength = rollover_state.length;
	      	for(j = 0; j < stateLength; j++)
	      	{
	        	var suffix = rollover_state[j]
	        	self[arg + '_' + suffix] = new Image();
	       		self[arg + '_' + suffix].src = image_directory + arg + '_' + suffix + '.' + extension;
	      	}
	    }
	}
}

function rollOver(baseImageName, changeTo)
{
  if(document.images && self[baseImageName + '_' + changeTo])
  {
    document.images[baseImageName].src = self[baseImageName + '_' + changeTo].src;
  }
}

var type = "IE";	//Variable used to hold the browser name

BrowserSniffer();

function BrowserSniffer() {
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";		//Opera
	else if (document.all) type="IE";														//Internet Explorer e.g. IE4 upwards
	else if (document.layers) type="NN";													//Netscape Communicator 4
	else if (!document.all && document.getElementById) type="MO";							//Mozila e.g. Netscape 6 upwards
	else type = "IE";		//I assume it will not get here
}

function ShowLayer(id, action){
	if (type=="IE") eval("document.all." + id + ".style.visibility='" + action + "'");
	if (type=="NN") eval("document." + id + ".visibility='" + action + "'");
	if (type=="MO" || type=="OP") eval("document.getElementById('" + id + "').style.visibility='" + action + "'");
}