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); 
   }
   getgm("#"+id).removeClass();
   getgm("#"+id).addClass(c);
   getgm("#"+id).html(value);
}

function checkloginrepass(){
	var repass = getgm("#repass").val();
	if(repass==''){
	   addClass("repasstip","wrong1","对不起，请输入提现密码");
	}else{
	   addClass("repasstip","chenggong1","");
	}
}

function repassform(){
  var post = true; 
  if(getgm("#repass").val().length<1){
	addClass("repasstip","wrong1","对不起，请输入提现密码");
    post = false;
  } 
  return post;  
} 

function checkmoney(){
	var howmoney = getgm("#howmoney").val();
	if(howmoney==''){
	   addClass("moneytip","wrong1","对不起，请输入提现金额");
	}else if(!isNum(howmoney)){
	   addClass("moneytip","wrong1","对不起，提现金额必须是数字");
	}else if(howmoney%100!=0){
	   addClass("moneytip","wrong1","对不起，提现金额必须是整百");
	}else{
	   addClass("moneytip","chenggong1","");
	}
}

function moneyform(){
  var post = true; 
  var howmoney = getgm("#howmoney").val();
  var nobank = getgm("#nobank").html();
  
  if(nobank.indexOf('您还没有设置用于提现的银行账户') != -1){
	addClass("banktip","wrong1","对不起，请正确选择提现银行");
    post = false;
  }else{
	addClass("banktip","chenggong1","");
  }
  
  if(howmoney%100!=0){
	addClass("moneytip","wrong1","对不起，提现金额必须是整百");
    post = false;
  }
  
  if(howmoney%100!=0){
	addClass("moneytip","wrong1","对不起，提现金额必须是整百");
    post = false;
  }
  if(!isNum(getgm("#howmoney").val())){
	addClass("moneytip","wrong1","对不起，提现金额必须是数字");
    post = false;
  }
  if(getgm("#howmoney").val().length<1){
	addClass("moneytip","wrong1","对不起，请输入金额");
    post = false;
  } 
  return post;  
} 

function checkpayment(){
	var howmoney = getgm("#howmoney").val();
	if(howmoney==''){
	   addClass("moneytip","wrong1","对不起，请输入提现金额");
	}else if(!isNum(howmoney)){
	   addClass("moneytip","wrong1","对不起，提现金额必须是数字");
	}else if(parseInt(howmoney)!=howmoney){
	   addClass("moneytip","wrong1","对不起，提现金额必须是整数");
	}else{
	   addClass("moneytip","chenggong1","");
	}
}

function paymentform(){
  var post = true; 
  if(parseInt(getgm("#howmoney").val())!=getgm("#howmoney").val()){
	addClass("moneytip","wrong1","对不起，提现金额必须是整数");
    post = false;
  }
  if(!isNum(getgm("#howmoney").val())){
	addClass("moneytip","wrong1","对不起，提现金额必须是数字");
    post = false;
  }
  if(getgm("#howmoney").val().length<1){
	addClass("moneytip","wrong1","对不起，请输入金额");
    post = false;
  } 
  return post;  
}

function checkoldpassword(){
	var oldpassword = getgm("#oldpassword").val();
	if(oldpassword.length<1){
	   addClass("oldpasswordtip","wrong1","对不起，请输入旧登录密码");
	}else{
       $.ajax({url:ajaxurl('&do=chkpassword&password='+oldpassword+'&floor='+Math.floor(Math.random()*1000+1)),type: 'GET',success: function(msg){
			if(msg.trim()=='ok'){
	           addClass("oldpasswordtip","chenggong1","");
			}else{
	           addClass("oldpasswordtip","wrong1","对不起，旧登录密码不正确");
			}	
	   }});
	}	
}

function checknewpassword(){
	var newpassword = getgm("#newpassword").val();
	var strleng = newpassword.length;
	if(strleng<6){
	   addClass("newpasswordtip","wrong1","请输入新登录密码,长度不得小于6位");
	}else{
	   addClass("newpasswordtip","chenggong1","");
	}
}

function checkcpassword(){
	var cpassword = getgm("#cpassword").val();
	var newpassword = getgm("#newpassword").val();
	if(cpassword==""){
	   addClass("cpasswordtip","wrong1","对不起，请再次输入登录密码");
	}else if(cpassword!=newpassword){
	   addClass("cpasswordtip","wrong1","对不起，两次输入登录密码不一致");
	}else{
	   addClass("cpasswordtip","chenggong1","");
	}
}

function checkform(){
  var post = true; 
  
  if(getgm("#oldpassword").val().length<1){
    addClass("oldpasswordtip","wrong1","对不起，请输入旧登录密码");
    post = false;
  } 
  
  if(getgm("#oldpasswordtip").html().indexOf('对不起，旧登录密码不正确') != -1){
    post = false;
  }   
  
  if(getgm("#newpassword").val().length<6){
	addClass("newpasswordtip","wrong1","请输入新登录密码,长度不得小于6位");
    post = false;
  }  
  
  if(getgm("#cpassword").val()==''){
	addClass("cpasswordtip","wrong1","对不起，请再次输入登录密码");
    post = false;
  } 
  if(getgm("#cpassword").val()!=getgm("#newpassword").val()){
	addClass("cpasswordtip","wrong1","对不起，两次输入登录密码不一致");
    post = false;
  }  
  return post;  
} 

function checkoldpwd(){
	var oldpassword = getgm("#oldpassword").val();
	if(oldpassword.length<1){
	   addClass("oldpasswordtip","wrong1","对不起，请输入旧提现密码");
	}else{
       $.ajax({url:ajaxurl('&do=chkrepass&password='+oldpassword+'&floor='+Math.floor(Math.random()*1000+1)),type: 'GET',success: function(msg){
			if(msg.trim()=='ok'){
	           addClass("oldpasswordtip","chenggong1","");
			}else{
	           addClass("oldpasswordtip","wrong1","对不起，旧提现密码不正确");
			}	
	   }});
	}	
}

function checknewpwd(){
	var newpassword = getgm("#newpassword").val();
	var strleng = newpassword.length;
	if(strleng<6){
	   addClass("newpasswordtip","wrong1","请输入新提现密码,长度不得小于6位");
	}else{
	   addClass("newpasswordtip","chenggong1","");
	}
}

function checkcpwd(){
	var cpassword = getgm("#cpassword").val();
	var newpassword = getgm("#newpassword").val();
	if(cpassword==""){
	   addClass("cpasswordtip","wrong1","请再次输入新提现密码");
	}else if(cpassword!=newpassword){
	   addClass("cpasswordtip","wrong1","两次输入新提现密码不一致");
	}else{
	   addClass("cpasswordtip","chenggong1","");
	}
}

function checkpwd(){
  var post = true; 
  
  if(getgm("#oldpassword").val().length<1){
    addClass("oldpasswordtip","wrong1","对不起，请输入旧提现密码");
    post = false;
  } 
  
  if(getgm("#oldpasswordtip").html().indexOf('对不起，旧提现密码不正确') != -1){
    post = false;
  }   
  
  if(getgm("#newpassword").val().length<6){
	addClass("newpasswordtip","wrong1","请输入新提现密码,长度不得小于6位");
    post = false;
  }  
  
  if(getgm("#cpassword").val()==''){
	addClass("cpasswordtip","wrong1","请再次输入新提现密码");
    post = false;
  } 
  if(getgm("#cpassword").val()!=getgm("#newpassword").val()){
	addClass("cpasswordtip","wrong1","两次输入提现密码不一致");
    post = false;
  }  
  return post;  
} 