//////////////////////////////////////////////////////////////////////
// Expandable Menu
//
//////////////////////////////////////////////////////////////////////
var UL_emProperties = new Object();
var UL_emCollapsedH = 30;
var UL_emExpandedH = 140;
  	
//////////////////////////////////////////////////////////////////////
function UL_initAnimateEM(id, to) 
{
	UL_emProperties[id] = new Object();
	UL_emProperties[id].div = document.getElementById(id);
	UL_emProperties[id].currentH = '';
	UL_emProperties[id].toH = to;
	
	var p = UL_emProperties[id];
	if(p.timer) clearTimeout(p.timer);
	p.timer = null;

	if(p.toH == UL_emCollapsedH) {
			p.div.className = 'expandable_menu_0';
	}
				
	UL_animateEM(id);
}

//////////////////////////////////////////////////////////////////////
function UL_animateEM(id) 
{
	var p = UL_emProperties[id];

	var currentH = p.div.style.height;
	if(currentH == '') {
		p.div.style.height = UL_emCollapsedH+'px';
	}
	p.currentH = parseInt(p.div.style.height);
	p.currentH += 0.3 *(p.toH-p.currentH);
	p.div.style.height = Math.round(p.currentH)+'px';
	
	if(Math.round(Math.abs(p.toH-p.currentH)-1) > 0) {
		if(p.timer) clearTimeout(p.timer);
		p.timer = setTimeout('UL_animateEM("'+id+'")', 10);
	} else if(p.toH == UL_emExpandedH) {
		p.div.className = 'expandable_menu_1';
		p.div.style.height = p.toH+'px';
	} else {
		p.div.style.height = p.toH+'px';
	}
}

//////////////////////////////////////////////////////////////////////
function UL_hideEM(id) {
	if(cssIsLoaded()) {
		UL_initAnimateEM(id, UL_emCollapsedH);
	}  		
}

//////////////////////////////////////////////////////////////////////
function UL_showEM(id) {
	if(cssIsLoaded()) {
		UL_initAnimateEM(id, UL_emExpandedH);
	}
} 	
//////////////////////////////////////////////////////////////////////
function cssIsLoaded() {
		if(document.styleSheets.length > 0) {
			var numRules = 0;
			if(document.styleSheets[0].rules) { // IE7
				numRules = document.styleSheets[0].rules.length;
			} else {
				numRules = document.styleSheets[0].cssRules.length
			}
			return (numRules > 0);
		}
		return false;
}