
	function CheckEmpty(Field, FieldTitle)
	{
		if (Field.value == "")
		{
			alert("请在\"" + FieldTitle + "\"中输入值.");
			Field.focus();
			return false;
		}		
		return true;
	}	
	
	function CheckEmpty2(Field)
	{
		if (Field.value == "")
		{
			return false;
		}		
		return true;
	}
	
	function CheckInteger(Field, FieldTitle)
	{
		if (Field.value != "")
		{
			for (i = 0; i < Field.value.length; i++)
			{
				ch = Field.value.charAt(i);
				if ( (ch < '0' || ch > '9') && ch != '-' ) {
					alert("\"" + FieldTitle + "\"中只能输入数字.");
					Field.focus();
					return	false;
				}
			}
		}
		
		return true;
	}
	
	function CheckReal(Field, FieldTitle)
	{
		if (Field.value != "")
		{
			DotNum = 0;
			for (i = 0; i < Field.value.length;  i++)
			{
				ch = Field.value.charAt(i);
				
				if ((ch < '0' || ch > '9') && ch != '.') 
				{
					alert("\"" + FieldTitle + "\"中只能输入数字.");
					Field.focus();
					return false;
				}
				
				if (ch == '.')
				{
					if (DotNum > 0) 
					{
						alert("\"" + FieldTitle + "\"中只能输入一个小数点.");
						Field.focus();
						DotNum++;
						return false;
					}
				}
			}
		}
		
		return	true;
	}

	function CheckMaxLength(Field, MaxLength, FieldTitle)
	{
		if (Field.value != "")
		{
			if (Field.value.length > MaxLength)
			{
				alert("\"" + FieldTitle + "\"中输入的字符请不要超过" + MaxLength + "字符.");
				Field.focus();
				return false;
			}
		}
		
		return true;
	}
	
	function CheckOption(Field, FieldTitle) 
	{
		for (i = 0; i < Field.length; i++)
			if (Field[i].checked)
				return true;				
		alert("请选择\"" + FieldTitle + "\"中的值.");
		return false;
	}

	//此函数用于判断Email地址是否正确
function CheckEmail(Field)
{

   // there must be >= 1 character before @, so we
   // start looking at character position 1
   // (i.e. second character)
   var i = 1;
   var len = Field.value.length;

	if (len > 50)
	{
		window.alert("email地址长度不能超过50位!");
		return false;
	}
	
	pos1 = Field.value.indexOf("@");
	pos2 = Field.value.indexOf(".");
	pos3 = Field.value.lastIndexOf("@");
	pos4 = Field.value.lastIndexOf(".");
	//check '@' and '.' is not first or last character
	if ((pos1 <= 0)||(pos1 == len-1)||(pos2 <= 0)||(pos2 == len-1))  
	{
		window.alert("请输入有效的E-mail地址！");
		return false;
	}
	else
	{
		//check @. or .@
		if( (pos1 == pos2 - 1) || (pos1 == pos2 + 1) 
		  || ( pos1 != pos3 )  //find two @
		  || ( pos4 < pos3 ) ) //. should behind the '@'  		
		{
			window.alert("请输入有效的E-mail地址！");
			return false;
		}
	}
	return true;
}


function CheckMinLength(Field, MinLength, FieldTitle)
	{
		if (Field.value != "")
		{
			if (Field.value.length < MinLength)
			{
				alert("\"" + FieldTitle + "\"中输入的字符请不要少于" + MinLength + "字符.");
				Field.focus();
				return false;
			}
		}
		
		return true;
	}

	function CheckField(Field, FieldTitle)
	{
		if (Field.value != "")
		{
			for (i = 0; i < Field.value.length; i++)
			{ 
				var ch2
				ch = Field.value.charAt(i);
				ch2 = Field.value.charCodeAt(i);
				
					if(eval(ch2 - 0x80) >= 0) 
					{   
						
					}
					else
					{
						if ( (ch < '0' || ch > '9') && ch != '-' && ch!='_' &&(ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') ) 
						{
							alert("\"" + FieldTitle + "\"中只能输入中文字符、字母和数字或下划线.");
							Field.focus();
							return	false;
						}
					}
			}
		}
		
		return true;
	}
function CheckAgain(Field, FieldTitle)
{
	if (Field.value != "")
		{
		var temp;
		pos1 = Field.value.indexOf("@");		
		temp=Field.value.substring(1,pos1-1);		
		for (i = 0; i < temp.length; i++){
      	  ch = temp.charAt(i);			
		  if ( (ch < '0' || ch > '9') && ch != '-' && ch!='_' &&(ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') ) {
			alert("\"" + FieldTitle + "\"中只能输入字母和数字或下划线.");
			Field.focus();
			return	false;
			}	
		}
	}
		
	return true;
}

function checkSele(field,fieldname)	{
 if(field.value==0){
   alert("请选择您的"+fieldname);
   field.focus();
   return false;}   
 return true;   
}	
/*name sex  birth nation workyears officeyears 
degree  school  major  workcorp headship 
address  zipcode  tel_off  tel_fam  tel_mobile
leader_show leader_skill corp_status  corp_product 
corp_active  corp_capital corp_tribute self_credit  corp_opinion */		


function Check(theForm)
{   	
    if (!CheckEmpty(theForm.name, "姓名"))				return false;	   
    if (!CheckEmpty(theForm.birth_year, "出生年"))				return false;
    if (!CheckEmpty(theForm.ID, "身份证"))				return false;
	if (!CheckEmpty(theForm.email, "email"))				return false;
		
 }		