function chgImg(imgField,newImg,divname,colorname) {
		if (document.images) {
			document[imgField].src= eval(newImg + ".src")
			changecolor(divname,colorname)
		}
		}	
		searchcollectionsa = new Image
		searchcollectionsb = new Image
		searchcollectionsa.src = "../global/searchcollections.gif"
		searchcollectionsb.src = "../global/searchcollections_over.gif"
		
		askjoanofarta = new Image
		askjoanofartb = new Image
		askjoanofarta.src = "../global/askjoan.gif"
		askjoanofartb.src = "../global/askjoan_over.gif"
		
		artinformationresourcesa = new Image
		artinformationresourcesb = new Image
		artinformationresourcesa.src = "../global/artinfo.gif"
		artinformationresourcesb.src = "../global/artinfo_over.gif"
		
		photoa = new Image
		photob = new Image
		photoa.src = "../global/photo.gif"
		photob.src = "../global/photo_over.gif"
		
		researcha = new Image
		researchb = new Image
		researcha.src = "../global/research.gif"
		researchb.src = "../global/research_over.gif"
		
		planninga = new Image
		planningb = new Image
		planninga.src = "../global/planningyourvisit.gif"
		planningb.src = "../global/planningyourvisit_over.gif"

		collectionsa = new Image
		collectionsb = new Image
		collectionsa.src = "../global/collectionsandexhibitions.gif"
		collectionsb.src = "../global/collections_over.gif"
		
		aboutmusa = new Image
		aboutmusb = new Image
		aboutmusa.src = "../global/aboutthemuseum.gif"
		aboutmusb.src = "../global/aboutmuseum_over.gif"

		aboutrena = new Image
		aboutrenb = new Image
		aboutrena.src = "../global/abouttherenwick.gif"
		aboutrenb.src = "../global/aboutrenwick_over.gif"
		
		teacherstuda = new Image
		teacherstudb = new Image
		teacherstuda.src = "../global/teachersandstudents.gif"
		teacherstudb.src = "../global/teachersstudents_over.gif"

		supportusa = new Image
		supportusb = new Image
		supportusa.src = "../global/supportus.gif"
		supportusb.src = "../global/supportus_over.gif"

		pressrooma = new Image
		pressroomb = new Image
		pressrooma.src = "../global/pressroom.gif"
		pressroomb.src = "../global/pressroom_over.gif"


var n4, ie, n6;

/* detecting browser support for certain key objects/methods and 
assembling a custom document object */

var doc,doc2,doc3,sty;

if (document.layers) {
  doc = "document.";
  doc2 = ".document.";
  doc3 = "";
  sty = "";
  n4 = true;
  }
else if (document.all) {
  doc = "document.all.";
  doc2 = "";
  doc3 = "";
  sty = ".style";
  ie = true;
}

else if (document.getElementById) {
  doc = "document.getElementById('";
  doc2 ="')";
  doc3 ="')";
  sty = "').style";
  n6 = "true";
 } 
 
// mouse over (on) and mouseoff(off) color values
var oncolor = "#000000";
var offcolor = "#FFC210";

function changecolor(divname,colorname) {
stopall();
if (!n4) {
menuObj = eval(doc + divname + sty);
menuObj.backgroundColor = colorname;
  }
}

// show or hide DIV element
function showhide(divname,state) {
if (n4) {
divObj = eval (doc + divname);
 }
else {
divObj = eval (doc + divname + sty);
}
divObj.visibility = state;
}


// variables that hold the value of the currently active (open) menu
var active_submenu1 = null;
var active_submenu2 = null;
var active_menuelem = null;
var active_topelem = null;

// function closes all active menus and turns back to 'off' state
function closeallmenus() {
if(active_submenu1 != null) {
  showhide(active_submenu1,'hidden');
  }
if(active_submenu2 != null) {
  showhide(active_submenu2,'hidden');
  }
if(active_menuelem != null) {
  changecolor(active_menuelem,offcolor);
  }
if(active_topelem != null) {
  onoff('mainmenu',active_topelem,'off');
  }
}

// the menu close timeout variable
var menu_close_timeout = 0;

// delay in miliseconds until the open menus are closed
var delay = 400;

// function calls the closeallmenus() function after a delay
function closeall() {
menu_close_timeout = setTimeout('closeallmenus()',delay);
}

// stop all timeout functions (stops menus from closing)
function stopall() {
clearTimeout(menu_close_timeout);
}

// function controls submenus 
function controlsubmenu(submenu1,submenu2,menuelem,topelem) {
stopall();
closeallmenus();
if (submenu1 != null) {
  showhide(submenu1,'visible');
  active_submenu1 = submenu1;
  }
}


