/*
 * unitpngfix.js
 * 
 * Updated for use with City of Chicago Recovery
 * and Reinvestment website
 * 
 * Last Updated: June 11, 2009
 * (Last)Author: Ryan Abbott <ryan.abbott@crowehorwath.com>
 */

// added by Tinh Tran
// make sure that each column has the same height
window.onload = function(e) {
	var contentPanel = document.getElementById("content-panel");
	if (contentPanel != null) {
		var centerdiv = document.getElementById("content-panel");
		var leftdiv = document.getElementById("left-column");

		var centerColumnHeight = centerdiv.clientHeight;
		var leftColumnHeight = leftdiv.clientHeight;
		var centerColumnHeightNew = (leftColumnHeight + 100)
    
		if (leftColumnHeight > 650) {
			contentPanel.style.height  = centerColumnHeightNew + "px";
		}
	}
}

// give the png's transparency
pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}

// function to check for a browser
function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

// gather browser information
var detect = navigator.userAgent.toLowerCase();

// check for msie in the string, if its found the user is using IE 
if(checkIt('msie')) {
	browser = "IE";	
}

// check for the version, only perform this function if the version < 6
var version = 0;
if(navigator.appVersion.indexOf("MSIE")!= -1) {
	temp = navigator.appVersion.split("MSIE");
	version = parseFloat(temp[1]);
}

// if using IE and its version 6 or less, use transparency fix
if((browser == 'IE') && ( version <= 6)) {
	window.attachEvent('onload',pngfix);	
}