<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="add.aspx.cs" Inherits="JuSNS.Web.home.vote.add" %>

<!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 runat="server" id="ptitle">发起投票</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" />
<link href="../../template/<% Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/css/vote.css" id="Link1" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript">
function show()
{
    document.getElementById("showDesc").style.display="block";
    document.getElementById("spantitle").style.display="none";
}
function showtime(tf)
{
    if(tf)
        document.getElementById("spanTime").style.display="";
    else
        document.getElementById("spanTime").style.display="none";
}
function add(spanobj)
{
    var f = document.form1;
    var j=0;
    var obj= document.getElementById("UlOption");
    for(var i=0;i<f.length;i++)
    {
        if(f.elements[i].name.indexOf("Option")>-1)
        {
            j++;
        }
    }
    spanobj.style.display="none";
    if(j<20)
    {
        for(var i=1;i<6;i++)
        {
            var s = obj.innerHTML;
            if(i==5 && (j+i)<20)
                obj.innerHTML = s+ "<li><div class=\"content\"><label class=\"f-label\">项目"+(j+i)+"</label><input name=\"Option_"+(j+i)+"\" type=\"text\" class=\"f-text s30\" /><span id=\"spanOption"+(i+j)+"\"> <a href=\"javascript:add(document.getElementById('spanOption"+(i+j)+"'));\">增加选项</a></span></div></li>";
            else 
                obj.innerHTML = s+ "<li><div class=\"content\"><label class=\"f-label\">项目"+(j+i)+"</label><input name=\"Option_"+(j+i)+"\" type=\"text\" class=\"f-text s30\" /></div></li>";
             document.form1.OpNum.value=(j+i);
       }
    }
}
</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"> 
                 <!--主题内容中-->    
                
                <div class="body_frame_otherinfo">
	                        <div class="title">
                                <div class="l"><img src="../../template/<%Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/images/site/ico/vote.gif" align="absmiddle" /> <span class="shenlan bold font14 ocolor" id="bName" runat="server">发起投票</span></div>
                                <div class="r"><a href="javascript:window.history.back();" title="返回上一页">返回上一页</a></div>
                                <div class="c"></div>
                            </div>
            		       
                            <div class="nav-menu nl" style="width:83.5%;">
                                <ul>
                                    <li><a href="../vote">最新投票</a></li>
                                    <li><a href="../vote/?r=friend">好友的投票</a></li>
                                    <li><a href="../vote/?r=my">我的投票</a></li>
                                    <li><a href="../vote/?r=myc">我参与的投票</a></li>
                                    <li><a href="../vote/?r=hot">热门投票</a></li>
                                    <li class="current"><a href="<%=Request.Url %>">发起投票</a></li>
                                 </ul>
                            </div>      
                           <div class="nav-menu-other nr">
                                <ul>
                                    <li><a href="../vote/add.aspx" class="shortcut-link">发起新投票</a></li>
                                </ul>
                           </div>   
                     </div>
                 <div class="body_sec_all">
                    <div class="msg-error" id="div_Error" runat="server" style="display: none;"></div>
                    <form id="form1" runat="server">
                         <div class="content">
                        <ul>
                            <li>
                                <div class="content">
                                    <label class="f-label"><b>投票主题</b></label>
                                    <asp:TextBox ID="Title" runat="server" CssClass="f-text s30"></asp:TextBox><asp:RequiredFieldValidator  ID="RequireTitle" runat="server" ControlToValidate="Title" Display="Dynamic" ErrorMessage="标题不能为空"></asp:RequiredFieldValidator>
                                     <span id="spantitle"><a href="javascript:show();">添加描述</a></span></div>
                            </li>
                            <li id="showDesc" style="display: none;">
                                <div class="content">
                                    <label class="f-label">描述</label>
                                    <asp:TextBox ID="Intro" runat="server" CssClass="f-text" Height="100" Width="219"></asp:TextBox>
                                </div>
                            </li>
                            <li>
                                <div>
                                    <ul id="UlOption">
                                        <li>
                                            <div class="content">
                                                <label class="f-label">项目1</label>
                                                <input name="Option_1" class="f-text s30" type="text" />
                                                </div>
                                        </li>
                                        <li>
                                            <div class="content">
                                                <label class="f-label">项目2</label>
                                                <input name="Option_2" class="f-text s30" type="text" />
                                                </div>
                                        </li>
                                        <li>
                                            <div class="content">
                                                <label class="f-label">项目3</label>
                                                <input name="Option_3" class="f-text s30" type="text" />
                                                </div>
                                        </li>
                                        <li>
                                            <div class="content">
                                                <label class="f-label">项目4</label>
                                                <input name="Option_4" class="f-text s30" type="text" />
                                                </div>
                                        </li>
                                        <li>
                                            <div class="content">
                                                <label class="f-label">项目5</label>
                                                <input name="Option_5" class="f-text s30" type="text" /> <span id="spanOption1"><a href="javascript:add(document.getElementById('spanOption1'));">增加选项</a></span>
                                                </div>
                                                
                                        </li>
                                    </ul>
                                </div>
                            </li>
                            <li>
                                <div class="content">
                                    <label class="f-label">投票方式</label>
                                    <asp:RadioButtonList ID="Mode" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                                        <asp:ListItem Value="1" Text="单选" Selected="True"></asp:ListItem>
                                        <asp:ListItem Value="0" Text="复选"></asp:ListItem>
                                    </asp:RadioButtonList></div>
                            </li>
                            <li>
                                <div class="content">
                                   <label class="f-label">&nbsp;</label>
                                    <asp:CheckBox ID="isEnd" runat="server" onclick="javascript:showtime(this.checked);" />截止日期<span id="spanTime" style="display: none;"><input type="text" id="EndTime" maxlength="100" runat="server" onclick="SelectDate(this,'yyyy-MM-dd')" class="f-text" style="width: 100px;" /></span>
                                </div>
                            </li>
                            <li>
                                <div class="content">
                                   <label class="f-label">&nbsp;</label>
                                    <asp:CheckBox ID="IsFriend" runat="server" />仅好友可见 </div>
                           </li>
                            <li>
                                <div class="content">
                                   <label class="f-label">&nbsp;</label>
                                    <asp:Button ID="Button1" runat="server" Text="发布投票" CssClass="f-button" OnClick="Button1_Click" /><asp:HiddenField ID="OpNum" runat="server" Value="5" />
                                </div>
                            </li>
                        </ul>                            
                         </div>   
                    
                                
                     </form>        
                 </div>
                 </div>
               <!--底部-->
                 <div class="divbottom">
                  <%=this.GetHtmlFoot()%>
                  </div>
                 
                 </div>
                 </div>
                 </div>
</body>
</html>