function showHide(objname){
    var obj = $(objname);
    var s_add="0";
    if(obj.style.display == "none"){
		obj.style.display = "block";
		s_add="1";
	}else{
		obj.style.display = "none";
		s_add="0";
	}
	
  var i_num=parseInt(objname.replace("items",""));
  
  
  s_list=s_list.substring(0,i_num)+s_add+s_list.substr(i_num+1);
  
  SetCookie("MenuList",s_list);
  
  var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象
  var srcElement = evt.srcElement || evt.target;  // 获取触发事件的源对象
  if(srcElement.src.search("plus")>0)
  {
  	srcElement.src=srcElement.src.replace("plus","minus")	;
  	
  }
  else
  {
  	srcElement.src=srcElement.src.replace("minus","plus");
  	
  }
}


function changeButtonColorByName(s_name)
{
	changeButtonColor($('ahr'+s_name));
}


function changeButtonColor(btnNow)
{
	if(typeof(btnNow)!="object")
	{
		btnNow= event.srcElement;
	}	
	
	var p=document.getElementsByTagName("A");
	
	for (var j = 0; j < p.length; j++){
		if(p[j].className!="class")
		{
			p[j].style.color="#5DA0D4";
		}	
	}
	
	var o_pnt=btnNow.parentNode.parentNode.parentNode;
	
	
	
	var o_chd;
	var i_index=0;
	while(o_pnt.tagName!="DL")
	{
		o_pnt=o_pnt.parentNode;
		if(o_pnt==null)
			return ;
	}
	
	
	btnNow.style.color="red";
	
	while(true)
	{
		o_chd=o_pnt.childNodes[i_index];
		i_index++;
		
		if(o_chd.nodeName!='#text')
			break;
	}
	o_pnt=o_chd;
	i_index=0;
	
	while(true)
	{
		o_chd=o_pnt.childNodes[i_index];
		i_index++;
		
		if(o_chd.nodeName!='#text')
			break;
	}
	
	if("栏目内容管理"!=o_chd.innerHTML)
	{
		
		var s_tip=o_chd.innerHTML+" > "+btnNow.innerHTML;
		parent.frames["navtip"].document.getElementById("divnav").innerHTML="当前分类："+s_tip;
	}	
	
	
	
	var s_id=btnNow.parentElement.parentElement.parentElement.id.replace("items","ahr");
	
	if(s_id=="")
	{
		s_id=btnNow.parentElement.parentElement.id.replace("items","ahr");
	}
	
	var s_top=$(s_id).style.backgroundPositionY;
	
	//保存到Cookies里面
	SaveLastToCookies(btnNow.innerHTML+","+btnNow.href+","+s_top);
	
}

//从提示页面改变链接状态
function TipSetLink(s_name,s_href,s_top)
{
	var p=document.getElementsByTagName("A");
	
	for (var j = 0; j < p.length; j++){
		if(p[j].className!="class")
		{
			p[j].style.color="#5DA0D4";
		}	
		
		if(p[j].innerHTML==s_name)
		{
			//p[j].style.color="red";
			//
			changeButtonColor(p[j]);
		}	
	}
	
	SaveLastToCookies(s_name+","+s_href+","+s_top);
	
}

//保存最后访问记录
function SaveLastToCookies(s_now)
{
	var s_link=new Array();
	var s_cklink=GetCookie("LastLink");
	
	var s_set=s_now;
	
	
	if(s_cklink!=null)
	{
		var s_con=s_cklink.split('|');
		
		for(i=0;i<s_con.length;i++)
		{
			if(s_now!=s_con[i])
			{
				if(i>5) //控制历史显示的数量
					break;
				
				s_set+="|"+s_con[i];
			}
		}
	}
	
	
	SetCookie("LastLink",s_set);
	
	parent.frames["banner"].GetHistory();
}

var s_mnulst="0";
function ShowMenu(layer,id)
{
  var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象
  var srcElement = evt.srcElement || evt.target;  // 获取触发事件的源对象
  if(srcElement.src.search("plus")>0)
  {
  	srcElement.src=srcElement.src.replace("plus","minus")	;
  	$('spn'+id).style.display="";
  }
  else
  {
  	srcElement.src=srcElement.src.replace("minus","plus");
  	$('spn'+id).style.display="none";
  }
  
	if($('spn'+id).innerHTML=="")
	{
		top.o_parentFrame=window;
		window.open( 'dynamic.aspx?body=1&sel=1&layer='+layer+'&id='+id+'&rnd='+Math.random(), 'fremenu1');
	}
}

function ClassMenu()
{
	var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象
  var srcElement = evt.srcElement || evt.target;  // 获取触发事件的源对象
  if(srcElement.src.search("plus")>0)
  {
  	srcElement.src=srcElement.src.replace("plus","minus")	;
  	
  }
  else
  {
  	srcElement.src=srcElement.src.replace("minus","plus");
  	
  }
  showHide('items4');
}



var s_list;
function LoadBody()
{
	s_list=GetCookie("MenuList");
	
	var p=document.getElementsByTagName("A");
	
	for (var j = 0; j < p.length; j++)
	{
		if(p[j].onclick==null)
			p[j].onclick=changeButtonColor;
	}
	
	if(s_list!=null)
	{
		for(i=0;i<15;i++)
		{
				if(s_list.substr(i,1)=="0")
				{
					if($("items"+i)!=null)
					{
						$("items"+i).style.display = "none";
						
						$('img'+i).src=$('img'+i).src.replace("minus","plus")	;
						
					}
				}
		}
	}
	else
		{
			s_list=new Array(15).join('1');
		}
	
	
	if(top.o_pageTemplate.length==0)
	{
		top.o_parentFrame=window;
		ExecuteScriptIndex(1,"/admin/dynamic.aspx?sel=4&Rnd="+Math.random());
	}
	
	
	
	//定时运行
	if(!IsLocalhost())
		setInterval("GetUpdateInfo()",600000); 
	
	//延迟执行	
	setTimeout("GetUpdateInfo()",8000); 
}

var i_max=1;
var o_ahr=new Array("lw","eb"); //留言 和收件箱
var o_wink=new Array(0,0,0,0,0,0,0);
var i_value=new Array(0,0,0,0,0,0,0);
var i_maxwink=3;

function GetUpdateInfo()
{
	
	
	o_wink=new Array(0,0,0,0,0,0,0);
	
	ExecuteScript("/admin/dynamic.aspx?sel=5&rnd="+Math.random());
	
	
}

//闪烁提示
var l_timeoutwink=0;

//判断是否闪烁
function StartShowTip()
{
	//debugger;
	
	var i_add=0;
	
	for(i=0;i<3;i++)
	{
		
		i_add+= i_value[i];
	}
	
  window.clearInterval(l_timeoutwink);
  
  
  if(i_add>0)
  {
		//3 表示提示的总数  	
	  for(i=0;i<i_maxwink;i++)
	  {
			if( i_value[i]>0)
			{
	  		o_wink[i]="1";
	  	}	
	  	else
  		{
  			//恢复原状
  			o_wink[i]="0";
  			
  			if($("ahr"+o_ahr[i])!=null)
  				$("ahr"+o_ahr[i]).style.color="#5DA0D4";
  		}
	  }      
	  
	  l_timeoutwink=setInterval("ShowWink()",500);  
	  
	  //在admin_top提示
	  parent.frames["banner"].StartTip(true);
	}
	else
	{
		//恢复原状
		for(i=0;i<i_maxwink;i++)
	  {
	  	if($("ahr"+o_ahr[i])!=null)
				$("ahr"+o_ahr[i]).style.color="#5DA0D4";
				
  		o_wink[i]="0";
	  }      
	  parent.frames["banner"].StartTip(false);
	}	
        
}



//开始闪烁
function ShowWink()
{
	for(i=0;i<i_maxwink;i++)
	{
		if(o_wink[i]=="1")
		{
			if($("ahr"+o_ahr[i])!=null)
			{
				if($("ahr"+o_ahr[i]).style.color=="red")
				{
					$("ahr"+o_ahr[i]).style.color="#5DA0D4";
				}
				else
				{
					$("ahr"+o_ahr[i]).style.color="red";
				}	
			}	
		}
	}
}