<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit-edu.aspx.cs" Inherits="JuSNS.Web.home.space.edit_edu" %>
<!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" />
<script language="JavaScript" type="text/JavaScript">
//function $(o){return document.getElementById(o);}
function setPos(){
	document.getElementById('Zindextop').style.top = ((window.screen.height/2)-236) + "px";
}

//取坐标

function setsee(I,DegreeID){
document.getElementById('Zindextop').style.display="block";
$("frameShool").src="ChooseShool.aspx?flag="+I+"&DegreeID="+DegreeID;
}
//指定其为块级元素

function setnone(){
document.getElementById('Zindextop').style.display="none";
}
</script>
</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="edit.aspx">基本信息</a></li>
                                 <li><a href="edit-link.aspx">联系信息</a></li>
                                 <li><a href="edit-like.aspx">个人爱好</a></li>
                                 <li class="current"><a href="edit-edu.aspx">教育信息</a></li>
                                 <li><a href="edit-work.aspx">工作信息</a></li>
                                 <li><a href="userheadphoto.aspx">上传头像</a></li>
                                 <li><a href="template.aspx">装扮空间</a></li>
                                 <li><a href="../privacy">隐私设置</a></li>
                                 <li><a href="../base">帐号管理</a></li>
                                 </ul>
                            </div>        
                     </div>
                      <div class="body_sec_all">  
                     <% =GetTiShiDivStr%>   
                    <input type="hidden"  runat="server" id="txtCount" value="0"/>
                    <input type="hidden"  runat="server" id="txtRes" value="0"/>
                    <input type="hidden"  runat="server" id="txtDree"/><input type="hidden"  runat="server" id="txtDelID"/>
                    <div class="content-reshow">
                        填写学校信息，在<% =JuSNS.Config.UiConfig.SiteName%>找到老同学。可以通过<a href="../privacy">隐私设置</a>控制谁可以看见以下内容。
                    </div>
                    <div class="msg-error" id="Div_Error"  style="display:none;"></div>
                    <div class="msg-succ" id="Div_Succ"  style="display:none;"></div>

                   <form id="form1" runat="server">
                    <div class="content">
                            <ul  id="schoollist">
                            <li id="school_0" style="display:none;" class="pstr">
                                 <input type="hidden"  runat="server" value="0" id="txtID_0"/>
                                <select name="type_0" id="SelType_0" class="type" onchange="getSelType(this.value,0);" runat="server">
                                    <option value="1">初中</option>
                                    <option value="2">高中</option>
                                    <option value="3" selected="selected">大学</option>
                                    <option value="4">研究生</option>
                                    <option value="5">博士生</option>
                                </select>
                                <input type="text" class="f-text" runat="server" id="txtSchoolName_0" onclick="setsee(0,SelType_0.value); setPos();" /><input type="hidden"  runat="server" id="txtShoolID_0"/>
                                <select name="selYear" id="selYear_0" class="year" runat="server"><option value="0">入学年份</option>
                                </select>
                                &nbsp;
                                <select name="selAcademy" id="selAcademy_0" runat="server" style="display:none;" >
                                    <option value="0">请选择院系...</option>
                                </select>
                                &nbsp;<a href="javascript:DelShool(0)">删除</a>
                              </li>
                              <li id="school_1" style="display:none;" class="pstr"><input type="hidden"  runat="server" value="0" id="txtID_1"/>
                                <select name="type_0" id="SelType_1" runat="server"  class="type" onchange="getSelType(this.value,1);">
                                    <option value="1">初中</option>
                                    <option value="2">高中</option>
                                    <option value="3" selected="selected">大学</option>
                                    <option value="4">研究生</option>
                                    <option value="5">博士生</option>
                                </select>
                                <input type="text" class="f-text" id="txtSchoolName_1" runat="server" onclick="setsee(1,SelType_1.value); setPos();" /><input type="hidden"  runat="server" id="txtShoolID_1"/>
                                <select name="selYear" id="selYear_1" class="year" runat="server" >
                                <option value="0">入学年份</option>
                                </select>
                                &nbsp;
                                <select name="selAcademy" id="selAcademy_1" runat="server" style="display:none;">
                                    <option value="0">请选择院系...</option>
                                </select>
                                &nbsp;<a href="javascript:DelShool(1)">删除</a>
                              </li>
                              <li id="school_2" style="display:none;" class="pstr"><input type="hidden"  runat="server" value="0" id="txtID_2"/>
                                <select name="type_0" id="SelType_2" runat="server"  class="type" onchange="getSelType(this.value,2);">
                                    <option value="1">初中</option>
                                    <option value="2">高中</option>
                                    <option value="3" selected="selected">大学</option>
                                    <option value="4">研究生</option>
                                    <option value="5">博士生</option>
                                </select>
                                <input type="text" class="f-text" id="txtSchoolName_2" runat="server" onclick="setsee(2,SelType_2.value); setPos();" /><input type="hidden"  runat="server" id="txtShoolID_2"/>
                                <select name="selYear" id="selYear_2" class="year" runat="server" >
                                    <option value="0">入学年份</option>
                                </select>
                                &nbsp;
                                <select name="selAcademy" id="selAcademy_2" runat="server" style="display:none;">
                                    <option value="0">请选择院系...</option>
                                </select>
                                &nbsp;<a href="javascript:DelShool(2)">删除</a>
                              </li>
                              <li id="school_3" style="display:none;" class="pstr"><input type="hidden"  runat="server" value="0" id="txtID_3"/>
                                <select name="type_0" id="SelType_3" runat="server"  class="type" onchange="getSelType(this.value,3);">
                                    <option value="1">初中</option>
                                    <option value="2">高中</option>
                                    <option value="3" selected="selected">大学</option>
                                    <option value="4">研究生</option>
                                    <option value="5">博士生</option>
                                </select>
                                <input type="text" class="f-text" id="txtSchoolName_3"  runat="server" onclick="setsee(3,SelType_3.value); setPos();"  /><input type="hidden"  runat="server" id="txtShoolID_3"/>
                                <select name="selYear" id="selYear_3" class="year" runat="server" >
                                    <option value="0">入学年份</option>
                                </select>
                                &nbsp;
                                <select name="selAcademy" id="selAcademy_3" runat="server" style="display:none;">
                                    <option value="0">请选择院系...</option>
                                </select>
                                &nbsp;<a href="javascript:DelShool(3)">删除</a>
                              </li>
                              <li id="school_4" style="display:none;" class="pstr"><input type="hidden"  runat="server" value="0" id="txtID_4"/>
                                <select name="type_0" id="SelType_4" class="type" runat="server"  onchange="getSelType(this.value,4);">
                                    <option value="1">初中</option>
                                    <option value="2">高中</option>
                                    <option value="3" selected="selected">大学</option>
                                    <option value="4">研究生</option>
                                    <option value="5">博士生</option>
                                </select>
                                <input type="text" class="f-text" id="txtSchoolName_4" runat="server"  onclick="setsee(4,SelType_4.value); setPos();" /><input type="hidden"  runat="server" id="txtShoolID_4"/>
                                <select name="selYear" id="selYear_4" class="year" runat="server" >
                                    <option value="0">入学年份</option>
                                </select>
                                &nbsp;
                                <select name="selAcademy" id="selAcademy_4" runat="server" style="display:none;">
                                    <option value="0">请选择院系...</option>
                                </select>
                                &nbsp;<a href="javascript:DelShool(4)">删除</a>
                              </li>
                              <li id="school_5" style="display:none;" class="pstr"><input type="hidden"  runat="server" value="0" id="txtID_5"/>
                                <select name="type_0" id="SelType_5" class="type" runat="server"  onchange="getSelType(this.value,5);">
                                    <option value="1">初中</option>
                                    <option value="2">高中</option>
                                    <option value="3" selected="selected">大学</option>
                                    <option value="4">研究生</option>
                                    <option value="5">博士生</option>
                                </select>
                                <input type="text" class="f-text" id="txtSchoolName_5" runat="server"  onclick="setsee(5,SelType_5.value); setPos();" /><input type="hidden"  runat="server" id="txtShoolID_5"/>
                                <select name="selYear" id="selYear_5" class="year" runat="server" >
                                    <option value="0">入学年份</option>
                                </select>
                                &nbsp;
                                <select name="selAcademy" id="selAcademy_5" runat="server" style="display:none;">
                                    <option value="0">请选择院系...</option>
                                </select>
                                &nbsp;<a href="javascript:DelShool(5)">删除</a>
                              </li>
                              <li id="school_6" style="display:none;" class="pstr"><input type="hidden"  runat="server" value="0" id="txtID_6"/>
                                <select name="type_0" id="SelType_6" class="type" runat="server"  onchange="getSelType(this.value,6);" >
                                    <option value="1">初中</option>
                                    <option value="2">高中</option>
                                    <option value="3" selected="selected">大学</option>
                                    <option value="4">研究生</option>
                                    <option value="5">博士生</option>
                                </select>
                                <input type="text" class="f-text" runat="server" id="txtSchoolName_6" onclick="setsee(6,SelType_6.value); setPos();" /><input type="hidden"  runat="server" id="txtShoolID_6"/>
                                <select name="selYear" id="selYear_6" class="year" runat="server">
                                    <option value="0">入学年份</option>
                                </select>
                                &nbsp;
                                <select name="selAcademy" id="selAcademy_6" runat="server" style="display:none;">
                                    <option value="0">请选择院系...</option>
                                </select>
                                &nbsp;<a href="javascript:DelShool(6)">删除</a>
                              </li>
                              <li id="school_7" style="display:none;" class="pstr"><input type="hidden"  runat="server" value="0" id="txtID_7"/>
                                <select name="type_0" id="SelType_7" class="type" onchange="getSelType(this.value,7);" runat="server" >
                                    <option value="1">初中</option>
                                    <option value="2">高中</option>
                                    <option value="3" selected="selected">大学</option>
                                    <option value="4">研究生</option>
                                    <option value="5">博士生</option>
                                </select>
                                <input type="text" class="f-text" id="txtSchoolName_7" runat="server"  onclick="setsee(7,SelType_7.value); setPos();" /><input type="hidden"  runat="server" id="txtShoolID_7"/>
                                <select name="selYear" id="selYear_7" class="year" runat="server" >
                                    <option value="0">入学年份</option>
                                </select>
                                &nbsp;
                                <select name="selAcademy" id="selAcademy_7" runat="server" style="display:none;">
                                    <option value="0">请选择院系...</option>
                                </select>
                                &nbsp;<a href="javascript:DelShool(7)">删除</a>
                              </li>
                            </ul>
                    </div> 
                     
                     <div class="content">
                         <span id="spanadd"><a href="javascript:AddShool();"><b>添加学校</b></a></span>
                      </div>
                    <div class="content"> 
                         <input type="button" class="f-button" value="保存教育信息" onclick="AddEducation();"/>
                    </div>
                     <div class="spline"></div>   
                           </form> 
                 </div>                                                                                                
             </div>
           <!--底部-->
             <div class="divbottom">
              <%=this.GetHtmlFoot()%>
              </div>    
           </div>
        </div>
</div>
<div id="Zindextop" style="display:none;">
  <iframe src="ChooseShool.aspx" frameborder="0" class="alertframe" scrolling="auto" id="frameShool" style="width: 680px; height: 420px"></iframe>
</div>
        
</body>
</html>
<script language="javascript" type="text/javascript">
function setnone(){
 window.frameElement.document.getElementById('Zindextop').style.display="none";
}
//加载
function LoadYear()
{
    var num=$("txtCount").value; 
    
    if(num>=8)
    {
        $("spanadd").style.display="none";
    }
    for(var k=num;k<8;k++)
    {
        $("school_"+k).style.display="none";
    }
    for(var i=0;i<num;i++)
    {
        $("school_"+i).style.display="";
        $("selAcademy_"+i).style.display="";
    }
}LoadYear();

function AddShool()
{
    var num=$("txtCount").value; 
    var res=$("txtRes").value;//保存临时的学校数
    if(res<8)
    {
        if(res==0)
        {
            $("school_"+num).style.display="";
            res=num;
            res++;
        }
        else if(res>num)
        {
            $("school_"+res).style.display="";
            res++;
        }
        $("txtRes").value=res;
        if(res==8)
        {
             $("spanadd").style.display="none";
        }
    }
    else if(res>=8)
    {
        for(var i=0;i<8;i++)
        {
           if($("school_"+i).style.display=="none")
           {
                $("school_"+i).style.display=""
                $("txtSchoolName_"+i).value="";
                $("txtShoolID_"+i).value="";
                $("selYear_"+i).value=0;
                $("selAcademy_"+i).style.display="none";
           }
        }
        $("spanadd").style.display="none";
    }
}


//删除会员教育信息
function DelShool(I)
{
    $("school_"+I).style.display="none";
    $("txtDelID").value+=$("txtID_"+I).value+"|";
    $("spanadd").style.display="";
}

function getSelType(value,I)
{
    $("txtDree").value=value;
    $("txtSchoolName_"+I).value="";
    $("txtShoolID_"+I).value="";
    $("selYear_"+I).value=0;
    $("selAcademy_"+I).style.display="none";
}

//添加教育信息
function AddEducation()
{
   var DegreeID="";//受教育程度
   var SchoolID="";//学校
   var AcademyID="";//院系
   var MatriculationYear="";//入学时间
   var ID="";//编号
   var DelId=$("txtDelID").value;//修要删除ID
   var count=0;
   for(var i=0;i<8;i++)
   {
        if($("school_"+i).style.display=="")
        {
            if($("txtSchoolName_"+i).value!="" && $("txtShoolID_"+i).value!="")
            {
               DegreeID+=$("SelType_"+i).value+"|";
               SchoolID+=$("txtShoolID_"+i).value+"|";
               AcademyID+=$("selAcademy_"+i).value+"|";
               MatriculationYear+=$("selYear_"+i).value+"|";
               ID+=$("txtID_"+i).value+"|";
               count=count+1;
            }
            else
            {
               $("Div_Error").style.display="";
               $("Div_Succ").style.display="none";
               $("Div_Error").innerHTML="请填写学校名称";
               return;
            }
        }
   }
    var  options={  
		               method:'post',  
		               parameters:"DegreeID="+DegreeID+"&SchoolID="+SchoolID+"&AcademyID="+AcademyID+"&MatriculationYear="+MatriculationYear+"&ID="+ID+"&count="+count+"&DelId="+DelId+"&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
					        {
                               $("Div_Error").style.display="none";
                               $("Div_Succ").style.display="";
                               $("Div_Succ").innerHTML="保存成功";
					        }
			            }  
		              }; 
           new Ajax.Request('edit-edu.aspx',options);
}

</script>
