
function $(ele) {
	return (typeof ele=='object' ? ele : document.getElementById(ele));
}

var _prevObj = null;
function showMenu(a, menu) {
	menu = $(menu);
	if(menu.style.display == 'none') {
		a.style.cssText = "color: red";
	}else{
		a.style.cssText = "";
	}
	flexObj(menu);
}
var _obj;
var _inr;
function flexObj(_object) {
	clearInterval(_inr);
	if(_object == null) return false;
	_obj = $(_object);
	//_obj.style.display = "";
	if(_obj.style.display == 'none') {
		_obj.style.display = '';
		_obj.style.height = '0px';
	}
	var _oh = _obj.offsetHeight;
	var _sh = _obj.scrollHeight;
	if(Number(_oh) == 0) {
		_inr = setInterval("doflex("+_sh+")", 15);
	}else{
		_inr = setInterval("doflex(0)", 15);
	}
	
}
function doflex(_h) {
	var _oh = _obj.style.height;
	var _oth;
	if(_oh == "") {
		_obj.style.height = _obj.offsetHeight +"px";
		_oh = _obj.style.height;
	}
	_oh = Number(_oh.substring(0, _oh.length-2));
	_oth = (_h-_oh)*.2;
	_oth = _oth > 0 ? Math.ceil(_oth) : Math.floor(_oth);
	_oh += _oth;
	_obj.style.height = _oh +"px";
	if(_oh == 0) {
		_obj.style.display = "none";
		clearInterval(_inr);
	}
	if(_oth == 0) {
		clearInterval(_inr);
	}
}

