function set_div(t){
   return '<span class="action_po"><span class="action_po_top">'+t+'</span><span class="action_po_bot"></span></span></span>';
}
function addClass(id,c,v){
   var value;
   if(v==''){
	  value = '';
   }else{
	  value = set_div(v); 
   }
   $("#"+id).removeClass();
   $("#"+id).addClass(c);
   $("#"+id).html(value);
}

function checkuserphone(){
	var userphone = getgm("#userphone").val();
	if(!isPhone(userphone)){
	   addClass("userphonetip","wrong1","对不起，请正确填写手机号码！");
	}else{
	   var url = ajaxurl('&do=checkuserphone&userphone='+encodeURIComponent(userphone)+'&floor='+Math.floor(Math.random()*1000+1));
       $.ajax({url:url,type: 'GET',success: function(msg){
			if(msg.trim()=='ok'){
	           addClass("userphonetip","chenggong","");
			}else{
	           addClass("userphonetip","wrong1","对不起，该手机号码已存在");
			}	
	   }});
	}
}

function auth(){
  var post = true; 
  
  if(!isPhone(getgm("#userphone").val())){
	addClass("userphonetip","wrong1","对不起，请正确填写手机号码！");
    post = false;
  }else if($("#userphonetip").html().indexOf('对不起，该手机号码已存在') != -1){
    addClass("userphonetip","wrong1","对不起，该手机号码已存在");
    post = false;
  }else{
    addClass("userphonetip","chenggong","");		
  }
    
  return post;  
}

function checkcodes(){
  var post = true; 
  
  if(getgm("#checkcode").val()==''){
	addClass("checkcodetip","wrong1","对不起，请输入手机认证码！");
    post = false;
  }else{
    addClass("checkcodetip","chenggong","");		
  }
    
  return post;  
} 