/* ======== Global ======== */
var gh = window.location.host;

/* ======== Menu ======== */
var isOverMainMenu = false;
var isOverSortMenu = false;
function showMenu(id){
	//if(gh=="www.516.com"||gh=="516.com") id="Admin";
	var a = document.getElementById("MainMenu").getElementsByTagName("a");
	for(var i=0;i<a.length;i++){
		a[i].onmouseover = function() {
			if(this.className!="active") this.className = "hover";
			showSortMenu(this.id);
			isOverMainMenu=true;
		}
		a[i].onmouseout = function() {
			if(this.className!="active") this.className = "";
			setTimeout("showSortMenu('"+id+"')", 400);
			isOverMainMenu=false;
		}
	
		if(a[i].id == id) {
			a[i].className = "active";
			showSortMenu(id);
		} else {
			a[i].className = "";
		}
	}
}
function showSortMenu(id){
	var a = document.getElementById("SortMenu");
	a.onmouseover = function(){
		isOverSortMenu=true;
	}
	a.onmouseout = function(){
		isOverSortMenu=false;
	}
	if(!isOverSortMenu && !isOverMainMenu) {
		var b = document.getElementById("SortMenu").getElementsByTagName("ul"); 
		for(var i=0;i<b.length;i++){
			if(b[i].id == "SortMenu_"+id) {
				b[i].className = "active";
			} else {
				b[i].className = "";
			}
		}
	}
}





function $(strId){
	return document.getElementById(strId);
}



/* Comments & Responses*/
function commShow(id)
{
	for(i=1;i<=3;i++){ 
		document.getElementById("para"+i).className="cmt_tab_l";
		document.getElementById("comm"+i).style.display="none";
     }
	 document.getElementById("para"+id).className="cmt_tab_a";
	 document.getElementById("comm"+id).style.display="block";      
}

function ExShow(id)
{
	for(i=1;i<=cou;i++){ 
		document.getElementById("cs"+i).className="com_tab_l";
		document.getElementById("Ex"+i).style.display="none";
     }
	 document.getElementById("cs"+id).className="com_tab_a";
	 document.getElementById("Ex"+id).style.display="block";      
}

/*Tablist*/
function onmouseoverCommonIndex(id)
{
	for(i=1;i<=num;i++){ 
		document.getElementById("commonindex"+i).className="frm_tab_l  frm_tab_l_"+wcount;
		document.getElementById("M"+i).style.display="none";
     }
	 document.getElementById("commonindex"+id).className="frm_tab_a  frm_tab_a_"+wcount;
	 document.getElementById("M"+id).style.display="block";      
	 
	 var emt1=document.getElementById("span_video_more");
	 var emt2=document.getElementById("span_audio_more");
	 
	 if(emt1 != null && emt2 != null){
		 if(emt1.style.display=="block")
			emt1.style.display="none";
		 else
			emt1.style.display="block";
			
		 if(emt2.style.display=="block")
			emt2.style.display="none";
		 else
			emt2.style.display="block";	 
	 }
}
  
var t;
function waitMouseOver(n){
	t = setTimeout("onmouseoverCommonIndex("+n+")",100);
}
function waitMouseOut(){
  	clearTimeout(t);
}

/*top*/
function toptabrandom(id)
{
	for(i=1;i<=3;i++){ 
		document.getElementById("commonindex"+i).className="top_tab_l";
		document.getElementById("M"+i).style.display="none";
     }
	 document.getElementById("commonindex"+id).className="top_tab_a";
	 document.getElementById("M"+id).style.display="block";      
}
var t;
function topwaitMouseOver(n){
	t = setTimeout("toptabrandom("+n+")",100);
}
function topwaitMouseOut(){
  	clearTimeout(t);
}



/**

???space.admin?????
********************************/
/**/
function show(id) {
	document.getElementById('L'+id).style.display="block";
}

function showHide(id){
if (document.getElementById('L'+id).style.display=="block"){
	document.getElementById('L'+id).style.display="none";}
else{
	document.getElementById('L'+id).style.display="block";
	}
	return true;
}



function showLayer(id) {
	for ( i=1; i<=3; i++ ) {
		document.getElementById('layer'+i).style.display="none";
	}
	document.getElementById('layer'+id).style.display="block";
}
/**/
function amenuShow(id)
{
	for(i=1;i<=11;i++){ 	
		document.getElementById("c"+i).className="cata_l";
		document.getElementById("lst"+i).style.display="none";
		
     }
	 document.getElementById("c"+id).className="cata_a";
	 document.getElementById("lst"+id).style.display="block"; 	 
}

function eff(){	
		if(!window.effid){
			window.effid=this.id;
			document.getElementById(this.id).className="adm_cata_lnk";
			return;
		}
		if(window.effid!=this.id){
			document.getElementById(this.id).className="adm_cata_lnk";
			document.getElementById(window.effid).className='';
			window.effid=this.id;
			
		}
		return;
}
function frdSearch()
{
	var obj=document.getElementById('searID');
	var div = document.getElementById("frdsear-container");
	var img = document.getElementById("showhide-img");
	if (obj.innerHTML == "\u70b9\u6211\u5c55\u5f00")
	{		
		div.style.display = "";
		obj.innerHTML = "\u70b9\u6211\u5173\u95ed";
		img.src = "http://www.516.com/images/search/frdS_closed.gif";
		img.alt = "\u5173\u95ed";

	}
	else
	{
		div.style.display = "none";
		obj.innerHTML = "\u70b9\u6211\u5c55\u5f00";
		img.src = "http://www.516.com/images/search/frdS_expend.gif";
		img.alt = "\u5c55\u5f00";
	}
}

function showLabel(obj)
{
	var nav = document.getElementById("nav");
	var childs = childNodes(nav);
	var channels = new Array("vdo", "ado", "grp", "frd", "usr");
	for (var i=0; i<childs.length; i++)
	{
		if (childs[i] == obj)
		{
			childs[i].className = childs[i].className.toString() + " here";
			document.getElementById("module-" + channels[i]).style.display = "";
		}
		else
		{
			childs[i].className = childs[i].className.toString().replace(/here/, "");
			document.getElementById("module-" + channels[i]).style.display = "none";
		}
	}
}
function childNodes(element)
{
	var nodes = element.childNodes;
	var _nodes = new Array();
	var j = 0;
	for (var i = 0; i < nodes.length; i ++)
	{
		if (nodes[i].nodeType == 1) 
		{
			_nodes[j] = nodes[i];
			j ++;
		}
	}
	return _nodes;
}

