//此JS适合后台使用，屏蔽的参数

//F5屏蔽(后台全局)
//function document.onkeydown()
//{ 

//F5
//if ( event.keyCode==116)
//{  
//event.keyCode = 0;  
//event.cancelBubble = true;
//return false;  
//} 

//}
//-------------------------------------------------------
//公用
function havenoNumber(theelement)
{//含有非数字字符 返回 true
   text="1234567890.";
   for(i=0;i<=theelement.length-1;i++)
   {
      char1=theelement.charAt(i);
      index=text.indexOf(char1);
      if(index==-1)
      {
        return true; 
      }
   }
   return false;
}

function havenoDateTime(theelement)
{//含有非数字日期字符 返回 true
   text="1234567890:";
   for(i=0;i<=theelement.length-1;i++)
   {
      char1=theelement.charAt(i);
      index=text.indexOf(char1);
      if(index==-1)
      {
        return true; 
      }
   }
   return false;
}




function checknochinese(theelement)
{//如果含有中文字符返回 false
   text="abcdefghijklmnopqrstuvwxyz1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
   for(i=0;i<=theelement.length-1;i++)
   {
      char1=theelement.charAt(i);
      index=text.indexOf(char1);
      if(index==-1)
      {
         return false;//有中文
      }  
     //没有中文
   }
   return true;
}
function checkchinese(theelement)
{//如果含有中文字符返回 true
   text="abcdefghijklmnopqrstuvwxyz1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ_- .@";
   for(i=0;i<=theelement.length-1;i++)
   {
      char1=theelement.charAt(i);
      index=text.indexOf(char1);
      if(index==-1)
      {
         return true;//有中文
      }  
     //没有中文
   }
   return false;
}
function checkCommaEn(theelement)
{//不能包含英文字符“,”
	text="";
	for(i=0;i<theelement.length;i++)
	{
		char1=theelement.charAt(i);
      	index=text.indexOf(char1);
		if(index>=0)
		{
			return true;//有英文逗号
		}  
	}
	return false; // 没有英文逗号
}

//验证当天时间
function checkToDay(obj,xTime,errorTxt)
{
	if (obj.value < xTime){
		alert(errorTxt+"已过期！");
		obj.focus();
		return false;
	}else{
		return true;
	}
	
}

//----------------JS方法-----------------//
//判断OBJ是否存在
function checkObj(obj, errorTxt){
    if(typeof(obj) == 'object'){
        return true;
    }else{
        alert("请选择" + errorTxt + "!")
        return false
    }
}



//为空验证(单)
function checkEmpty(obj,errorTxt)
{
	if(obj.value == ""){
		alert(errorTxt+"不能为空！");
		obj.focus();
		return false;
		}else{
			if(checkCommaEn(obj.value)){
			alert(errorTxt+"不能包含英文逗号，可以使用中文逗号！")
			obj.focus();
			return false;
			}else{
				return true;
				}
			}			
}

//验证是否包含英文逗号（单）
function checkComma(obj,errorTxt)
{
	if(checkCommaEn(obj.value)){
		alert(errorTxt+"不能包含英文逗号，可以使用中文逗号！")
		obj.focus();
		return false;
		}else{
			return true;
			}	
}


//验证多选不能为空(单)
function checkEmptyMul(obj,errorTxt)
{
	for(var i=0;i<obj.length;i++){
		if(obj[i].checked == true){
			return true;
			}
	}
	alert(errorTxt+"中必须选择一个！");
	return false;
}


//不能大于验证(单)
function checkLengthMax(obj,maxInt,errorTxt)
{
	if(obj.value.length>maxInt){
		alert(errorTxt+"不能多于"+maxInt+"个字符！");
		obj.focus();
		return false;
		}else{
			return true;
			}		

}

//不能小于验证(单)
function checkLengthMin(obj,minInt,errorTxt)
{
	if(obj.value.length<minInt){
		alert(errorTxt+"不能少于"+minInt+"个字符！");
		obj.focus();
		return false;
		}else{
			return true;
			}		

}

//2个对象验证相等(单)
function checkEqual(oneObj,twoObj,errorTxt)
{
if(oneObj.value != twoObj.value)
{
	alert(errorTxt+"不相等！");
	twoObj.focus();
	return false;
}else{
	return true;
	}
}


//验证是否为数字(单)
function checkNum(obj,errorTxt)
{
if (havenoNumber(obj.value))
{
	alert(errorTxt+"包含了非法字符！");
	obj.focus();
	return false;
}else{
	return true;
	}
}

//验证是否为数字日期(单)
function checkDateTime(obj,errorTxt)
{
if (havenoDateTime(obj.value))
{
	alert(errorTxt+"包含了非日期字符！");
	obj.focus();
	return false;
}else{
	return true;
	}
}

//验证是否为时间格式
 function   checkTime(obj,errorTxt)     
              {     
                  var a = obj.value.match(/^(\d{1,2})(:)?(\d{1,2})$/);     
                  if   (a == null) {alert('输入的参数不是时间格式'); return   false;}     
                  if   (a[1]>23 || a[3]>59)
                  {     
                      alert(errorTxt+"格式不正确或超出正常范围！");   
					  obj.focus();
                      return false     
                  }     
                  return true;     
              }     


//验证不能有中文
function checkUserName(obj,errorTxt)
{
	if (checkchinese(obj.value))
	{
		alert(errorTxt+"不能包含中文字符及特殊符号！");	
		obj.focus();
		return false;
	}else{
		return true;
	}	
}


function doActionDel()
{
	return confirm("确认要删除记录吗？");
}

//记录的只度/可写 调换
function doOperate(hideObj,displayObj,num,buttonObj,hideSubObj,hideSubBut,displaySubBut)
{
	for(var i=0;i<hideObj.length;i++)
	{
		if (num == i){
			hideObj[num].style.display = 'none';
			displayObj[num].style.display = 'block';
			if (buttonObj != null){
				buttonObj[num].checked = 'true';
			}
			if(hideSubObj !=null){
				hideSubObj[num].style.display = 'none';
				hideSubBut[num].style.display = 'none';
				displaySubBut[num].style.display = 'block';
				}
		}
	}
	
	if(hideObj.length==null){
		
			hideObj.style.display = 'none';
			displayObj.style.display = 'block';
			if (buttonObj != null){
				buttonObj.checked = 'true';
			}
			if(hideSubObj !=null){
				hideSubObj.style.display = 'none';
				hideSubBut.style.display = 'none';
				displaySubBut.style.display = 'block';
			}
		}
		
}

//order 显示
function doBlock(obj,num,objbn,objbb)
{
	if(obj.length>0){
		for(var i=0;i<obj.length;i++){
			if(i==num){
			obj[i].style.display = 'block';
			objbn[i].style.display = 'block';
			objbb[i].style.display = 'none';
			}			
			}
		}else{
			obj.style.display = 'block';
			objbn.style.display = 'block';
			objbb.style.display = 'none';
			}
}

//order 隐藏
function doNone(obj,num,objbb,objbn)
{
	if(obj.length>0){
		for(var i=0;i<obj.length;i++){
			if(i==num){
			obj[i].style.display = 'none';
			objbb[i].style.display = 'block';
			objbn[i].style.display = 'none';
			}			
			}
		}else{
			obj.style.display = 'none';
			objbb.style.display = 'block';
			objbn.style.display = 'none';
			}
}



//为空验证（多条）
function checkEmptyMore(obj,errorTxt)
{
	var num = 0;
	if (obj.length>0){
	for(var i=0;i<obj.length;i++){
		if (obj[i].value == ""){
			num=i+1;
			alert("第"+num+"行"+errorTxt+"不能为空！")
			obj[i].focus();
			return false;
			}
		if(checkCommaEn(obj[i].value)){
			num=i+1;
			alert("第"+num+"行"+errorTxt+"不能包含英文逗号，可以使用中文逗号！")
			obj[i].focus();
			return false;
			}
		}
	}else{
		if (obj.value == ""){
			num=1;
			alert("第"+num+"行"+errorTxt+"不能为空！")
			obj.focus();
			return false;
			}
		if(checkCommaEn(obj.value)){
			num=1;
			alert("第"+num+"行"+errorTxt+"不能包含英文逗号，可以使用中文逗号！")
			obj.focus();
			return false;
			}
		
	}
		return true;
}

//验证不能含有英文逗号（多条）
function checkCommaMore(obj,errorTxt)
{
	var num = 0;
	if (obj.length>0){
	for(var i=0;i<obj.length;i++){
		if(checkCommaEn(obj[i].value)){
			num=i+1;
			alert("第"+num+"行"+errorTxt+"不能包含英文逗号，可以使用中文逗号！")
			obj[i].focus();
			return false;
			}
		}
		
	}else{
		if(checkCommaEn(obj.value)){
			num=1;
			alert("第"+num+"行"+errorTxt+"不能包含英文逗号，可以使用中文逗号！")
			obj.focus();
			return false;
			}
		
		}
		return true;
}

//为数字（多条）
function checkNumMore(obj,errorTxt)
{
	var num = 0;
	if(obj.length>0){
	for(var i=0;i<obj.length;i++){
		if (havenoNumber(obj[i].value)){
			num=i+1;
			alert("第"+num+"行"+errorTxt+"含有非数字型字符！")
			obj[i].focus();
			return false;
			}
		}
	}else{
		if (havenoNumber(obj.value)){
			num=1;
			alert("第"+num+"行"+errorTxt+"含有非数字型字符！")
			obj.focus();
			return false;
			}
		
		}
		return true;
}


//不能大于（多条）
function checkLengthMaxMore(obj,maxInt,errorTxt)
{

	var num = 0;
	if(obj.length>0){
	for(var i=0;i<obj.length;i++){
		if (obj[i].value.length > maxInt){
			num=i+1;
			alert("第"+num+"行"+errorTxt+"不能多于"+maxInt+"个字符！")
			obj[i].focus();
			return false;
			}
		}
		
	}else{
		if (obj.value.length > maxInt){
			num=1;
			alert("第"+num+"行"+errorTxt+"不能多于"+maxInt+"个字符！")
			obj.focus();
			return false;
			}
		
		}
		return true;

}
//不能小于（多条）
function checkLengthMinMore(obj,minInt,errorTxt)
{

	var num = 0;
	if (obj.length>0){
	for(var i=0;i<obj.length;i++){
		if (obj[i].value.length < minInt){
			num=i+1;
			alert("第"+num+"行"+errorTxt+"不能小于"+minInt+"个字符！")
			obj[i].focus();
			return false;
			}
		}
		
	}else{
		if (obj.value.length < minInt){
			num=1;
			alert("第"+num+"行"+errorTxt+"不能小于"+minInt+"个字符！")
			obj.focus();
			return false;
			}
		
		}
		return true;

}

//---------------------------------------------------------------
//处理提交
function doSubmitProcess(obj)
    {
        obj.className = 'button_process';
        obj.disabled = true;
    }


function doSubmitProcessToImg(obj)
{
	obj.style.display = "none";
	document.getElementById("loading").style.display = "block";	
}

function getLoading(name)
{
	document.getElementById(name).style.display = "block";
}

function noLoading(name)
{
	document.getElementById(name).style.display = "none";
}


//软键盘参数初始化
var kdImg = 0;
var kdImg2 = 0;
//软键盘
function getKdToImg(obj, id)
{
			//第一组
			if(id == 0){
				if(kdImg == 0){
					password1=opeaForm.psdn;
					showkeyboard();
					Calc.password.value='';	
					obj[0].src = '../images/globalStyle/kd_1.gif';
					obj[0].alt = '关闭软键盘';
					
					obj[1].src = '../images/globalStyle/kd_2.gif';
					obj[1].alt = '开启软键盘';
					
					kdImg = 1;
					kdImg2 = 0;
					password1.focus();
				}else{
					password1=opeaForm.psdn;
					closekeyboard();
					obj[0].src = '../images/globalStyle/kd_2.gif';
					obj[0].alt = '开启软键盘';
					
					obj[1].src = '../images/globalStyle/kd_2.gif';
					obj[1].alt = '开启软键盘';
					
					kdImg = 0;
					kdImg2 = 0;
					password1.focus();
				}
			}
			
			//第二组
			if(id == 1){
				if(kdImg2 == 0){
					password1=opeaForm.psdo;
					showkeyboard();
					Calc.password.value='';	
					obj[1].src = '../images/globalStyle/kd_1.gif';
					obj[1].alt = '关闭软键盘';
					
					obj[0].src = '../images/globalStyle/kd_2.gif';
					obj[0].alt = '开启软键盘';
					
					kdImg = 0;
					kdImg2 = 1;
					password1.focus();
				}else{
					password1=opeaForm.psdo;
					closekeyboard();
					obj[0].src = '../images/globalStyle/kd_2.gif';
					obj[0].alt = '开启软键盘';
					
					obj[1].src = '../images/globalStyle/kd_2.gif';
					obj[1].alt = '开启软键盘';
					
					kdImg = 0;
					kdImg2 = 0;
					password1.focus();
				}
			}
			
	//确认
			if(id == 2){
				if(obj.length>0){
					closekeyboard();
					obj[0].src = '../images/globalStyle/kd_2.gif';
					obj[0].alt = '开启软键盘';
					
					obj[1].src = '../images/globalStyle/kd_2.gif';
					obj[1].alt = '开启软键盘';
					
					kdImg = 0;
					kdImg2 = 0;
				}else{
					closekeyboard();
					obj.src = '../images/globalStyle/kd_2.gif';
					obj.alt = '开启软键盘';
					kdImg = 0;	
				}
			}			
			
}

//软键盘
function getKdToImgOne(obj,id)
{
			//第一组
			if(id == 0){
				if(kdImg == 0){
					password1=opeaForm.psdn;
					showkeyboard();
					Calc.password.value='';	
					obj.src = '../images/globalStyle/kd_1.gif';
					obj.alt = '关闭软键盘';
					kdImg = 1;
					password1.focus();
				}else{
					password1=opeaForm.psdn;
					closekeyboard();
					obj.src = '../images/globalStyle/kd_2.gif';
					obj.alt = '开启软键盘';
					kdImg = 0;
					password1.focus();
				}
			}
			
	//确认
			if(id == 2){
					closekeyboard();
					obj.src = '../images/globalStyle/kd_2.gif';
					obj.alt = '开启软键盘';
					kdImg = 0;
			}			
			
}




//---------------------------------------------------------------
//var timeline = null;
//function textlength() {
	//if (timeline != null) {
		//clearTimeout(timeline);
	//}

	//var textl = document.forms['search'].elements['sFsd'].value;
	//document.forms['search'].elements['sFsd_slt'].value = textl;

	//timeline = window.setTimeout('textlength()', 100);
//}