<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="voteadd.aspx.cs" Inherits="Focus.Admin.voteadd" %>

<%@ Register TagPrefix="cc1" Namespace="Focus.Control" Assembly="Focus.Control" %>
<!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 id="Head1" runat="server">
    <title>添加投票</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="styles/calendar.css" type="text/css" rel="stylesheet" />
    <link href="styles/style.css" type="text/css" rel="stylesheet">

    <script language="javascript" type="text/javascript" src="../calendar/WdatePicker.js"></script>

    <script language="javascript" type="text/javascript" src="js/ajax.js"></script>

    <script language="javascript" type="text/javascript" src="js/main.js"></script>

    <script language="javascript" type="text/javascript" src="js/auction.js"></script>

    <script language="javascript" type="text/javascript">
		function searchDoc(){
	        var ret = window.showModalDialog("attachmentlist.aspx?aidlist="+$("attachments").value,"","dialogWidth:500px;status:no;status:no;dialogHeight:450px;scrollbars:no");
	        try
	        {
	            if(ret.filename!=""){
		            $("DefaultPic").value=ret.filename;
		            $("titleimg").src=ret.sfilename;
	            }
	        }
	        catch(e){}
        }
        
        function cloneObj(oClone, oParent, count) {
	        if(oParent.childNodes.length < count) {
		        var newNode = oClone.cloneNode(true);
		        oParent.appendChild(newNode);
        		
		        return newNode;
	        } 
	        return false;	
        }

        function delObj(oParent, count) {
	        if(oParent.childNodes.length > count) {
		        oParent.removeChild(oParent.lastChild);
		        return true;
	        }
	        return false;
        }

        function clonePoll(maxpoll){
            var newNode = cloneObj($('divPollItem'), $('polloptions') ,parseInt(maxpoll)+1);
            if(!newNode){
                alert('投票项不能多于 ' + maxpoll + ' 个');
            }
            var inputs = findtags(newNode, 'input');
            var attach;
            for(i in inputs) {
                if(inputs[i].name == 'pollitemid') {
	                inputs[i].value="";
	                inputs[i].id = "pollitemid";
                }
            }
        }
    </script>

    <meta content="MSHTML 6.00.3790.0" name="GENERATOR" />
</head>
<body leftmargin="5" topmargin="5" rightmargin="5" bottommargin="5" background="Images/main_bg.gif">
    <form id="Form1" runat="server">
    <table class="TdBg" cellspacing="1" cellpadding="0" width="100%" border="0">
        <tbody>
            <tr valign="middle">
                <td class="Tdimg" style="padding-left: 10px" height="28" colspan="2">
                    <img height="18" src="images/bbs_find.gif" width="18" align="absMiddle" border="0">
                    <strong>添加投票，所在栏目：<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></strong>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 100px;" height="22" align="right">
                    投票主题：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:TextBox ID="title" runat="server" RequiredFieldType="暂无校验" CanBeNull="必填" Width="300"></cc1:TextBox>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 100px;" height="22" align="right">
                    分类：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:DropDownList ID="typeid" runat="server">
                    </cc1:DropDownList>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 100px;" height="22" align="right">
                    投票类型：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:RadioButtonList ID="polltype" runat="server" RepeatColumns="2">
                        <asp:ListItem Value="0" Selected="True">单选</asp:ListItem>
                        <asp:ListItem Value="1">多选</asp:ListItem>
                    </cc1:RadioButtonList>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 100px;" height="22" align="right">
                    选项设置：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <asp:CheckBox ID="isrec" runat="server" Text="推荐" />&nbsp;&nbsp;<asp:CheckBox ID="isindex"
                        runat="server" Text="首页显示" />
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 100px;" height="22" align="right">
                    投票选项：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <div id="divPoll1">
                        <input class="ManagerButton" onclick="clonePoll('10')" type="button" value="增加投票项"
                            name="button">
                        <input class="ManagerButton" onclick="if(!delObj(document.getElementById('polloptions'),2)){alert('投票项不能少于2个');}"
                            type="button" value="删除投票项" name="button">
                        <div id="polloptions" style="margin-top: 3px">
                            <div id="divPollItem" style="padding-top: 4px">
                                <input class="colorblue" id="pollitemid" onblur="this.className='colorblue';" onfocus="this.className='colorfocus';"
                                    size="70" name="pollitemid"></div>
                            <div style="padding-top: 4px">
                                <input class="colorblue" id="pollitemid" onblur="this.className='colorblue';" onfocus="this.className='colorfocus';"
                                    size="70" name="pollitemid"></div>
                        </div>
                    </div>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 100px;" height="22" align="right">
                    结束时间：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:Calendar ID="endtime" runat="server" ReadOnly="False" ScriptPath="js/calendar.js">
                    </cc1:Calendar>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 100px;" height="22" align="right">
                    发布时间：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:TextBox ID="postdatetime" runat="server" CssClass="Wdate"></cc1:TextBox>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 100px;" height="22" align="right">
                    状态：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:RadioButtonList ID="status" runat="server" RepeatColumns="3">
                        <asp:ListItem Value="0" Selected="True">未审核</asp:ListItem>
                        <asp:ListItem Value="1">审核通过</asp:ListItem>
                        <asp:ListItem Value="2">审核未通过</asp:ListItem>
                    </cc1:RadioButtonList>
                </td>
            </tr>
            <tr class="TdBgL">
                <td height="35" style="width: 100px">
                    &nbsp;
                </td>
                <td style="padding-left: 10px">
                    <cc1:Button ID="AddAdInfo" runat="server" Text=" 提 交 " OnClick="AddAdInfo_Click">
                    </cc1:Button>&nbsp;&nbsp;
                    <button class="ManagerButton" type="button" onclick="javascript:window.location.href='votemanage.aspx?sortid=<%=sortid%>';">
                        <img src="images/arrow_undo.gif" />返 回</button>
                </td>
            </tr>
        </tbody>
    </table>
    </form>
</body>
</html>
