<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit.aspx.cs" Inherits="JuSNS.Web.home.space.edit" %>
<!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>
<script language="javascript" type="text/javascript" src="../../js/date.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/<%=JuSNS.Config.UiConfig.SkinStyle %>/images/site/acc.gif" align="absmiddle" /> <span class="shenlan bold font14 ocolor">
                                <%if (Request.QueryString["f"] == "1" && string.IsNullOrEmpty(path))
                                  {%>请先完善基本信息<%}else{ %>空间基本信息<%} %></span></div>
                                <div class="r"><a href="javascript:window.history.back();" title="返回上一页">返回上一页</a></div>
                                <div class="c"></div>
                            </div>
            		       
                            <div class="nav-menu">
                                <ul>
                                <%if (Request.QueryString["f"] == "1" && string.IsNullOrEmpty(path))
                                  {%>
                                 <li class="current"><a href="edit.aspx?f=1">第一步：基本信息</a></li>
                                 <li><a href="javascript:void(0);">第二步：联系信息</a></li>
                                 <li><a href="javascript:void(0);">第三步：上传头像</a></li>
                                <%}
                                  else
                                  { %>
                                 <li class="current"><a href="edit.aspx<%=param %>">基本信息</a></li>
                                 <li><a href="edit-link.aspx<%=param %>">联系信息</a></li>
                                 <li><a href="edit-like.aspx<%=param %>">个人爱好</a></li>
                                 <li><a href="edit-edu.aspx<%=param %>">教育信息</a></li>
                                 <li><a href="edit-work.aspx<%=param %>">工作信息</a></li>
                                 <li><a href="userheadphoto.aspx<%=param %>">上传头像</a></li>
                                 <li><a href="template.aspx<%=param %>">装扮空间</a></li>
                                 <li><a href="../privacy">隐私设置</a></li>
                                 <li><a href="../base">帐号管理</a></li>
                                 <%} %>
                                 </ul>
                            </div>        
                     </div>
                     <div class="body_sec_all">
                    <% =GetTiShiDivStr%>                     
                    <div class="content-reshow">
                        你可以通过<a href="../privacy">隐私设置</a>控制谁可以看见以下内容
                    </div>
                    <div class="spline"></div>
                    <div class="msg-error" id="Div_Error"  style="display:none;"></div>
                    <div class="msg-succ" id="Div_Succ"  style="display:none;"></div>
                    <div class="spline"></div>
                    <form runat="server" id="form1">
                        <div class="content"><label class="f-label">性别：</label>
                             <select name="gender" id="gender" runat="server"><option value="1">男</option><option value="0" selected="selected">女</option></select>
                        </div>
                        <div class="content"><label class="f-label">生日：</label>
                            <input type="text" onclick="SelectDate(this,'yyyy-MM-dd')" id="birth" runat="server" class="f-text" /> 格式：2008-10-1或者2008/10/1
                        </div>
                        <div class="content"><label class="f-label">显示样式：</label>
                            <select name="birthPrivacy" id="birthPrivacy" runat="server"><option value="0" selected="selected">显示年月日</option><option value="1">显示月和日</option><option value="2">显示年</option><option value="3">不显示</option></select>
                        </div>
                        
                        <div class="content"><label class="f-label">星座：</label>
                            <select name="zodiac" id="zodiac" runat="server"></select>
                        </div>
                        <div class="content"><label class="f-label">家乡：</label>
                            <select name="homeprovince" id="homeprovince" runat="server" onchange="ShowC(this.value);"></select><input type="hidden" id="hidProvince" runat="server" value="" />		
                            <select name="SelCity" id="SelCity" runat="server" ></select>              
                        </div>
                        <div class="content"><label class="f-label">行业：</label>
                            <select name="vocation" id="vocation" runat="server" ></select>
                        </div>
                        <div class="content"><label class="f-label">婚姻：</label>
						    <select id="Marriage" name="Marriage">
						        <option value="0" <%if(isMarr=="0") {%>selected<%} %>>保密</option>
						        <option value="1"  <%if(isMarr=="1") {%>selected<%} %>>单身</option>
						        <option value="2"  <%if(isMarr=="2"){ %>selected<%} %>>恋爱中</option>
						        <option value="3"  <%if(isMarr=="3"){ %>selected<%} %>>订婚</option>
						        <option value="4"  <%if(isMarr=="4"){ %>selected<%} %>>已婚</option>
						        <option value="5"  <%if(isMarr=="5"){ %>selected<%} %>>离异</option>
						    </select>                           
                        </div>
                        <div class="content pstr"><label class="f-label">&nbsp;</label>
                            <input type="button" class="f-button" value="保存基本资料" onclick="Submit();" />
                        </div> 
                        
                    </form>
                        <div class="spline"></div>           
                        <div class="content" runat="server" id="GetState"></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 signs() 
{
    var  birthyear = $("birthyear").value, date=$("birthDay").value, month=$("birthMonth").value;

    with ($("zodiac"))
    {
        if (month == 3  &&  date >=21 || month == 4  &&  date <=19) {value = "1";}
        if (month == 3  &&  date > 31) {value = "OK.  Whatever.";}
        if (month == 4  &&  date >=20 || month == 5  &&  date <=20) {value = "2";}
        if (month == 4  &&  date > 30) {value = "I'm soooo sorry!";}
        if (month == 5  &&  date >=21 || month == 6  &&  date <=21) {value = "3";}
        if (month == 5  &&  date > 31) {value = "Umm ... no.";}
        if (month == 6  &&  date >=22 || month == 7  &&  date <=22) {value = "4";}
        if (month == 6  &&  date > 30) {value = "Sorry.";}
        if (month == 7  &&  date >=23 || month == 8  &&  date <=22) {value = "5";}
        if (month == 7  &&  date > 31) {value = "Excuse me?";}
        if (month == 8  &&  date >=23 || month == 9  &&  date <=22) {value = "6";}
        if (month == 8  &&  date > 31) {value = "Yeah. Right.";}
        if (month == 9  &&  date >=23 || month == 10  &&  date <=22) {value = "7";}
        if (month == 9  &&  date > 30) {value = "Try Again.";}
        if (month == 10  &&  date >=23 || month == 11  &&  date <=21) {value = "8";}
        if (month == 10  &&  date > 31) {value = "Forget it!";}
        if (month == 11  &&  date >=22 || month == 12  &&  date <=21) {value = "9";}
        if (month == 11  &&  date > 30) {value = "Invalid Date";}
        if (month == 12  &&  date >=22 || month == 1  &&  date <=19) {value = "10";}
        if (month == 12  &&  date > 31) {value = "No way!";}
        if (month == 1  &&  date >=20 || month == 2  &&  date <=18) {value = "11";}
        if (month == 1  &&  date > 31) {value = "Huh?";}
        if (month == 2  &&  date >=19 || month == 3  &&  date <=20) {value = "12";}
        if (month == 2  &&  date > 29) {value = "Say what?";}
    }
}

//加载年份
function LoadYear()
{
    for(var i=2008;i>1920;i--)
    {
        $("birthyear").options.add(new Option(i,i));
    }
    if($("SelCity").length==0)
    {
       $("SelCity").style.display="none"; 
    }
    else
    {
        $("SelCity").style.display=""; 
    }
}//LoadYear();

//根据年份和月份加载天
function getDaysInMonth(year,month)
{
    $("birthDay").length=0;
    $("birthDay").options.add(new Option('选择日',0));
    if(year=="0")
    {
      year="1904";
    }
    
    if(month!="0")
    {
      month = parseInt(month,10)+1;
      var temp = new Date(year+"/"+month+"/0");
      var rs=temp.getDate();
      for(var i=1;i<=rs;i++)
      {
        $("birthDay").options.add(new Option(i,i));
      }
    }
    else
    {
        for(var i=1;i<=31;i++)
      {
        $("birthDay").options.add(new Option(i,i));
      }
    }
}//getDaysInMonth(2008,1);


//根据省加载市
function ShowC(id)
{
     var  options={  
				   method:'post',  
				   parameters:"id="+id+"&Type=City",  
				   onComplete:function(transport)
					{ 
					    var v=transport.responseText;
					    
					    if (v.indexOf("??")>-1)
					    {
					        $("SelCity").style.display="none";
                        }
					    else
					    {
                           var array=v.split('|');
                           var len=array.length;
                           if(len>0)
                           {  
                               $("SelCity").style.display="";
                               $("SelCity").length=0;
                               for(var i=0;i<array.length-1;i++)
                               { 
                                  var s=array[i].split(',');
                                  if(s.length>0)
                                  {
                                    $("SelCity").options.add(new Option(s[1],s[0]));
                                  }
                               }
                           } 
                           else
                           {
                                $("SelCity").style.display="none";
                           }
                        }
					}  
				  }; 
       new Ajax.Request('edit.aspx',options);
}

//提交
function Submit()
{
    var sex=$("gender").value;
    var birthPrivacy=$("birthPrivacy").value;
    var zodiac=$("zodiac").value;
    var homeprovince=$("homeprovince").value;
    var SelCity=$("SelCity").value;
    var vocation=$("vocation").value;
    var birth=$("birth").value;
    var Marriage=$("Marriage").value;
    if($("SelCity").style.display=="none")
    {
        SelCity=0;
    }
    
    var  options={  
				   method:'post',  
				  
				   parameters:"birth="+birth+"&sex="+sex+"&birthPrivacy="+birthPrivacy+"&zodiac="+zodiac+"&homeprovince="+homeprovince+"&SelCity="+SelCity+"&vocation="+vocation+"&Marriage="+Marriage+"&Type=Edit",  
				   onComplete:function(transport)
					{ 
					    var v=transport.responseText;
					    if (v.indexOf("??")>-1)
					    {
                           $("Div_Error").style.display="";
                           $("Div_Succ").style.display="none";
                           $("Div_Error").innerHTML="修改失败";
                        }
					    else
					    {
					        if(v==1)
					        {
                               $("Div_Error").style.display="none";
                               $("Div_Succ").style.display="";
                               $("Div_Succ").innerHTML="保存成功";
					        }
					        else if(v==3)
					        {
                               $("Div_Error").style.display="";
                               $("Div_Succ").style.display="none";
                               $("Div_Error").innerHTML="出生日期不正确。正确格式为：2008-10-1或2008/10/1";
                            }
					        else if(v==4)
					        {
                               $("Div_Error").style.display="";
                               $("Div_Succ").style.display="none";
                               $("Div_Error").innerHTML="出生日期不正确。您太年轻了吧？年龄至少10岁以上。";
                            }
					        else if(v==2)
					        {
                                window.location.href="edit-link.aspx?f=1";
                            }
                        }
					}  
				  }; 
       new Ajax.Request('edit.aspx',options);
}

if($("txtYear").value!="")
{
    $("birthyear").value=$("txtYear").value;
}
if($("txtDay").value!="")
{
    $("birthDay").value=$("txtDay").value;
}
//  End -->
</script>