var displaymode=0;
    
//弹出升级提示
jQuery(document).ready(function(){
    UpgradeTipsCheck();
});

//GetHelpContent();
var IsShowUpgradeTipsFalse = false;
var IsUpgrade=true;

 function UpgradeTipsCheck() {
      
     jQuery.post(_BasePath + 'ajax.aspx', "<?xml version='1.0' encoding='utf-8'?><root><type>CheckUserUpgradeShow</type></root>", function(s) {
     
         var UpgradeShow = jQuery("UpgradeShow", s).text();

         if (UpgradeShow == "true") {
             lock();
         }
     });
 }

 function lock() {
 
     jQuery("#UpgradeTips").css("left",(document.body.clientWidth - 500) / 2 + document.body.scrollLeft);
     jQuery("#UpgradeTips").css("top",(document.body.clientHeight - 300) / 2 + document.body.scrollTop);
     jQuery("#UpgradeTips").css("display","block");
     jQuery("#ly").css("display","block");
     jQuery("#ly").css("width",document.body.clientWidth);
     jQuery("#ly").css("height",document.body.clientHeight);
     
     GetUpgradeTips();
 }

 function dosomething() {
     jQuery.post(_BasePath + 'ajax.aspx', "<?xml version='1.0' encoding='utf-8'?><root><type>SetUserUpgradeShow</type><upgradeshowset>"+IsShowUpgradeTipsFalse+"</upgradeshowset></root>");
     jQuery("#ly").css("display","none");
     jQuery("#UpgradeTips").css("display","none");
 }

function UpgradeShowCheck() {
    if (IsShowUpgradeTipsFalse)
    { IsShowUpgradeTipsFalse = false; }
    else {
        IsShowUpgradeTipsFalse = true;
    }
}

function UserUpgrade() {
    if(IsUpgrade)
    {
//        IsShowUpgradeTipsFalse = true;
//        jQuery.post(_BasePath + 'ajax.aspx', "<?xml version='1.0' encoding='utf-8'?><root><type>SetUserUpgradeShow</type><upgradeshowset>"+IsShowUpgradeTipsFalse+"</upgradeshowset></root>");
        jQuery.post(_BasePath + 'ajax.aspx', "<?xml version='1.0' encoding='utf-8'?><root><type>UserUpgrade</type><upgradeset>"+IsUpgrade+"</upgradeset></root>", function(s) {

          var isOk = jQuery("isOk", s).text();
          
         if (isOk == "true") {
            alert("恭喜您！已经升级成功！");
         }
         else
         {
            alert("对不起，升级失败！请及时与管理员联系！");
         }
         
        
        });
        jQuery("#ly").css("display","none");
        jQuery("#UpgradeTips").css("display","none");
    }
}

function GetUpgradeTips() {  
     jQuery.post(_BasePath + 'ajax.aspx', "<?xml version='1.0' encoding='utf-8'?><root><type>ShowUserUpgradeTips</type></root>", function(s) {
        var HtmlStr ="";
        var IsExecption= jQuery("IsExecption", s).text(); 
        if(IsExecption=="yes")
        {
            HtmlStr ="<li>出现异常，可能的原因：1、用户登录验证无效；2、所属会员组未配置会员升级参数。</li>"; 
        } 
        else
        { 
            HtmlStr ="<li>升级要达到的总金额："+ jQuery("Money", s).text()+"&nbsp;&nbsp;&nbsp;您现在的总金额："+ jQuery("YourMoney", s).text()+"</li>"; 
            HtmlStr +="<li>升级要达到的消费金额："+ jQuery("ConsumeMoney", s).text()+"&nbsp;&nbsp;&nbsp;您现在的消费金额："+ jQuery("YourConsumeMoney", s).text()+"</li>"; 
            HtmlStr +="<li>升级要达到的总点数："+ jQuery("UserPoint", s).text()+"&nbsp;&nbsp;&nbsp;您现在的总点数："+ jQuery("YourUserPoint", s).text()+"</li>";   
            HtmlStr +="<li>升级要达到的消费点数："+ jQuery("ConsumePoint", s).text()+"&nbsp;&nbsp;&nbsp;您现在的消费点数："+ jQuery("YourConsumePoint", s).text()+"</li>"; 
            HtmlStr +="<li></li>";  
            HtmlStr +="<li>升级需扣除的金额："+ jQuery("AutoUpgradeNeedMoney", s).text()+"&nbsp;&nbsp;&nbsp;升级奖励的金额："+ jQuery("AutoUpgradeAddMoney", s).text()+"</li>";   
            HtmlStr +="<li>升级需扣除的点数："+ jQuery("AutoUpgradeNeedPoint", s).text()+"&nbsp;&nbsp;&nbsp;升级奖励的点数："+ jQuery("AutoUpgradeAddPoint", s).text()+"</li>";   
            HtmlStr +="<li>升级需扣除的有效期："+ jQuery("AutoUpgradeNeedValidDate", s).text()+"&nbsp;&nbsp;&nbsp;升级奖励的有效期："+ jQuery("AutoUpgradeAddValidDate", s).text()+"</li>";
            HtmlStr +="<li></li>";   
            HtmlStr +="<li>升级后您的金额："+ jQuery("YourNewMoney", s).text()+"</li>";   
            HtmlStr +="<li>升级后您的点数："+ jQuery("YourNewPoint", s).text()+"</li>";   
            HtmlStr +="<li>升级后您的有效期："+ jQuery("YourNewValidDate", s).text()+"</li>";
            HtmlStr +="<li></li>";
            HtmlStr +="<li>可升级到的会员组："+ jQuery("UpgradeToUserGroup", s).text()+"</li>";            
        
        }
        HtmlStr = "<ul>"+HtmlStr+"</ul>";
        jQuery(document).ready(function(){
            jQuery("#UpgradeInfo").html(HtmlStr);
        }); 
     });    
}