﻿//JS for menu show
function showsubmenu(sid)
{
var whichEl = document.getElementById("submenu" + sid);
var topimgshow = document.getElementById("topimg" + sid);
var maxNumObj = document.getElementsByName("menushow");
var maxnum = maxNumObj.length;
if (whichEl.style.display == "none")
{
	var subMenuObj = document.getElementById("submenu" + sid);
	subMenuObj.style.display="block";
	topimgshow.src="../images/default/menu/arrow_top.gif";

	if (sid<maxnum){
		for(i=1;i<=sid-1;i++){
			subMenuObj = document.getElementById("submenu" + i);
			subMenuObj.style.display="none";
			subMenuObj = document.getElementById("topimg" + i);
			subMenuObj.src="../images/default/menu/arrow_show.gif";
		}

		for(i=sid+1;i<=maxnum;i++){
			subMenuObj = document.getElementById("submenu" + i);
			subMenuObj.style.display="none";
			subMenuObj = document.getElementById("topimg" + i);
			subMenuObj.src="../images/default/menu/arrow_show.gif";
		}
	}
	else{
		for(i=1;i<=sid-1;i++){
			subMenuObj = document.getElementById("submenu" + i);
			subMenuObj.style.display="none";
			subMenuObj = document.getElementById("topimg" + i);
			subMenuObj.src="../images/default/menu/arrow_show.gif";
		}
	}
}
else
{	
	subMenuObj = document.getElementById("submenu" + sid);
	subMenuObj.style.display="none";
	topimgshow.src="../images/default/menu/arrow_show.gif";
}
}

function showTopMenu(sid){
	var whichEl = document.getElementById("topmenushow" + sid);
	var maxNumObj = document.getElementsByName("topmenu");
	var maxnum = maxNumObj.length;

	if (whichEl.style.display == "none")
	{
		var topMenuObj = document.getElementById("topmenushow" + sid);
		topMenuObj.style.display="block";

		if (sid<maxnum){
			for(i=1;i<=sid-1;i++){
				topMenuObj = document.getElementById("topmenushow" + i);
				topMenuObj.style.display="none";
			}		
			for(i=sid+1;i<=maxnum;i++){
				topMenuObj = document.getElementById("topmenushow" + i);
				topMenuObj.style.display="none";
			}	
		}
		else{
			for(i=1;i<=sid-1;i++){
				topMenuObj = document.getElementById("topmenushow" + i);
				topMenuObj.style.display="none";			
			}
		}


	}

	//Change bgcolor
	for(i=1;i<=maxnum;i++){
		var whichTd = document.getElementById("div"+i);
		whichTd.style.backgroundColor="#EFEBDE";
	}
	whichTd = document.getElementById("div"+sid);
	whichTd.style.backgroundColor="#BDCBE7";
}