var lastDropOut = null;
var oldLastDropOut = null;
var fixHeightOn = null;

function drop_out_in(_id){
	
	obj = $(_id);
	//window.alert(lastDropOut);
	
	allObjs = obj.up().childElements();
	
	if(lastDropOut != obj){
		oldLastDropOut = lastDropOut;
		obj.childNodes[0].className = 'active';
		allObjs[1].style.position = 'relative';
		Effect.SlideDown(allObjs[1], {duration: 0.25});
		lastDropOut = obj;
		//_id.up().childNodes[3].className = 'dropout_visible';
	}
	else{
		
		obj.childNodes[0].className = '';
		Effect.SlideUp(allObjs[1], {duration: 0.25});
		oldLastDropOut = lastDropOut;
		lastDropOut = null;
		//_id.up().childNodes[3].className = 'dropout';
	}
	
	els = $$('.dropout');
		
	els.each(function(el, index) {
			if(oldLastDropOut != null) {
				oldEls = oldLastDropOut.up().childElements();
				otherEls = el.up().childElements();
				if(oldEls[1] == otherEls[1]){
					oldLastDropOut.childNodes[0].className = '';
					fixHeightOn = oldEls[1];
					Effect.SlideUp(el,{
							duration: 0.25, 				
							afterFinish: fixHeightOnFinish
					});
					oldLastDropOut = null;
					//_id.up().childNodes[3].style.display = 'none';
				}
			}
	});
	
}

function fixHeightOnFinish() {
	$(fixHeightOn).style.height = 'auto';
}

function initContent() {
	//window.alert('initcontent');
	$$('.dropout').each(function(el, index) {
			el.style.display = 'none';
	});
}

document.observe('dom:loaded', initContent);



