function check_login(theForm)
{

if (theForm.uid.value == "")
   {
   alert("请输入您的用户名!");
   theForm.uid.focus();
   return (false)
   }

if (theForm.pwd.value == "")
   {
   alert("请输入您的密码!");
   theForm.pwd.focus();
   return (false)
   }
}

function check_reg(theForm)
{

if (theForm.uid.value == "")
   {
   alert("请输入您的用户名!");
   theForm.uid.focus();
   return (false)
   }

var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
	var checkStr = theForm.uid.value;
	var allValid = true;
	for ( i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for ( j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j)) break;
		if ( j == checkOK.length)
		{
			allValid = false;
			break;
		}
	}

	if ( theForm.uid.value.length > 20)
	{
			allValid = false;
	}

	if ( !allValid)
	{
		alert("您输入的用户名不符合要求!");
		theForm.uid.focus();
		return (false);
	}
if (theForm.pwd.value == "")
   {
   alert("请输入您的密码!");
   theForm.pwd.focus();
   return (false)
   }

var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
	var checkStr = theForm.pwd.value;
	var allValid = true;
	for ( i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for ( j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j)) break;
		if ( j == checkOK.length)
		{
			allValid = false;
			break;
		}
	}

	if ( theForm.pwd.value.length > 20)
	{
			allValid = false;
	}

	if ( !allValid)
	{
		alert("您输入的密码不符合要求!");
		theForm.pwd.focus();
		return (false);
	}
   
if (theForm.pwdc.value == "")
   {
   alert("请输入您的确认密码!");
   theForm.pwdc.focus();
   return (false)
   } 
   
if (theForm.pwd.value != theForm.pwdc.value)
   {
   alert("您输入的密码与确认密码不符,请重新输入!");
   theForm.pwdc.focus();
   return (false)
   }   
if ( theForm.question.value == "")
	{
		alert("请您输入密码提示问题!");
		theForm.question.focus();
		return (false);
	}
if ( theForm.answer.value == "")
	{
		alert("请您输入密码提示答案!");
		theForm.answer.focus();
		return (false);
	}
if ( theForm.uname.value == "")
	{
		alert("请您输入您的真实姓名!");
		theForm.uname.focus();
		return (false);
	}                                      
if ( theForm.email.value == "")
	{
		alert("请您输入您的E_mail!");
		theForm.email.focus();
		return (false);
	}


	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_@.";
	var checkStr = theForm.email.value;
	var allValid = true;
	for ( i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for ( j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j)) break;
		if ( j == checkOK.length)
		{
			allValid = false;
			break;
		}
	}

	if ( theForm.email.value.length < 6)
	{
			allValid = false;
	}

	if ( !allValid)
	{
		alert("您输入的电子邮件地址无效!");
		theForm.email.focus();
		return (false);
	}

	address=theForm.email.value;
    if(address.length>0)
	{
        i=address.indexOf("@");
        j=address.indexOf(".")
        if((i==-1)||(j==-1))
		{
			window.alert("您输入的电子邮件地址是错误的!")
			theForm.email.focus();
			return false
        }
    }
	if (checktext(theForm.email.value))
	{
		alert("请您输入有效的E_mail!");
		theForm.email.select();
		theForm.email.focus();
		return (false);
	}
  function checktext(text)
  {
			allValid = true;

		for (i = 0;  i < text.length;  i++)
		{
			if (text.charAt(i) != " ")
			{
				allValid = false;
				break;
			}
		}

  return allValid;
  }

}