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 agreement(){
   if($("#xiy").css("display")=="none"){
      $("#xiy").show(500);
   }else{
      $("#xiy").hide(500);
   }
}

function checku(){
	var username = $("#username").val();
	var strleng = strlen(username);
	if(strleng<1){
	   addClass("usernametip","wrong1","您还没有输入用户名");
	}else{
       var url ='/index.php?mod=tools&act=ajax&do=chkusername&username='+encodeURIComponent(username)+'&floor='+Math.floor(Math.random()*1000+1);
       $.ajax({url: url,type: 'GET',success: function(msg){
			if(msg.trim()=='ok'){
	           addClass("usernametip","wrong1","该会员不存在");
			}else{
				addClass("usernametip","chenggong1","");

			}	
	   }});
	}	
}


function addywy(){
  var post = true; 
  if(strlen($("#username").val()) < 1){
	addClass("usernametip","wrong1","您还没有输入用户名");
    post = false;
  }

  
  if($("#usernametip").html().indexOf('该会员不存在') != -1){
	addClass("usernametip","wrong1","该会员不存在");
    post = false;
  }
  
  if(post){
	addClass("usernametip","chenggong1","","");
  }
  

  
  return post;  
} 