function FnWindowOpenModel(FileName,WindowName)
{
  window.open(FileName,WindowName,"scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,width=800,height=600,left=0,top=0");
}
function FnWindowOpenJY(FileName,WindowName)
{
  window.open(FileName,WindowName,"scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=500,height=450,left=100,top=100");
}
function Small(FileName,WindowName)
{
  window.open(FileName,WindowName,"scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=500,height=300,left=100,top=100");
}
function Big(FileName,WindowName)
{
  window.open(FileName,WindowName,"scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=800,height=600,left=0,top=0");
}
function WindowClose()
{
	window.close(this);
}






function parseDate(sString, sInFormat) {						
  var sResult,undefined										
  if (sInFormat==undefined) sResult = formatDateString(sString,'M-D-YYYY')		
  else sResult = getDateString(sString, sInFormat,'M-D-YYYY')	
  if ( sResult == '' )  return (new Date(1900,0,1))			
  else	return (new Date(sResult))
}			

function formatDateString(sString, sOutFormat){
  var sResult						
  sResult = getDateString(sString, 'YMD', sOutFormat)								
  if (sResult=='') sResult = getDateString(sString, 'MDY', sOutFormat)				
  if (sResult=='') sResult = getDateString(sString, 'DMY', sOutFormat)				
  return sResult
}																	

function formatDate(dDate, sOutFormat) {
  var undefined			
  if (dDate == undefined) return ''							
  else return OutFormatDatePortion(dDate.getYear(), dDate.getMonth() + 1, dDate.getDate(), sOutFormat) 
}	

function isValidDateString(val,mode,sInFormat) {								
   if((mode==0) && (val.value=="")){
	  return true;
   }
	
   var sResult,undefined,sString
   sString=val.value;														
   if ( sInFormat == undefined) sResult = formatDateString(sString);	
   else  sResult = getDateString(sString, sInFormat);									
   if (sResult == ''){
	  alert("请输入正确的日期数据!!");
	  val.focus();
	  val.select();	
      return false;
   }	  
   else
      return true;
}
					
function isValidDateTime(sDateTime,sDateFormat,sTimeFormat) {
	var asDateTime = new Array()
	asDateTime = sDateTime.split(' ')
	if (asDateTime.length != 2) return false
	if (! isValidDateString(asDateTime[0],sDateFormat)) return false
	if (! isValidTimeString(asDateTime[1],sTimeFormat)) return false
	return true
}

function isValidTimeString(sTime,sInFormat) {
	var aiTime = new Array()
	var sTimeFormat
	var undefined
	if (sInFormat==undefined) sTimeFormat = 'HHMMSS'
	else sTimeFormat = sInFormat.toString();
	sTime = sTime.toString()
	if (sTimeFormat.indexOf(':') > 0){
		aiTime = sTime.split(':');
		return isValidTime(aiTime);
	}
	else{
		if (sTimeFormat.length != sTime.length) return false
		if (sTimeFormat.length == 4 || sTimeFormat.length == 6)
			aiTime[0] = sTime.substr(0,2)
			aiTime[1] = sTime.substr(2,2)
			if (sTimeFormat.length == 6) aiTime[2] = sTime.substr(4,2)
		else
			return false
	}
}

function isValidTime(aiTime){
	if (aiTime.length == 2 || aiTime.length == 3){
		if (aiTime[0] < 0 || aiTime[0] > 23) return false
		if (aiTime[1] < 0 || aiTime[1] > 59) return false
		if (aiTime.length == 3)
			if (aiTime[2] < 0 || aiTime[2] > 59) return false
		return true
	}
	else
		return false
}

function getDateString(sString, sInFormat, sOutFormat, sDelimiter){	
  var undefined														
  var sResult=''														
  var sY, sM, sD														
  var iDml1, iDml2														
  if ( sString == undefined || sString.toString() == '' || sString.length < 6)    return sResult		
  else sString = sString.toString().toUpperCase()														
  if ( sDelimiter == undefined)   sDelimiter = ''														
  if ( sInFormat == undefined || sInFormat.toString() == '' )											
     { sInFormat = 'YMD';  if (sDelimiter=='') sDelimiter = getDateDelimiter(sString) ; }				
  else    { sInFormat = sInFormat.toUpperCase();														
			 if (sDelimiter == '')  sDelimiter = getDateDelimiter(sInFormat)							
			 if (sDelimiter == '')  sDelimiter = getDateDelimiter(sString)								
			 else sInFormat = sInFormat.replace(sDelimiter,'').replace(sDelimiter,'')					
            sInFormat = sInFormat.replace('YYYY','Y').replace('YYY','Y').replace('YY','Y').replace('MM','M').replace('DD','D')}			
  if (sDelimiter == '')   {																			
		if (sString.length ==8)  {																		
			 ('sY=sString.substr('+(sInFormat.indexOf('Y',0)*2)+',4)')								
	        eval('sString=sString.substring(0,'+(sInFormat.indexOf('Y',0)*2)+')+sString.substring('+(sInFormat.indexOf('Y',0)*2 + 4)+',sString.length)')				
			sInFormat = sInFormat.replace('Y','')      }												
		else if (sString.length ==6)      {																
			eval('sY=sString.substr('+(sInFormat.indexOf('Y',0)*2)+',2)')								
			eval('sString=sString.substring(0,'+(sInFormat.indexOf('Y',0)*2)+')+sString.substring('+(sInFormat.indexOf('Y',0)*2 + 2)+',sString.length)')				
			sInFormat = sInFormat.replace('Y','')	   }												
		else			      return sResult;															
	    eval('s'+sInFormat.substr(0,1) + '=sString.substr(0,2)')										
		eval('s'+sInFormat.substr(1,1) + '=sString.substr(2,2)')		   }							
  else        {																						
		iDel1 = sString.indexOf(sDelimiter,0);     iDel2 = sString.indexOf(sDelimiter,iDel1 + 1);		
		if (iDel1 == -1 || iDel2==-1) return sResult													
	    eval('s'+sInFormat.substr(0,1) + '=sString.substr(0,'+iDel1 + ')')								
		eval('s'+sInFormat.substr(1,1) + '=sString.substring('+(iDel1+1)+','+iDel2.toString()+')')		
		eval('s'+sInFormat.substr(2,1) + '=sString.substring('+(iDel2+1)+','+sString.length+')')  }		
  if (isValidDate(sY,sM,sD)) sResult = outFormatDatePortion(sY,sM,sD,sOutFormat)						
  return sResult    
}
																					
function isLeapYear(iYear) {
  var undefined						
  if ( iYear != undefined && !isNaN(iYear) && iYear > 0 &&		
       (iYear%4==0 && iYear%100 !=0 || iYear%400==0)   )		
      return true												
	else return false;
}											

function isValidDate(iY, iM, iD) {
  var undefined									
  if ( iY != undefined && !isNaN(iY) && iY >=0 && iY<=9999 &&						
       iM != undefined && !isNaN(iM) && iM >=1   && iM<=12   &&					
       iD != undefined && !isNaN(iD) && iD >=1   && iD<=31  )  {					
       if (iY<50) iY = 2000+iY; else if (iY<100) iY=1900+iY;						
    if (iM == 2  && (isLeapYear(iY)  && iD > 29 || !isLeapYear(iY) && iD>28) ||	
        iD == 31 && (iM<7 && iM%2==0 || iM>7 && iM%2==1) )							
		return false																
	else	return true   
 }														
 else  return false
}																
//验证字符串数据
function CheckData(valname,val,valimode,limitlen){
	if( val.value.indexOf("<",0)>0 || val.value.indexOf(">",0)>0){
		alert(valname+"不能包含<或>字符!。");
		val.focus();
		val.select();	
		return false;
	}
    if(valimode==1){
		if(isblank(val.value)){
			alert(valname+"不能为空!");
			val.focus();
			val.select();	
            return false;
        }
        tmp=new String(val.value)
		if(istoolong(tmp,limitlen)){
			alert(valname+"不能超过"+limitlen+"个字符!");
			val.focus();
			val.select();	
            return false;
        }
    }
    else{
		tmp=new String(val.value)
        if(istoolong(tmp,limitlen)){
			alert(valname+"不能超过"+limitlen+"个字符!!");
			val.focus();
			val.select();	
            return false;
        }
    }
    return true;
}
function isblank(str){
    var i;
    var len=str.length;
    for(i=0;i<len;++i){
		if(str.charAt(i)!=" ")
			return false;
    }
    return true;
}
function istoolong(str,i){
    var len=str.length;
    if(i==0)
		return false;
    else{   
        if(len>i)
		    return true;
        else
			return false;
    }
}
//验证推荐人用户名
function CheckUserIntroducer(val,min,max,mode){
	if((mode==0) && (val.value=="")){
		return true;
	}
	
	var len = val.value.length;
	if (len<min || len>max){
		alert("推荐人用户名长度不正确，应为"+min+"-"+max+"个英文字母、数字。");
		val.focus();
		val.select();	
		return false;
	}
	for (i=0;i<val.value.length;i++){
		var ch = val.value.charAt(i);
		if ( (ch<"0" || ch>"9") && (ch<"a" || ch >"z")){
			alert("推荐人用户名必须由小写字母或数字组成。");
			val.focus();
			val.select();	
			return false;
		}
	}
	return true;
}
//验证用户名
function CheckUserName(val,min,max){
	var len = val.value.length;
	if (len<min || len>max){
		alert("用户名长度不正确，应为"+min+"-"+max+"个英文字母、数字。");
		val.focus();
		val.select();	
		return false;
	}
	for (i=0;i<val.value.length;i++){
		var ch = val.value.charAt(i);
		if ( (ch<"0" || ch>"9") && (ch<"a" || ch >"z")){
			alert("用户名必须由小写字母或数字组成。");
			val.focus();
			val.select();	
			return false;
		}
	}
	return true;
}
//验证密码
function CheckPassWord(val,min,max){
	var len = val.value.length;
	if (len<min || len>max){
		alert("密码长度不正确，应为"+min+"-"+max+"个英文字母、数字。");
		val.focus();
		val.select();	
		return false;
	}
	for (i=0;i<val.value.length;i++){
		var ch = val.value.charAt(i);
		if ( (ch<"0" || ch>"9") && (ch<"a" || ch >"z")){
			alert("密码必须由小写字母或数字组成。");
			val.focus();
			val.select();	
			return false;
		}
	}
	return true;
}
//验证密码匹配
function IsSame(val1,val2){
	if (val1.value != val2.value ){
		alert("两次输入的密码不相同。");
		val2.focus();
		val2.select();	
		return false;
	}
	else
		return true;
}
//验证Email
function CheckEmail(val,mode){
	if((mode==0) && (val.value=="")){
		return true;
	}

	var etext
	var elen
	var i
	var aa
	etext=val.value
	elen=etext.length
	if (elen<5){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	i= etext.indexOf("@",0)
	if (i==0 || i==-1 || i==elen-1){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	else{
		if (etext.indexOf("@",i+1)!=-1){
			alert("请输入正确的Email。");
			val.focus();
			val.select();	
			return false;
		}
	}
	if (etext.indexOf("..",i+1)!=-1){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	i=etext.indexOf(".",0)
	if (i==0 || i==-1 || etext.charAt(elen-1)=='.'){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	if ( etext.charAt(0)=='-' ||  etext.charAt(elen-1)=='-'){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	if ( etext.charAt(0)=='_' ||  etext.charAt(elen-1)=='_'){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	for (i=0;i<=elen-1;i++){
		aa=etext.charAt(i)
		if (!((aa=='.') || (aa=='@') || (aa=='-') ||(aa=='_') || (aa>='0' && aa<='9') || (aa>='a' && aa<='z') || (aa>='A' && aa<='Z'))){
			alert("请输入正确的Email。");
			val.focus();
			val.select();	
			return false;
		}
	}
	return true;
}
function CheckEmail1(val,mode){
	if (val=="")
{return false;}
	var etext
	var elen
	var i
	var aa
	etext=val.value
	elen=etext.length
	if (elen<5){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	i= etext.indexOf("@",0)
	if (i==0 || i==-1 || i==elen-1){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	else{
		if (etext.indexOf("@",i+1)!=-1){
			alert("请输入正确的Email。");
			val.focus();
			val.select();	
			return false;
		}
	}
	if (etext.indexOf("..",i+1)!=-1){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	i=etext.indexOf(".",0)
	if (i==0 || i==-1 || etext.charAt(elen-1)=='.'){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	if ( etext.charAt(0)=='-' ||  etext.charAt(elen-1)=='-'){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	if ( etext.charAt(0)=='_' ||  etext.charAt(elen-1)=='_'){
		alert("请输入正确的Email。");
		val.focus();
		val.select();	
		return false;
	}
	for (i=0;i<=elen-1;i++){
		aa=etext.charAt(i)
		if (!((aa=='.') || (aa=='@') || (aa=='-') ||(aa=='_') || (aa>='0' && aa<='9') || (aa>='a' && aa<='z') || (aa>='A' && aa<='Z'))){
			alert("请输入正确的Email。");
			val.focus();
			val.select();	
			return false;
		}
	}
	return true;
}
//验证用户身高
function CheckValHeight(val,min,max,mode){
	if((mode==0) || (val.value=="")){
		return true;
	}
	
	var len = val.value;
	if (len<min || len>max){
		alert("请输入正确的身高数据。");
		val.focus();
		val.select();	
		return false;
	}
	var val2 = val.value;
	for (i=0;i<val2.length;i++){
		var ch = val2.charAt(i);
		if ( (ch<"0" || ch>"9") ){
			alert("身高数据必须由有效数字组成。");
			val.focus();
			val.select();	
			return false;
		}
	}
	if (isNaN(val2)){	
		alert("身高数据必须由有效数字组成。");
		val.focus();
		val.select();	
		return false;
	}
	else if (parseInt(val2)<=0){
		alert("身高数据必须由有效数字组成。");
		val.focus();
		val.select();	
		return false;
	}
	else if (val2.indexOf('0')==0){
		alert("身高数据必须由有效数字组成。");
		val.focus();
		val.select();	
		return false;
	}
	return true;
}
//验证用户体重
function CheckValWeight(val,min,max,mode){
	if((mode==0) || (val.value=="")){
		return true;
	}
	
	var len = val.value;
	if (len<min || len>max){
		alert("请输入正确的体重数据。");
		val.focus();
		val.select();	
		return false;
	}
	var val2 = val.value;
	for (i=0;i<val2.length;i++){
		var ch = val2.charAt(i);
		if ( (ch<"0" || ch>"9") ){
			alert("体重数据必须由有效数字组成。");
			val.focus();
			val.select();	
			return false;
		}
	}
	if (isNaN(val2)){	
		alert("体重数据必须由有效数字组成。");
		val.focus();
		val.select();	
		return false;
	}
	else if (parseInt(val2)<=0){
		alert("体重数据必须由有效数字组成。");
		val.focus();
		val.select();	
		return false;
	}
	else if (val2.indexOf('0')==0){
		alert("体重数据必须由有效数字组成。");
		val.focus();
		val.select();	
		return false;
	}
	return true;
}
//验证数值
function CheckNumber(val,min,max,mode){
	if((mode==0) && (val.value=="")){
		return true;
	}
	
	var len = val.value.length;
	if (len<min || len>max){
		alert("请输入正确的数值。");
		val.focus();
		val.select();	
		return false;
	}
	var val2 = val.value;
	for (i=1;i<val2.length;i++){
		var ch = val2.charAt(i);
		if ( (ch<"0" || ch>"9" ) ){
			alert("请输入正确的数值。");
			val.focus();
			val.select();	
			return false;
		}
	}
	
	if (isNaN(val2)){	
		alert("请输入正确的数值。");
		val.focus();
		val.select();	
		return false;
	}
	
	else if (val2.indexOf('-')==0 && val2.indexOf('0')==1){
		alert("请输入正确的有效数值。");
		val.focus();
		val.select();	
		return false;
	}
	return true;
}
//验证正数值
function CheckPositive(val,min,max,mode){
	if((mode==0) && (val.value=="")){
		return true;
	}
	
	if(!CheckNumber(val,min,max,mode)){
		val.focus();
		val.select();	
		return false;
	}
	if (parseInt(val.value)<=0){
		alert("数据必须为有效的正整数。");
		val.focus();
		val.select();	
		return false;
	}

	return true;
}

//验证负数值
function CheckNegative(val,min,max,mode){
	if((mode==0) && (val.value=="")){
		return true;
	}
	
	if(!CheckNumber(val,min,max,mode)){
		val.focus();
		val.select();	
		return false;
	}
	if (parseInt(val.value)>=0){
		alert("数据必须为有效的负整数。");
		val.focus();
		val.select();	
		return false;
	}

	return true;
}
//验证浮点数值
function CheckFloat(val,min,max,mode){
	if((mode==0) && (val.value=="")){
		return true;
	}
	
	var len = val.value.length;
	if (len<min || len>max){
		alert("请输入正确的价格数值。");
		val.focus();
		val.select();	
		return false;
	}
	var val2 = val.value;
	for (i=1;i<val2.length;i++){
		var ch = val2.charAt(i);
		if ( (ch<"0" || ch>"9" ) ){
			if(ch!="."){
				alert("请输入正确的价格数值。");
				val.focus();
				val.select();	
				return false;
			}
		}
	}
	if (isNaN(val2)){	
		alert("请输入正确的价格数值。");
		val.focus();
		val.select();	
		return false;
	}
	else if (val2.indexOf('0')==0 && val2.indexOf('.')!=1){
		alert("请输入正确的有效价格数值。");
		val.focus();
		val.select();	
		return false;
	}
	else if (val2.indexOf('-')==0 && val2.indexOf('0')==1 && val2.indexOf('.')!=2){
		alert("请输入正确的有效价格数值。");
		val.focus();
		val.select();	
		return false;
	}
	else if (val2.indexOf('-')==0 && val2.indexOf('.')==1){
		alert("请输入正确的有效价格数值。");
		val.focus();
		val.select();	
		return false;
	}
	else if (val2.indexOf('.')==0){
		alert("请输入正确的有效价格数值。");
		val.focus();
		val.select();	
		return false;
	}
	return true;
}
//验证文件路径
function CheckPath(val,mode){
	if((mode==0) && (val.value=="")){
		return true;
	}
	
	var val2 = val.value;
	if ( val2.indexOf(':\\')>0 ){
		var isNot=" !@#$^*()'`~|]}[{;.>,<?%&+=";
		if (val2.indexOf('\"')>0){
			alert("请输入正确的文件路径。");
			val.focus();
			val.select();	
			return false;
		}
		else{
			for (var i = 0;i < val2.length;i++){
				for (var x = 1 ;x < isNot.length;x++){
					if (val2.charAt(i)==isNot.charAt(x)){
						alert("请输入正确的文件路径。");
						val.focus();
						val.select();	
						return false;
					}
				}
			}
		}
	}
	else{
		alert("请输入正确的文件路径。");
		val.focus();
		val.select();	
		return false;
	}
	return true;
}
//验证URL
function CheckURL(val,mode){
	if((mode==0) && (val.value=="")){
		return true;
	}
	
	var val2 = val.value;
	if ( val2.indexOf('://')>0 ){
		var isNot=" !@$^*()'`~|]}[{;.>,<";
		if (val2.indexOf('\"')>0){
			alert("请输入正确的URL。");
			val.focus();
			val.select();	
			return false;
		}
		else{
			for (var i = 0;i < val2.length;i++){
				for (var x = 1 ;x < isNot.length;x++){
					if (val2.charAt(i)==isNot.charAt(x)){
						alert("请输入正确的URL。");
						val.focus();
						val.select();	
						return false;
					}
				}
			}
		}
	}
	else{
		alert("请输入正确的URL。");
		val.focus();
		val.select();	
		return false;
	}
	return true;
}
//验证身份证//
function CheckChinaIDCard_J(val,mode){
	if((mode==0) && (val.value=="")){
		return true;
	}
	
    sNo = val.value.toString()
	if (!isInteger(sNo)) {
		alert("请输入正确的身份证。");
		val.focus();
		val.select();	
		return false
	}	
	switch(sNo.length){
		case 15: if (isValidDate(sNo.substr(6,2),sNo.substr(8,2),sNo.substr(10,2))) {
			return true
		}
		case 18: if (isValidDate(sNo.substr(6,4),sNo.substr(10,2),sNo.substr(12,2))) {
			return true
		}
	}
	alert("请输入正确的身份证。");
	val.focus();
	val.select();	
	return false
}
function isInteger(sNum) {
	var	num
	num=new RegExp('[^0-9_]','')
	if (isNaN(sNum)) {
		return false
	}
	else {
		if (sNum.search(num)>=0) {
			return false
		}
		else {
			return true
		}
	}
}

//验证Zip
function CheckZip(val,slen,mode){
	if((mode==0) || (val.value=="")){
		return true;
	}
	
	if(val.value.length!=slen){
		alert('请输入正确的邮政编码!!');
		val.focus();
		val.select();	
		return false
	}
	var r1
	r1 = new RegExp('[^0-9]','');
	if ( val.value.search(r1) >= 0 ) {
		alert('请输入正确的邮政编码!!');
		val.focus();
		val.select();	
		return false
	}
	else
		return true;
}
	
//验证Date and Time
function getDateDelimiter(sFormatString){
  var undefined				
  if (sFormatString == undefined)            return  ''				
  if (sFormatString.indexOf('-',0) > 0)		 return  '-'			
  else if (sFormatString.indexOf('/',0) > 0) return  '/'				
  else if (sFormatString.indexOf('.',0) > 0) return  '.'				
  else									     return ''	
}				

function outFormatDatePortion(sY,sM,sD,sOutFormat) {
  var undefined		
  var sDelimiter, sResult												
  var iY,iM,iD, i1,i2,i3,sU=''											
  if ( sOutFormat == undefined || sOutFormat.toString() == '' )		
	{ sOutFormat = 'MDY';  sDelimiter = new Array('','-','-','');		
	  if (sY.toString().length == 2) { if ( parseInt(sY)<50 ) sY = '20'+sY; else sY = '19'+sY; } }	
  else   { sOutFormat = sOutFormat.toUpperCase()						
       if (sOutFormat.indexOf('YYYY') != -1 && sY.toString().length == 2) { if ( parseInt(sY)<50 ) sY = '20'+sY; else sY = '19'+sY; }	
	    if (sOutFormat.indexOf('MM') != -1 && sM.toString().length == 1) sM = '0'+sM													
		if (sOutFormat.indexOf('DD') != -1 && sD.toString().length == 1) sD = '0'+sD													
	    sOutFormat = sOutFormat.replace('YYYY','Y').replace('YYY','Y').replace('YY','Y').replace('MM','M').replace('DD','D')			
       iY = sOutFormat.indexOf('Y'); iM = sOutFormat.indexOf('M'); iD = sOutFormat.indexOf('D')										
		{i1=Math.min(iY,Math.min(iM,iD)); i2=(iY>iM)?Math.min(iY,Math.max(iM,iD)):(Math.min(iM,Math.max(iD,iY)));  i3=Math.max(iY,Math.max(iM,iD));}				
       if (i3 == -1) return ''																											
        else if (i2==-1)  {																											
			sDelimiter = new Array(sOutFormat.substring(0,i3),'','',sOutFormat.substring(i3+1,sOutFormat.length))						
			sOutFormat = 'UU'+sOutFormat.substr(i3,1)    }																				
        else if (i1==-1) {																																					
	       sDelimiter = new Array(sOutFormat.substring(0,i2),'',sOutFormat.substring(i2+1,i3),sOutFormat.substring(i3+1,sOutFormat.length))									
			sOutFormat = 'U'+sOutFormat.substr(i2,1)+sOutFormat.substr(i3,1)    }																							
        else {																																								
			sDelimiter = new Array(sOutFormat.substring(0,i1),sOutFormat.substring(i1+1,i2),sOutFormat.substring(i2+1,i3),sOutFormat.substring(i3+1,sOutFormat.length))		
			sOutFormat = sOutFormat.substr(i1,1)+sOutFormat.substr(i2,1)+sOutFormat.substr(i3,1)    }	}																	
  eval("sResult='"+ sDelimiter[0] +"'+s"+sOutFormat.substr(0,1)+"+'"+sDelimiter[1]+"'+s"+sOutFormat.substr(1,1)+"+'"+sDelimiter[2]+"'+s"+sOutFormat.substr(2,1)+"+'"+sDelimiter[3]+"'" )	
  return sResult
}		
//验证学科编码//
function CheckSubjectid(val){
if (val.value==""){
alert("请输入正确的学科编码！");
val.focus();
val.select();	
return false;
}
for (var i=0;i<val.value.length;i++)
{var ch=val.value.charAt(i);
if (ch<"0"||i>"9"){
alert("学科编码必须为数字！");
val.focus();
val.select();
return false;
}
if (isNaN(val.value)){	
		alert("学科编码必须由有效数字组成。");
		val.focus();
		val.select();	
		return false;
	}
	else if (parseInt(val.value)<=0){
		alert("学科编码必须由有效数字组成。");
		val.focus();
		val.select();	
		return false;
	}
return true;
}
}
//验证出生日期//
function CheckBirthday(val,min,max){
	if(val.value==""){
		return true;
	}
	
	var len = val.value;
	if (len>max){
		alert("你又骗我！你还是婴儿吗？");
		val.focus();
		val.select();	
		return false;
	}
	if (len<min){
		alert("不会吧？你这么一大把年纪了？");
		val.focus();
		val.select();	
		return false;
	}
	var val2 = val.value;
	for (i=0;i<val2.length;i++){
		var ch = val2.charAt(i);
		if ( (ch<"0" || ch>"9") ){
			alert("出生日期必须为正确的有效数值！");
			val.focus();
			val.select();	
			return false;
		}
	}
	if (isNaN(val2)){	
		alert("出生日期必须由有效数字组成。");
		val.focus();
		val.select();	
		return false;
	}
	else if (parseInt(val2)<=0){
		alert("出生日期必须由有效数字组成。");
		val.focus();
		val.select();	
		return false;
	}
	return true;
}
//验证字符串长度//
function checklength(texttitle,val,maxs){
if(val.value==""){
return true;
}
if(val.value.length>maxs){
alert(""+texttitle+"不得超过"+maxs+"个字！");
return false;
val.focus();
val.select();
}
return true;
}


function checkid(i_code,born){
icode=i_code.value;
bstring=born;

if (!(icode.length==15 || icode.length==18))
{alert("请输入正确的身份证号码!");
return false;
}; 

if (icode.length==15)
   {
    if (icode.substring(6,12)==bstring.substring(2,8))
      return true;
    else 
	{alert("请输入正确的身份证号码!");
      return false;}
	  }
 if (icode.length==18)
 
 {
 if (icode.substring(6,14)==bstring)
     return true
  else
     {alert("请输入正确的身份证号码!");
      return false;}
	  } 
	 
	}
