
var trMoveColor="#cae5ff"; 
//电话号码加-
function AutoFillTel(CurrDate)
{ 	
	if (!(window.event.keyCode == 8))
	{
		//补齐'-'号
		if(CurrDate.value.length == 4) {
			CurrDate.value += '-';
		}
	}
}
//判断是否包含特殊字符
function isIllCharater(data,msg){
   vkeyWords=/^[^`~!@#$%^&*()》。，、“（）《？……×￥#@！%+=|\\\][\]\{\}:;'\,.<>/?]{1}[^`~!@$%^&()》。，“（）《？……×%￥#@！+=|\\\][\]\{\}:;'\,.<>?]{0,19}$/; 
   if(!vkeyWords.test(data.value))
   {
    alert(msg);
    data.focus();
    return false;
   }   
   return true;
 }
//判断网址
function IsURL(url,msg){
  var strRegex = "^((https|http|ftp|rtsp|mms)?://)"
   + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" // ftp的user@
   + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184
   + "|" // 允许IP和DOMAIN（域名）
   + "([0-9a-z_!~*'()-]+\.)*" // 域名- www.
   + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名
   + "[a-z]{2,6})" // first level domain- .com or .museum
   + "(:[0-9]{1,4})?" // 端口- :80
   + "((/?)|" // a slash isn't required if there is no file name
   + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
 var re = new RegExp(strRegex);
       if(re.test(url)){ 
            return true;  
        }else{  
        	alert(msg);
            return false;  
        } 
    } 


function AutoFillDate(CurrDate,DateTypeLength)
{ 	
	if (!(window.event.keyCode == 8))
	{
		//补齐'-'号
		if(CurrDate.value.length == 4) 
			CurrDate.value += '.';



		if(CurrDate.value.length == 5 || CurrDate.value.length == 8) 	
		{
			if(CurrDate.value.charAt(CurrDate.value.length - 1) != '.') 
				CurrDate.value = CurrDate.value.substring(0,CurrDate.value.length - 1) + '.';
		}
		if (CurrDate.value.charAt(5) == '.' || CurrDate.value.charAt(8) == '.')
		{
			CurrDate.value = CurrDate.value.substring(0,CurrDate.value.length - 1);
		}
		if (CurrDate.value.charAt(6) == '.')
		{
			CurrDate.value = CurrDate.value.substring(0,5) + '0' + CurrDate.value.substring(5,CurrDate.value.length)
		}
		if (CurrDate.value.charAt(9) == '.')
		{
			CurrDate.value = CurrDate.value.substring(0,8) + '0' + CurrDate.value.substring(8,9)
		}
		if(CurrDate.value.length == 7 && CurrDate.value.charAt(7)!='.') 
			CurrDate.value += '.';
		//总长度限制
		if (CurrDate.value.length > DateTypeLength) 
		{
			CurrDate.value = CurrDate.value.substring(0,DateTypeLength);
		}
	
	}
}
function CheckDate(strDate,msg,focusWhere)//判断日期
{
    var Months= new Array(31,28,31,30,31,30,31,31,30,31,30,31); 
    var objDate= new Date();
    var nowYear=objDate.getYear();
    var Leap = false; 
    var Valid=true;
    var strDate=TrimAll(strDate);
    var Y=strDate.substr(0,4);
    var M=strDate.substr(5,2)
    var D=strDate.substr(8,2);
    var Reg=/^\d{4}.\d{2}.\d{2}$/;
    var accordToReg=Reg.exec(strDate);
    if(!accordToReg)
		Valid=false;
    if((Y % 4 == 0) && ((Y % 100 != 0) || (Y %400 == 0))) 
		Leap = true; 
	if((D < 1) || (D > 31) || (M < 1) || (M > 12) || (Y < 0)) 
		Valid=false;
    if((D > Months[M-1]) && !((M == 2) && (D > 28))) 
		Valid=false;
	if(!(Leap) && (M == 2) && (D > 28)) 
		Valid=false;
	if((Leap) && (M == 2) && (D > 29)) 
		Valid=false;
	if(parseInt(strDate.substr(0,2))<19 || parseInt(strDate.substr(0,2))>20)
		Valid=false;
//	if(parseInt(nowYear)-parseInt(Y)<0)
//	    Valid=false;
	if(!Valid)
	{
		 alert(msg);
		 focusWhere.focus();
		 return false;
	}
    return true;
}
/*
输入日期格式的时候失去焦点触发事件
*/
function DateLoseFocus(CurrDate,DateTypeLength)
{
	
	if (CurrDate.value.length == DateTypeLength - 1)
	{
		CurrDate.value = CurrDate.value.substring(0,DateTypeLength - 2) + '0' + CurrDate.value.charAt(DateTypeLength - 2);
	}
}
// 超链接
function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "mainFrame") {
     anchor.target = "mainFrame"; 
   }else if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "rightMain") {
	 anchor.target = "rightMain"; 
   }	   
 } 
} 
window.onload = externalLinks;

//去首尾空格函数
function trimAll(data)
{
  var reg=/^ +| +$/g;
  var str=data.replace(reg,"");
  return str;
}

//判断是否为空：
function chkNull(data,msg)
{
	if (trimAll(data.value)=='')
	{
		alert(msg);
		//data.select();
		data.focus();
		return false;
	}
	return true;
}

function chkNullNo(data,msg)//判断是否为空：
{
	
	//判断是否为空
	if (trimAll(data.value)=='')
	{
		alert(msg);
		//data.select();
		return false;
	}
	return true;
}

function isEquals(data,defaultData,msg)//判断data是否为defaultData：
{
	//判断是否为空
	if (trimAll(data.value) == "" + defaultData)
	{
		alert(msg);
		//data.select();
		//data.focus();
		return true;
	}
	//判断是否存在单'号
	var reg=/\'/g;
    var isOddQuote=reg.exec(trimAll(data.value)); 
	if(isOddQuote)
    {
        alert('请不要使用单引号');
        data.select();
        return true;
    }

	return false;
}

function chkOddQuote(data)  //判断单引号
{
    var reg=/\'/g;

    var isOddQuote=reg.exec(trimAll(data.value)); 
	if(isOddQuote)
    {
        alert('请不要使用单引号');
        data.select();
        return false;
    }
    return true;
}
function chkOddQuote2(data)  //判断单引号
{
    var reg=/\'/g;

    var isOddQuote=reg.exec(trimAll(data.value)); 
	if(isOddQuote)
    {
        alert('请不要使用单引号');
        data.focus();
        return false;
    }
    return true;
}

function chkNullQuote(data,msg)//判断是否空和存在单引号
{
	//判断是否为空
	//alert("dsfasdf");
	if (trimAll(data.value)=="")
	{
		alert(msg);
		data.focus();
		return false;
	}
	if(!chkOddQuote2(data))
	{
		//有单引号
		return false;
	}
	return true;
}
function chkPhoneNum2(data,msg)//判断是否是正确的电话号码
{    
	 var reg=/^13\d{9}$/;
     var reg2=/^15[8,9]\d{8}$/;
  if (reg.test(data.value)==false&&reg2.test(data.value)==false){
        alert(msg);
        data.focus();
        return false;
     }
	 return true;
}

function chkPhoneNum(data,msg)//判断是否是正确的电话号码
{
	//判断是否为空
	//alert("dsfasdf");
	if (trimAll(data.value)=="")
	{
		alert(msg);
		data.focus();
		return false;
	}
	if(!chkOddQuote2(data))
	{
		//有单引号
		return false;
	}
	//alert("sdfsdfsad");
	//判断是否有'-'
	//var s=str1.indexOf(str);
	if(data.value.indexOf("-")==-1)
	{
		alert("     号码格式不正确    \n  号码格式应为0574-87364008  ");
		data.focus();
		return false;
	}
	if(data.value.indexOf("-")!=4)
	{
		alert("     号码格式不正确    \n  号码格式应为0574-87364008  ");
		data.focus();
		return false;
	}
	if(data.value.length>14 || data.value.length<12)
	{
		alert("     号码格式不正确    \n  号码格式应为0574-87364008  ");
		data.focus();
		return false;
	}
	return true;
}

function TrimAll(data)//去首尾空格函数
{
  var reg=/^ +| +$/g;
  var str=data.replace(reg,"");
  return str;
}


function CheckDate(strDate,msg,focusWhere)//判断日期
{
    var Months= new Array(31,28,31,30,31,30,31,31,30,31,30,31); 
    var objDate= new Date();
    var nowYear=objDate.getYear();
    var Leap = false; 
    var Valid=true;
    var strDate=TrimAll(strDate);
    var Y=strDate.substr(0,4);
    var M=strDate.substr(5,2)
    var D=strDate.substr(8,2);
    var Reg=/^\d{4}.\d{2}.\d{2}$/;
    var accordToReg=Reg.exec(strDate);
    if(!accordToReg)
		Valid=false;
    if((Y % 4 == 0) && ((Y % 100 != 0) || (Y %400 == 0))) 
		Leap = true; 
	if((D < 1) || (D > 31) || (M < 1) || (M > 12) || (Y < 0)) 
		Valid=false;
    if((D > Months[M-1]) && !((M == 2) && (D > 28))) 
		Valid=false;
	if(!(Leap) && (M == 2) && (D > 28)) 
		Valid=false;
	if((Leap) && (M == 2) && (D > 29)) 
		Valid=false;
	if(parseInt(strDate.substr(0,2))<19 || parseInt(strDate.substr(0,2))>20)
		Valid=false;
//	if(parseInt(nowYear)-parseInt(Y)<0)
//	    Valid=false;
	if(!Valid)
	{
		 alert(msg);
		 focusWhere.focus();
		 return false;
	}
    return true;
}


function checkNum(txtNum,msg)//判断整数
{
    var reg=/^\d*$/gi;
    var isNum=reg.exec(TrimAll(txtNum.value)); 
    if(!isNum)
    {
        alert(msg);
        txtNum.focus();
        return false;
    }
    return true;
}

function checkDecimal(txtNum,msg)//判断小数
{
    if(isNaN(txtNum.value))
    {
        alert(msg);
        txtNum.focus();
        return false;
    }
    return true;
}

function nulltoZ(value){
    var reg=/^\d*$/gi;
    var isNum=reg.exec(TrimAll(value)); 
    if(!(isNum) || isNaN(value) || value=='' ){
       return eval(0);
   }else{
      return eval(value);
   }
   
}

//判断是否是正整数(>0)：
function chkPlusInt2(data,msg)
{
    var reg=/^\d*$/gi;
    var isInt=reg.exec(trimAll(data.value)); 
    if(!isInt)
    {
        alert(msg);
        data.select();
        return false;
    }
    if(trimAll(data.value) <= 0)
    {
        alert(msg);
        data.select();
        return false;
    }
    return true;
}

function checkNum2(txtNum,msg)//判断整数
{
    var reg=/^\d*$/gi;
    var isNum=reg.exec(TrimAll(txtNum.value)); 
	//判断是否为空
	if (trimAll(txtNum.value)=="")
	{
		alert(msg);
		txtNum.focus();
		return false;
	}
    if(!isNum)
    {
        alert(msg);
        txtNum.focus();
        return false;
    }
    return true;
}

//判断是整数,没有单引号
function chkNumNp(data,msg)
{
	if(!checkNum2(data,msg))
	{
		return false;
	}
	if(!ReplaceStr(data))
	{
		return false;
	}
	return true;
}
function chkNumNp18(data,msg){
	if(!checkNum2(data,msg))
	{
		return false;
	}
	if(!ReplaceStr(data))
	{
		return false;
	}
	return true;
}
//判断是数字并且是正数,没有单引号
function chkNumNp2(data,msg)
{
	if(data.value=="")
	{
		alert(msg);
		data.focus();
		return false;
	}
	if(isNaN(data.value))
	{
		alert(msg);
		data.focus();
		return false;
	}
	if(data.value<0)
	{
		alert(msg);
		data.focus();
		return false;
	}
	if(!ReplaceStr(data))
	{
		return false;
	}
	return true;
}

function ReplaceStr(txt)  //判断单引号
{
    var reg=/\'/g;
    var isNum=reg.exec(TrimAll(txt.value)); 
    if(isNum)
    {
        alert('请不要使用单引号');
        txt.focus();
        return false;
    }
    return true;
}

function showMDialog(url,width,height)
{
	res = showModalDialog(url, window, 'Dialogwidth:' + width + 'px;Dialogheight:' + height + 'px;status:no;help:no;resizable:yes');
	if(res) {
		Frame.submit();
		alert('');
		return true;
	}
}
function showMDialogRe(url,width,height)
{
	res = showModalDialog(url, window, 'Dialogwidth:' + width + 'px;Dialogheight:' + height + 'px;status:no;help:no;resizable:yes');
	return res;
}

function showMDialogFrame(url,width,height)
{
	showModalDialog(url, window, 'Dialogwidth:' + width + 'px;Dialogheight:' + height + 'px;resizable:yes');
}
				 
function closeWin() {
	if(window.event.keyCode==27) {
		window.close();
		return;
	}
}

//-------------------------多项选择select函数开始----------------------------------
//多项选择select函数1：选择函数
function selectMore(from,to,isAll)
{
/*
from:源选择框的name值
to:目标选择框的name值
isAll:是否全部选择
*/
	fromList = eval('document.forms[0].' + from);
	toList = eval('document.forms[0].' + to);
	if (isAll)
	{
		fromListLength=fromList.options.length

		for(i=0;i<fromListLength;i++)
		{
			current=fromList.options[0];
			txt=current.text;
			val=current.value;
			toList.options[toList.length]=new Option(txt,val);
			fromList.options[0]=null;
		}
	}
	else
	{	//	alert(fromList.options.length);
		for (i=0;i<fromList.options.length;i++)
		{
			current=fromList.options[i];
			if (current.selected)
			{
				txt=current.text;
				val=current.value;
				toList.options[toList.length]=new Option(txt,val);
				fromList.options[i]=null;
				i--;
			}
		}
	}
}

//多项选择select函数1：选择函数，用于框架中
function selectMoreFrame(from,to,isAll,framename)
{
/*
from:源选择框的name值
to:目标选择框的name值
isAll:是否全部选择
*/

	if(framename==''){
	   	fromList = eval('parent.document.forms[0].' + from);
	  	toList = eval('document.forms[0].' + to);
	}else{
	  	fromList = eval(framename+'.document.forms[0].' + from);
	  	toList = eval('document.forms[0].' + to);
	}

	if (isAll)
	{
		fromListLength=fromList.options.length

		for(i=0;i<fromListLength;i++)
		{
			current=fromList.options[0];
			txt=current.text;
			val=current.value;
			toList.options[toList.length]=new Option(txt,val);
			fromList.options[0]=null;
		}
	}
	else
	{	//	alert(fromList.options.length);
		for (i=0;i<fromList.options.length;i++)
		{
			current=fromList.options[i];
			if (current.selected)
			{
				txt=current.text;
				val=current.value;
				toList.options[toList.length]=new Option(txt,val);
				fromList.options[i]=null;
				i--;
			}
		}
	}
}




//-------------------------多项选择select函数开始----------------------------------
//多项选择select函数1：选择函数
function selectMore1(from,to,isAll)
{
/*
from:源选择框的name值
to:目标选择框的name值
isAll:是否全部选择
*/

	fromList = eval('document.forms[1].' + from);
	toList = eval('document.forms[1].' + to);
	if (isAll)
	{
		fromListLength=fromList.options.length

		for(i=0;i<fromListLength;i++)
		{
			current=fromList.options[0];
			txt=current.text;
			val=current.value;
			toList.options[toList.length]=new Option(txt,val);
			fromList.options[0]=null;
		}
	}
	else
	{	//	alert(fromList.options.length);
		for (i=0;i<fromList.options.length;i++)
		{
			current=fromList.options[i];
			if (current.selected)
			{
				txt=current.text;
				val=current.value;
				toList.options[toList.length]=new Option(txt,val);
				fromList.options[i]=null;
				i--;
			}
		}
	}
}

//多项选择select函数2：选定函数
//当用户按下提交按钮时，对列出选择的select对象执行全选工作
//让递交至的后台程序能取得相关数据
function selectMore2(to)
{
  toList = eval('document.forms[1].' + to);
  for (i=0;i<toList.length;i++)
  {
     toList.options[i].selected = true;
  }
}

function selectAllx(toList)
{
  for (i=0;i<toList.length;i++)
  {
     toList.options[i].selected = true;
  }
}


//(得到已添加)那个多选框中的所有值
function selectAll(to)
{
	var returnValue = "";

    toList = eval('window.document.forms[1].' + to);
    for (i=0;i<toList.length;i++)
    {
        if (i==toList.length-1)
            returnValue += toList.options[i].value;
        else
            returnValue += toList.options[i].value+",";
    }
	return returnValue;
}

//(得到已添加)那个多选框中的所有显示的值
function selectAllText(to)
{
	var returnValue = "";

    toList = eval('window.document.forms[1].' + to);
    for (i=0;i<toList.length;i++)
    {
        if (i==toList.length-1)
            returnValue += toList.options[i].text;
        else
            returnValue += toList.options[i].text+",";
    }
	return returnValue;
}
//-------------------------多项选择select函数结束------------------

/*********模式对话框************/
function showMDialog(url,width,height)
{
	res = showModalDialog(url, window, 'Dialogwidth:' + width + 'px;Dialogheight:' + height + 'px;status:no;help:no;resizable:yes');
	if(res){
		Frame.submit();
		return true;
	}
}
/*
function showMDialogFrame(url,width,height)
{
	showModalDialog(url, window, 'Dialogwidth:' + width + 'px;Dialogheight:' + height + 'px;resizable:yes');
}*/

function showMenuMDialogFrame(url,width,height)
{
	showModalDialog(url, window, 'Dialogwidth:' + width + 'px;Dialogheight:' + height + 'px;status:no;help:no;resizable:yes');
}

function showMDialogFrameLess(url,width,height)
{
	showModelessDialog(url, window, 'Dialogwidth:' + width + 'px;Dialogheight:' + height + 'px;status:no;help:no;resizable:yes');
}

/****************判断输入是否汉字*******************/
function isChinese(s,msg){
	var reg = /[^\u4E00-\u9FA5]/g;
	if (reg.test(s.value))
	{
		s.focus();
		s.select()
		alert((msg?msg:'对不起!只能输入中文!请改正!'));
		return false;
	}
	return true;
}

/************判断是否为汉字*************/
function isChineseBoolean(s){
	if (s.charCodeAt(0)>0x80)
	{
		return 0;
	}
	return 1;
}
/***********打印函数******************/
function setPrint111()
{
		document.all.WebBrowser.ExecWB(8,1);
}
	
function DirectPrint(){
		document.all.WebBrowser.ExecWB(6,6);
}
function showPrint(){
         // document.all.factory.printing.paperSource=" 自动选择";
		  document.all.factory.printing.header = "";//面眉
		  document.all.factory.printing.footer = "";//脚
		  document.all.factory.printing.portrait = false;
		/* document.all.factory.printing.leftMargin = 1.0;
		  document.all. factory.printing.topMargin = 1.0;
		  document.all.factory.printing.rightMargin = 1.0;  
		  document.all.factory.printing.bottomMargin = 1.0; */
		  document.all.factory.printing.Print(false);
}
function printpreview(){ 
		  document.all.factory.printing.header = "";//面眉
		  document.all.factory.printing.footer = "";//脚
		  document.all.factory.printing.portrait = false;//true 纵向,false,横向(默认)
		  /*document.all.factory.printing.leftMargin = 1.0;
		  document.all.factory.printing.topMargin = 1.0;
		  document.all. factory.printing.rightMargin = 1.0;  
		  document.all.factory.printing.bottomMargin = 1.0;*/
		  document.all.factory.printing.Preview();
} 
function setPrint(){
		  document.all.factory.printing.header = "";//面眉
		  document.all.factory.printing.footer = "";//脚
		  document.all.factory.printing.portrait = false;//true 纵向,false,横向(默认)
		  document.all.factory.printing.PageSetup();
}
function showPrint2(){
         // document.all.factory.printing.paperSource=" 自动选择";
		  document.all.factory.printing.header = "";//面眉
		  document.all.factory.printing.footer = "";//脚
		  document.all.factory.printing.portrait = true;
		/* document.all.factory.printing.leftMargin = 1.0;
		  document.all. factory.printing.topMargin = 1.0;
		  document.all.factory.printing.rightMargin = 1.0;  
		  document.all.factory.printing.bottomMargin = 1.0; */
		  document.all.factory.printing.Print(false);
}
function printpreview2(){ 
		  document.all.factory.printing.header = "";//面眉
		  document.all.factory.printing.footer = "";//脚
		  document.all.factory.printing.portrait = true;//true 纵向,false,横向(默认)
		  /*document.all.factory.printing.leftMargin = 1.0;
		  document.all.factory.printing.topMargin = 1.0;
		  document.all. factory.printing.rightMargin = 1.0;  
		  document.all.factory.printing.bottomMargin = 1.0;*/
		  document.all.factory.printing.Preview();
} 
function setPrint2(){
		  document.all.factory.printing.header = "";//面眉
		  document.all.factory.printing.footer = "";//脚
		  document.all.factory.printing.portrait = true;//true 纵向,false,横向(默认)
		  document.all.factory.printing.PageSetup();
}
//money
function showPrintA3(){
		  document.all.factory.printing.header = "";//面眉
		  document.all.factory.printing.footer = "";//脚
		  document.all.factory.printing.portrait = false;
		  document.all.factory.printing.Print(false);
}
function printpreviewA3(){ 
		  document.all.factory.printing.header = "";//面眉
		  document.all.factory.printing.footer = "";//脚
		  document.all.factory.printing.portrait = false;//true 纵向,false,横向(默认)
		  document.all.factory.printing.Preview();
} 
//连接变色函数
function mouseStyle(obj,color,fontSize) {
	obj.style.color = color;
	obj.style.fontSize = fontSize;
	return true;
}

function closeWin() {
	if(window.event.keyCode==27) {
		window.close();
		return;
	}
}

function chkCharLength(data,len,msg)  //判断输入的字符窜长度是否符合长度
{
	if ((trimAll(data.value).length)!=len)
	{
		alert(msg);
		data.select();
		return false;
	}
	return true;
}


function chkCharLength2(data,len,msg)  //判断输入的字符窜长度是否符合长度
{
	if ((trimAll(data.value).length)<len)
	{
		alert(msg);
		data.select();
		return false;
	}
	return true;
}

///////////填充日期格式///////
/*
功能说明：
DateType---7: 构造出"yyyy-mm"格式
		---10:构造出"yyyy-mm-dd"格式
*/
function AutoFillDate2(CurrDate,DateTypeLength)
{ 	
	if (!(window.event.keyCode == 8))
	{
		//补齐'-'号
		if(CurrDate.value.length == 4) 
			CurrDate.value += '-';



		if(CurrDate.value.length == 5 || CurrDate.value.length == 8) 	
		{
			if(CurrDate.value.charAt(CurrDate.value.length - 1) != '-') 
				CurrDate.value = CurrDate.value.substring(0,CurrDate.value.length - 1) + '-';
		}
		if (CurrDate.value.charAt(5) == '-' || CurrDate.value.charAt(8) == '-')
		{
			CurrDate.value = CurrDate.value.substring(0,CurrDate.value.length - 1);
		}
		if (CurrDate.value.charAt(6) == '-')
		{
			CurrDate.value = CurrDate.value.substring(0,5) + '0' + CurrDate.value.substring(5,CurrDate.value.length)
		}
		if (CurrDate.value.charAt(9) == '-')
		{
			CurrDate.value = CurrDate.value.substring(0,8) + '0' + CurrDate.value.substring(8,9)
		}
		if(CurrDate.value.length == 7 && CurrDate.value.charAt(7)!='-') 
			CurrDate.value += '-';
		//总长度限制
		if (CurrDate.value.length > DateTypeLength) 
		{
			CurrDate.value = CurrDate.value.substring(0,DateTypeLength);
		}
	
	}
}

/*
输入日期格式的时候失去焦点触发事件
*/
function DateLoseFocus(CurrDate,DateTypeLength)
{
	if (CurrDate.value.length == DateTypeLength - 1)
	{
		CurrDate.value = CurrDate.value.substring(0,DateTypeLength - 2) + '0' + CurrDate.value.charAt(DateTypeLength - 2);
	}
}

//得到文件扩展名
function getFileExt(obj,filename)
{
  ext =filename.substring(filename.lastIndexOf(".")+1,filename.length);
  ext=ext.toUpperCase();
  var array= new Array(20);
  array[0]='XML';
  if (ext!='') {
	  var ex9=false;
	  for (i=0;i<array.length;i++)
	  {
		  if (ext==array[i]){
		     ex9=true;
			 break;
		  } 
	  }
	  if (ex9!=true){
	  	alert('你上传的文件类型不被允许!');
		obj.focus();
		obj.select();
	    obj.outerHTML=obj.outerHTML
		return false;
	   }
  }
  return true;
}
//得到radioBox的当前选中值
function getRadioCurrentValue(obj){
      var retValue='';

		try{
			   for(i=0;i<obj.length;i++){
				  if(obj[i].checked==true){
					 retValue=obj[i].value;
					 break;
				  }
			   }
			   if(retValue==''){
			     retValue=obj.value;
			   }
		}catch(e){
            
		}

		return retValue;
}

function getRadioCurrentValue2(obj){
      var retValue='';
		try{  
			retValue=obj.value;
		}catch(e){
            
		}

		return retValue;
}

function keyDown(e){
	if(event.keyCode==13 && event.srcElement.type!='button' && event.srcElement.type!='submit' && event.srcElement.type!='reset' && event.srcElement.type!='textarea' && event.srcElement.type!=''){
		event.keyCode=9;
	 } 
} 

function chkMail(val) {
	var emailPat= /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;

	var matchArray=val.value.match(emailPat);
	if (matchArray==null) {
	 alert('Email格式错误!');
	 val.focus();
	 return false;
    }
    return true;
}

Number.prototype.toFixed=function(len)
{
	if(isNaN(len)||len==null)
	{
	  len = 0;
	}else{
	 if(len<0){
	   len = 0;
	 }
	}
		return Math.round(this * Math.pow(10,len)) / Math.pow(10,len);
}

// 四舍五入 把x四舍五入，小数点后n位
function formatNumberRound(x,n){
 return  x.toFixed(n);
}

//动态区域变化
function showProvince(listobj)
{ 

	for(var i=0;i<bid.length;i++)
	{

			var opt = new Option(bname[i],bid[i]) ;
			listobj.options[listobj.options.length] = opt ;
			opt = null ;
	}
    listobj.options[1] =null;
	/*for(var i=0;i<3;i++)
	{

			var opt = new Option(pname[i],pid[i]) ;
			listobj.options[listobj.options.length] = opt ;
			opt = null ;
	}*/
}
function showCity(ppid,listobj)
{
	opt = null ;
	for(var i=0;i<pid.length;i++)
	{
		
		if(pid[i] == ppid)
		{
			var opt = new Option(pname[i],pcid[i]) ;
			listobj.options[listobj.options.length] = opt ;
			opt = null ;
		}
	}
}

function showTown(ppid,listobj)
{

	for(var i=0;i<apid.length;i++)
	{
		if(apid[i] == ppid)
		{
			var opt = new Option(aname[i],acid[i]) ;
			listobj.options[listobj.options.length] = opt ;
			opt = null ;
		}
	}

}

function clearOption(obj)
{
	while(obj.options.length>1)
	{
		obj.options[obj.options.length-1] = null ;
	}
}
function selectedProvince(obj,bid)
{
	for(var i=0;i<obj.options.length;i++)
	{
		if(obj.options[i].value == bid)
		{
			obj.options[i].selected = true ;
			break ;
		}
	}
}
function selectedCity22(obj,pid)
{
	for(var i=0;i<obj.options.length;i++)
	{
		if(obj.options[i].value == pid)
		{
			obj.options[i].selected = true ;
			break ;
		}
	}
}
function selectedCity(listobj,pid,cid)
{
	showCity(pid,listobj) ;
	obj = listobj ;
	for(var i=0;i<obj.options.length;i++)
	{
		if(obj.options[i].value == cid)
		{
			obj.options[i].selected = true ;
			break ;
		}
	}
}function selectedTown(listobj,pid,cid)
{
	showTown(pid,listobj) ;
	obj = listobj ;
	for(var i=0;i<obj.options.length;i++)
	{
		if(obj.options[i].value == cid)
		{
			obj.options[i].selected = true ;
			break ;
		}
	}
}


function showdepart(listobj)
{ 

	for(var i=0;i<cid.length;i++)
	{

			var opt = new Option(cname[i],cid[i]) ;
			listobj.options[listobj.options.length] = opt ;
			opt = null ;
	}
    listobj.options[1] =null;
	/*for(var i=0;i<3;i++)
	{

			var opt = new Option(pname[i],pid[i]) ;
			listobj.options[listobj.options.length] = opt ;
			opt = null ;
	}*/
}


function selectedchildDepart(obj,cid)
{
	for(var i=0;i<obj.options.length;i++)
	{
		if(obj.options[i].value == cid)
		{
			obj.options[i].selected = true ;
			break ;
		}
	}
}


function showChildDepart(ppid,listobj)
{

	opt = null ;
	for(var i=0;i<zid.length;i++)
	{
		
		if(zid[i] == ppid)
		{
			var opt = new Option(zname[i],zcid[i]) ;
			listobj.options[listobj.options.length] = opt ;
			opt = null ;
		}
	}
	if(listobj.options.length == 2)
	{
		listobj.options[1].selected = true ;
	}
}
function winOpen(Url,width,height,scrollbars,resizable,toolbar,menubar,location,status)
{
ow = width;
oh = height;
var xposition=0; 
var yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ))
  {
    xposition = (screen.width - width) / 2;
    yposition = (screen.height - height-25) / 2;
  }
  window.open (Url,"","width ="+ow+",height="+oh+",scrollbars = "+scrollbars+",resizable="+resizable+",left="+xposition+",top="+yposition+",toolbar="+toolbar+",menubar="+menubar+",location="+location+", status="+status);
} 

//读取框
var t_id = setInterval(animate,20);
var pos=0;
var dir=2;
var len=0;
function animate()
{
var elem = document.getElementById('progress');
if(elem != null) {
if (pos==0) len += dir;
if (len>32 || pos>79) pos += dir;
if (pos>79) len -= dir;
if (pos>79 && len==0) pos=0;
elem.style.left = pos;
elem.style.width = len;
}
}
function remove_loading() {
this.clearInterval(t_id);
var targelem = document.getElementById('loader_container');
targelem.style.display='none';
targelem.style.visibility='hidden';
}

function chkHandPhone(mobile,msg) {
var reg =/^0{0,1}(13[0-9]?|15[0-9]|18[8,9])[0-9]{8}$/;
 if(!reg.test(mobile.value))
        {
            alert(msg);
			mobile.focus();
            return false;
        }
		return true;
}