//Note: MB Feb26/08, To add a new div to stats.php, you need to increment/update the variable numberOfCharts in the file table_flipbook.js
var numberOfCharts=16;

function showChart(chart,obj,no) {
  
	// show chart and bold new inner menu item
	if(chart){
		var object = document.getElementById(chart);
   		 var id = object.id;
	}
	if(obj && arguments.length>2){
	   var oid = obj.id;
	   var num = parseInt(no);
	   var par = obj.parentNode.id;
	   par = par.substring(0,5);
	  	for(var y=1;y<=num;y++){
			if(oid==document.getElementById(par+"_"+y).id){
				document.getElementById(par+"_"+y).style.backgroundColor='#ffffff';
				document.getElementById(par+"_"+y).style.fontWeight='bold';
				document.getElementById(par+"_"+y).style.color='#8768b9';
			}else{
				document.getElementById(par+"_"+y).style.backgroundColor='#ffffff';
				document.getElementById(par+"_"+y).style.fontWeight='normal';
				document.getElementById(par+"_"+y).style.color='#b49cd6';
			}
		}
	}
	
	
     for (var i=1;i<=numberOfCharts;i++) {
		if(id==document.getElementById("chart"+i).id){
			document.getElementById("chart"+i).style.display='block';
		}else{
			document.getElementById("chart"+i).style.display='none';
		}
	}
}

function showSub(obj,no){
     
   var mainMenuChart;
   var object = document.getElementById(obj);
   var id = object.id;
   var num = parseInt(no);
   
    for (var i=1;i<=3;i++)
	{
		if(id==document.getElementById("sub_"+i).id){
			document.getElementById("chart_"+i).style.color='#666666';
			if (document.getElementById("sub_"+i+"_arrow").innerHTML != ''){
				document.getElementById("sub_"+i).style.display='block';
				document.getElementById("sub_"+i).firstChild.style.backgroundColor='#ffffff';
				document.getElementById("sub_"+i).firstChild.style.fontWeight='bold';
				document.getElementById("sub_"+i).firstChild.style.color='#8768b9';
				document.getElementById("sub_"+i+"_arrow").innerHTML = '<img src="../images/stats_nav_arrowdown.gif" width="13" height="6" border="0" align="absmiddle" />';
				for (var x=2;x<=no;x++){
					document.getElementById("sub_"+i+"_"+x).style.backgroundColor='#ffffff';
					document.getElementById("sub_"+i+"_"+x).style.fontWeight='normal';
					document.getElementById("sub_"+i+"_"+x).style.color='#b49cd6';
				}
			}
		}else{
			document.getElementById("chart_"+i).style.color='#a3a3a3';
			document.getElementById("sub_"+i).style.display='none';
			(document.getElementById("sub_"+i+"_arrow").innerHTML == '') ? document.getElementById("sub_"+i+"_arrow").innerHTML = '' : document.getElementById("sub_"+i+"_arrow").innerHTML = '<img src="../images/stats_nav_arrowright.gif" width="10" height="10" border="0" align="absmiddle" />';
		}
	}

}


function showSubSub(obj,openWhich,maxOpens){
     
   var object = document.getElementById(obj);
   var id = object.id;
   
	for (var x=1;x<=maxOpens;x++){
		
		if (x==openWhich){
			document.getElementById(obj+"_sub_"+x).style.display='block';
			var str = document.getElementById(obj+"_sub_"+x+"_arrow").innerHTML;
			str = str.replace("right", "down");
			str = str.replace("height=\"10\" width=\"10\"", "width=\"13\" height=\"6\"");
			document.getElementById(obj+"_sub_"+x+"_arrow").innerHTML = str;
		} else {
			document.getElementById(obj+"_sub_"+x).style.display='none';
			var str = document.getElementById(obj+"_sub_"+x+"_arrow").innerHTML;
			str = str.replace("down", "right");
			str = str.replace("width=\"13\" height=\"6\"","height=\"10\" width=\"10\"");
			str = str.replace("height=\"6\" width=\"13\"","height=\"10\" width=\"10\"");
			document.getElementById(obj+"_sub_"+x+"_arrow").innerHTML = str;
		}
	}
   
}
	

