function GoTo(i,j){
	if (i){
		var s = sub_menu_url[i-1][j-1];
		if (s!="") window.location= s;
	}else{
		var m =menu_url[j-1];
		if (m!="") window.location= m;
	}
}

function Agent(){
  this.agent=navigator.userAgent.toLowerCase();
  this.opera = (this.agent.indexOf('opera')!=-1) ? true:false;
  this.ie = (this.agent.indexOf('msie')>=0) ? true:false;
  this.ns6 = ((this.agent.indexOf('gecko')>=0) && (this.agent.indexOf('opera')==-1)) ? true:false;
  this.ns4 = ((this.agent.indexOf('mozilla')>=0) && (this.agent.indexOf('gecko')==-1) && (this.agent.indexOf('msie')==-1)) ? true:false;
  return(1);
}
var a = new Agent();

function GetWindowWidth(){
	return((a.ns4)? window.innerWidth : document.body.clientWidth);
}

function SwapImage(id,mode){
	var img=document.images[id].src;
	if (mode==1) document.images[id].src=img.substr(0,img.length-4)+'_a.'+img.substr(img.length-3,img.length);
	if (mode==0) document.images[id].src=img.substr(0,img.length-6)+'.'+img.substr(img.length-3,img.length);
}

/* menu */
var t=null; 
var oni=0; 
var oni=0;
var onj=0;

function SetTimer(){ 
	StopTimer();
	t = setTimeout('HideMenu()', 500);
}

function StopTimer(){
if(t!=null){ 
	clearTimeout(t);
	t=null;
}
return (true);
}

function HideMenu(){
if(t!=null) StopTimer();
if(oni>0){
	if(onj>0)DeSelect(oni,onj);
	if (document.getElementById("t"+oni)) SwapImage("p"+oni,0);
	document.getElementById("s"+oni).style.visibility='hidden';
	with (document.getElementById("m"+oni).style){
		backgroundImage="url('img/mn_b.gif')";
	}
}
oni=0;
}


function ShowMenu(id){
StopTimer();
if(oni!=id) {
	HideMenu();
	with (document.getElementById("m"+id)){
		style.backgroundImage='url(img/mn_b_a.gif)';
		var l = offsetLeft-1;
	}
	var w = document.getElementById("m"+(id+1)).offsetLeft-l;
	if (document.getElementById("t"+id)){ 
		document.getElementById("t"+id).style.width= (a.ns6) ? w-1 :w;
		SwapImage("p"+id,1);
	}
	with(document.getElementById("s"+id).style){
		left= (a.ie) ? l : l+1;
		visibility="visible";
	}
	
	oni=id; 
}
}	

function DeSelect(i,j){
with(document.getElementById("t"+i+j).style){
//	background='#EFEFE9';
	background='#E7E0DE';
	color='#646371';
}
onj=0;
}

function Select(i,j){
if ((oni!=0) & (onj!=0)) DeSelect(oni,onj);
with(document.getElementById("t"+i+j).style){
	background='#8E4242';
	color='white';
}
onj=j;
}

