chn_menu_num=0;
function topnav_tab_move(num,szTapColor){
	if(!num) num = topnav_tab_def>0?topnav_tab_def:1;
	if(chn_menu_num == num) return;
	
	var arrTabColors = topnav_tab_color.split(",");
	var initTabColor = arrTabColors[1];
	
	if ((typeof(szTapColor)=="undefined") || (szTapColor == "")) {selTapColor = initTabColor.replace("#","");} 
	else {selTapColor=szTapColor;}
	
	this_tab=document.getElementById('topnav_tab_id'+num); if(!this_tab) return;
	this_tab_l=document.getElementById('topnav_tab_id'+num+'_l'); if(!this_tab_l) return;
	this_tab_r=document.getElementById('topnav_tab_id'+num+'_r'); if(!this_tab_r) return;
	this_tab_sub=document.getElementById('topnav_sub'+num); if(!this_tab_sub) return;
	
	for(i=1; i<=10; ++i){
		if(i != num){
			tmp_td_id_l = document.getElementById('topnav_tab_id'+ i +'_l');
			tmp_td_id = document.getElementById('topnav_tab_id'+ i);
			tmp_td_id_r = document.getElementById('topnav_tab_id'+ i +'_r');
			if(tmp_td_id && tmp_td_id.className!='topnav_menu'){
				tmp_td_id_l.style.backgroundImage='';
				tmp_td_id_l.className='topnav_menu_l';
				
				tmp_td_id.style.backgroundImage='';
				tmp_td_id.className='topnav_menu';
				
				tmp_td_id_r.style.backgroundImage='';
				tmp_td_id_r.className='topnav_menu_r';
			}
		}else{
			this_tab_l.className='topnav_menu_color_l';
			this_tab_l.style.backgroundImage="url("+ topnav_tab_theme +"/"+ selTapColor +"_tab_button"+num+"_l.gif)";
			this_tab.className='topnav_menu_color';
			this_tab.style.backgroundImage="url("+ topnav_tab_theme +"/"+ selTapColor +"_tab_button"+num+"_bg.gif)";
			this_tab_r.className='topnav_menu_color_r';
			this_tab_r.style.backgroundImage="url("+ topnav_tab_theme +"/"+ selTapColor +"_tab_button"+num+"_r.gif)";
			
			for(j=1; j<=10; ++j){
				subtemp=document.getElementById('topnav_sub'+j);
				if(subtemp) subtemp.style.display='none';
			}
			if(this_tab_sub){
				this_tab_sub.style.display='inline';
				document.getElementById('topnav_sub_table').style.backgroundColor=arrTabColors[num];
			}
		}
	}
	chn_menu_num=num;
}

// TopNav tab under menu layer controll
function open_btm_layer(div_id,this_coord){
	var arrTabColors = topnav_tab_color.split(",");

	btmmenu_id=document.getElementById(div_id);
	btmmenu_id.style.left = Get_objLeft(this_coord)-10;
	btmmenu_id.style.top = Get_objTop(this_coord)+12;
	btmmenu_id.style.visibility = 'visible';
	btmmenu_id.style.backgroundColor = arrTabColors[chn_menu_num];
}
function close_btm_layer(){btmmenu_id.style.visibility='hidden';}
function hold_btm_layer(){btmmenu_id.style.visibility='visible';}

function Get_objTop(thisobj){
	if(typeof(thisobj)!='object') thisobj=document.getElementById(thisobj);
	if (thisobj.offsetParent==document.body) return thisobj.offsetTop;
	else return thisobj.offsetTop + Get_objTop(thisobj.offsetParent);
}

function Get_objLeft(thisobj){
	if(typeof(thisobj)!='object') thisobj=document.getElementById(thisobj);
	if (thisobj.offsetParent==document.body) return thisobj.offsetLeft;
	else return thisobj.offsetLeft + Get_objLeft(thisobj.offsetParent);
}

function Get_objCenter(thisobj){
	if(typeof(thisobj)!='object') thisobj=document.getElementById(thisobj);
	if (thisobj.offsetParent==document.body) return thisobj.offsetCenter;
	else return thisobj.offsetCenter + Get_objCenter(thisobj.offsetParent);
}

