/*
	HUF JS Functions
*/

//============================================ Nav List Over (IE6)
function start_list() {
	// called onLoad: IE only
	navRoot = document.getElementById("nav");
	if (document.all&&document.getElementById) {
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

//============================================ pngs, etc => onLoad
function do_pngs() {
	// pngfix
	if(needs_ie_pngfix()){
		do_ie_pngfix();
	}
	
	/*
	else {
		// pngs visible => this doesn't work in Safari (2.04) now
		setStyleByClass('img','png','visibility','visible');
	}
	*/
}

function needs_ie_pngfix() {
	var ie4 = (document.all) ? true : false;	
	if (ie4) {
		var ar_vers = navigator.appVersion.split("MSIE");
		var vers = parseFloat(ar_vers[1]);		
		if (vers >= 5.5 && vers < 7 && document.body.filters) {
			return true;
		}
		else {
			return false;
		}
	}
	else {
		return false;
	}
}

function do_ie_pngfix () {
	for(var i=0; i<document.images.length; i++) {
	   var img = document.images[i];
	   var imgName = img.src.toUpperCase();
	   if (imgName.substring(imgName.length-3, imgName.length) == "PNG" && img.className=="png") {
		  var imgID = (img.id) ? "id='" + img.id + "' " : "";
		  var imgClass = (img.className) ? "class='" + img.className + "' " : "" ;
		  var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " ;
		  var imgStyle = "display:inline-block;" + img.style.cssText ;
		  if (img.align == "left") imgStyle = "float:left;" + imgStyle ;
		  if (img.align == "right") imgStyle = "float:right;" + imgStyle ;
		  if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle ;
		  var strNewHTML = "<span " + imgID + imgClass + imgTitle
		  + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
		  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		  + "(src=\'" + img.src + "\', sizingMethod='scale'); visibility:visible\"></span>" ;
		  img.outerHTML = strNewHTML ;
		  i = i-1 ;
	   }
	}
}

function fix_single_png (elem) {
   var img = get_object(elem);
   var imgName = img.src.toUpperCase();
   if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
	  var imgID = (img.id) ? "id='" + img.id + "' " : "";
	  var imgClass = (img.className) ? "class='" + img.className + "' " : "" ;
	  var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " ;
	  var imgStyle = "display:inline-block;" + img.style.cssText ;
	  if (img.align == "left") imgStyle = "float:left;" + imgStyle ;
	  if (img.align == "right") imgStyle = "float:right;" + imgStyle ;
	  if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle ;
	  var strNewHTML = "<span " + imgID + imgClass + imgTitle
	  + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	  + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" ;
	  img.outerHTML = strNewHTML ;
   }
}

