function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {  // if window.onload has already happened
		window.onload = func;
	} else { // if it's our FIRST function (window not yet loaded)
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


function preloader() {
     imageObj = new Image();

     imageArray = new Array();
     imageArray[0]="images/gallery/pic_0.jpg"
     imageArray[1]="images/gallery/pic_1.jpg"
     imageArray[2]="images/gallery/pic_2.jpg"
     imageArray[3]="images/gallery/pic_3.jpg"
	 imageArray[4]="images/gallery/pic_4.jpg"
     imageArray[5]="images/gallery/pic_5.jpg"
     imageArray[6]="images/gallery/pic_6.jpg"
	 imageArray[7]="images/gallery/pic_7.jpg"

     for(var i = 0; i < imageArray.length; i++) 
     {
          imageObj.src=imageArray[i];
     }
	 addImage();
} 



//The array of alt descriptions used.
var altArray = new Array('Gallery Image 0','Gallery Image 1','Gallery Image 2','Gallery Image 3','Gallery Image 4','Gallery Image 5','Gallery Image 6','Gallery Image 7');

function swapimage(state) {
	//alert('development note 1');
	if (!document.getElementsByTagName) return false; // DOM compatability check
	var images = document.getElementById("searchbut");
	if(state == 'over'){
		//alert('development note 2: OVER');
		images.setAttribute("src", "http://www.simonthornton.co.uk/btns/nav_m_02_over.gif");
	} else {
		//alert('development note 2: OUT');
		images.setAttribute("src", "http://www.simonthornton.co.uk/btns/nav_m_02.gif");
	}	
}