// Javascript for "sideBox accordion" effects
var sideBoxAnimationDuration = 0.1;
var arr_sideBoxItemHeights = new Array();

var arr_sideBoxItemIds = new Array();
var arr_sideBoxItemStatus = new Array();

var imgIconIdSuffix = "_icon";

function showAllItem(isExpand) {
	if (isExpand == "false")
	{
		for (var i=0; i<arr_sideBoxItemIds.length; i++ )
			showSideBoxItem(arr_sideBoxItemIds[i]);
	}
}

function showSideBoxItem(itemId) {

	var imgElement = document.getElementById(itemId+imgIconIdSuffix);
	var item = document.getElementById(itemId);
	if (arr_sideBoxItemStatus[itemId] == "expand") {
		item.style.display    = "none";
		item.style.visibility = "hidden";

		if (imgElement) {
			imgElement.src = "/info/static/images/icon_expand.gif";
		}
		arr_sideBoxItemStatus[itemId] = "collapse";
	} else if (arr_sideBoxItemStatus[itemId] == "collapse") {
		item.style.display    = "";
		item.style.visibility = "";

		if (imgElement) {                                    
			imgElement.src = "/info/static/images/icon_collapse.gif";
		}
		arr_sideBoxItemStatus[itemId] = "expand";
	} 
}

function onInitMenu(){
	for (var i=0; i<arr_sideBoxItemIds.length; i++ ) {  
		YAHOO.util.Event.onContentReady(arr_sideBoxItemIds[i], function () {
			var regionItem = YAHOO.util.Dom.getRegion(this);
			arr_sideBoxItemHeights[this.id] = regionItem.bottom - regionItem.top;	    	                        
		});
	}
}


function onloadedCallBack(){
	if(navigator.appName.indexOf("Internet Explorer")>-1){
		if (document.readyState =="loaded" || document.readyState =="complete"){
			showAllItem(isExpand);
		}else{
			setTimeout("showAllItem('"+isExpand+"')", 100);
		}
	}else{
		setTimeout("showAllItem('"+isExpand+"')", 100)
	}
}
