var listing = {
	codes : Array,
	init : function() {
		listing.codes = document.getElementsByClassName('l-item');
		listing.attach();
	},
	attach : function() {
		var i;
		for ( i=0;i<listing.codes.length;i++ ) {
			Event.observe(listing.codes[i],'click',listing.collapse,false);
			Element.cleanWhitespace(listing.codes[i].parentNode);
			Element.cleanWhitespace(listing.codes[i].parentNode.parentNode);
		}
	},
	getEventSrc : function (e) {
		if (!e) e = window.event;
		if (e.originalTarget)
			return e.originalTarget;
		else if (e.srcElement)
			return e.srcElement;
	},
	collapse : function(e) {
		var el = listing.getEventSrc(e).nextSibling;
		Effect.toggle(el.id,'slide', {duration:0.2});
		
		if (el.style.display == "none") {
			listing.getEventSrc(e).className = "l-itemOn";
		} else {
			listing.getEventSrc(e).className = "l-item";
		}
	}
};

// ATTACH ONCLICK EVENT TO ALL ELEMENTS WITH THE l-item CLASS
Event.observe(window,'load',listing.init,false);

function openIPIX(id) {
  var popupWin = window.open('./IPIX.cfm?ipixID=' + id, 'ipixWin',  'status,scrollbars=no,resizable=no,dependent,width=410,height=330,left=50,top=50');
	popupWin.focus();
}	
