// validate.js
function isDigit(n) 
{
	var test = "" + n;

	if (test == "0" || test == "1" || test == "2" || test == "3" ||
          	test == "4" || test == "5" || test == "6" || test == "7" ||
          	test == "8" || test == "9") { return true; }
        	else { return false; }
}

function isNum(obj)
{
	var i = 0
	var j = 0
	
	while (i < obj.value.length)
	{
		if (isDigit(obj.value.substring(i,i+1)))
		{
			j++
		}
		i++
	}

	if (j == obj.value.length)
	{	
		return true
	}
	else
	{
		return false
	}
}

function alertBox(object, box) 
{
	alert(object)
	box.focus()
  	box.select()
}

function checkTel(object) {
	if (object.value != "") {
		if (!isNum(object)) {
          		alertBox("Please use digits (0-9)", object)
          		return false;
    		}
   	}
   	return true
}

function check_valid_num(obj)
{
	if (obj.value != "")
	{
		if (!isNum(obj))
		{
			alertBox("Please use digits (0-9)", obj)
			return false;
		}
	}
}

function isCharN(n) {
    var test = "" + n;
        if (test == 'a' || test == 'A' || test == 'b' || test == 'B' ||
          test == 'c' || test == 'C' || test == 'd' || test == 'D' || 
          test == 'e' || test == 'E' || test == 'f' || test == 'F' || 
          test == 'g' || test == 'G' || test == 'h' || test == 'H' || 
          test == 'i' || test == 'I' || test == 'j' || test == 'J' || 
          test == 'k' || test == 'K' || test == 'l' || test == 'L' || 
          test == 'm' || test == 'M' || test == 'n' || test == 'N' ||
          test == 'o' || test == 'O' || test == 'p' || test == 'P' || 
          test == 'q' || test == 'Q' || test == 'r' || test == 'R' || 
          test == 's' || test == 'S' || test == 't' || test == 'T' || 
          test == 'u' || test == 'U' || test == 'v' || test == 'V' || 
          test == 'w' || test == 'W' || test == 'x' || test == 'X' || 
          test == 'y' || test == 'Y' || test == 'z' || test == 'Z' || 
          test == ' ' || test == '.' || test == '-') { 
          return true;
        }
        else {

          return false;
        }
}

function isallCharN(object) {
    var i = 0 
        while (i < object.value.length) {
           if (isDigit(object.value.substring(i,i+1))) {           	
             return false
                 break;
           }
           i++
        }
        return true
}

function isSpecChar(n) {
    var test = "" + n;
        if (test == 'A' || test == 'B' || test == 'C' || test == 'D' || test == 'E' || test == 'F' || test == 'G' || test == 'H' || test == 'I' || test == 'J' || test == 'K' || test == 'L' || test == 'M' || test == 'N' || test == 'O' || test == 'P' || test == 'Q' || test == 'R' || test == 'S' || test == 'T' || test == 'U' ||test == 'V' || test == 'W' || test == 'X' || test == 'Y' || test == 'Z' || 
test == ' ' || test == '`' || test == '~' || test == '!' || test == '@' || test == '#' || test == '$' || test == '%' || test == '^' || test == '&' || test == '*' || test == '(' || test == ')' || test == '=' || test == '+' || test == '[' || test == '{' || test == ']' || test == '}' || test == ';' || test == ':' || test == "'" || test == '"' || test == '\\' || test == '|' || test == ',' || test == '<' || test == '>' || test == '/' || test == '?') { 
          return true;
        }
        else {

          return false;
        }
}

function isValidChar(n) {
    var test = "" + n;
        if (test == 'a' || test == 'A' || test == 'b' || test == 'B' ||
          test == 'c' || test == 'C' || test == 'd' || test == 'D' || 
          test == 'e' || test == 'E' || test == 'f' || test == 'F' || 
          test == 'g' || test == 'G' || test == 'h' || test == 'H' || 
          test == 'i' || test == 'I' || test == 'j' || test == 'J' || 
          test == 'k' || test == 'K' || test == 'l' || test == 'L' || 
          test == 'm' || test == 'M' || test == 'n' || test == 'N' ||
          test == 'o' || test == 'O' || test == 'p' || test == 'P' || 
          test == 'q' || test == 'Q' || test == 'r' || test == 'R' || 
          test == 's' || test == 'S' || test == 't' || test == 'T' || 
          test == 'u' || test == 'U' || test == 'v' || test == 'V' || 
          test == 'w' || test == 'W' || test == 'x' || test == 'X' || 
          test == 'y' || test == 'Y' || test == 'z' || test == 'Z' || 
          test == '_' || test == '.' || test == '-' || test == '0' || 
          test == '1' || test == '2' || test == '3' || test == '4' ||                     
          test == '5' || test == '6' || test == '7' || test == '8' ||   
          test == '9') {               	
          return true;
        }
        else {

          return false;
        }
}

// this function is specially for checking the first character
function isValidChar1(n) {
    var test = "" + n;
        if (test == 'a' || test == 'A' || test == 'b' || test == 'B' ||
          test == 'c' || test == 'C' || test == 'd' || test == 'D' || 
          test == 'e' || test == 'E' || test == 'f' || test == 'F' || 
          test == 'g' || test == 'G' || test == 'h' || test == 'H' || 
          test == 'i' || test == 'I' || test == 'j' || test == 'J' || 
          test == 'k' || test == 'K' || test == 'l' || test == 'L' || 
          test == 'm' || test == 'M' || test == 'n' || test == 'N' ||
          test == 'o' || test == 'O' || test == 'p' || test == 'P' || 
          test == 'q' || test == 'Q' || test == 'r' || test == 'R' || 
          test == 's' || test == 'S' || test == 't' || test == 'T' || 
          test == 'u' || test == 'U' || test == 'v' || test == 'V' || 
          test == 'w' || test == 'W' || test == 'x' || test == 'X' || 
          test == 'y' || test == 'Y' || test == 'z' || test == 'Z' || 
          test == '_' || test == '.' || test == '-' || test == '0' || 
          test == '1' || test == '2' || test == '3' || test == '4' ||                     
          test == '5' || test == '6' || test == '7' || test == '8' ||   
          test == '9') {               	
          return true;
        }
        else {

          return false;
        }
}

function checkMinLen(object, n, val) {
        if (object.value.length < val) {
	alert(n + "at least should have " + val + " characters.")
	object.focus();
	return false;
        }
        else {
	return true;
        }
}

function checkNameN(object, n, val) {
        if (isallCharN(object) == false) {
	alert(n + "cannot contain digits.")
	object.focus();
	return false;
        }
        else {
                if (checkMinLen(object, n, val)) {
                        return true;
                }
                else {
                        return false;
                }
        }
}

function checkPwd(object1, object2, n1, n2) {
	if (object1.value != object2.value)
	{
          alertBox(n1 + " and " + n2 + " do not match.", object1)
          return false;	
	}
}

function reset_form(thisForm) {
	thisForm.reset();
}

function isValidAddrChar(n) {
    var test = "" + n;
        if (test == '`' || test == '~' || test == '!' || test == '@' ||
      test == '%' || test == '^' || test == '*' || test == '<' || 
      test == '{' || test == '}' || test == '[' || test == '>' || 
      test == ']' || test == '+' || test == '?') {
          return false;
        }
        else {
          return true;
    }
}

function isNotValidAddrChar(object) {
    var i = 0 
        while (i < object.value.length) {
           if (!isValidAddrChar(object.value.substring(i,i+1))) {
             return true
                 break;
           }
           i++
        }
        return false
}

function checkaddr(object) {
  if (object.value != "") {
    if (isNotValidAddrChar(object)) {
          alertBox("Please enter suitable character.", object)
          return false;
    }
    else
          return true;
  }
}

function checkMemName(object, n) {
    var i = 0 

	if ( !isValidChar1(object.value.substring(0,1)) ) {
			alert(n + " First character is limited to alphabets (a-z), digits (0-9) and \"_\".")
			object.focus();
             return false
	}

		while (i < object.value.length) {
           if ( !isValidChar(object.value.substring(i,i+1)) ) {
			alert(n + " cannot have upper captial letter,space,chinese character and special character.")
			object.focus();
             return false
                 break;
           }
           i++
        }
        return true
}

function checkEmLogin(s, object, n) {
    var i = 0 

	if ( !isValidChar1(s.substring(0,1)) ) {
			alert(n + " First character is limited to alphabets (a-z), digits (0-9) and \"_\".")
			object.focus();
             return false
	}

	while (i < s.length) {
        if ( !isValidChar(s.substring(i,i+1)) ) {
			alert(n + " cannot have upper captial letter,space,chinese character and special character.")
			object.focus();
				return false
					break;
        }
        i++
    }

	return true
}

function checkEmDom(s, object, n) {
    var i = 0 

	if ( !isValidChar1(s.substring(s.length-1,s.length)) ) {
			alert(n + " is not a valid domain.")
			object.focus();
             return false
	}

	var ldom = s.substring(s.lastIndexOf(".")+1,s.length);
	if (ldom.length > 3) {
			alert(n + " is not a valid domain.")
			object.focus();
             return false
	}

	while (i < s.length) {
        if ( !isValidChar(s.substring(i,i+1)) ) {
			alert(n + " cannot have upper captial letter,space,chinese character and special character.")
			object.focus();
				return false
					break;
        }
        i++
    }

	return true
}
// end validate.js

var domList = new Array(".com",".org",".gov",".net",".mil",".edu",".cc",".biz",".sh",".zj",".js",".sd",".gd",".fj",".it",".gs",".yzjs",".hn",".co",".ln",".xj",".ne",".sn",".xa",".sx",".or",".he",".be",".cn",".ha",".de",".ah",".icn",".jx");

function submit_form1(theForm)
{
	theForm.action = theForm.action + "?username=" + theForm.uName.value;
	theForm.submit();
}

function reset_form(theForm)
{
	theForm.reset();
}

function afterlogin(theForm)
{
	theForm.action = theForm.action + "?username=" + theForm.uName.value;
	return true;
}

function check_pwd(theForm)
{
	if (theForm.OlduPwd.value == "")
  	{
    		alert("请输入 \"旧密码\".");
    		theForm.OlduPwd.focus();
    		return (false);
  	}
  		
	if (theForm.uPwd.value == "")
  	{
    		alert("请输入 \"新密码\".");
    		theForm.uPwd.focus();
    		return (false);
  	}
	else
	{
		if (checkMinLen(theForm.uPwd, '新密码', 6) == false)
	    		return (false);
	}

	if (theForm.uConfirm.value == "")
  	{
    		alert("请输入 \"密码确认\".");
    		theForm.uConfirm.focus();
    		return (false);
  	}
	else
	{
		if (checkPwd(theForm.uConfirm,theForm.uPwd, '密码确认', '新密码') == false)
	    		return (false);
	}
}

function validate_enq(theForm)
{
	theForm.prod_list.value = "";

	ChkCps1 = 0;
	for (i=1; i <= 3; i++)
	{
		tmpV = "theForm.cpsc1"+i+".checked";
		if (eval(tmpV))
			ChkCps1 = 1;
	}
	  	
	if (ChkCps1 == 0)
	{
		alert("请注明\"来源\".");
		theForm.cpsc11.focus();
		return (false);  		
	}		

	ChkCps2 = 0;
	for (i=1; i <= 4; i++)
	{
		tmpV = "theForm.cpsc2"+i+".checked";
		if (eval(tmpV))
			ChkCps2 = 1;
	}
	  	
	if (ChkCps2 == 0)
	{
		alert("请注明\"您的兴趣\".");
		theForm.cpsc21.focus();
		return (false);  		
	}
		
	if (theForm.mLName.value == "")
  	{
    		alert("请输入 \"姓氏\".");
    		theForm.mLName.focus();
    		return (false);
  	}
	else
	{
		if (checkNameN(theForm.mLName, '姓氏', 1) == false)
	    		return (false);
	}  	

	if (theForm.mFName.value == "")
  	{
    		alert("请输入 \"名字\".");
    		theForm.mFName.focus();
    		return (false);
  	}
	else
	{
		if (checkNameN(theForm.mFName, '名字', 1) == false)
	    		return (false);
	} 

	if (theForm.Gender_id.options[theForm.Gender_id.selectedIndex].value == "")	
  	{
    		alert("请输入 \"称谓\".");
    		theForm.Gender_id.focus();
    		return (false);
  	}
  		
	if (theForm.mEmail.value == "")
  	{
    		alert("请输入 \"电邮地址\".");
    		theForm.mEmail.focus();
    		return (false);
  	}
  			
	if (theForm.mCname.value == "")
  	{
    		alert("请输入 \"单位名称\".");
    		theForm.mCname.focus();
    		return (false);
  	}

	if (theForm.mCadd1.value == "")
  	{
    		alert("请输入 \"单位地址\".");
    		theForm.mCadd1.focus();
    		return (false);
  	}
  	else if (checkaddr(theForm.mCadd1) == false)
  	{
  		return false;
  	}

	if (theForm.Country_id.options[theForm.Country_id.selectedIndex].value == "")	
  	{
    		alert("请输入 \"国家\".");
    		theForm.Country_id.focus();
    		return (false);
  	}
  	else if (theForm.Country_id.selectedIndex == 44)	
  	{
  		if (theForm.Province_id.options[theForm.Province_id.selectedIndex].value == 0)
  		{
	    		alert("请输入 \"省份\".");
	    		theForm.Province_id.focus();
	    		return (false);
  		} 
	}

	// telephone number
	if (theForm.mTelAC.value == "")
  	{
    		alert("请输入 \"地区编码\".");
    		theForm.mTelAC.focus();
    		return (false);
  	}
  	else
  	{
		if (!isNum(theForm.mTelAC)) {
          		alertBox("请用(0-9) 的数字", theForm.mTelAC)
          		return false;
    		}  		
  	}

	if (theForm.mTel.value == "")
  	{
    		alert("请输入 \"电话号码\".");
    		theForm.mTel.focus();
    		return (false);
  	}
  	else
	{
		if (checkTel(theForm.mTel) == false)
	    		return (false);
	}  	  	

	if (theForm.jtitle.options[theForm.jtitle.selectedIndex].value == "")	
  	{
    		alert("请输入 \"职衔/职位\".");
    		theForm.jtitle.focus();
    		return (false);
  	}
  	else if (theForm.jtitle.selectedIndex == (theForm.jtitle.length-1))
  	{
  		// select others, but didn't fill in the text box
  		if (theForm.title.value == "")
  		{
	    		alert("请注明您的 \"职衔/职位\".");
	    		theForm.title.focus();
	    		return (false);
  		}
  	}

	if (theForm.department.options[theForm.department.selectedIndex].value == "")	
  	{
    		alert("请输入 \"部门\".");
    		theForm.department.focus();
    		return (false);
  	}
  	else if (theForm.department.selectedIndex == (theForm.department.length-1))
  	{
  		// select others, but didn't fill in the text box
  		if (theForm.Dept_other.value == "")
  		{
	    		alert("请注明您的 \"部门\".");
	    		theForm.Dept_other.focus();
	    		return (false);
  		}
  	}
  	
  	tmpV = "theForm.c"+theForm.other_id.value+".checked";
  	if (eval(tmpV))
  	{
  		if (theForm.other_prod.value == "")
  		{
	    		alert("请注明您的 \"业务性质\".");
	    		theForm.other_prod.focus();
	    		return (false);  			
  		}
  	}
  	
  	// compose the product list for saving
  	for (i=1; i <= theForm.other_id.value; i++)
  	{
  		tmpV1 = "theForm.c"+i+".checked";
  		if (eval(tmpV1))
  		{
  			if (theForm.prod_list.value != "")
  				theForm.prod_list.value += ",";
  			
  			tmpV2 = "theForm.c"+i+".value";
			theForm.prod_list.value += eval(tmpV2);  			
  		}
	}
}

function validate_search(theForm)
{
	FormInput = 0
	if (theForm.myIndustry_id.options[theForm.myIndustry_id.selectedIndex].value != "")	
		FormInput = 1;
	if (theForm.myCountry_id.options[theForm.myCountry_id.selectedIndex].value != "")	
		FormInput = 1;
	if (theForm.smonth.options[theForm.smonth.selectedIndex].value != "")	
		FormInput = 1;
	if (theForm.syear.options[theForm.syear.selectedIndex].value != "")	
		FormInput = 1;
	if (theForm.emonth.options[theForm.emonth.selectedIndex].value != "")	
		FormInput = 1;
	if (theForm.eyear.options[theForm.eyear.selectedIndex].value != "")	
		FormInput = 1;
		
	if (FormInput == 0)
	{
		    alert("请选择搜索条件.");
		    theForm.myIndustry_id.focus();
		    return (false);		
	}
	else		
		return (true);
}

function validate_userinfo(theForm)
{
	if (theForm.action.value == "addnew")
	{
		// member information
		if (theForm.uName.value == "")
	  	{
	    		alert("请输入 \"会员代号\".");
	    		theForm.uName.focus();
	    		return (false);
	  	}
		else
		{
			if (checkMinLen(theForm.uName, '会员代号', 4) == false)
		    		return (false);
	
			if (checkMemName(theForm.uName, '会员代号') == false)
		    		return (false);
		}
			
		if (theForm.uPwd.value == "")
	  	{
	    		alert("请输入 \"密码\".");
	    		theForm.uPwd.focus();
	    		return (false);
	  	}
		else
		{
			if (checkMinLen(theForm.uPwd, '密码', 6) == false)
		    		return (false);
		}
	
		if (theForm.uConfirm.value == "")
	  	{
	    		alert("请输入 \"密码确认\".");
	    		theForm.uConfirm.focus();
	    		return (false);
	  	}
		else
		{
			if (checkPwd(theForm.uConfirm,theForm.uPwd, '密码确认', '密码') == false)
		    		return (false);
		}
		
		if (theForm.mEmail.value == "")
	  	{
	    		alert("请输入 \"电邮地址\".");
	    		theForm.mEmail.focus();
	    		return (false);
	  	}
		else
		{
			ChkEmail1 = 0;
			ChkEmail2 = 0;
			for (j=0; j < theForm.mEmail.value.length; j++)
			{
				if (theForm.mEmail.value.charAt(j) == "@")
					ChkEmail1 = 1;
				if (theForm.mEmail.value.charAt(j) == ".")
					ChkEmail2 = 1;				
			}
			
		  	if (ChkEmail1 == 0 || ChkEmail2 == 0)
		  	{
			    	alert("不是有效的电邮地址.");
			    	theForm.mEmail.focus();
			    	return (false);  		
			}  			
		}		
	}	


	// company information
	if (theForm.mLName.value == "")
  	{
    		alert("请输入 \"姓氏\".");
    		theForm.mLName.focus();
    		return (false);
  	}
	else
	{
		if (checkNameN(theForm.mLName, '姓氏', 1) == false)
	    		return (false);
	}  	

	if (theForm.mFName.value == "")
  	{
    		alert("请输入 \"名字\".");
    		theForm.mFName.focus();
    		return (false);
  	}
	else
	{
		if (checkNameN(theForm.mFName, '名字', 1) == false)
	    		return (false);
	} 
	
	if (theForm.mCname.value == "")
  	{
    		alert("请输入 \"单位名称\".");
    		theForm.mCname.focus();
    		return (false);
  	}

	if (theForm.mCadd1.value == "")
  	{
    		alert("请输入 \"单位地址\".");
    		theForm.mCadd1.focus();
    		return (false);
  	}
  	else if (checkaddr(theForm.mCadd1) == false)
  	{
  		return false;
  	}

	if (theForm.Country_id.options[theForm.Country_id.selectedIndex].value == "")	
  	{
    		alert("请输入 \"国家\".");
    		theForm.Country_id.focus();
    		return (false);
  	}
  	else if (theForm.Country_id.selectedIndex == 44)	
  	{
  		if (theForm.Province_id.options[theForm.Province_id.selectedIndex].value == 0)
  		{
	    		alert("请输入 \"省份\".");
	    		theForm.Province_id.focus();
	    		return (false);
  		} 
	}
  	/*
	if (theForm.mCcity.value == "")
  	{
    		alert("请输入 \"市/县\".");
    		theForm.mCcity.focus();
    		return (false);
  	}

	if (theForm.mCpostal.value == "")
  	{
    		alert("请输入 \"邮编\".");
    		theForm.mCpostal.focus();
    		return (false);
  	}
*/  	
	// telephone number
	if (theForm.mTelAC.value == "")
  	{
    		alert("请输入 \"地区编码\".");
    		theForm.mTelAC.focus();
    		return (false);
  	}
  	else
  	{
		if (!isNum(theForm.mTelAC)) {
          		alertBox("请用(0-9) 的数字", theForm.mTelAC)
          		return false;
    		}  		
  	}

	if (theForm.mTel.value == "")
  	{
    		alert("请输入 \"电话号码\".");
    		theForm.mTel.focus();
    		return (false);
  	}
  	else
	{
		if (checkTel(theForm.mTel) == false)
	    		return (false);
	}  	  	

	/*
	// fax number
	if (theForm.mFaxAC.value == "")
  	{
    		alert("请输入 \"地区编码\".");
    		theForm.mFaxAC.focus();
    		return (false);
  	}
  	else
  	{
		if (!isNum(theForm.mFaxAC)) {
          		alertBox("请用(0-9) 的数字", theForm.mFaxAC)
          		return false;
    		}  		
  	}

	if (theForm.mFax.value == "")
  	{
    		alert("请输入 \"传真号码\".");
    		theForm.mFax.focus();
    		return (false);
  	}
  	else
	{
		if (checkTel(theForm.mFax) == false)
	    		return (false);
	}
	*/
	
	// Personal Profile
	/*
	if (theForm.Age_id.options[theForm.Age_id.selectedIndex].value == "")	
  	{
    		alert("请输入 \"年龄\".");
    		theForm.Age_id.focus();
    		return (false);
  	}
  		*/  	

	if (theForm.jtitle.options[theForm.jtitle.selectedIndex].value == "")	
  	{
    		alert("请输入 \"职业\".");
    		theForm.jtitle.focus();
    		return (false);
  	}/*
  	else if (theForm.jtitle.selectedIndex == (theForm.jtitle.length-1))
  	{
  		// select others, but didn't fill in the text box
  		if (theForm.title.value == "")
  		{
	    		alert("请注明您的 \"职业\".");
	    		theForm.title.focus();
	    		return (false);
  		}
  	}
*/
	if (theForm.department.options[theForm.department.selectedIndex].value == "")	
  	{
    		alert("请输入 \"工作性质\".");
    		theForm.department.focus();
    		return (false);
  	}
  	
	if (theForm.Education_id.options[theForm.Education_id.selectedIndex].value == 0)	
  	{
    		alert("请输入 \"教育程度\".");
    		theForm.Education_id.focus();
    		return (false);
  	}

	if (theForm.myindustry.options[theForm.myindustry.selectedIndex].value == 0)	
  	{
    		alert("请输入 \"行业\".");
    		theForm.myindustry.focus();
    		return (false);
  	}
  		
	// Company Profile
	/*
	if (theForm.noemp.options[theForm.noemp.selectedIndex].value == "")	
  	{
    		alert("请输入 \"总职工人数\".");
    		theForm.noemp.focus();
    		return (false);
  	}  	
  	*/
/*
  	// news list
  	theForm.newslist.value = "";
	for (j=0; j < theForm.fsindustry.length; j++)
	{
		if (theForm.fsindustry.options[j].selected)
		{
			if (theForm.newslist.value != "")
			  	theForm.newslist.value += ",";
			
			theForm.newslist.value += theForm.fsindustry.options[j].value;  						
		}
	}
	  	*/
  	// exh list
  	theForm.exhlist.value = "";
	for (j=0; j < theForm.myshow.length; j++)
	{
		if (theForm.myshow.options[j].selected)
		{
			if (theForm.exhlist.value != "")
			  	theForm.exhlist.value += ",";
			
			theForm.exhlist.value += theForm.myshow.options[j].value;  						
		}
	}

  	// pub list
  	theForm.publist.value = "";
	for (j=0; j < theForm.mypub.length; j++)
	{
		if (theForm.mypub.options[j].selected)
		{
			if (theForm.publist.value != "")
			  	theForm.publist.value += ",";
			
			theForm.publist.value += theForm.mypub.options[j].value;  						
		}
	}	
}

function validate_page1(theForm)
{
		// member information
		if (theForm.uName.value == "")
	  	{
	    		alert("请输入 \"会员代号\".");
	    		theForm.uName.focus();
	    		return (false);
	  	}
		else
		{
			if (checkMinLen(theForm.uName, '会员代号', 4) == false)
		    		return (false);
	
			if (checkMemName(theForm.uName, '会员代号') == false)
		    		return (false);
		}
			
		if (theForm.uPwd.value == "")
	  	{
	    		alert("请输入 \"密码\".");
	    		theForm.uPwd.focus();
	    		return (false);
	  	}
		else
		{
			if (checkMinLen(theForm.uPwd, '密码', 6) == false)
		    		return (false);
		}
	
		if (theForm.uConfirm.value == "")
	  	{
	    		alert("请输入 \"密码确认\".");
	    		theForm.uConfirm.focus();
	    		return (false);
	  	}
		else
		{
			if (checkPwd(theForm.uConfirm,theForm.uPwd, '密码确认', '密码') == false)
		    		return (false);
		}
  		
	if (theForm.mEmail.value == "")
  	{
    		alert("请输入 \"电邮地址\".");
    		theForm.mEmail.focus();
    		return (false);
  	}
	else
	{
		ChkEmail1 = 0;
		ChkEmail2 = 0;
		for (j=0; j < theForm.mEmail.value.length; j++)
		{
			if (theForm.mEmail.value.charAt(j) == "@")
				ChkEmail1 = 1;
			if (theForm.mEmail.value.charAt(j) == ".")
				ChkEmail2 = 1;				
		}
		
	  	if (ChkEmail1 == 0 || ChkEmail2 == 0)
	  	{
		    	alert("不是有效的电邮地址.");
		    	theForm.mEmail.focus();
		    	return (false);  		
		}  			
	}  	
}

function validate_page2(theForm)
{
	// company information
	if (theForm.mLName.value == "")
  	{
    		alert("请输入 \"姓氏\".");
    		theForm.mLName.focus();
    		return (false);
  	}
	else
	{
		if (checkNameN(theForm.mLName, '姓氏', 1) == false)
	    		return (false);
	}  	

	if (theForm.mFName.value == "")
  	{
    		alert("请输入 \"名字\".");
    		theForm.mFName.focus();
    		return (false);
  	}
	else
	{
		if (checkNameN(theForm.mFName, '名字', 1) == false)
	    		return (false);
	} 

	if (theForm.Gender_id.options[theForm.Gender_id.selectedIndex].value == "")	
  	{
    		alert("请输入 \"称谓\".");
    		theForm.Gender_id.focus();
    		return (false);
  	}
  			
	if (theForm.mCname.value == "")
  	{
    		alert("请输入 \"单位名称\".");
    		theForm.mCname.focus();
    		return (false);
  	}

	if (theForm.mCadd1.value == "")
  	{
    		alert("请输入 \"单位地址\".");
    		theForm.mCadd1.focus();
    		return (false);
  	}
  	else if (checkaddr(theForm.mCadd1) == false)
  	{
  		return false;
  	}

	if (theForm.Country_id.options[theForm.Country_id.selectedIndex].value == "")	
  	{
    		alert("请输入 \"国家\".");
    		theForm.Country_id.focus();
    		return (false);
  	}
  	else if (theForm.Country_id.selectedIndex == 44)	
  	{
  		if (theForm.Province_id.options[theForm.Province_id.selectedIndex].value == 0)
  		{
	    		alert("请输入 \"省份\".");
	    		theForm.Province_id.focus();
	    		return (false);
  		} 
	}

	// telephone number
	if (theForm.mTelAC.value == "")
  	{
    		alert("请输入 \"地区编码\".");
    		theForm.mTelAC.focus();
    		return (false);
  	}/*
  	else
  	{
		if (!isNum(theForm.mTelAC)) {
          		alertBox("请用(0-9) 的数字", theForm.mTelAC)
          		return false;
    		}  		
  	}*/

	if (theForm.mTel.value == "")
  	{
    		alert("请输入 \"电话号码\".");
    		theForm.mTel.focus();
    		return (false);
  	}
  	else
	{
		if (checkTel(theForm.mTel) == false)
	    		return (false);
	}  	  	

	/*
	// fax number
	if (theForm.mFaxAC.value == "")
  	{
    		alert("请输入 \"地区编码\".");
    		theForm.mFaxAC.focus();
    		return (false);
  	}
  	else
  	{
		if (!isNum(theForm.mFaxAC)) {
          		alertBox("请用(0-9) 的数字", theForm.mFaxAC)
          		return false;
    		}  		
  	}

	if (theForm.mFax.value == "")
  	{
    		alert("请输入 \"传真号码\".");
    		theForm.mFax.focus();
    		return (false);
  	}
  	else
	{
		if (checkTel(theForm.mFax) == false)
	    		return (false);
	}*/
	  	
	if (theForm.jtitle.options[theForm.jtitle.selectedIndex].value == "")	
  	{
    		alert("请输入 \"职业\".");
    		theForm.jtitle.focus();
    		return (false);
  	}

	if (theForm.department.options[theForm.department.selectedIndex].value == "")	
  	{
    		alert("请输入 \"工作性质\".");
    		theForm.department.focus();
    		return (false);
  	}
	
	// Personal Profile
	if (theForm.Education_id.options[theForm.Education_id.selectedIndex].value == 0)	
  	{
    		alert("请输入 \"教育程度\".");
    		theForm.Education_id.focus();
    		return (false);
  	}

	if (theForm.myindustry.options[theForm.myindustry.selectedIndex].value == 0)	
  	{
    		alert("请输入 \"行业\".");
    		theForm.myindustry.focus();
    		return (false);
  	}
  	  	
	// Company Profile
	if (theForm.bizNature.options[theForm.bizNature.selectedIndex].value == 0)	
  	{
    		alert("请输入 \"业务性质\".");
    		theForm.bizNature.focus();
    		return (false);
  	}
}

function validate_page3(theForm)
{
	/*
  	// news list
  	theForm.newslist.value = "";
	for (j=0; j < theForm.fsindustry.length; j++)
	{
		if (theForm.fsindustry.options[j].selected)
		{
			if (theForm.newslist.value != "")
			  	theForm.newslist.value += ",";
			
			theForm.newslist.value += theForm.fsindustry.options[j].value;  						
		}
	}
	*/	
  	// exh list
  	theForm.exhlist.value = "";
	for (j=0; j < theForm.myshow.length; j++)
	{
		if (theForm.myshow.options[j].selected)
		{
			if (theForm.exhlist.value != "")
			  	theForm.exhlist.value += ",";
			
			theForm.exhlist.value += theForm.myshow.options[j].value;  						
		}
	}

  	// pub list
  	theForm.publist.value = "";
	for (j=0; j < theForm.mypub.length; j++)
	{
		if (theForm.mypub.options[j].selected)
		{
			if (theForm.publist.value != "")
			  	theForm.publist.value += ",";
			
			theForm.publist.value += theForm.mypub.options[j].value;  						
		}
	}	
}

function validPubAdv(theForm)
{
	if (theForm.mLName.value == "")
  	{
    		alert("请输入 \"姓氏\".");
    		theForm.mLName.focus();
    		return (false);
  	}
	else
	{
		if (checkNameN(theForm.mLName, '姓氏', 1) == false)
	    		return (false);
	}  	

	if (theForm.mFName.value == "")
  	{
    		alert("请输入 \"姓名\".");
    		theForm.mFName.focus();
    		return (false);
  	}
	else
	{
		if (checkNameN(theForm.mFName, '姓名', 1) == false)
	    		return (false);
	} 

	if (theForm.mEmail.value == "")
  	{
    		alert("请输入 \"电邮地址\".");
    		theForm.mEmail.focus();
    		return (false);
  	}
  			
	if (theForm.mCname.value == "")
  	{
    		alert("请输入 \"单位名称\".");
    		theForm.mCname.focus();
    		return (false);
  	}
}

function validate_userinfo_simple(theForm)
{
	checkPt = 0;
	checkPV = 0;
	
	if (theForm.mEmail.value == "")
  	{
    		alert("请输入 \"电邮地址\".");
    		theForm.mEmail.focus();
    		return (false);
  	}
	else
	{
		ChkEmail1 = 0;
		ChkEmail2 = 0;
		for (j=0; j < theForm.mEmail.value.length; j++)
		{
			if (theForm.mEmail.value.charAt(j) == "@")
				ChkEmail1 = 1;
			if (theForm.mEmail.value.charAt(j) == ".")
				ChkEmail2 = 1;				
		}
		
	  	if (ChkEmail1 == 0 || ChkEmail2 == 0)
	  	{
		    	alert("不是有效的电邮地址.");
		    	theForm.mEmail.focus();
		    	return (false);  		
		}  			
	}
	
		if (theForm.uPwd.value == "")
	  	{
	    		alert("请输入 \"密码\".");
	    		theForm.uPwd.focus();
	    		return (false);
	  	}
		else
		{
			if (checkMinLen(theForm.uPwd, '密码', 6) == false)
		    		return (false);
		}
	
		if (theForm.uConfirm.value == "")
	  	{
	    		alert("请输入 \"密码确认\".");
	    		theForm.uConfirm.focus();
	    		return (false);
	  	}
		else
		{
			if (checkPwd(theForm.uConfirm,theForm.uPwd, '密码确认', '密码') == false)
		    		return (false);
		}

	// company information
	if (theForm.mLName.value == "")
  	{
    		alert("请输入 \"姓氏\".");
    		theForm.mLName.focus();
    		return (false);
  	}
	else
	{
		if (checkNameN(theForm.mLName, '姓氏', 1) == false)
	    		return (false);
	}  	

	if (theForm.mFName.value == "")
  	{
    		alert("请输入 \"名字\".");
    		theForm.mFName.focus();
    		return (false);
  	}
	else
	{
		if (checkNameN(theForm.mFName, '名字', 1) == false)
	    		return (false);
	} 
	
	if (theForm.mCname.value == "")
  	{
    		alert("请输入 \"单位名称\".");
    		theForm.mCname.focus();
    		return (false);
  	}

	if (theForm.mTel.value == "")
  	{
    		alert("请输入 \"电话号码\".");
    		theForm.mTel.focus();
    		return (false);
  	}
  	else
	{
		if (checkTel(theForm.mTel) == false)
	    		return (false);
	}

	if (theForm.mFax.value == "")
  	{
    		alert("请输入 \"传真号码\".");
    		theForm.mFax.focus();
    		return (false);
  	}
  	else
	{
		if (checkTel(theForm.mFax) == false)
	    		return (false);
	}
	
	if (theForm.mCadd1.value == "")
  	{
    		alert("请输入 \"单位地址\".");
    		theForm.mCadd1.focus();
    		return (false);
  	}
  	else if (checkaddr(theForm.mCadd1) == false)
  	{
  		return false;
  	}
  	  	
	if (theForm.Country_id.options[theForm.Country_id.selectedIndex].value == "")	
  	{
    		alert("请输入 \"国家\".");
    		theForm.Country_id.focus();
    		return (false);
  	}
  	else if (theForm.Country_id.selectedIndex == 44)	
  	{
  		if (theForm.Province_id.options[theForm.Province_id.selectedIndex].value == 0)	
  		{
	    		alert("请输入 \"省份\".");
	    		theForm.Province_id.focus();
	    		return (false);
  		} 
	}
	
	// Personal Profile  	
	if (theForm.Education_id.options[theForm.Education_id.selectedIndex].value == 0)	
  	{
    		alert("请输入 \"教育程度\".");
    		theForm.Education_id.focus();
    		return (false);
  	}
  	
	if (theForm.jtitle.options[theForm.jtitle.selectedIndex].value == "")	
  	{
    		alert("请输入 \"职业\".");
    		theForm.jtitle.focus();
    		return (false);
  	}

	if (theForm.department.options[theForm.department.selectedIndex].value == "")	
  	{
    		alert("请输入 \"工作性质\".");
    		theForm.department.focus();
    		return (false);
  	}
  	
	if (theForm.myindustry.options[theForm.myindustry.selectedIndex].value == 0)	
  	{
    		alert("请输入 \"行业\".");
    		theForm.myindustry.focus();
    		return (false);
  	}  	
	
	if (theForm.myindustry.options[theForm.myindustry.selectedIndex].value != -1)	 
	{
		if (theForm.ptid.options[theForm.ptid.selectedIndex].value == 0)	
	  	{
	    		alert("请输入 \"产品类别\".");
	    		theForm.ptid.focus();
	    		return (false);
	  	}
  	}
}

function setEmail(theForm)
{
	theForm.dcemail.value = theForm.mEmail.value;
}