function chkcnDmn(theForm) {

    if (theForm.domain.value =="")
    {
      alert("对不起，请输入域名！");
      theForm.domain.focus();
      return (false);
    }


	var str,dn, de, i;
	str=theForm.domain.value;

	i = str.indexOf('.');
    dn =theForm.domain.value;
	if (i >0)
	 {
		theForm.domain.value=str.substr(0,i);
		dn =str.substr(0,i);
     }  

	
    for ( i=0; i<dn.length; i++ ) {
	if (  !( (dn.charAt(i) >= 'a' && dn.charAt(i) <= 'z') ||
			 (dn.charAt(i) >= 'A' && dn.charAt(i) <= 'Z') ||
			 (dn.charAt(i) >= '0' && dn.charAt(i) <= '9') ||
			 (dn.charAt(i) == '-') && i != 0 && i != (dn.length - 1)) 
	   ){
	    	  alert("对不起，域名只能使用字符A-Z，a-z，数字0-9和连字符（-）\n而且只能以字母或数字开头！");
	    	  theForm.domain.focus();
              return false;
         } 
	}


	return true;

}
