
// canManipulateImages - check if the browser we're using can do
// clever stuff with document images.

function canManipulateImages() {
	if (document.images)
		return true;
	else
		return false;
}
var imgWait;
var cnt;
var x = 10;
function swapImage(ai,imageURL,w,h) {
	if (gImageCapableBrowser &&
			(cnt != imageURL)
	) {
		cnt = imageURL;
		document.imageSwap.style.visibility = 'hidden';
		document.imageSwap.src = imageURL;
		lhref = ai.parentNode.href; 
		if(w && h) {
			document.imageSwap.width = w;  document.imageSwap.height = h; 
			document.imageSwap.style.width = w+'px';  document.imageSwap.style.height = h+'px'; 
		}
		if(document.all) {
      document.imageSwap.onload = initImage2; 
		} else {
      document.imageSwap.onload = initImage2(10);
		}
		document.getElementById('imageSwapAnchor').href = lhref;
		
		return false;
	}
	else {
		return true;
	}
}

function initImage2(x) {
   clearTimeout(imgWait);
   if(!x) { x = 10; }
	x+=10;
	document.imageSwap.style.visibility = 'visible';
	setOpacity(document.imageSwap,x);
	if(x < 100) {	imgWait = setTimeout("initImage3("+x+")", 100); }
	else { x = 10; }
}

function initImage3(x) {
   clearTimeout(imgWait);
   if(!x) { x = 10; }
	x+=10;
	document.imageSwap.style.visibility = 'visible';
	setOpacity(document.imageSwap,x);
	if(x < 100) {	imgWait = setTimeout("initImage2("+x+")", 100); }
	else { x = 10; }
}

function setOpacity(obj, opacity) { 
  opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
 obj.style.filter = "alpha(opacity:"+opacity+")"; 
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/101;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/101;
}

function dshowtrail() { }

// gImageCapableBrowser - is this browser hip to images? Set up
// a global variable so that we don't have to keep calling a function
// (useful if the function becomes costly to compute).

gImageCapableBrowser = canManipulateImages();

