﻿function setcookie(cookieName, cookieValue, seconds, path, domain, secure) {
	var expires = new Date();
	expires.setTime(expires.getTime() + seconds * 1000);
	domain = !domain ? cookiedomain : domain;
	path = !path ? cookiepath : path;
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; expires=' + expires.toGMTString() : '')
		+ (path ? '; path=' + path : '/')
		+ (domain ? '; domain=' + domain : '')
		+ (secure ? '; secure' : '');
}
function updatestring(str1, str2, clear) {
	str2 = '_' + str2 + '_';
	return clear ? str1.replace(str2, '') : (str1.indexOf(str2) == -1 ? str1 + str2 : str1);
}

function getcookie(name) {
	var cookie_start = document.cookie.indexOf(name);
	var cookie_end = document.cookie.indexOf(";", cookie_start);
	return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
}
function LockSystem() {
    var webFileUrl = "Lock.aspx";
    var result = "";
    var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
    xmlHttp.open("POST", webFileUrl, false); //使用XMLPOST方式
    xmlHttp.send(""); //发送  　　
    result = xmlHttp.responseText; //得到返回的结果
    document.all("sLock").innerHTML = result;
}
function OpenNotify() {
    var webFileUrl = "Notify.aspx";
    var result = "";
    var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
    xmlHttp.open("POST", webFileUrl, false); //使用XMLPOST方式
    xmlHttp.send(""); //发送  　　
    result = xmlHttp.responseText; //得到返回的结果
    document.all("SNotify").innerHTML = result;
}

function FnInit() {
}

function unLock(upass)
 {
     if (upass == '')
      {
         alert("请输入你的密码");
      }
      else 
        {
         var webFileUrl = "unLock.aspx?password=" + upass;
         var result = "";
         var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
         xmlHttp.open("POST", webFileUrl, false); //使用XMLPOST方式
         xmlHttp.send(""); //发送  　　
         result = xmlHttp.responseText; //得到返回的结果
         if (result == "UnLock")
           {
             document.all("sLock").innerHTML = "";
         }
         else {
             alert("密码不正确");
         }
     }          
  }

function ImageChanged(img,count)
		{ 
			var newimage
			newimage=img.src;
			if(count == 0)
			newimage = newimage.replace("1.gif","2.gif");
			else
			newimage = newimage.replace("2.gif","1.gif");
			img.src = newimage;      
		}
			function exit()
			{
				strUrl = "Logout.aspx";
				strPro = "height=1,border=none,width=1, top=0,left=0,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no";
				window.open(strUrl,"",strPro);
			}
			

function fopenwin(obj) 
{	showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
	showy = event.screenY - event.offsetY + 18; // + deltaY;
	newWINwidth = 210 + 4 + 18;
	retval = window.showModalDialog("Calendar.ftl", "", "dialogWidth:197px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no;" );
	if( retval != null ) 
	{
	  	obj.value = retval;
	}
}
var msgCalYear = "年";
var msgCalMonth = "月";
var msgCalDay = "日";
var msgCalWeek = "星期";
var msgCalToCurMon = "到当前月";
var msgCalClickGet = "点击取值";
var msgCalToday = "今天是：";
var msgCalClear = "清空";
var msgCalWeek0 = "日";
var msgCalWeek1 = "一";
var msgCalWeek2 = "二";
var msgCalWeek3 = "三";
var msgCalWeek4 = "四";
var msgCalWeek5 = "五";
var msgCalWeek6 = "六";
var msgCalPriorMon = "上一个月";
var msgCalNextMon = "下一个月";
var msgCalSelMonth = "点击选择月";
var msgCalSelYear = "点击选择年";
var imgDir = "../images/";


function LoadWindow(URL) {
    window.showModalDialog(URL, self, "edge:raised;scroll:0;status:0;help:0;resizable:1;dialogWidth:400px; dialogHeight:420px; center: Yes;");
}

function LoadWindowScore(URL) {
    window.showModalDialog(URL, self, "edge:raised;scroll:1;status:0;help:0;resizable:1;dialogWidth:400px; dialogHeight:420px; center: Yes;");
}

//超链接指向,str标题,href地址
function HrefTarget(str,href)
{   
  var str,href;
  var parentfrm=window.parent;
  parentfrm.run_item(str,href,-1);
	 }

//显示、隐藏菜单
function switchSysBar(obj,ImgPath){    
	if (document.all("X_Left").style.display==""){
	 obj.src=ImgPath+"goout.gif";
	 obj.title='显示菜单';
	 document.all("X_Left").style.display="none";
	 }
	else{         
	 obj.src=ImgPath+"goin.gif";
	 obj.title='隐藏菜单';
	 document.all("X_Left").style.display="" ;
	}
}

//显示、隐藏菜单
function switchSysTop(obj){    
	if (document.all("X_Top").style.display==""){
	 obj.src="IMAGES/ManageMain/Topgoout.gif";
	 obj.title='显示';
	 document.all("X_Top").style.display="none";
	 }
	else{         
	 obj.src="IMAGES/ManageMain/Topgoin.gif";
	 obj.title='隐藏';
	 document.all("X_Top").style.display="" ;
	}
}

//取得日期和星期
function initArray(){
	 this.length=initArray.arguments.length
	 for(var i=0;i<this.length;i++)
	 this[i+1]=initArray.arguments[i] 
}
 
function initTime(){
	today=new Date();
    var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); 
    document.write(today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日 ",d[today.getDay()+1],"&nbsp;");  	
}

//功能操作
function gotoMydesk(type){	
    if (type==7)
	{   
	    HrefTarget('在线帮助','Help/Index.Aspx');		
		return;
	}
	
	if (type==8)
	{
		if (!confirm("确定要注销吗?")){
			return false;
		}else{
		    window.location.href="LoginOut.aspx";
		    return true;			
			}		
	}
	if (type==9)
	{
		if (!confirm("确定要退出吗?")){
			return false;
		}else{
		    window.location.href="LoginOut.aspx?act=closewin";
		    return true;		
		}
	}				
}		


function settimes(){   
	  var time= new Date();   
	  hours  = time.getHours();   
	  mins  = time.getMinutes();   
	  secs  = time.getSeconds();   
	  if(hours<10)hours="0"+hours;   
	  if(mins<10)mins="0"+mins;   
	  if(secs<10)secs="0"+secs;	     
	  eval("document.all.timediv.innerHTML='时间："+hours+":"+mins+":"+secs+"'");   
	  setTimeout("settimes()",1000);   
  }

function openwin(w,h,url)
		{
		var l=(window.screen.width/2)-w/2;
		var t=(window.screen.height/2)-h/2;
		window.open(url,'','width='+w+',height='+h+',top='+t+',left='+l+',menubar=no,toobar=no,scrollbars=yes,resizable=yes,status=no,loation=no');
	
}
function calenderout(){                            
calendar = new Date(); 
month = calendar.getMonth();                                 
date = calendar.getDate();                                 
year = calendar.getYear();
hours= calendar.getHours();
if (year< 100)  year = 2000 + year;
 document.write(" <font color=red><b>今天是："+year+"年"+(month+1)+"月"+date+"日");                             
//提前十天提醒节日                                 
document.write("<br>"); 
//以下为元旦提醒 
if ((month == 11) && (date == 22))  document.write("距元旦还有十天！");
if ((month == 11) && (date == 23))  document.write("距元旦还有九天！");
if ((month == 11) && (date == 24))  document.write("距元旦还有八天！");
if ((month == 11) && (date == 25))  document.write("距元旦还有七天！");
if ((month == 11) && (date == 26))  document.write("距元旦还有六天！");
if ((month == 11) && (date == 27))  document.write("距元旦还有五天！");
if ((month == 11) && (date == 28))  document.write("距元旦还有四天！");
if ((month == 11) && (date == 29))  document.write("距元旦还有三天！");
if ((month == 11) && (date == 30))  document.write("距元旦还有二天！");
if ((month == 11) && (date == 31))  document.write("距元旦还有一天！");               
if ((month == 0) && (date == 1))  document.write("元旦快乐！");
//情人节提醒 
if ((month == 1) && (date == 4)) document.write("距情人节还有十天！");
if ((month == 1) && (date == 5)) document.write("距情人节还有九天！");
if ((month == 1) && (date == 6)) document.write("距情人节还有八天！");
if ((month == 1) && (date == 7)) document.write("距情人节还有七天！");
if ((month == 1) && (date == 8)) document.write("距情人节还有六天！");
if ((month == 1) && (date == 9)) document.write("距情人节还有五天！");
if ((month == 1) && (date == 10)) document.write("距情人节还有四天！");
if ((month == 1) && (date == 11)) document.write("距情人节还有三天！");
if ((month == 1) && (date == 12)) document.write("距情人节还有二天！");
if ((month == 1) && (date == 13)) document.write("距情人节还有一天！");                    
if ((month == 1) && (date == 14)) document.write("情人节快乐！");
//妇女节提醒，还要考虑是不是闰年的问题 
if ((((year%4)==0)&&((year%100)!=0))||((year%400)==0))
{
if ((month == 1) && (date == 26)) document.write("距劳动妇女节还有十天！");
if ((month == 1) && (date == 27)) document.write("距劳动妇女节还有九天！");
if ((month == 1) && (date == 28)) document.write("距劳动妇女节还有八天！");
if ((month == 1) && (date == 29)) document.write("距劳动妇女节还有七天！");
}
else
{
if ((month == 1) && (date == 25)) document.write("距劳动妇女节还有十天！");
if ((month == 1) && (date == 26)) document.write("距劳动妇女节还有九天！");
if ((month == 1) && (date == 27)) document.write("距劳动妇女节还有八天！");
if ((month == 1) && (date == 28)) document.write("距劳动妇女节还有七天！");
}


if ((month == 2) && (date == 1)) document.write("距劳动妇女节还有六天！");
if ((month == 2) && (date == 2)) document.write("距劳动妇女节还有五天！");
if ((month == 2) && (date == 3)) document.write("距劳动妇女节还有四天！");
if ((month == 2) && (date == 4)) document.write("距劳动妇女节还有三天！");
if ((month == 2) && (date == 6)) document.write("距劳动妇女节还有二天！");
if ((month == 2) && (date == 7)) document.write("距劳动妇女节还有一天！");         
if ((month == 2) && (date == 8)) document.write("今天是国际劳动妇女节！");
//劳动节提醒

if ((month == 3) && (date == 21)) document.write("距劳动节还有十天！");
if ((month == 3) && (date == 22)) document.write("距劳动节还有九天！");
if ((month == 3) && (date == 23)) document.write("距劳动节还有八天！");
if ((month == 3) && (date == 24)) document.write("距劳动节还有七天！");
if ((month == 3) && (date == 25)) document.write("距劳动节还有六天！");
if ((month == 3) && (date == 26)) document.write("距劳动节还有五天！");
if ((month == 3) && (date == 27)) document.write("距劳动节还有四天！");
if ((month == 3) && (date == 28)) document.write("距劳动节还有三天！");
if ((month == 3) && (date == 29)) document.write("距劳动节还有二天！");
if ((month == 3) && (date == 30)) document.write("距劳动节还有一天！");
if ((month == 4) && (date == 1)) document.write("今天是国际劳动节！");
//儿童节提醒

if ((month == 4) && (date == 22)) document.write("距儿童节还有十天！");
if ((month == 4) && (date == 23)) document.write("距儿童节还有九天！");
if ((month == 4) && (date == 24)) document.write("距儿童节还有八天！");
if ((month == 4) && (date == 25)) document.write("距儿童节还有七天！");
if ((month == 4) && (date == 26)) document.write("距儿童节还有六天！");
if ((month == 4) && (date == 27)) document.write("距儿童节还有五天！");
if ((month == 4) && (date == 28)) document.write("距儿童节还有四天！");
if ((month == 4) && (date == 29)) document.write("距儿童节还有三天！");
if ((month == 4) && (date == 30)) document.write("距儿童节还有二天！");
if ((month == 4) && (date == 31)) document.write("距儿童节还有一天！");
if ((month == 5) && (date == 1)) document.write("今天是国际儿童节！");
//教师节提醒
if ((month == 7) && (date == 31)) document.write("距教师节还有十天！");
if ((month == 8) && (date == 1)) document.write("距教师节还有九天！");
if ((month == 8) && (date == 2)) document.write("距教师节还有八天！");
if ((month == 8) && (date == 3)) document.write("距教师节还有七天！");
if ((month == 8) && (date == 4)) document.write("距教师节还有六天！");
if ((month == 8) && (date == 5)) document.write("距教师节还有五天！");
if ((month == 8) && (date == 6)) document.write("距教师节还有四天！");
if ((month == 8) && (date == 7)) document.write("距教师节还有三天！");
if ((month == 8) && (date == 8)) document.write("距教师节还有二天！");
if ((month == 8) && (date == 9)) document.write("距教师节还有一天！");
if ((month == 8) && (date == 10)) document.write("今天是教师节！");
//国庆节提醒 
if ((month == 8) && (date == 21)) document.write("距国庆节还有十天！");
if ((month == 8) && (date == 22)) document.write("距国庆节还有九天！");
if ((month == 8) && (date == 23)) document.write("距国庆节还有八天！");
if ((month == 8) && (date == 24)) document.write("距国庆节还有七天！");
if ((month == 8) && (date == 25)) document.write("距国庆节还有六天！");
if ((month == 8) && (date == 26)) document.write("距国庆节还有五天！");
if ((month == 8) && (date == 27)) document.write("距国庆节还有四天！");
if ((month == 8) && (date == 28)) document.write("距国庆节还有三天！");
if ((month == 8) && (date == 29)) document.write("距国庆节还有二天！");
if ((month == 8) && (date == 30)) document.write("距国庆节还有一天！");           
if ((month == 9) && (date == 1)) document.write("今天是国庆节！");
//圣诞提醒  
if ((month == 11) && (date == 15)) document.write("距圣诞还有十天！");
if ((month == 11) && (date == 16)) document.write("距圣诞还有九天！");
if ((month == 11) && (date == 17)) document.write("距圣诞还有八天！");
if ((month == 11) && (date == 18)) document.write("距圣诞还有七天！");
if ((month == 11) && (date == 19)) document.write("距圣诞还有六天！");
if ((month == 11) && (date == 20)) document.write("距圣诞还有五天！");
if ((month == 11) && (date == 21)) document.write("距圣诞还有四天！");
if ((month == 11) && (date == 22)) document.write("距圣诞还有三天！");
if ((month == 11) && (date == 23)) document.write("距圣诞还有二天！");
if ((month == 11) && (date == 24)) document.write("距圣诞还有一天！");
if ((month == 11) && (date == 25)) document.write("圣诞快乐！");
document.write("</b></font>");  }  

function send_root_request(url) {//初始化、指定处理函数、发送请求的函数
	 http_request = false;
	 if(window.XMLHttpRequest) {
	  http_request = new XMLHttpRequest();	  
	  if (http_request.overrideMimeType) {//设置MiME类别
		http_request.overrideMimeType('text/xml');
	  }
	}
	else if (window.ActiveXObject) { // IE浏览器
	  try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
	  }catch (e){
		try {
			http_request = new ActiveXObject("Microsoft.XMLHTTP");
	  }catch (e) {

		}
	  }
	}

	if (!http_request) { // 异常，创建对象实例失?
	  window.alert("不能创建XMLHttpRequest对象实例.");
	  return false;
	}
	http_request.onreadystatechange = processRootRequest;
	// 确定发送请求的方式和URL以及是否同步执行下段代码	
	http_request.open("POST", url, true);
	http_request.send(null);
	//
}
function processRootRequest() {		
if (http_request.readyState == 4) { // 判断对象状态
	if (http_request.status != 200) { // 信息已经成功返回，开始处理信息	 			   	
		 alert("您所请求的页面有异常。");
	   }
	}
}

function center(){
if(event.ctrlKey && window.event.keyCode==13){checkform();}
if (window.say.saytext.value.length > 210) 
window.say.saytext.value = window.say.saytext.value.substring(0,210);
}

//--------------------------------------文件功能---------------------------------------------------
var currFocus;
var ExistAttaInfo = new Array();
var oldDelAttas = new Array();
var attaIdx = 0;
var IsIE;
function fInitMSIE(){
	if (navigator.userAgent.indexOf("MSIE") != -1){
		IsIE = true;
	}else{
		IsIE = false;
	}
}
fInitMSIE();



function fTrim(str){
	str = str.replace(/(^\s*)/,"");
	str = str.replace(/(\s*$)/,"");
	return str;
}

//    function list
//    -------------------------------------------------------------------------------------------------------------------
//    IsIEBrowser()  返回值: true(IE) false(NNx)
//    exist(fileId)  判断fileId是否已经存在
//    addInputFile(spanId,fileId)  在名为spanId 的元素里面增加序号为index的input file
//    addbr(spanId,brId)  在名为spanId 的元素里面增加id为brId的换行符
//    adddel(spanId,index) 在名为spanId 的元素里面增加序号为index的"删除"按钮，他可以删除相应的input file 和 br
//    addhidden(spanId,hiddenId,value)  在名为spanId 的元素里面增加id为hiddenId，值为value的input type=hidden
//    -------------------------------------------------------------------------------------------------------------------

var IsIE;
var attaIdx = 0;

//search,全局变量
//-----------------------------------------------------------------------------------------------------------
function IsIEBrowser() {
	if (navigator.userAgent.indexOf("MSIE") != -1) {
		return true;
		} else {
		return false;
		}
}

// 增加文件函数 ()，增加到 idfilespan,基数为 attaIdx 。

function add() {

	addfile("idfilespan",attaIdx);
	attaIdx++;
	return false;
}

//----------------------------------------fileexist()----------------------------------------------------------
//edited by alun
function exist(fileId) {
      var file = document.getElementById(fileId);
	  var result = false;
	  if ( file !=null ) {
			if ( file.value != null && file.value != "") {
				result = existFile( file);
				
			}//if
	  }
	  if( result)
	  {
		alert("这个文件您已经添加过了,新添加的文件将已被删除");
		//document.sendmail."+fileId+".value=""";
		var attach_num = fileId.substring(10,12);
		
		delfile("idfilespan",attach_num);
		 
		//--attaIdx;
		//document.getElementById( "idAttachOper"+ attaIdx).click();
	  }
	add();
}//end of function
//added by alun
function getfilename( attaName ) {
	var s = attaName.lastIndexOf( '\\' );
	return attaName.substr(s+1, attaName.length - s -1);
}
//added by alun
function existFile( file)
{
	var form = document.sendmail;
	for ( var i= 0 ; i < form.elements.length ; i ++ ) {				    
		if ( form.elements[i].type == "file" && form.elements[i].name != file.name ) {
			if ( file.value == form.elements[i].value ) {
				//alert(form.elements[i].value=null);
				return true;
			}
		}
	}//for
	for (var i=0; i<ExistAttaInfo.length; i++) {
		var theName = ExistAttaInfo[i];
		if ( theName != null && theName != "" && theName == getfilename(file.name) ) {
			return true;
		}
	}
	return false;
}
//----------------------------------------addfile(spanId,index)----------------------------------------------
function addfile(spanId,index)
{
       var strIndex = "" + index;
	   
	   var fileId = "attachfile"+ strIndex;
	   var brId = "idAttachBr" + strIndex;
	   addInputFile(spanId,fileId);

	   adddel(spanId,index);

	   addbr(spanId,brId);
	   //document.getElementById( "attachfile"+ strIndex).click();
	   return;
}
//-------------------------------------------sub fuction addInputFile-----------------------------------------
function addInputFile(spanId,fileId)
{
	  var span = document.getElementById(spanId);
	  if ( span !=null ) {
	                if ( !IsIE ) {
						var fileObj = document.createElement("input");
						if ( fileObj != null ) {
							fileObj.type="file";
							fileObj.name = fileId;
							fileObj.id = fileId;
							fileObj.size="50";
							var clickEvent = "exist('" + fileId + "')";
							fileObj.setAttribute("onclick",clickEvent,0);  
							span.appendChild(fileObj);
						}//if fileObj
					}// !IsIE

					if ( IsIE ) {
						var fileTag = "<input type='file'  id ='" + fileId + "' size=46 name='file" + fileId + "' onchange=exist('" + fileId + "')>";
						var fileObj = document.createElement(fileTag); 
						span.appendChild(fileObj);
					}//IsIE if
			
	  }//if span
}

function addbr(spanId,brId)
{
	  var span = document.getElementById(spanId);
	  if ( span !=null ) {
			var brObj = document.createElement("br");
			if ( brObj !=null ) {
				brObj.name = brId;
				brObj.id = brId;
				span.appendChild(brObj);
            }//i2f
     }//if
	 return;
}

function adddel(spanId,index)
{
      var strIndex = "" + index;
	  var delId = "idAttachOper" + strIndex;
	  var span = document.getElementById(spanId);
	  if ( span != null ) {
			var oTextNode = document.createElement("SPAN");
			oTextNode.style.width = "5px";
			span.appendChild(oTextNode);
		    if ( IsIE ) {
	        var tag = "<input type='submit' class=button style='BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; OVERFLOW: no; BORDER-LEFT: #000000 1px solid;  BORDER-BOTTOM: #000000 1px solid; HEIGHT: 20' size=46 value=''  id='" + delId + "' onclick=delfile('" + spanId + "',"+strIndex+")></input>";
			var delObj = document.createElement(tag);
			if ( delObj != null ) {
				span.appendChild(delObj);
			}//if

			}// Is IE
			
	        if ( !IsIE ) {
				var delObj = document.createElement("input");
				if ( delObj != null ) {
					delObj.name = delId;
					delObj.id = delId;
					delObj.type = "button";
					var clickEvent = "return delfile('" + spanId + "',"+strIndex+");";
					delObj.setAttribute("onclick",clickEvent);  
					span.appendChild(delObj);
				}//if
			}// !IsIE if
			if( delObj != null) delObj.value = "删除文件";
		}//main if
		return;
}


//-------------------------------------------------------------------------------------------------------------


//---------------------------------------------delete input file-----------------------------------------------
function delfile(spanId,index)
{
	   var strIndex = "" + index;
	   var fileId = "attachfile"+ strIndex;
	   var brId = "idAttachBr" + strIndex;
	   var delId = "idAttachOper" + strIndex;
	   //first,get the element
       var span = document.getElementById(spanId);
	   //alert(  "del span: " + span  );
	   if ( span == null ) return false;

	   var fileObj = document.getElementById(fileId);
	   if ( fileObj == null ) return false;

	   var brObj = document.getElementById(brId);
	   if ( brObj ==null ) return false;

	   var delObj = document.getElementById(delId );
	   //alert(  "del delId: " + delObj  );
	   if ( delObj == null ) return false;

       //second,create the replace element
	   var temp= document.createElement("SPAN");
	   //third,replace it
	    span.replaceChild(temp,fileObj);
		span.replaceChild(temp,brObj);
		// Added by Harry, Repair Remove attached bug 2005/04/04
		span.removeChild(delObj.previousSibling);
		var attach = document.getElementById("attach");
		if(span.getElementsByTagName("INPUT").length == 1) attach.childNodes[0].nodeValue='添加文件';
		// End
		span.replaceChild(temp,delObj);	
		
		return false;
}


ie4=(document.all)?true:false;
ns4=(document.layers)?true:false;




function toExit(){
var args=toExit.arguments;
var visible=args[0];
if(ns4){
        theObj=eval("document.layers[\'"+args[1]+"\']");
        if(theObj)theObj.visibility=visible;
        }
else if(ie4){
        if(visible=='show')visible='visible';
        if(visible=='hide')visible='hidden';
        theObj=eval("document.all[\'"+args[1]+"\']");
        if(theObj)theObj.style.visibility=visible;
        }

}
function checkclick(msg)
{
if(confirm(msg))
{
event.returnValue=true;
}
else
{
event.returnValue=false;
}
}
function chkall(e)
{
	if(form1.MAID)
	{
		form1.MAID.checked=e.checked;
		for(i=0;i<form1.MAID.length;i++)
		if(form1.MAID[i].disabled!=true) form1.MAID[i].checked=e.checked;
	}
}

//复选表单全选事件 form：表单名
function CheckAll(form)  {
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if (e.name != 'chkall'&&e.type=="checkbox")
		{
			e.checked = form.chkall.checked;
		}
	}
}
function popUpcalendar3(ctl, obj, format) {
    if (arguments.length == 0) {
        //如果是文本框的onmousedown世间是由脚本绑定的,且没有参数  modified by qiuchun
        if (event.srcElement) {
            var pchild = event.srcElement;
            if (pchild.type && pchild.type.toLowerCase() == "text")
                arguments[0] = pchild.id;
        }
    }
    var x = event.screenX;
    var y = event.screenY;
    var result = window.showModalDialog('../../Calendar.htm', 'Calendar', "dialogLeft:" + x + "px;dialogTop:" + y + "px;dialogWidth:195px;dialogHeight:200px;help:no;status:no");
    //alert(arguments[0]);
    if (result != null)
        arguments[1].value = result;
    //eval(arguments[0]+".value=result");		
    return false;
}		

function popUpcalendar2(ctl,obj,format)
{
    if (arguments.length==0){
	  //如果是文本框的onmousedown世间是由脚本绑定的,且没有参数  modified by qiuchun
	  if (event.srcElement){
	    var pchild = event.srcElement;
	    if (pchild.type && pchild.type.toLowerCase() == "text")
	      arguments[0] = pchild.id;
	  }
	}
	var x=event.screenX;
	var y=event.screenY;
	var result=window.showModalDialog('../Calendar.htm','Calendar',"dialogLeft:"+x+"px;dialogTop:"+y+"px;dialogWidth:195px;dialogHeight:200px;help:no;status:no");
	//alert(arguments[0]);
	if(result!=null)
	arguments[1].value=result;
		//eval(arguments[0]+".value=result");		
	return false;
}		
function $(objID) {
  return document.getElementById(objID)
}

function $F(objID) {
  return document.getElementById(objID).value
}
 
var XMLHttp=function(){
	try {return new ActiveXObject("Msxml5.XMLHTTP");}catch(e){}
	try {return new ActiveXObject("Msxml4.XMLHTTP");}catch(e){}
	try {return new ActiveXObject("Msxml3.XMLHTTP");}catch(e){}
	try {return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){}
	try {return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}
	try {return new XMLHttpRequest();}catch(e){}
	return null;
}

function updater(objid,url,method,parameters,loading,async){
	var req=new XMLHttp();
	var objid=objid;
	var url=url;
	var method=method;
	var parameters=parameters;
	var loading=loading;
	var async=async;
	if (req!=null){
		req.onreadystatechange = function(){
			if (req.readyState==4){
				if(req.status==200){
					//window.status=""
					$(loading).style.display="none";
					$(objid).innerHTML=req.responseText;
				}else{
					//window.status="服务器出错,错误代码："+req.statusText
					alert("服务器出错,错误代码："+req.statusText)
				}
			}else{
				// window.status="正在加载......"
				 $(loading).style.display="block";
			}
		}
		if (parameters=="") url=url;
		else url+="?"+parameters;
		url+=(url.indexOf("?") >= 0)?"&nowtime="+new Date().getTime():"?nowtime=" + new Date().getTime();
		if (method=='get'){
			req.open('GET',url,async);
			req.send(null);
		}else if (method=='post'){
			req.open('POST',url,async);
			req.setRequestHeader("Content-Length",parameters.length); 
			req.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=UTF-8');
			req.send(parameters);
		}else{
		    alert("请至少使用一种传送方式");
		}
	}else{
		alert("无法创建xmlhttp");
	}
}
function updater2(objid,url,method,parameters,async){
	var req=new XMLHttp();
	var objid=objid;
	var url=url;
	var method=method;
	var parameters=parameters;
	var loading=loading;
	var async=async;
	if (req!=null){
		req.onreadystatechange = function(){
			if (req.readyState==4){
				if(req.status==200){
					//window.status=""
					$(objid).innerHTML=req.responseText;
				}else{
					//window.status="服务器出错,错误代码："+req.statusText
					alert("服务器出错,错误代码："+req.statusText)
				}
			}
		}
		if (parameters=="") url=url;
		else url+="?"+parameters;
		url+=(url.indexOf("?") >= 0)?"&nowtime="+new Date().getTime():"?nowtime=" + new Date().getTime();
		if (method=='get'){
			req.open('GET',url,async);
			req.send(null);
		}else if (method=='post'){
			req.open('POST',url,async);
			req.setRequestHeader("Content-Length",parameters.length); 
			req.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=UTF-8');
			req.send(parameters);
		}else{
		    alert("请至少使用一种传送方式");
		}
	}else{
		alert("无法创建xmlhttp");
	}
}

function updater1(url,method,parameters,async){
	var req=new XMLHttp();
	var url=url;
	var method=method;
	var parameters=parameters;
	var async=async;
	if (req!=null){
		req.onreadystatechange = function(){
			if (req.readyState==4){
				if(req.status==200){
					//window.status=""
					document.write(req.responseText);					
				}else{
					//window.status="服务器出错,错误代码："+req.statusText
					alert("服务器出错,错误代码："+req.statusText)
				}
			}else{
				// window.status="正在加载......"				 
			}
		}
		if (parameters=="") url=url;
		else url+="?"+parameters;
		url+=(url.indexOf("?") >= 0)?"&nowtime="+new Date().getTime():"?nowtime=" + new Date().getTime();
		if (method=='get'){
			req.open('GET',url,async);
			req.send(null);
		}else if (method=='post'){
			req.open('POST',url,async);
			req.setRequestHeader("Content-Length",parameters.length); 
			req.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=UTF-8');
			req.send(parameters);
		}else{
		    alert("请至少使用一种传送方式");
		}
	}else{
		alert("无法创建xmlhttp");
	}
}

function ShareDisplay(objname)
{
  var sharedisplay=document.getElementById(objname).style.display;
  if(objname=="Panel1")
  { 
    document.getElementById(objname).style.display='';
    document.getElementById('Panel2').style.display='none';
    document.getElementById('Panel3').style.display='none';	
	}
	else if(objname=="Panel2")
    { 
      document.getElementById(objname).style.display='';
      document.getElementById('Panel1').style.display='none';
       document.getElementById('Panel3').style.display='none';	
	   }
	   else if(objname=="Panel2")
          { 
           document.getElementById(objname).style.display='';
           document.getElementById('Panel1').style.display='none';
           document.getElementById('Panel3').style.display='none';	
	        }
			else if(objname=="Panel3")
              { 
              document.getElementById(objname).style.display='';
              document.getElementById('Panel1').style.display='none';
              document.getElementById('Panel2').style.display='none';	
	            }
	           else
                { 
                  document.getElementById('Panel1').style.display='none';
                  document.getElementById('Panel2').style.display='none';
                  document.getElementById('Panel3').style.display='none';	
	               }
	
	}
  
