<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="mobile.aspx.cs" Inherits="JuSNS.Web.home.ibase.mobile" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title id="ptitle" runat="server">手机设置</title>
<script language="javascript" type="text/javascript" src="../../js/ajax.js"></script>
<script language="javascript" type="text/javascript" src="../../js/public.js"></script>
<link href="../../template/<% Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/css/base.css" id="skinpath" type="text/css" rel="stylesheet" />
</head>
<body>
<!--头部-->
<%=this.GetHtmlShort()%>
<div id="divhead">
    <%=this.GetHtmlHead()%>
</div>

<div id="divbody">
    <div id="body_first">
        <div class="body_menu"> 
        <%=this.GetHtmlLeft()%>
        </div>
    </div>
    <div id="body_sec">
            <div id="body_mid"> 
                <div class="body_frame"> 
                 <!--主题内容中-->    
                
                <input type="hidden" id="txtYear" runat="server" /><input type="hidden" id="txtDay" runat="server" />                    
                <div class="body_frame_otherinfo">
	                        <div class="title">
                                <div class="l"><img src="../../template/<%Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/images/site/acc.gif" align="absmiddle" /> <span class="shenlan bold font14 ocolor">手机设置</span></div>
                                <div class="r"><a href="javascript:window.history.back();" title="返回上一页">返回上一页</a></div>
                                <div class="c"></div>
                            </div>
            		       
                            <div class="nav-menu">
                                <ul>
                                 <li><a href="index.aspx">帐号管理</a></li>
                                 <li style="display:none;"><a href="advs.aspx">高级管理</a></li>
                                 <li><a href="network.aspx">网络设置</a></li>
                                 <li><a href="msn.aspx">MSN/GTalk</a></li>
                                 <li class="current"><a href="mobile.aspx">手机</a></li>
                                 <li><a href="email.aspx">邮件通知</a></li>
                                 <li><a href="../space/edit.aspx">空间设置</a></li>
                                 </ul>
                            </div>        
                     </div>
                 <div class="body_sec_all">
                    <div class="content-reshow">
                       绑定手机后，你可以通过彩信上传照片，通过短信发布心情日记。
                    </div>
                    <div class="spline"></div>
                    <div class="msg-succ" id="div_succ" style="display: none;">设置手机捆绑成功。</div>
                    <div class="msg-error" id="div_error" style="display: none;"></div>
                    <div class="spline"></div>
	                <!--修改Mobile设置-->
                      <div class="content">
                            <label id="lbMobile1"><h3>绑定手机</h3><span class="reshow" style="display:none;">发送验证码 <%=JuSNS.Common.Public.GetXMLValue("sendmobileNumber")%>到 <%=JuSNS.Common.Public.GetXMLValue("sendMobileBind") %>完成绑定。</span></label>
                            <label id="lbMobile2"><h3>绑定手机</h3><span class="reshow" style="display:none;">发送验证码 <%=JuSNS.Common.Public.GetXMLValue("sendmobileNumber")%>到 <%=JuSNS.Common.Public.GetXMLValue("sendMobileBind") %>完成绑定。</span></label>
                            <div class="line1"></div>
	                            <form method="post" action="" class="nf" id="acc-mobile-form">
		                            <div class="pstr">
			                            <label class="f-label" id="lbTS1">手机号码</label>
			                            <label class="f-label" id="lbTS2">手机号码</label>
                            			
			                            <input type="text" class="f-text" name="mobile"  runat="server" id="txtNumber" disabled="disabled"/>
			                            <label id="lbDel"><a href="javascript:;" onclick="javascript:DelInfo(0);" id="mobile-reset">删除并重设</a></label>
		                            </div>
		                            <div class="pstr">
		                                <label class="f-label" id="Label1">&nbsp;</label>
			                            <input type="button" id="btnMobile" class="f-button" value="保存设置..." onclick="Save();" />
		                            </div>
	                            </form>                           
                      </div> 
	                              
                    <div class="spline"></div>
            </div>        
           </div>  
           <!--底部-->
             <div class="divbottom">
              <%=this.GetHtmlFoot()%>
              </div>
          </div>
   </div>
</div>
</body>
</html>
<script language="JavaScript" type="text/javascript">
//function $(o){return document.getElementById(o);}
//初始化
function Load()
{
   var Num=$("txtNumber").value;
   if(Num.replace(/(^\s*)/g,"")!="")
   {
        $("lbMobile1").style.display="";
        $("lbMobile2").style.display="none";
        $("btnMobile").style.display="none";
        $("lbDel").style.display="";
        $("lbTS1").style.display="";
        $("lbTS2").style.display="none";
   } 
   else
   {
     $("txtNumber").disabled=false;
     $("txtNumber").value="";
     $("lbMobile1").style.display="none";
     $("lbMobile2").style.display="";
     $("btnMobile").style.display="";
     $("lbDel").style.display="none";
     $("lbTS2").style.display="";
     $("lbTS1").style.display="none";
   }
}Load();

//删除手机号码
function DelInfo()
{ 
    if(window.confirm("你确定要删除吗？"))
    {
        var value="";
        
	     var  options={  
					       method:'get',  
					       parameters:"Value="+value+"&Type=Mobile",
					       onComplete:function(transport)
						    {  
							    var returnvalue=transport.responseText;
							    if (returnvalue=="1")
							    {
				                    $("div_succ").style.display=""
				                    $("div_error").style.display="none"
				                    $("div_succ").innerHTML="删除成功" 
				                    $("txtNumber").value="";
				                    Load();
                                 }
							    else
							    {
				                    $("div_succ").style.display="none"
				                    $("div_error").style.display=""
				                    $("div_error").innerHTML="设置失败" 
							    }
						    }  
				       }; 
	     new  Ajax.Request('/inc/ajax/ibase/seting.aspx?no-cache='+Math.random(),options);    
	     }
}

function Save()
{
     var myreg =/^(?:13\d|15[0-9]{1})-?\d{5}(\d{3}|\*{3})$/;
     if(myreg.test($("txtNumber").value))
    {
        var content="<h3>绑定手机</h3><span class=\"reshow\">发送验证码 <%=JuSNS.Common.Public.GetXMLValue("sendmobileNumber") %> 到 <%=JuSNS.Common.Public.GetXMLValue("sendMobileBind")%> 完成绑定。</span>";
        ShowDlg(464,194,'请继续下面的步骤',content,"SaveSubmit()");
    }
    else
    {
        alert("你输入的手机号码有误，请检查");
        return;
    }
}

//保存手机号码
function SaveSubmit()
{ 
    if(window.confirm("你确定要绑定吗？"))
    {
        var value="";
        
	     var  options={  
					       method:'get',  
					       parameters:"Value="+$("txtNumber").value+"&Type=Mobile",
					       onComplete:function(transport)
						    {  
			                        var v=transport.responseText; 
			                        if (v.indexOf("??")>-1)
			                        {
				                        $("div_succ").style.display="none"
				                        $("div_error").style.display=""
				                        $("div_error").innerHTML="设置失败" 
			                        }
			                        else
			                        {
			                            HideAlertBox();
			                            if(v=="1")
			                            {
				                            $("div_succ").style.display=""
				                            $("div_error").style.display="none"
				                            $("div_succ").innerHTML="设置成功，发送验证码 <%=JuSNS.Common.Public.GetXMLValue("sendmobileNumber")%> 到 <%=JuSNS.Common.Public.GetXMLValue("sendMobileBind")%> 完成绑定。</span>" 
				                            $("txtNumber").value="";
				                            Load();
			                            }
			                            else if(v=="2")
			                            {
				                            $("div_succ").style.display="none"
				                            $("div_error").style.display=""
				                            $("div_error").innerHTML="此手机已经存在" 
			                                return;
			                            }
			                            Load();
			                        }
						    }  
				       }; 
	     new  Ajax.Request('../../inc/ajax/ibase/seting.aspx?no-cache='+Math.random(),options);    
	     }
}
</script>