<!--
     var d=document.getElementById;
//for image cycling
     var cpos = 1;
//set up arrays for images and text
  	 var exal;
	 exL1 = new Array(); 
	 exL2 = new Array(); 
	 exL3 = new Array();
     np = new Array();
	 var dir4;
	 var currloc
	 var dir;
	 var dir2;
	 var dir3;
	 
//test if page has changed to see whether we cahnge the 'page x of y' at the bottom of the scroll box	 
	var haspagechanged = false;
	
//setup the array of the bar images for the top of the screen	 
	var imag;
	images = new Array
	images[0] = '../images/bar/0.jpg'
	images[1] = '../images/bar/1.jpg'
	images[2] = '../images/bar/2.jpg'
	images[3] = '../images/bar/3.jpg'
	images[4] = '../images/bar/4.jpg'
	


   

//GENERAL FUNCTIONS FOR THE SITE
//-------------------------------------------------------------------------------------------------
//=================================================================================================

//show a hudden object
function show(object) {
	if (document.layers) document.layers[object].visibility = 'show';
	if (document.getElementById) document.getElementById(object).style.visibility = 'visible';
	if (document.all) document.all[object].style.visibility = 'visible';
}

//hide an object
function hide(object) {
	if (document.layers) document.layers[object].visibility = 'hide';
	if (document.getElementById) document.getElementById(object).style.visibility = 'hidden';
	if (document.all) document.all[object].style.visibility = 'hidden';
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function goDisplay(menu, colx) {
//function to put drop down menus in the right place 
 var obj = document.getElementById('col1');
  if (colx=="c1") 
   {obj = document.getElementById('col1')}
  else if (colx=="c2") 
   {obj = document.getElementById('col2')}
  else if (colx=="c3") 
   {obj = document.getElementById('col3')}
  else if (colx=="c4") 
   {obj = document.getElementById('col4')}
  else if (colx=="c5") 
   {obj = document.getElementById('col5')}
  document.getElementById(menu).style.left = findPosX(obj) -132 + 'px';
//    document.getElementById(menu).style.left = findPosX(obj) -1 + 'px';
  document.getElementById(menu).style.top = findPosY(obj)+ 33 + 'px';
  show(menu);
  }

//calculate the left position of the object
 function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
	 return curleft;
   }
   
//calculate the top position of the object   
    function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
   	 return curtop;
   }
   
//function to change the header bar randomly
function changeTop(){
do {
imag = Math.round(Math.random() * 10)}
while (imag > 4);
document.getElementById('topimagediv').innerHTML = '<img src="' + images[imag] + '" width="760" alt="FifeX Custom interactive hands-on exhibits" />';
}


//IMAGE CYCLING FOR THE EXHIBIT / EXHIBITION SCROLLER
//-------------------------------------------------------------------------------------------------
//=================================================================================================

function changeim() {
 	                     //change the image down the left and other things
						  haspagechanged = true;
						  currloc = window.location + ""; //location that we're at
						  d_loc = currloc.indexOf("_"); //find the first instance of _ which is the main directory
						  dir = currloc.substring(d_loc - 1, d_loc); //find whether section a, b, c etc
						  dir2 = currloc.substring(d_loc + 1, d_loc + 4); //find whether zex or zes
						  dir3 = currloc.substring(0, currloc.lastIndexOf(".")) //now make a new substring with everything up to the .file extension
						  dir4 = dir3.substring(dir3.lastIndexOf("_") + 1)
						    if (dir4.length > 2){dir4 = 'default'} //this is the case if there is no page number within exhibits, i.e. if we are on the first page
								if (dir == "a")
						     {document.getElementById('menu1').src = "../images/images/bar_OR_s1_dn.png"}
						    else if (dir == "b")
						     {document.getElementById('menu2').src = "../images/images/bar_OR_s2_dn.png"}
							else if (dir == "c")
						     {document.getElementById('menu4').src = "../images/images/bar_OR_s4_dn.png"}
							else if (dir == "d")
						     {document.getElementById('menu3').src = "../images/images/bar_OR_s3_dn.png"}
							else if (dir == "f")
						     {document.getElementById('menu5').src = "../images/images/bar_OR_s5_dn.png"}
						 
														
   			 //close function
				}
								

	 
  function loadPage(){
  //ok, take the page location and seperate it out cos this will provide you with the last image that was in the middle of the scroll
	var nom
	wloc = window.location.href + ""; //full page address
	qpl = wloc.lastIndexOf("?"); //find the last instance of ?
	if (qpl == -1) {nom = 2}  //if it doesn't exist, use 3
	else 
	nom = wloc.substring(qpl + 1);
	np[3] = Number(nom)
	np[2] = np[3] - 1
	np[1] = np[3] - 2
	np[4] = np[3] + 1
	np[5] = np[3] + 2
	goCheck()
	}
	 
   function goChange(dir){
   //np is to set the NEW values
     if(dir == 'right') {
     np[2] = Number(cpos); //2nd image now becomes what was the middle
	 np[1] = np[2] - 1;	
  	 np[3] = np[2] + 1;
	 np[4] = np[2] + 2;
	 np[5] = np[2] + 3;
     }
    if(dir == 'left') {
     np[4] = Number(cpos);	//4th image becomes what was the middle
	 np[5] = np[4] + 1;  
	 np[1] = np[4] - 3;
	 np[2] = np[4] - 2;
	 np[3] = np[4] - 1; 
     }
   goCheck()
	 }
	 
   function goCheck(){ 
	  for (a=1; a<6; a++) //do it as a loop here
	  { 
	  if (np[a]>exal) 
	    {np[a] = (np[a] - exal - 1)} //go to start of array if greater than array length
	  if (np[a]<0) 
	    {np[a] = (exal + np[a])} //go to end of array if less than zero
	  }
	 if (exL1[np[3]] != undefined)
	 document.getElementById('infobx').innerHTML = 'Click&nbsp;to&nbsp;scroll'
	 //do this if those images are all present and working, otherwise, stick with what's on the page
	  {
	cpos = np[3];  
	document.getElementById('pic1').innerHTML = '<a href = "/c_zex/ex_' + exL1[np[1]] + '.php?' + cpos + '"><img width="80" height="60" class="imagecycle" border="0" src="/c_zex/menuimages/' + exL1[np[1]] + '.jpg" alt="' + exL2[np[1]] + ', ' + exL3[np[1]]+ ' - (Exhibit no. ' + np[1] + ')" title="' + exL2[np[1]] + ', ' + exL3[np[1]]+ ' - (Exhibit no. ' + (np[1] + 1) + ')" /><br />' + (np[1] + 1) + '. ' + exL2[np[1]] + '</a>';
	document.getElementById('pic2').innerHTML = '<a href = "/c_zex/ex_' + exL1[np[2]] + '.php?' + cpos + '"><img width="80" height="60" class="imagecycle" border="0" src="/c_zex/menuimages/' + exL1[np[2]] + '.jpg" alt="' + exL2[np[2]] + ', ' + exL3[np[2]]+ ' - (Exhibit no. ' + np[2] + ')" title="' + exL2[np[2]] + ', ' + exL3[np[2]]+ ' - (Exhibit no. ' + (np[2] + 1) + ')" /><br />' + (np[2] + 1) + '. ' + exL2[np[2]] + '</a>'; 
	document.getElementById('pic3').innerHTML = '<a href = "/c_zex/ex_' + exL1[np[3]] + '.php?' + cpos + '"><img width="80" height="60" class="imagecycle" border="0" src="/c_zex/menuimages/' + exL1[np[3]] + '.jpg" alt="' + exL2[np[3]] + ', ' + exL3[np[3]]+ ' - (Exhibit no. ' + np[3] + ')" title="' + exL2[np[3]] + ', ' + exL3[np[3]]+ ' - (Exhibit no. ' + (np[3] + 1) + ')" /><br />' + (np[3] + 1) + '. ' + exL2[np[3]] + '</a>'; 
	document.getElementById('pic4').innerHTML = '<a href = "/c_zex/ex_' + exL1[np[4]] + '.php?' + cpos + '"><img width="80" height="60" class="imagecycle" border="0" src="/c_zex/menuimages/' + exL1[np[4]] + '.jpg" alt="' + exL2[np[4]] + ', ' + exL3[np[4]]+ ' - (Exhibit no. ' + np[4] + ')" title="' + exL2[np[4]] + ', ' + exL3[np[4]]+ ' - (Exhibit no. ' + (np[4] + 1) + ')" /><br />' + (np[4] + 1) + '. ' + exL2[np[4]] + '</a>'; 
	document.getElementById('pic5').innerHTML = '<a href = "/c_zex/ex_' + exL1[np[5]] + '.php?' + cpos + '"><img width="80" height="60" class="imagecycle" border="0" src="/c_zex/menuimages/' + exL1[np[5]] + '.jpg" alt="' + exL2[np[5]] + ', ' + exL3[np[5]]+ ' - (Exhibit no. ' + np[5] + ')" title="' + exL2[np[5]] + ', ' + exL3[np[5]]+ ' - (Exhibit no. ' + (np[5] + 1) + ')" /><br />' + (np[5] + 1) + '. ' + exL2[np[5]] + '</a>';
          if (haspagechanged == true) { //ie the user has loaded a new page rather than just scrolling through the images
		  if (dir4 != 'default') 
		        {for (i=0; i<(exal+1) ;i++)
				    {//do a reference back from the array to find out what page we are on
					  if (exL1[i] == dir4)
						  document.getElementById('infobx').innerHTML = 'Browse our portfolio (' + exal + ' pages)'
					}
				}
		   else {document.getElementById('infobx').innerHTML = 'Click&nbsp;to&nbsp;scroll'}
	       haspagechanged = false
		   }//do nothing if the page has not changed
		}//shut the check for ex section
		 		 
  //shut function
  }
  -->
