function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('container').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			
			var shiftHeight = 0
			if (document.getElementById('extra').offsetHeight >= shiftHeight) { shiftHeight = document.getElementById('extra').offsetHeight; }
			if (document.getElementById('content').offsetHeight >= shiftHeight) { shiftHeight = document.getElementById('content').offsetHeight; }
			if (document.getElementById('navigation').offsetHeight >= shiftHeight) { shiftHeight = document.getElementById('navigation').offsetHeight; }
			shiftHeight += document.getElementById('header').offsetHeight;
		
			if ((windowHeight - (shiftHeight + footerHeight)) >= 0) {
				footerElement.style.top = (windowHeight - shiftHeight - footerHeight) + 'px';
			}	else {
				footerElement.style.top = '0px';
			}
		}
	}
}
window.onload = function() { setFooter(); }
window.onresize = function() { setFooter();	}

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function pngfix() {
	if ((version >= 5.5) && (document.body.filters)) {
		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") {
				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
				i = i-1
			}
		}
	}
}

function print_r(theObj) {
  if(theObj.constructor == Array || theObj.constructor == Object) {
    document.write("<pre><ul>");
    for(var p in theObj) {
      if(theObj[p].constructor == Array || theObj[p].constructor == Object) {
        document.write("<li>["+p+"] => "+typeof(theObj)+"</li>");
        document.write("<ul>");
        print_r(theObj[p]);
        document.write("</ul>");
      } else {
        document.write("<li>["+p+"] => "+theObj[p]+"</li>");
      }
    }
    document.write("</ul></pre>");
  }
}
