function displayTransImage(strId, strPath, intWidth, intHeight, strClass, strAlt) {
	var pngAlpha = false;
	var pngNormal = false;
	
	// if IE5.5+ on Win32, then display PNGs with AlphaImageLoader
	if ((browser.isIE55 || browser.isIE6x || browser.isIE6up) && browser.isWin32)
		pngAlpha = true;
	else if ((browser.isGecko) || (browser.isAppleWebKit) || (browser.isIE7up) || (browser.isIE5up && browser.isMac) || (browser.isOpera && browser.isWin && browser.versionMajor >= 6) || (browser.isOpera && browser.isUnix && browser.versionMajor >= 6) || (browser.isOpera && browser.isMac && browser.versionMajor >= 5) || (browser.isOmniweb && browser.versionMinor >= 3.1) || (browser.isIcab && browser.versionMinor >= 1.9) || (browser.isWebtv) || (browser.isDreamcast))
		pngNormal = true;
	
	//decode and display accordingly.  If no support, display static gif
	if (pngAlpha)
		document.write('<div style="height:' + intHeight + 'px; width:' + intWidth + 'px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + strPath + '.png\', sizingMethod=\'scale\')" id="' + strId + '" class="' + strClass + '"></div>');
	else if (pngNormal)
		document.write('<img src="' + strPath + '.png" name="' + strId + '" border="0" class="' + strClass + '" alt="' + strAlt + '" />');
	else
		document.write('<img src="' + strPath + '.gif" name="' + strId + '" border="0" class="' + strClass + '" alt="' + strAlt + '" />');
}

function randomImageRotate(elemIda, elemIdb, imgList, len, sec, transition) {
	document.getElementById(elemIda).style.display = "block";
	document.getElementById(elemIdb).style.display = "block";
	randomImageRotater(elemIda, elemIdb, "first", imgList, len, sec, transition, 0);
}

function randomImageRotater(elemIda, elemIdb, curElem, imgList, len, sec, transition, rand) {
	var oldRand = rand;

	if (curElem == "first") {
		curElem = elemIdb;
		//if this is the first run through, setup our image a and b
		while (oldRand == rand)
			rand = Math.floor(Math.random() * len);
		oldRand = rand;
		document.getElementById(elemIda).style.backgroundImage = "url('" + imgList[rand] + "')";
		while (oldRand == rand)
			rand = Math.floor(Math.random() * len);
		document.getElementById(elemIdb).style.backgroundImage = "url('" + imgList[rand] + "')";
	} else {
		if (transition == "fade") {
			//change opacity
			if (curElem == elemIdb) { opacityChange(elemIda, 100, 0, 1000); }
			else { opacityChange(elemIda, 0, 100, 1000); }
		} else {
			//swap our images
			if (curElem == elemIdb) { document.getElementById(elemIda).style.visibility = "hidden"; }
			else { document.getElementById(elemIda).style.visibility = "visible"; }
		}

		//setup our image
		while (oldRand == rand)
			rand = Math.floor(Math.random() * len);
		document.getElementById(curElem).style.backgroundImage = "url('" + imgList[rand] + "')";

		//switch cur image
		if (curElem == elemIda) { curElem = elemIdb; } else { curElem = elemIda; }
	}

	//recurse
	var imgListTxt = "";
	for (i = 0; i < len; i++) { imgListTxt = imgListTxt + "'" + imgList[i] + "',"; }
	setTimeout("randomImageRotater('" + elemIda + "','" + elemIdb + "','" + curElem + "',[" + imgListTxt.substring(0, imgListTxt.length - 1) + "]," + len + "," + sec + ",'" + transition + "'," + rand + ")", (sec * 1000));
	//setTimeout(function (){randomImageRotater(elemIda, elemIdb, curElem, imgList, len, sec, transition, rand);}, sec * 1000);
}

function opacityChange(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 200);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if (opacStart > opacEnd) {
		for (i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
			timer++;
		}
	} else if (opacStart < opacEnd) {
		for (i = opacStart; i <= opacEnd; i++) {
			setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
			timer++;
		}
	}
}

function changeOpac(opacity, id) {
	var object = document.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function randomImage(elemId, imgList, altList, len) {
	rand = Math.floor(Math.random() * len);
	document.getElementById(elemId).src = imgList[rand];
	document.getElementById(elemId).alt = altList[rand];
}

function randomImageBack(elemId, imgList, len) {
	rand = Math.floor(Math.random() * len);
	document.getElementById(elemId).style.backgroundImage = "url('" + imgList[rand] + "')";
}

