

//时间显示函数
function timeview()
{
  timestr=LOCAL_TIME.toLocaleString(); 
  //timestr=timestr.substr(timestr.indexOf(" "));
  window.document.all.time_span.innerHTML = USERINFO+'&nbsp;'+getTimeSect()+"好！ " + "当前日期："+timestr+"&nbsp;&nbsp;&nbsp;";
  LOCAL_TIME.setSeconds(LOCAL_TIME.getSeconds()+1);
  window.setTimeout( "timeview()", 1000 );
}
//短消息脚本
//_title 标题
//_content 正文
var showMsgRect=false;
function showMessage(_title,_content)
{
	var _RECT_WIDTH=200;
	var _RECT_HEIGHT=118;
	
	var _left=window.document.body.clientWidth-_RECT_WIDTH-2;
	var _top=window.document.body.clientHeight-_RECT_HEIGHT-2;
	
	var htm='<DIV onmouseover="showMsgRect=true" onmouseout="showMsgRect=false;"  style="position:absolute;font-family:宋体; font-size:12px;'+
			'left:'+_left+'px; top:'+_top+'px ;'+
		    ' width:' + _RECT_WIDTH + ';height:' + _RECT_HEIGHT + ';' +
		    ' border:1px solid #6588BA; background:#FFFFFF;zIndex:0;filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr=#FFFFFF, endColorStr=#ECF3F6, gradientType=0)"><table style="font-size:9pt;border-bottom-color:#BED6E0;border-bottom-style:solid;border-bottom-width:1px;filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr=#C9DFE4, endColorStr=#F2F7F9, gradientType=0)" cellpadding=3 cellspacing=1 width=100%><tr><td width=90% height=25 ><b>'+_title+'</b></td><td><img id=msg_close style="cursor:hand;" onclick="DeleteMsg(this)" src="Images/icon_del.gif"></td></tr></table><table style="font-size:9pt;color:#333333;" cellpadding=5 cellspacing=0 width=100%><tr><td >'+_content+'</td></tr></table></DIV>';
	document.body.insertAdjacentHTML("beforeEnd",htm);
	LeaveShow();
}
function KeepShow()
{
	clearTimeout("close_timer");
}
function LeaveShow()
{
	var close_timer=window.setTimeout("DeleteMsg(null)",6000);
}

function DeleteMsg(ctl)
{
	
	if(ctl==null)
		ctl=document.all.msg_close;
	else
		showMsgRect=false;
	
	if(showMsgRect)
		return;
	
	try{
		var Curr=ctl.parentElement.parentElement.parentElement.parentElement.parentElement;
		window.document.body.removeChild(Curr);
	}catch(e)
	{}
	clearTimeout("close_timer");
}
function GetMessage()
{
	getOnlineUser();
	var Http = new ActiveXObject("Microsoft.XMLHTTP");
	Http.open("get","Common/msg.aspx",true);
	Http.onreadystatechange=function(){
		if(Http.readyState==4 && Http.status==200)
		{
			var txt=Http.responseText;
			if(txt=="")
				return ;
			if(txt==null)
				return ;
			try{
			var _array=new Array();
				_array=txt.split('$');
				showMessage(_array[0],_array[1]);
			}catch(e)
			{}
		}
	}
	Http.Send();
	window.setTimeout("GetMessage()",30000);
}

function GetDataEx()
{	
	repShow.innerHTML="数据正在加载……";
	var vt=setTimeout("GetTop5Message()",1);
}

function GetTop5Message()
{
	var Http = new ActiveXObject("Microsoft.XMLHTTP");
	Http.open("get","default.aspx?Type=Message",false);
	Http.Send();
	var txt=Http.responseText;
	if(txt=="")
		return ;
	if(txt==null)
		return ;
	try{
	repShow.innerHTML=txt;
	}catch(e)
	{}
}

function getTimeSect()
{
  var tag="晚上";
  var time=LOCAL_TIME.getHours()+LOCAL_TIME.getMinutes()/60;
  
	if(time<6.5)
	{
		tag="晚上";
		return tag;
	}
	if(time<8)
	{
		tag="早上";
		return tag;
	}
	if(time<11.5)
	{
		tag="上午";
		return tag;
	}
	if(time<14)
	{
		tag="中午";
		return tag;
	}
	if(time<17.5)
	{
		tag="下午";
		return tag;
	}
  
  return tag;
}


function _ShowDlg(_url,_height,_width,fixed)
{
	if(_height==0||_width==0)
	{
		_height=300;
		_width=400;
	}
	if(fixed==null)
	{
		fixed="No";
	}
	var _left=window.document.body.clientWidth/2+screenLeft-_width/2;
	var _top=window.document.body.clientHeight/2+screenTop-_height/2-60;
	window.showModalDialog(_url,null,"dialogHeight: "+_height+"px; dialogWidth: "+_width+"px; dialogTop:"+_top+"px; dialogLeft: "+_left+"px; edge: Raised; center: Yes; help: No; resizable: "+fixed+"; status: No;");
}
function showmsg(ctl,text)
{
	var oPopup = window.createPopup();
	var _width=text.length*14+20;
	var _height=-36;
	text='<DIV NOWRAP align=center STYLE="height:28px; background:#FFFFdd; border:1px solid #575757; padding:4px;"><IMG vspace=1 align=absmiddle src="Images/icon_err.gif"><font size=2 color=#DC0C0C>'+text+'</font></DIV>'
	oPopup.document.body.innerHTML=text;
	oPopup.show(0, _height, _width, 28,ctl);
}
function openBrWindow(theURL,winName,features)
{
  window.open(theURL,winName,features);
}

var MENU_VIEW=true;
var HTM_MENU=null;
var MENU_W=null;
function initMainView()
{
	self.moveTo(0,0);
	self.resizeTo(screen.availWidth,screen.availHeight);
	//self.resizeTo(1024,768);
	self.focus();
	timeview();	
	//GetMessage();
}
function MouseOverStyle(obj)
{	obj.className="IconStyleOn";
}
function MouseOutStyle(obj)
{
	obj.className="IconStyle";
}
function DoTran(obj)
{
	obj.style.filter='alpha(opacity=66);'
}
function ClearTran(obj)
{
	obj.style.filter='alpha(opacity=100);'
}
function menu_ctrl()
{
	if(!MENU_VIEW)
	{
		leftMenu.width=MENU_W;
		leftMenu.bgColor='white';
		MENU_VIEW=true;
		//leftMenu.innerHTML=HTM_MENU;
		leftMenu.style.display="";
		MainFrm.splitImg.src="Images/splitArrow.gif";
	}
	else
	{
		leftMenu.style.display="none";
		MENU_W=leftMenu.width;
		leftMenu.width=1;
		leftMenu.bgColor='#B6C5E7';
		//HTM_MENU=leftMenu.innerHTML;
		//leftMenu.innerHTML='';
		MENU_VIEW=false;
		MainFrm.splitImg.src="Images/_splitArrow.gif";
	}
	
}
function My_ShowDlg(_url,_width,_height,fixed)
{
if(_height==0||_width==0)
	 {
		_height=300;
		_width=400;
	 }
	 if(fixed==null)
	 {
		fixed="No";
	}
	 var _left=window.document.body.clientWidth/2+screenLeft-_width/2;
	 var _top=window.document.body.clientHeight/2+screenTop-_height-60;
	 var result=window.showModalDialog(_url,null,"dialogHeight: "+_height+"px; dialogWidth: "+_width+"px; dialogTop:"+_top+"px; dialogLeft: "+_left+"px; edge: raised; help: no; resizable: "+fixed+"; status: no;");
	 
	 if(result=="ok")
		window.location.reload();
}
function MyopenDlg(_url,_width,_height)
{
	window.open(_url, '', 'height='+_height+', width='+_width+', top=200,left=300, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no ,status=no');
}
function MopenDlg(_url,_width,_height)
{   
   window.open(_url, '', 'height='+_height+', width='+_width+', top=200,left=300, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no ,status=no');
   GetDataEx(); 
}

//当向加收缩时
function Right_menu_ctrl()
{
	if(!MENU_VIEW)
	{
		leftMenu.width=MENU_W;
		leftMenu.bgColor='white';
		MENU_VIEW=true;
		//leftMenu.innerHTML=HTM_MENU;
		leftMenu.style.display="";
		MainFrm.splitImg.src="Images/_splitArrow.gif";
	}
	else
	{
		leftMenu.style.display="none";
		MENU_W=leftMenu.width;
		leftMenu.width=1;
		leftMenu.bgColor='#B6C5E7';
		//HTM_MENU=leftMenu.innerHTML;
		//leftMenu.innerHTML='';
		MENU_VIEW=false;		
		MainFrm.splitImg.src="Images/splitArrow.gif";
	}
	
}

function closeWT()
{
	try{
			document.all.WTMsg.style.display="none";
		}catch(e)
		{
		}
}

function Go2Url(url)
{    
	try{
			document.all.WTMsg.style.display="";
			var _left=window.document.body.clientWidth/2-60;
	        var _top=window.document.body.clientHeight/2-30;
	        document.all.WTMsg.style.left=_left;
	        document.all.WTMsg.style.top=_top;
			document.all.WTMsg.focus();
			document.all.indexFrame.src=url;
		}catch(e)
		{
		}
}
function goback()
{
	indexFrame.history.back(-1);
}
function goforward()
{
	indexFrame.history.go(1);
}
function refresh()
{
	indexFrame.location.reload();
}
function gosearch()
{
	document.all.indexFrame.src=document.all.edAllSearch.value;
}
function exit()
{
	if(confirm("确定退出系统吗？"))
		window.close();
}
function Go2Url1(url,widht,height,fix)
{
	MyopenDlg(url,widht,height);	
}

//pop弹出窗口
var TemoPopup = window.createPopup();	
		
	
//显示弹出属性筐
function TemshowProp(img)
{		
  
}	
//Pop转向
function PopGo2Url(url)
{
    TemoPopup.hide();
    var Temp=document.all.SearchKey.value;
	document.all.indexFrame.src=url+'?key='+Temp;
}
		
//---左工具栏检测
//弹出POP窗口
function ToolshowProp(img)
{		
   
}	
//检测是否已选三个
function setsel(ctl)
{
  
  
}
//保存TOOL选项
function savetool()
{
  
}
//选项转换成按钮
function changtohtml()
{
  Left_Toolbar.innerHTML="";
  var _array=new Array();	
	_array=document.all["ToolId"].value.split(',');
	for(var j=0;j<_array.length;j++)
	{	   
	   if(_array[j]=="ed1")
	   {
	       Left_Toolbar.innerHTML=Left_Toolbar.innerHTML+"<A href=\"javascript:Go2Url('MyDocument/CopDoc.aspx');\"><IMG class=\"IconStyle\" onmousemove=\"MouseOverStyle(this)\" onmouseout=\"MouseOutStyle(this)\" src=\"Images/icon_link.gif\">&nbsp;公司文档</a>&nbsp;";
	   }
	   if(_array[j]=="ed2")
	   {
	       Left_Toolbar.innerHTML=Left_Toolbar.innerHTML+"<A href=\"javascript:Go2Url('MyDocument/privyDoc.aspx');\"><IMG class=\"IconStyle\" onmousemove=\"MouseOverStyle(this)\" onmouseout=\"MouseOutStyle(this)\" src=\"Images/icon_link.gif\">&nbsp;私人文档</a>&nbsp;";
	   }
	   if(_array[j]=="ed3")
	   {
	       Left_Toolbar.innerHTML=Left_Toolbar.innerHTML+"<A href=\"javascript:Go2Url('plan/dayplan.aspx');\"><IMG class=\"IconStyle\" onmousemove=\"MouseOverStyle(this)\" onmouseout=\"MouseOutStyle(this)\" src=\"Images/icon_link.gif\">&nbsp;日程安排</a>&nbsp;";
	   }
	   if(_array[j]=="ed4")
	   {
	       Left_Toolbar.innerHTML=Left_Toolbar.innerHTML+"<A href=\"javascript:Go2Url('Document/TransactWait.aspx');\"><IMG class=\"IconStyle\" onmousemove=\"MouseOverStyle(this)\" onmouseout=\"MouseOutStyle(this)\" src=\"Images/icon_link.gif\">&nbsp;待办公文</a>&nbsp;";
	   }
	   if(_array[j]=="ed5")
	   {
	       Left_Toolbar.innerHTML=Left_Toolbar.innerHTML+"<A href=\"javascript:Go2Url('WorkRecord/WorkRecordView.aspx');\"><IMG class=\"IconStyle\" onmousemove=\"MouseOverStyle(this)\" onmouseout=\"MouseOutStyle(this)\" src=\"Images/icon_link.gif\">&nbsp;工作记录</a>&nbsp;";
	   }
	   if(_array[j]=="ed6")
	   {
	       Left_Toolbar.innerHTML=Left_Toolbar.innerHTML+"<A href=\"javascript:Go2Url('Document/TransactFinish.aspx');\"><IMG class=\"IconStyle\" onmousemove=\"MouseOverStyle(this)\" onmouseout=\"MouseOutStyle(this)\" src=\"Images/icon_link.gif\">&nbsp;已办公文</a>&nbsp;";
	   }
	}  
}
//在加载时检测已选项
function checktool()
{
 var obj=TemoPopup.document.body;
 var _Value=document.all["ToolId"].value;
 for(var i=0;i<obj.children.length;i++)
    { 
      var ck = obj.children(i).children(0).children(0);        
      if(ck.tagName=="INPUT")
      { 
          if(_Value.indexOf(ck.id)>=0)
          {                  
            ck.checked=true;                       
          }
      }
    } 
}
//---左工具栏检测End
function PopMain()
{
	var oPopup = window.createPopup();
	oPopup.document.body.onload=new openBrWindow('Main.aspx','','status=yes ,toolbar=yes,resizable=yes');
	oPopup.show(0, 0, 20, 20,null);
}


function chk()
{
	if(""==document.all.edUser.value)
	{
		showmsg(document.all.edUser," 请输入您要登陆的帐号！");
		document.all.edUser.focus();
	}
	else
	{
		var _width=400;
		var _height=200;
		var _left=window.document.body.clientWidth/2+screenLeft-_width/2;
		var _top=window.document.body.clientHeight/2+screenTop-_height/2-60;
		//openBrWindow('redirect.htm','','height='+_height+', width='+_width+',left='+_left+', top='+_top+', status=no ,toolbar=no,resizable=yes');
		LoginFrm.submit();
	}
}
function loginInit(tag)
{
	if(tag!=null)
	{
		window.location.reload();
		return;
	}	
	window.LoginFrm.edUser.focus();
}

function openBrWindow(theURL,winName,features)
{
	window.open(theURL,winName,features);
}
function getOnlineUser()
{
//alert(LOCALUSER);
	var Http = new ActiveXObject("Microsoft.XMLHTTP");
	Http.open("get","Default.aspx?Type=1",true);
	Http.onreadystatechange=function(){
		if(Http.readyState==4 && Http.status==200)
		{
			var txt=Http.responseText;
			if(txt=="")
				return ;
			if(txt==null)
				return ;
			try{
				LOCALUSER=txt;
				//alert(LOCALUSER+'fdasfs');
			}catch(e)
			{}
		}
	}
	Http.Send();
}
function setOnlineUser()
{
	var Http = new ActiveXObject("Microsoft.XMLHTTP");
	Http.open("get","Default.aspx?Type=2",true);
	Http.onreadystatechange=function(){
		if(Http.readyState==4 && Http.status==200)
		{
			var txt=Http.responseText;
			if(txt=="")
				return ;
			if(txt==null)
				return ;
			try{
				//LOCALUSER=txt;
			}catch(e)
			{}
		}
	}
	Http.Send();
}