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 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;
	}
}
function chkall1(e)
{
	if(form1.SMID)
	{
		form1.SMID.checked=e.checked;
		for(i=0;i<form1.SMID.length;i++)
		if(form1.SMID[i].disabled!=true) form1.SMID[i].checked=e.checked;
	}
}


function checkadd(){
			if(document.frmAdd.FolderName.value==""){
				alert("请输入文件夹名称！");
				document.frmAdd.FolderName.focus();
				return false;
			}
		}
		function DoFolder(action){
			if(document.frmEdit.FolderId.value==""){
				alert("请选择要修改的文件夹！");
			}else{
				document.frmEdit.action.value=action;
				if(document.frmEdit.FolderName.value==""){
					alert("请输入文件夹名称！");
					document.frmEdit.FolderName.focus();
				}else{
					if(action=="delete"){
						if(confirm("确定要删除该文件夹吗？\n\n注意：删除该文件夹将删除该文件下的所有文件！")){
							document.frmEdit.submit();
						}
					}else{
						document.frmEdit.submit();
					}
				}
			}
		}
menu_flag=0;
var STATUS_BAR_MENU;

function show_WEBSMS()
{
   if(menu_flag==0)   
       STATUS_BAR_MENU=window.open("HX_WEBSMS/list.asp","STATUS_BAR_MENU","height=360,width=90,status=0,toolbar=no,menubar=no,location=no,scrollbars=no,top=200,left=150,resizable=no");
   STATUS_BAR_MENU.focus();
}
function CloseOpen(evt) {
   if(evt.clientX<=0 && evt.clientY<0) {
	location.href='HX_login.asp?action=loginout';
        if(!confirm('您已经安全的退出系统，按“确定”关闭浏览器，按“取消”重新登录？')){
         window.open('index.asp');
           return false;}
         else{
          window.close();
            return true;
          }
	}
}

   var MENU_ID_ARRAY = new Array();
    MENU_ID_ARRAY[0]="01";
    MENU_ID_ARRAY[1]="02";
    MENU_ID_ARRAY[2]="03";
    MENU_ID_ARRAY[3]="04";
    MENU_ID_ARRAY[4]="02";
    MENU_ID_ARRAY[5]="06";
    MENU_ID_ARRAY[6]="07";
	MENU_ID_ARRAY[7]="08";
	MENU_ID_ARRAY[8]="09";
	MENU_ID_ARRAY[9]="10";
	MENU_ID_ARRAY[6]="11";	
function check_all(menu_all,MENU_ID)
{
 for (i=0;i<document.all(MENU_ID).length;i++)
 {
   if(menu_all.checked)
      document.all(MENU_ID).item(i).checked=true;
   else
      document.all(MENU_ID).item(i).checked=false;
 }
}
 

function openlogin(url){
HeightValue=screen.height;
WidthValue=screen.width;
window.location.href=url;
window.moveTo(0,0);
window.resizeTo(WidthValue+6,HeightValue-23);
}
function setstyle(id){
var id;
if(id.className=='but'){
id.className='tddown';
switch(id){
case a1: say.saytext.style.fontWeight='bold';say.fontb.value='bold';break;
case a2: say.saytext.style.fontStyle='italic';say.fonti.value='italic';break;
case a3: say.saytext.style.textDecoration='underline';say.fontu.value='underline';break;
}}else{
id.className='but';
switch(id){
case a1: say.saytext.style.fontWeight='';say.fontb.value='';break;
case a2: say.saytext.style.fontStyle='';say.fonti.value='';break;
case a3: say.saytext.style.textDecoration='';say.fontu.value='';break;
}
}
}
function mover(id){
var id;
if(id.className=='')
id.className='but';
}
function mout(id){
var id;
if(id.className=='but')
id.className='';
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=='Netscape')&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf('?'))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function selectimg(image){
var image
document.say.saytext.value=document.say.saytext.value+image;
MM_showHideLayers('facelay','','hide');
}




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);
}


function checkfrm_upload(){
		if(document.frm_upload.doc.value==""){
			alert("请选择要上传的附件！");
			return false;
		}
	}
function jg_onchange(){
jgnum=0;
if(document.form1.WS_wage.value==""||isNaN(document.form1.WS_wage.value))
{
alert("只能输入数字");
}
else
{
jgnum=jgnum+parseFloat(document.form1.WS_wage.value);
}
if(document.form1.WS_pay.value=="")document.form1.WS_pay.value=0
if(isNaN(document.form1.WS_pay.value))
{
alert("只能输入数字");
}
else
{
jgnum=jgnum+parseFloat(document.form1.WS_pay.value);
}
if(document.form1.WS_house.value=="")document.form1.WS_house.value=0
if(isNaN(document.form1.WS_house.value))
{
alert("只能输入数字");
}
else
{
jgnum=jgnum+parseFloat(document.form1.WS_house.value);
}
if(document.form1.WS_lunch.value=="")document.form1.WS_lunch.value=0
if(isNaN(document.form1.WS_lunch.value))
{
alert("只能输入数字");
}
else
{
jgnum=jgnum+parseFloat(document.form1.WS_lunch.value);
}
if(document.form1.WS_outpay.value=="")document.form1.WS_outpay.value=0
if(isNaN(document.form1.WS_outpay.value))
{
alert("只能输入数字");
}
else
{
jgnum=jgnum+parseFloat(document.form1.WS_outpay.value);
}
if(document.form1.WS_bonus.value=="")document.form1.WS_bonus.value=0
if(isNaN(document.form1.WS_bonus.value))
{
alert("只能输入数字");
}
else
{
jgnum=jgnum+parseFloat(document.form1.WS_bonus.value);
}
if(document.form1.WS_card.value=="")document.form1.WS_card.value=0
if(isNaN(document.form1.WS_card.value))
{
alert("只能输入数字");
}
else
{
jgnum=jgnum-parseFloat(document.form1.WS_card.value);
}
if(document.form1.WS_ratal.value=="")document.form1.WS_ratal.value=0
if(isNaN(document.form1.WS_ratal.value))
{
alert("只能输入数字");
}
else
{
jgnum=jgnum-parseFloat(document.form1.WS_ratal.value);
}
if(document.form1.WS_safe.value=="")document.form1.WS_safe.value=0
if(isNaN(document.form1.WS_safe.value))
{
alert("只能输入数字");
}
else
{
jgnum=jgnum-parseFloat(document.form1.WS_safe.value);
}
if(document.form1.WS_other.value=="")document.form1.WS_other.value=0
if(isNaN(document.form1.WS_other.value))
{
alert("只能输入数字");
}
else
{
jgnum=jgnum-parseFloat(document.form1.WS_other.value);
document.form1.WS_lastmoney.value=eval("jgnum");
}
}
//--------------------------------------附件功能---------------------------------------------------
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;
}
//****************************WSOAS3.0************************************************************

//本js文件用于compose.htm同时发送多个附件的js函数，支持 IE 和 NNx 系列。
//所有的函数都适用于 IE 和 NNx 系列，直接调用就可以
//函数里面会根据语句判断浏览器类型，然后依据不同的bowser属性增加元素
//主要功能是动态创建 各种表单元素 和 删除表单元素
//written by xpr

//    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 Elementdisplay(objname)
{
document.getElementById(objname).style.display='';
}

function Elementdisplaynone(objname)
{
document.getElementById(objname).style.display='none';
}


function ShareDisplay(objname)
{
  var sharedisplay=document.getElementById(objname).style.display;
  if(objname=="Panel2")
          { 
           document.getElementById(objname).style.display='';
           
           document.getElementById('Panel3').style.display='none';	
	        }
			else if(objname=="Panel3")
              { 
              document.getElementById(objname).style.display='';
             
              document.getElementById('Panel2').style.display='none';	
	            }
	           else
                { 
                  
                  document.getElementById('Panel2').style.display='none';
                  document.getElementById('Panel3').style.display='none';	
	               }
	
	}
  
function window.onload()
{
   var olink = document.links;
   var str = "\u6B22\u8FCE\u60A8\u7684\u5149\u4E34\uFF01";
   for(var i=0;i<olink.length;i++)
   {
       olink[i].onmouseover=function(){window.status=str;return true;}
       olink[i].onfocus=function(){window.status=str;return true;}
   }
}

var clickmessage="\u8BF7\u5DE6\u51FB\uFF01"
function disableclick(e) {
	if (document.all) {
		if (event.button==2||event.button==3) {
			if (document.all["PhotoPic"]!=undefined){	
			alert(clickmessage);
			return false;
			}
		}
	}
	if (document.layers) {
		if (e.which == 3) {
		alert(clickmessage);
		return false;
		}
	}
}

function associateimages(){
	for(I=0;I<document.images.length;I++)
	document.images[I].onmousedown=disableclick;
}

if (document.all)
	document.onmousedown=disableclick
else if (document.layers)
	associateimages()


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);   
  }




