function PopMessage(path,msgId)
{
    var url = path + "PopMsg.aspx?msg=" + msgId ;
    OpenWin(url,"","200","350");
}
function PopMessageC(path,msgId,cId)
{
    var url = path + "PopMsg.aspx?msg=" + msgId + "&cid=" + cId ;
    OpenWin(url,"","200","350");
}
function PopMessageCC(path,msgId,cId)
{
    var url = path + "Msg.aspx?msg=" + msgId + "&cid=" + cId ;
    window.location.href = url;
}
function PopMessageLook(path,userId,strName,checkID)
{
    var url = path + "Look.aspx?user=" + userId + "&name=" + escape(strName) + "&checkData=" + checkID ;
    //window.open(url);
    var lab = document.getElementById("Look");
    lab.href = url;
    lab.click();
}
/******************************************************
描述：	执行服务器端的程序文件
返回：	成功则返回程序执行结果。失败则返回-1
参数：	strPrgmURL	程序文件路径
		strMethod	发送方法（POST或GET）
		strParamString POST方法时的参数字符串
******************************************************/
function ExecServerPrgm(strPrgmURL, strMethod, strParamString, strUserID, strPwd)
{   
	var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	if (strUserID != "" && strUserID != null)
		xmlhttp.Open(strMethod, strPrgmURL, false, strUserID, strPwd);
	else
		xmlhttp.Open(strMethod, strPrgmURL, false);
		
	if (strMethod.toUpperCase() == 'POST'){
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlhttp.Send(strParamString);
	}else{
		xmlhttp.Send();	
	}
	if (xmlhttp.status == 200)
		return unescape(trimStr(xmlhttp.responseText));
	else
		return -1;
}
//判断年月日是否都选择了function CheckDate(year,month,day,str)
{
    var bYear = false;
    var bMonth = false;
    var bDay = false;
    if( year.value != "") { bYear = true;}
    if( month.value != "") { bMonth = true;}
    if(day) {
         if(day.value != "") { bDay = true;}
    }
    if(bYear && bMonth && bDay) { return "";}
    if(!bYear && !bMonth && !bDay) { return "";}
    var d = "";
    var e = "";
    if(bYear){ d = "年" ;}
    if(!bYear){ e = "年" ;}
    if(bMonth)
    {
        if(d == "")
        {
            d = "月";
        }
        else
        {
            d += ",月";
        }
    }
    else
    {
        if(e == "")
        {
            e = "月";
        }
        else
        {
            e += ",月";
        }
    }
    if(day)
    {
        if(bDay)
        {
            if(d == "")
            {
                d = "日";
            }
            else
            {
                d += ",日";
            }
        }
        else
        {
            if(e == "")
            {
                e = "日";
            }
            else
            {
                e += ",日";
            }
        }
    }

    var msg = "您只选择了[" + str + "]的[" + d + "],请选择[" + e + "]";
    if(e == "")
    {
        msg = "";
    }
    return msg;
    
}

function resetList(){
document.all.contentList.style.height=bheight-27-2;
}
function resetBriefing(){
document.all.briefing.style.left=bwidth-175;
document.all.briefing.style.height=bheight-27-2;
document.all.briefing.style.top=28;
}
function initDiv(){
bwidth=document.body.offsetWidth;
bheight=document.body.offsetHeight;
resetList();
}

/*打开新窗口调用以下函数-*/
function OpenSmallWin(url)
{
	OpenWin(url,'', '350', '600');
}
function OpenBigWin(url)
{
	OpenWin(url,'', '600', '800');
}
function OpenWinASSiz(url,height,width)
{
	OpenWin(url,'', height, width);
}
/*-------*/

function OpenViewWorkFlow(url)
{
   OpenModalDialog(url, "500","800");
}
function Get_Center(size, side)
{
	self.y_center=(parseInt(screen.height/2));
	self.x_center=(parseInt(screen.width/2));
	center = eval('self.'+side+'_center-('+size+'/2);');
	return(parseInt(center));
}
function OpenPrintWin(url, name, height, width)
{
	var left = Get_Center(width,'x');	
	var top = Get_Center(height,'y');
	if (top > 30)
	{
		top = top - 30;
	}
	window.open(url,name,"height=" + height + ",width=" + width + ",left=" + left + ",top=" + top + ",scrollbars=no,toolbar=no,menubar=yes,location=no,resizable=yes");
}
function OpenPrintBigWin(url, name, height, width)
{
	var left = Get_Center(width,'x');	
	var top = Get_Center(height,'y');
	if (top > 30)
	{
		top = top - 30;
	}
	window.open(url,name,"height=" + height + ",width=" + width + ",left=" + left + ",top=" + top + ",scrollbars=yes,toolbar=no,menubar=yes,location=no,resizable=yes");
}

function OpenEditWin(url)
{
	var height = 700;
	var width = 1000;
	var name = "EditForm";
	OpenWin(url, name, height, width);	
}
function OpenWin(url, name, height, width)
{
	var left = Get_Center(width,'x');	
	var top = Get_Center(height,'y');
	if (top > 30)
	{
		top = top - 30;
	}
	window.open(url,name,"height=" + height + ",width=" + width + ",left=" + left + ",top=" + top + ",scrollbars=no,toolbar=no,menubar=no,location=no,resizable=no");
}
function OpenNewWin(url, name, height, width)
{
	var left = Get_Center(width,'x');	
	var top = Get_Center(height,'y');
	if (top > 30)
	{
		top = top - 30;
	}
	window.open(url,name,"height=" + height + ",width=" + width + ",left=" + left + ",top=" + top + ",scrollbars=no,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes");
}

function OpenModalDialog(url, height, width)
{
   window.showModalDialog(url + "&rdm=" + Math.random(),document,"dialogHeight: " + height + "px; dialogWidth: " + width + "px;edge: Raised; center: Yes; help: No; resizable: No; scrollbars:No");
}

function OpenDialog(url, height, width)
{
	window.showModalDialog(url+ "&rdm=" + Math.random(),document,"dialogHeight: " + height + "px; dialogWidth: " + width + "px;edge: Raised; center: Yes; help: No; resizable: No; scrollbars:No");
}

function OpenSelectEmpAndDepDialog(urlPrex,IdCtr,EmployeeNameCtr,DeptIDCtr,DeptNameCtr,DeptNo)
{
	var url = urlPrex + "Common/Selector/SelectUser.aspx?IdCtr=" + IdCtr + "&EmployeeNameCtr=" + EmployeeNameCtr + "&DeptIDCtr=" + DeptIDCtr +"&DeptNameCtr=" + DeptNameCtr + "&DeptNo=" + DeptNo;
	OpenDialog(url, "480", "600")
}

function OpenSelectEmpDialog(urlPrex,IdCtr,EmployeeNameCtr,EmployeeNoCtr,DeptNo)
{
	var url = urlPrex + "Common/Selector/SelectUser.aspx?IdCtr=" + IdCtr + "&EmployeeNameCtr=" + EmployeeNameCtr + "&EmployeeNoCtr=" + EmployeeNoCtr + "&DeptNo=" + DeptNo;
	OpenDialog(url, "480", "600")
}

function OpenSelectMultiEmpDialog(urlPrex,IdCtr,EmployeeNameCtr,DeptNo,mancount,idvalue,namevalue)
{
	var url = urlPrex+"Common/Selector/SelectMultiUser.aspx?IdCtr=" + IdCtr + "&EmployeeNameCtr=" + EmployeeNameCtr + "&DeptNo=" + DeptNo+"&mancount="+mancount+"&idvalue="+escape(idvalue)+"&namevalue="+escape(namevalue);
	OpenDialog(url, "480", "600")
}

function OpenSelectRoleDialog(urlPrex,IdCtr,NameCtr)
{
	var url=urlPrex + "Common/Selector/SelectRole.aspx?IdCtr=" + IdCtr + "&NameCtr=" + NameCtr ;
	OpenDialog(url, "480", "600")
}

//选择单个员工放大镜 
//urlPrex是URL的前缀，例："../../"；

//IdCtr是id的控件名；

//EmployeeNameCtr是员工姓名的控件名；
//DeptIDCtr是部门ID的控件名，如果不用则给空值；
//DeptNameCtr是部门名称的控件名，如果不用则给空值；
//DeptNo是默认的部门编号。如果有必要可以使用，没必要则给空值；
function OpenSelectEmpAndDepDialog(urlPrex,IdCtr,EmployeeNameCtr,DeptIDCtr,DeptNameCtr,DeptNo)
{
	var url = urlPrex + "Common/Selector/SelectUser.aspx?IdCtr=" + IdCtr + "&EmployeeNameCtr=" + EmployeeNameCtr + "&DeptIDCtr=" + DeptIDCtr +"&DeptNameCtr=" + DeptNameCtr + "&DeptNo=" + DeptNo;
	OpenDialog(url, "480", "600")
}


function CheckAll(check)
{
	var e = document.forms[0].elements;
	var l = e.length;
	var o;
	for(var i = 0; i < l; i++)
	{
		o = e[i];
		if (o.type == "checkbox")
		{
			o.checked = check;
		}
	}
}
//单选框必须选择一条记录。

function CheckOne(stralert,varform)
{
	var j=0;
	for ( var i =0; i<varform.elements.length;i++)
	{
		var e = varform.elements[i];
		if(e.type=="radio"&&e.checked==true)
		{
			j++
		}
	}
	if(j == 0)
	{
		alert(stralert);	
		return false; 
	}
}

function ValidateLength(oSrc, args)
{
	args.IsValid = (args.Value.length <= oSrc["limit"]); 
}
function ValidateMinLength(oSrc, args)
{
	args.IsValid = (args.Value.length >= oSrc["limit"]); 
}
function Trim(str)
{
    str = str.replace(/\ /g, '');
    return str;
}


/*	BEGIN 会计数字大小写转换

*	add by ylren
*/

function NumberToString(number) 
{
 var numericString = number.toString();
 
 var expression  = new RegExp(/^\d+$/);
 var expression2 =  new RegExp(/^\d+\.\d{2}$/);
 var expression1 =  new RegExp(/^\d+\.\d{1}$/);

 if (expression.test(numericString) == false && expression1.test(numericString) == false && expression2.test(numericString) == false)
 {
  //alert("请输入数字，最多两位小数！");
  return;
 }
 
 if (expression1.test(numericString) == true)
 {
  numericString += "0";
 }
 else if (expression.test(numericString) == true)
 {
  numericString += ".00";
 }
 
 /*if (numericString.length > 9)
 {
  //alert("整数部分最多6位，小数部分最多２位！");
  return;
 }*/
 
 return numericString.replace(".", "");
}
function SmallToBig(number)
{
 var chineseDigitalString = '零壹贰叁肆伍陆柒捌玖';
 var arabianDigitalString = '0123456789';
 
 var chineseUnits = new Array("分", "角", "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿");
 var superUnits = new Array("拾", "佰", "仟", "万", "拾", "佰", "仟", "亿");
 
 var numericString = NumberToString(number);
 if (numericString == null) 
 {
  //alert("请输入数字，最多两位小数！");
  return;
 }
 
 var bigStyleString = "";
 var length = numericString.length;
 var index = length - 1;
 var superIndex;
 
  for (var i = 0; i < length; i++)
 {
  var digit = numericString.charAt(i);
  var unit;
  var x;
  
  x = chineseDigitalString.charAt(arabianDigitalString.indexOf(digit))
  unit = chineseUnits[index];

  if(unit == null)
  {  
	superIndex = index - 10;
	while(superIndex > 8)
	{
		superIndex = superIndex - 8;
	}
	superIndex -= 1;
	unit = 	superUnits[superIndex];
  }
  
  bigStyleString += x + unit;
  
  index--;
 } 
 // 叁亿叁仟零佰零拾零万贰仟零佰零拾零元贰角叁分
 
 bigStyleString = bigStyleString.replace(/零仟/g, "零");
 bigStyleString = bigStyleString.replace(/零佰/g, "零");
 bigStyleString = bigStyleString.replace(/零拾/g, "零");
 bigStyleString = bigStyleString.replace(/零{2,}/g, "零");
 bigStyleString = bigStyleString.replace(/零万/g, "万");
 
 if (bigStyleString.indexOf("零元") != 0)
  bigStyleString = bigStyleString.replace(/零元/g, "元");
 else
  bigStyleString = bigStyleString.replace(/零元/g, "");
  
 bigStyleString = bigStyleString.replace(/零角零分/g, "");
 bigStyleString = bigStyleString.replace(/零分/g, ""); 
 
 if (bigStyleString.indexOf("元") == bigStyleString.length - 1)
  bigStyleString += "整";
 if(bigStyleString == "整")
 {
     bigStyleString = "零";
 } 
 return bigStyleString; 
}
/*	END 会计数字大小写转换*/
<!--

// 用途：enter 转化成tab
//使用：onload ="initEnter2Tab()" form标记加上 <form name="frm" type="enter2tab">...</form>

var isCycle = false; //当光标到最后一个元素的时候，是否循环光标焦点，

var iCurrent = -1;
var frmName = "0"//input_form
//
function enterToTab()  //网页里按回车时焦点的转移
{
  var e = document.activeElement;
  if(e == null) return false;
  //获得当前表单的名字

  for(i=0;i<document.forms.length;i++){  
 for(var el in document.forms[i].elements){
  if(e.UniqueID == el.UniqueID){
   frmName = document.forms[i].name
  }    
 } 
  }
  if(window.event.keyCode == 13)
  {  
   switch(e.tagName)//标签类型
 {
     case "INPUT":
   handleInput(e)
   break;
     case "SELECT":
   handleSelect(e)   
   break;  
     case "TEXTAREA":
   handleTextarea(e)
   break;   
         default:  
    //window.status = "未知的标签名称:"+e.tagName+"，不能移动焦点！"
    }  
  }// end if
}
//处理input 标签类型
function handleInput(e)
{
   switch(e.type)
 {
     case "text":
  case "password":
  case "checkbox":
  case "radio":
  case "file":
   moveFocusToNextElement(e)
   break; 
 // case "submit"://处理有提交按钮的情况
  case "button":
   if(isHandleSubmit(e)){
    handleSubmit(e)
    focusOnNextElement(document.forms[frmName].elements,iCurrent-1)
    break;
   }
   moveFocusToNextElement(e)
   break;            
         default:  
        
    }
}
//处理select 标签类型
function handleSelect(e)
{
 moveFocusToNextElement(e)
}
//处理textarea 标签类型
function handleTextarea(e)
{
 //moveFocusToNextElement(e)
}
//移动到下一个元素

function moveFocusToNextElement(e)
{
  var oE = document.forms[frmName].elements, iCurentPos=-1;
  for(var i=0; i<oE.length; i++)
  {
    if(oE[i] == e) iCurentPos = i;
    if(iCurentPos>-1 && iCurentPos+1<oE.length)
    {
    //把焦点设置到下一个可用的元素上  
  focusOnNextElement(oE,iCurentPos)
    }
  }
}
//下一个可用元素得到焦点 n 元素的位置

function focusOnNextElement(oElements,iIndex)
{
	var oE = oElements
	var oldIndex = iIndex 
	while(oE[iIndex+1].type =="hidden" 
		|| oE[iIndex+1].disabled || oE[iIndex+1].tagName == "FIELDSET" || oE[iIndex+1].style.display == "none")
	{ 
		/*window.status += "e.name = "+oE[iIndex+1].name
		window.status += ";e.type = "+oE[iIndex+1].type
		window.status += ";e.disabled = "+oE[iIndex+1].disabled
		window.status += ";e.readOnly = "+oE[iIndex+1].readOnly+"."*/
		iIndex++;
		if(iIndex+1 == oE.length)
		{
		
			if(isCycle)
			{//设置焦点在第一元素
				focusOnNextElement(oE,-1);
			} 
			return;
		}
	}//end while
	iCurrent = iIndex+1
	oE[iCurrent].focus();
        //window.event.keyCode    = 0;
    window.event.returnValue= false; 
    return;
}
function focusFirstElement(oElements,iIndex)
{
	var oE = oElements
	var oldIndex = iIndex 
	while(oE[iIndex+1].type =="hidden" 
		|| oE[iIndex+1].tagName == "SELECT"
		|| oE[iIndex+1].readOnly == true
		|| oE[iIndex+1].disabled || oE[iIndex+1].tagName == "FIELDSET" || oE[iIndex+1].style.display == "none")
	{ 
		/*window.status += "e.name = "+oE[iIndex+1].name
		window.status += ";e.type = "+oE[iIndex+1].type
		window.status += ";e.disabled = "+oE[iIndex+1].disabled
		window.status += ";e.readOnly = "+oE[iIndex+1].readOnly+"."*/
		iIndex++;
		if(iIndex+1 == oE.length)
		{
		
			if(isCycle)
			{//设置焦点在第一元素
				focusFirstElement(oE,-1);
			} 
			return;
		}
	}//end while
	iCurrent = iIndex+1
	oE[iCurrent].focus();
        //window.event.keyCode    = 0;
    window.event.returnValue= false; 
    return;
}

//处理当前元素
function handleSubmit(element)
{
 element.click()
 return; 
}
//判断是否处理提交
function isHandleSubmit(element)
{
 var ret = false;
 if(element !=null && (element.id.toUpperCase() == "SUBMIT" || element.name.toUpperCase() == "SUBMIT" || element.isSubmit)){
  ret = true;
 }
 return ret; 
}
//初始化 initEnter2Tab()
function initEnter2Tab()
{
 for(i=0;i<document.forms.length;i++){
   document.forms[i].onkeydown = function f(){enterToTab();};
 }
 //文档初始化焦点

 if(document.forms[0].elements != null)
 {
  focusFirstElement(document.forms[0].elements,-1)
 }
} 
//格式化数字(数字，小数位数)
function FormatNumber(srcStr,nAfterDot){
    var srcStr,nAfterDot;
    var resultStr,nTen;
    srcStr = ""+srcStr+"";
    strLen = srcStr.length;
    dotPos = srcStr.indexOf(".",0);
    if (dotPos == -1){
        resultStr = srcStr+".";
        for (i=0;i<nAfterDot;i++){
            resultStr = resultStr+"0";
        }
        return resultStr;
    } else{
        if ((strLen - dotPos - 1) >= nAfterDot){
            nAfter = dotPos + nAfterDot + 1;
            nTen =1;
            for(j=0;j<nAfterDot;j++){
            nTen = nTen*10;
        }
        resultStr = Math.round(parseFloat(srcStr)*nTen)/nTen;
        return resultStr;
        } else{
            resultStr = srcStr;
            for (i=0;i<(nAfterDot - strLen + dotPos + 1);i++){
                resultStr = resultStr+"0";
            }
            return resultStr;
        }
    }
}

//隐藏按钮根据权限
function HideButton(strHide)
{
	var strs = strHide.split(',');
	for( var i = 0;i<strs.length;i++)
	{
		var o = document.getElementById(strs[i]);
		if(o)
		{
			o.style.display = 'none';
		}
	}
}
//-->


