var user_agent = navigator.userAgent;
var isOpera = user_agent.indexOf("Opera") >= 0;
var isFirefox = user_agent.indexOf("Firefox") >= 0;
var isWin32up = user_agent.indexOf("Win32") >= 0 
	|| user_agent.indexOf("Win64") >= 0
	|| user_agent.indexOf("Windows NT") >= 0;

// disallow Opera faking IE
var isIE = !isOpera && user_agent.indexOf("MSIE") >= 0;
var isIE55up = isIE && isWin32up && user_agent.match(/MSIE ((5\.5)|[6789])/);
var isIE70up = isIE && isWin32up && user_agent.match(/MSIE ([789])/);
var isIE55dn = isIE && !isIE55up;
var browser = "other";

if (isFirefox)
	browser = "firefox";
else if (isOpera) 
	browser = "opera";
else if (isIE55up) 
	browser = "ie55p";
else if (isIE55dn) 
	browser = "ie55d";

function setInnerHTML(elementID, HTML) {
	var targetElement = document.getElementById(elementID);
	if (targetElement != null)
		targetElement.innerHTML = HTML;
}

/** returns a browser specific alpha image layer.
* - imgPNG - PNG with alpha channel
* - imgGIF - failsafe transparent GIF image
*/
function alphaImg(width, height, imgPNG, imgGIF, alt, title) {
	var imgSpacer = I_URL + "sp.gif";
	var html;
	var alt_title;
	
	if (alt != null)
		alt_title = " alt=\"" + alt + "\"";
	else
		alt_title = " alt=\"\"";

	if (title != null)
		alt_title += " title=\"" + title + "\"";

	if (isIE70up || isOpera || isFirefox) {
		// use PNGs directly
		html = '<img src="' + imgPNG + '" width="' + width + '" height="' + height + '"' + alt_title + '>';
	} else if (isIE55up) {
		// use directX filters
		html = '<img style="width: ' + width + 'px; height: ' + height + 'px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + imgPNG + '\',sizingMethod=\'scale\');\" src="' + imgSpacer + '" width="' + width + '" height="' + height + '"' + alt_title + '>';
	} else {
		// use failsafe GIF images
		html = '<img src="' + imgGIF + '" width="' + width + '" height="' + height + '"' + alt_title + '>';
	}
	
	document.write(html);
}

/** returns a browser specific alpha image background.
* - imgPNG - PNG with alpha channel
* - imgGIF - failsafe transparent GIF image
*/
function alphaImgBG(imgPNG, imgGIF) {
	var html;
	
	if (isIE70up || isOpera || isFirefox) {
		// use PNGs directly
		html = 'background-image: url(' + imgPNG + ');';
	} else if (isIE55up) {
		// use directX filters
		html = 'filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + imgPNG + '\',sizingMethod=\'scale\');';
	} else {
		// use failsafe GIF images
		html = 'background-image: url(' + imgGIF + ');';
	}
	
	return html;
}

function MM_jumpMenu(selObj,restore){ //v3.1
	document.location.href=selObj.options[selObj.selectedIndex].value;
	if (restore == null || restore) selObj.selectedIndex=0;
}

function dgid(obj)
{
	return document.getElementById(obj);
} // function dgid(obj)

function displayDIVBlock(id) {
	var obj = document.getElementById(id);
	if (obj != null) obj.style.display = "block"
}

function hideDIVBlock(id) {
	var obj = document.getElementById(id);
	if (obj != null) obj.style.display = "none"
}
