//Declare a counter (c) and an array (imgSrc) to cycle the images in the banner
var c=0;
var imgSrc = new Array();

//var isrunning = 0;

function bannerChange()						 //Processes the changing pictures in the header file
{
  var strURL=document.URL;				 //Check the location of the main page being loaded
  if (strURL.match("CUGG/COSHH")==null){	 		 //If it isn't in the folder CUGG/COSHH
  imgSrc[0] = 'images/IMG_0167_s.jpg';				 //Then the route to the image folder is simple
  imgSrc[1] = 'images/MM050606000002_s.jpg';
  imgSrc[2] = 'images/MM050606000016_s.jpg';
  imgSrc[3] = 'images/MM050606000019_s.jpg';	 
	//Add more images if required, copy the previous line & increment the [number], quote the new filename.jpg
	//...(make sure the picture is in the 'images' folder
	//The source image must be of the correct dimensions: 766 pixels wide x 232 pixels high
  }
  else																				 //Otherwise we need to re-map the call to the image files
  {
  imgSrc[0] = '../../images/IMG_0167_s.jpg';	 						 //Go back up through two folders...
  imgSrc[1] = '../../images/MM050606000002_s.jpg';				 //Then map the images folder
  imgSrc[2] = '../../images/MM050606000016_s.jpg';
  imgSrc[3] = '../../images/MM050606000019_s.jpg';				  
	//Add more images if required, copy the previous line & increment the [number], quote the new filename.jpg
	//...(make sure the picture is in the 'images' folder
	//The source image must be of the correct dimensions: 766 pixels wide x 232 pixels high
  }

  var x = document.getElementById("hdr");									 //The table cell that holds the pictures has an ID of "hdr"
		x.style.backgroundImage="url("+imgSrc[c]+")";					 //Set the bacground image to the 
		x.style.backgroundRepeat="no-repeat";

  t=setTimeout("bannerChange()",5000);
  c=c+1
  if (c==imgSrc.length) //When c gets to the max value, 
  {c=0};								//Start the loop again
}



function vachover() {						//Processes the change in appearance of the 'Vacancies' Button, when the mouse hovers over
var strURL=document.URL;				 //Check the location of the main page being loaded
var vac=document.getElementById("vac");					 //The list element containing 'Vacancies' has an ID of "vac"  
  if (strURL.match("CUGG/COSHH")==null)					 
    {  
      vac.style.backgroundImage="url(glossyback2b.gif)";
    }			//was ...2p.gif
    else								 			  //The password protected page is being displayed, so the path to the button images is more complex
    {
      vac.style.backgroundImage="url(../../glossyback2b.gif)";
    }
}


function vacout() {						  //Processes the change in appearance of the 'Vacancies' Button, when the mouse leaves
var strURL=document.URL;				 //Check the location of the main page being loaded
var vac=document.getElementById("vac");					 //The list element containing 'Vacancies' has an ID of "vac"
  if (strURL.match("CUGG/COSHH")==null)
    { 
      vac.style.backgroundImage="url(glossybackp.gif)";
		}
		else  										  //The password protected page is being displayed, so the path to the button images is more complex
		{
      vac.style.backgroundImage="url(../../glossybackp.gif)";
		}
}
