var gi_ModuleId,gi_ModeuId2
var bshow=0

document.onclick = function divhide1() 
{
	if (!bshow && gi_ModuleId != null)
	{
	  gi_ModuleId.style.visibility ='hidden';	
	}	
	bshow = false;	
}

function menudiv_click(moduleId)
{
   if(moduleId.style.visibility == 'visible')
     {        
		moduleId.style.visibility ='hidden';			 
     }
   else
     { 
       if (gi_ModuleId != null)
          gi_ModuleId.style.visibility ='hidden';	       
                
        if (moduleId.id.toLowerCase() != 'singlesignon')
		{
			moduleId.style.left=(event.clientX + document.body.scrollLeft - event.offsetX - 80)+'px';  
			moduleId.style.top=(event.clientY + document.body.scrollTop - event.offsetY + 10)+'px';   		
		}
								
		moduleId.style.visibility ='visible';   		    		
		gi_ModuleId = moduleId; 
		bshow = true;		
     }
}

function setTableStyle(objTable,objTD)
{	
	//alert(objTD.childNodes[0].childNodes[0].childNodes[0].childNodes[1].innerHTML)
	if(objTable.style.display == "")
	{
		objTable.style.display = "none";
		objTD.childNodes[0].childNodes[0].childNodes[0].childNodes[1].innerHTML = "还原";
	}
	else
	{
		objTable.style.display = "";
		objTD.childNodes[0].childNodes[0].childNodes[0].childNodes[1].innerHTML = "最小化";
	}
		
}

function inCell(cell) {
	if (!cell.contains(event.fromElement)) {
		cell.bgColor = "#FEE197";
		cell.style.border="1px solid #3B5183";
		//alert(cell.childNodes[0].childNodes[0].childNodes[0].childNodes[0].innerHTML);
		cell.childNodes[0].childNodes[0].childNodes[0].childNodes[0].cssText="filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#FEE197, endColorstr=#FEE197,gradientType='1');width: 20px;";								
		//alert(cell.childNodes[0].childNodes[0].childNodes[0].childNodes[0].bgColor)			
	}
}

function outCell(cell) {
	if (!cell.contains(event.toElement)) {
		cell.bgColor = "";		
		cell.style.border="0";	
		cell.childNodes[0].childNodes[0].childNodes[0].childNodes[0].cssText="filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#E7F0FF, endColorstr=#A2B8F4,gradientType='1');width: 20px;";							
	}
}

function inSingleSignOnCell(cell) 
{
	if (!cell.contains(event.fromElement)) 
	{
		cell.bgColor = "#FEE197";
		cell.style.border="1px solid #3B5183";
	}
}

function outSingleSignOnCell(cell) {
	if (!cell.contains(event.toElement)) {
		cell.bgColor = "";		
		cell.style.border="0";			
	}
}
/*标签切换函数*/
function show_divMS(div){
	var inum = div.parentNode.getElementsByTagName(div.tagName).length;
	var idname = div.id;
	var idstr = idname.substring(0,2);
	var num = idname.substring(2,idname.length);
	for(var i=1;i<=inum;i++)
	{	try{
			document.getElementById(idstr+"body"+i).className="Winstar-undis";
			document.getElementById(idstr+i).className="";
		}catch(e){}
	}
		document.getElementById(idstr+"body"+num).className="Winstar-dis";
		document.getElementById(idstr+num).className="on";
}
/*表格经过换色*/
	function changeTable(tablename){
		var tbodyTable = document.getElementById(tablename).getElementsByTagName("table");
		var tbody = tbodyTable[0].getElementsByTagName("tr");
		var inum = tbody.length;
		var trClassName="";
		for(var i=1;i<inum;i++){
			tbody[i].onmouseover = function(){trClassName = this.className;this.className = "Winstar-table-over";};
			tbody[i].onmouseout = function(){this.className = trClassName;};
		}
	}
	function changeTableTest(tablename){
		var tbodyTable = document.getElementById(tablename);
		var tbody = tbodyTable.getElementsByTagName("tr");
		var inum = tbody.length;
		var trClassName="";
		for(var i=1;i<inum;i++){
			tbody[i].onmouseover = function(){trClassName = this.className;this.className = "Winstar-table-over";};
			tbody[i].onmouseout = function(){this.className = trClassName;};
		}
	}
	
/*滚动creat by lijing*/	
  function scrollright(){
    var speed=40;
    var failsure1=document.getElementById("failsure1");
    var failsure2=document.getElementById("failsure2");
    var failtest=document.getElementById("failtest");
	if(failsure1!=null||failsure2!=null||failtest!=null){
    failsure2.innerHTML=failsure1.innerHTML;
    function Marquee() 
    {  
     if(failsure2.offsetTop-failtest.scrollTop<=0) {failtest.scrollTop-=failsure1.offsetHeight;}
     else {failtest.scrollTop++;} 
    }
    var MyMar=setInterval(Marquee,speed) 
    failtest.onmouseover=function() {clearInterval(MyMar);} 
    failtest.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
	}
  }
 // if(window.attachEvent){
    //window.attachEvent("onload",scrollright);}
	
	if (document.all)
	{
		window.attachEvent('onload',scrollright);//对于IE
	} 
	else
	{
		window.addEventListener('load',scrollright,false);//对于FireFox 
	}



//guoqing image
var bestimg={
	timer:null,
	height:0,
	i:0,
	o:function(obj){return document.getElementById(obj);},
	userAgent:function()
	{
		var Sys = {};
		var ua = navigator.userAgent.toLowerCase();
		var s;
		(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
		(s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
		(s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
		(s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
		(s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
		return Sys;
	},
	loadbestimg:function()
	{
		if(bestimg.o("bestouter"))
		{
			bestimg.o("bestouter").style.left=((document.body.clientWidth-1000)/2)+"px";
			if(document.all)
				bestimg.height=bestimg.o("bestouter").currentStyle.height;
			else
				bestimg.height=document.defaultView.getComputedStyle(bestimg.o("bestouter"),null).height;
			bestimg.height=parseInt(bestimg.height.replace("px",""),10);
			bestimg.o("bestouter").getElementsByTagName("span")[0].onclick=bestimg.closeimg;
		}
	},
	closeimg:function()
	{
		if(bestimg.i>=19)
		{	
			clearTimeout(bestimg.timer);
			bestimg.o("bestouter").style.display='none';
			return;
		}	
		else
		{
			bestimg.o("bestouter").style.height=(bestimg.o("bestouter").offsetHeight-Math.ceil(bestimg.height/20))+"px";
			bestimg.i++;
		}
		bestimg.timer=window.setTimeout(bestimg.closeimg,50);
	},
	scrol:function()
	{
		if(bestimg.o("bestouter"))
		{
			var top=document.documentElement.scrollTop==0?document.body.scrollTop:document.documentElement.scrollTop;
			bestimg.o("bestouter").style.top=(160+top)+"px";
		}
	},
	addEvent:function(obj,func,ftype)
	{
		if(bestimg.userAgent().ie)
			obj.attachEvent("on"+ftype,func);
		else
			obj.addEventListener(ftype,func,false);	
	}
}
bestimg.addEvent(window,bestimg.loadbestimg,"load");
if(bestimg.userAgent().ie)
	bestimg.addEvent(window,bestimg.scrol,"scroll");



