/**
 * displayImage.js
 * 
 * JavaScript function to handle displaying images that may have "alpha transparency"
 * in various browsers.  This is mostly about dealing with PNGs in Internet Explorer, 
 * though it handles some other browser's issues too.
 *
 * For maximum cross-browser compatibility, images should be available in both PNG
 * and GIF format.  The client browser also needs to have JavaScript enabled (obviously).
 *
 * This script assumes that browserdetect_lite.js is already loaded.
 *
 * This code is based on the "A List Apart" article
 * http://www.alistapart.com/articles/pngopacity/
 * by Michael Lovitt.
 *
 * @package sadahome
 * @version $Id$
 * @copyright 2005 Doug Latornell
 * @author Doug Latornell <doug-code@sadahome.ca>
 **/
 // 
 // Set global variable pngAlpha or pngNormal depending on what the client
 // browser is
 // if IE5.5+ on win32, then display PNGs with AlphaImageLoader
if ((browser.isIE55 || browser.isIE6up) && browser.isWin32) {
	var pngAlpha = true;
	var strExt = ".png";
// else, if the browser can display PNGs normally, then do that. that list includes:
	//     -Gecko Engine: Netscape 6 or Mozilla, Mac or PC
	//     -IE5+ Mac (OpacityObject applies the background image at 100% opacity)
	//     -Opera 6+ PC
	//     -Opera 5+ Mac (Doesn't support dynamically-set background images)
	//     -Opera 6+ Linux 
	//     -Omniweb 3.1+ 
	//     -Icab 1.9+ 
	//     -WebTV 
	//     -Sega Dreamcast
} else if ((browser.isGecko) || (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)) {
	var pngNormal = true;
	var strExt = ".png";
	// otherwise, we use plain old GIFs
} else {
	var strExt = ".gif";
}
/**
 * displayImage Function
 *
 * Outputs the image in an img tag with appropriate handling of IE's brain-dead
 * alpha transparency idiocyncracies.
 *
 * This function requires a transparent blank GIF file to be available somewhere.
 * It also assumes that a GIF version of the image is available for fallback
 * when the global code above can't determine whether or not PNG alpha support
 * is available.
 *
 * @param string imgPath Path to image file **without** extension.
 * @param string width Width to display image at, including units.
 * @param string height Height to display image at, including units.
 * @param string blankSrc Relative path to a transparent blank GIF image that will
 * be used as a placeholder in IE.
 * @param string id Content for the id and name attributes of the img tag.
 * @param string class Content for the class attribute of the img tag.
 * @param string alt Content for the alt attribute of the img tag.
 * @param string title Content for the title attribute of the img tag.
 */
// 
// 
// a standard image tag.
//function displayImage(strId, strPath, intWidth, intHeight, strClass, strAlt) 
function displayImage(imgPath, width, height, blankSrc, id, clas, alt, title)
{	
	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>');
		document.write('<img src="'+blankSrc+'" width="'+width+'" height="'+height+'" \
						id="'+id+'" name="'+id+'" class="'+clas+'" alt="'+alt+'" \
						title="'+title+'" \
						style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+imgPath+'.png\', sizingMethod=\'scale\')" />');
	} else if (pngNormal) {
		document.write('<img src="'+imgPath+'.png" width="'+width+'" height="'+height+'" \
						id="'+id+'" name="'+id+'" class="'+clas+'" alt="'+alt+'" \
						title="'+title+'" />');
	} else {
		document.write('<img src="'+imgPath+'.gif" width="'+width+'" height="'+height+'" \
						id="'+id+'" name="'+id+'" class="'+clas+'" alt="'+alt+'" \
						title="'+title+'" />');
	}
}
