
// clear the 'loading' image for the main photo
var mainImageLoaded = function(img){
	// reset the cursor
	document.body.style.cursor = 'default';
	// turn off the loading message
	var loadmsg = document.getElementById('loading');
	loadmsg.style.visibility = 'hidden';
	
	var photod = document.getElementById('photodisplay');
	if (browser == 0) {
		photod.style.opacity=1;
	} else {
		photod.filters.item('DXImageTransform.Microsoft.Alpha').enabled = 0;
	}
}


var setSrc = function(newurl,img,idx,newdate) {
	// clear the border on the last image selected
	var lastimg = document.getElementById(last_selected);
	lastimg.style.borderColor = '#FFFFFF';
	// set the new last image (the current image)
	last_selected = idx;
	// set the clicked image border to red
	img.style.borderColor = '#FF0000';
	// switch the image source for the main photo
	var mainimg = document.getElementById('mainimage');
	var imgsource = "http://www.amaccessautowatch.com/resize_image.php?max_width=460&image=" + newurl
	// show the loading image first
	var photod = document.getElementById('photodisplay');
	if (browser == 0) {
		photod.style.opacity=0.4;
	} else {
		photod.filters.item('DXImageTransform.Microsoft.Alpha').enabled = 1;
	}
	// display a loading message
	var loadmsg = document.getElementById('loading');
	loadmsg.style.visibility = 'visible';
	mainimg.src = imgsource;
	// change the last update date/time
	var lu = document.getElementById('lastupdate');
	lu.innerHTML = newdate;
	// change the image alt tag
	mainimg.alt = 'Photo from ' + newdate;
	mainimg.title = 'Photo from ' + newdate;
	// display a wait cursor until the image is done re-loading
	document.body.style.cursor = 'wait';

}

var msieversion = function()
{
   var ua = window.navigator.userAgent
   var msie = ua.indexOf ( "MSIE " )

   if ( msie > 0 )      // If Internet Explorer, return version number
      return parseInt (ua.substring (msie+5, ua.indexOf (".", msie )))
   else                 // If another browser, return 0
      return 0
}

