function usercheck() {
var username = document.getElementById("username").value;
if(username == "")
{
 usernametext.innerHTML="<br>用户名不能为空";
 return false;
}

var xmlDom = jb(); 
var strData = "code=123";
var url = "?action=userchecksave&username="+username;
xmlDom.open("POST", url, false); 
xmlDom.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlDom.send(strData);
var webcode="<br>"+xmlDom.responseText

usernametext.innerHTML=webcode;
}

function jb() { 
 var A=null; 
 try { 
 A=new ActiveXObject("Msxml2.XMLHTTP");
 } 
 catch(e) { 
 try { 
 A=new ActiveXObject("Microsoft.XMLHTTP");
 } 
 catch(oc) { 
 A=null;
 } 
 } 

 if ( !A && typeof XMLHttpRequest != "undefined" ) { 
 A=new XMLHttpRequest();
 } 
 return A;
}


function ccimgchange()
{
 document.getElementById("ccimg").src = 'getcode.asp?a=' + Math.random();
}

function chkname(String)
{ 
var Letters = "abcdefghijklmnopqrstuvwxyz1234567890_"; //可以自己增加可输入值
var i;
var c;
if(String.charAt( 0 )=='-')
return false;
if( String.charAt( String.length - 1 ) == '-' )
return false;
for( i = 0; i < String.length; i ++ )
{
c = String.charAt( i );
if (Letters.indexOf( c ) < 0)
return false;
}
return true;
}

function userregcheck(){
if ((document.form2.username.value)==""){
 window.alert ('用户名必须填写!');
 document.form2.username.focus();
 return false;
}
if(!chkname(document.form2.username.value)){
 window.alert ('用户名不规则!');
 document.form2.username.focus();
 return false;
}
if ((document.form2.pwd.value)==""){
 window.alert ('密码必须填写!');
 document.form2.pwd.focus();
 return false;
}
if ((document.form2.pwd2.value)==""){
 window.alert ('重复密码必须填写!');
 document.form2.pwd2.focus();
 return false;
}
if ((document.form2.pwd.value)!==(document.form2.pwd2.value)){
 window.alert ('两次填写的密码不一样，请重写填写!');
 document.form2.pwd2.focus();
 return false;
}
if (form2.password.value!==form2.password2.value){
 window.alert ('两次输入的密码不一致!');
 document.form2.password2.focus();
 return false;
}
if ((document.form2.email.value)==""){
 window.alert ('E-mail必须填写!');
 document.form2.email.focus();
 return false;
}
if (!isValidEmail(document.form2.email.value)){
 window.alert ('E-mail的格式不正确!');
 document.form2.email.focus();
 return false;
}

if ((document.form2.pagename.value)==""){
 window.alert ('联系人必须填写!');
 document.form2.pagename.focus();
 return false;
}
if ((document.form2.pagetel.value)==""){
 window.alert ('联系电话必须填写!');
 document.form2.pagetel.focus();
 return false;
}
if (!Isphone(document.form2.pagetel.value)){
 window.alert ('联系电话的格式不正确!');
 document.form2.pagetel.focus();
 return false;
}
if ((document.form2.pageurl.value)==""){
 window.alert ('主页网址必须填写!');
 document.form2.pageurl.focus();
 return false;
}
if (!IsURL(document.form2.pageurl.value)){
 window.alert ('主页网址的格式不正确!');
 document.form2.pageurl.focus();
 return false;
}

var check_length = document.form2.quickstyle.length;
var i_count=0
for(var i=0;i<check_length;i++){
 if (document.form2.quickstyle(i).checked){
  i_count=i_count+1;
 }
}	  
if(i_count==0){
 window.alert("请选择一种基本样式!");
 return false;
}
if (((document.form2.quickstyle(0).checked)||(document.form2.quickstyle(1).checked)||(document.form2.quickstyle(2).checked))&&(form2.tjopen.options[form2.tjopen.selectedIndex].value)==""){
 window.alert ('请选择是否公开信息!');
 document.form2.tjopen.focus();
 return false;
}

if ((document.form2.checkcode.value)==""){
 window.alert ('请输入四位数的验证码!');
 document.form2.checkcode.focus();
 return false;
}

if (document.form2.agreeprotocol.checked==false){
 window.alert("同意协议才能注册用户!");
 return false;
}
return true;
}

function IsURL(str_url){
    var strRegex = "^((https|http|ftp|rtsp|mms)?://)" 
          + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@ 
          + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184 
          + "|" // 允许IP和DOMAIN（域名）
          + "([0-9a-z_!~*'()-]+\.)*" // 域名- www. 
          + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名 
          + "[a-z]{2,6})" // first level domain- .com or .museum 
          + "(:[0-9]{1,4})?" // 端口- :80 
          + "((/?)|" // a slash isn't required if there is no file name 
          + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; 
          var re=new RegExp(strRegex); 
          if (re.test(str_url)){
              return (true); 
          }else{ 
              return (false); 
          }
      }
	  
function Isphone(phonenum){
	var strphone=/(^(\d{2,4}[-_－—]?)?\d{3,8}([-_－—]?\d{3,8})?([-_－—]?\d{1,7})?$)|(^0?1[35]\d{9}$)/

          var regphone=new RegExp(strphone);
          if (regphone.test(phonenum)){
              return (true); 
          }else{ 
              return (false); 
          }
      }

function isValidEmail(s)
{
 var reg1 = new RegExp('^[a-zA-Z0-9][a-zA-Z0-9@._-]{3,}[a-zA-Z]$');
 var reg2 = new RegExp('[@.]{2}');
 if (s.search(reg1) == -1
  || s.indexOf('@') == -1
  || s.lastIndexOf('.') < s.lastIndexOf('@')
  || s.lastIndexOf('@') != s.indexOf('@')
  || s.search(reg2) != -1)
  return false;		
 return true;
}

function WriteCookie (cookieName, cookieValue, expiry)   
{   
var expDate = new Date();   
if(expiry)   
{   
expDate.setTime (expDate.getTime() + expiry);   
document.cookie = cookieName + "=" + escape (cookieValue) + "; path=/ expires=" + expDate.toGMTString();   
}   
else   
{   
document.cookie = cookieName + "=" + escape (cookieValue);   
}   
}   
sparetime=1000*60*60*24*3650;
WriteCookie('CFCountGGCookie',"1",sparetime);

function ashow_0(){
a_2.style.display = "none";
a_3.style.display = "none";
a_5.style.display = "none";
a_6.style.display = "none";
b_1.style.display = "none";
}
function ashow_1(){
a_2.style.display = "none";
a_3.style.display = "none";
a_5.style.display = "none";
a_6.style.display = "none";
b_1.style.display = "";
}
function ashow_2(){
a_2.style.display = "";
a_3.style.display = "none";
a_5.style.display = "none";
a_6.style.display = "none";
b_1.style.display = "";
}
function ashow_3(){
a_2.style.display = "none";
a_3.style.display = "";
a_5.style.display = "none";
a_6.style.display = "none";
b_1.style.display = "";
}
function ashow_4(){
a_2.style.display = "none";
a_3.style.display = "none";
a_5.style.display = "none";
a_6.style.display = "none";
b_1.style.display = "none";
}
function ashow_5(){
a_2.style.display = "none";
a_3.style.display = "none";
a_5.style.display = "";
a_6.style.display = "none";
b_1.style.display = "none";
}
function ashow_6(){
a_2.style.display = "none";
a_3.style.display = "none";
a_5.style.display = "none";
a_6.style.display = "";
b_1.style.display = "none";
}