function SetColumnHeightEqual(firstEl, secondEl)
{
	var fEl = document.getElementById(firstEl);
	var sEl = document.getElementById(secondEl);
	if ( fEl != null && sEl != null )
	{
		if (fEl.offsetHeight > sEl.offsetHeight) sEl.style.height = fEl.offsetHeight+'px';
		else if ( sEl.offsetHeight > fEl.offsetHeight) fEl.style.height = sEl.offsetHeight+'px';
	}
}

function setElementBgColor(el, strColor, subEl)
{
	if ( el!=null )
	{
		if ( subEl!='' ) {
			var arEls = el.getElementsByTagName(subEl);
			if ( arEls.length > 0 )
				if ( subEl=='td' )
					for (i=0;i<arEls.length;i++)
						arEls[i].style.backgroundColor=strColor;
				else
					arEls[0].style.backgroundColor=strColor;
		} else {
			el.style.backgroundColor=strColor;
		}
	}
}

var PopupManager = {
	CONST_OPENLINKCLASS: 'openpopup',
	CONST_CLOSELINKCLASS: 'close',
	
	open: function(popupel) {
		Element.setStyle(popupel, {display: 'block'});
	},
	
	close: function(popupel) {
		Element.setStyle(popupel, {display: 'none'});
	},
	
	setUpOpenEvents: function(parent) {
		var openlinks = document.getElementsByClassName(this.CONST_OPENLINKCLASS, parent||document);
		for ( i=openlinks.length-1; i>=0; i-- ) {
			var linkoobj = $(openlinks[i]);
			if ( linkoobj ) {
				var popupel = $(linkoobj.rel);
				this.setUpCloseEvents(popupel);
				Event.observe(linkoobj, 'click', this.open.bind(this, popupel), false);
			}
		}
	},
	
	setUpCloseEvents: function(popupel) {
		var closelinks = document.getElementsByClassName(this.CONST_CLOSELINKCLASS, popupel||document);
		for ( j=closelinks.length-1; j>=0; j-- ) {
			var linkcobj = $(closelinks[j]);
			if ( linkcobj ) {
				Event.observe(linkcobj, 'click', this.close.bind(this, popupel), false);
			}
		}
	}
}