<%@ Page Language="c#" Inherits="Web.User.addAd" CodeBehind="addAd.aspx.cs" %>
<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>广告管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file = "../Css/head.htm" -->
    <!--#include file = "../Css/userCssEdit.htm" -->
        <style>
        .ke-input-text {
            padding: 0px 0px !important;
        }
        /*编辑器上传弹出框文本框样式*/
    </style>
    <script src="../Js/ColorPicker.js" charset="utf-8"></script>

    
</head>
<body>
    <form id="adform" method="post" runat="server">
    <div class="edit-func-box func-box" style="height:720px;">
        <div class="hd">
            添加/编辑</div>
        <div class="bd mb80">
            <table class="edit-table">
                <tr>
                    <th>
                        广告标题：
                    </th>
                    <td>
                        <asp:TextBox ID="title" runat="server" notNull="true" msgName="广告标题" class="input-md w3"></asp:TextBox>
                        &nbsp;&nbsp;
                        <asp:CheckBox ID="isTop" runat="server" Text="固顶"></asp:CheckBox>
                    </td>
                </tr>
                <tr>
                    <th>
                        图像(动画)：
                    </th>
                    <td>
                        <asp:TextBox ID="showUrl" runat="server" class="input-md w3" notNull="true" msgName="图像(动画)"></asp:TextBox>&nbsp;&nbsp;
                        <a href="javascript:void(0);" id="uploadimg" class="btn btn-primary btn-xs" ><i class="ace-icon fa fa-cloud-upload"></i>上传图片</a>&nbsp;&nbsp;
                        <a href="javascript:void(0);" id="uploadswf" class="btn btn-primary btn-xs" ><i class="ace-icon fa fa-cloud-upload"></i>上传动画</a>
                    </td>
                </tr>
                <tr>
                    <th>
                        链接地址：
                    </th>
                    <td>
                        <asp:TextBox ID="url" runat="server" class="input-md w3"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <th>
                        显示等级：
                    </th>
                    <td>
                        <asp:DropDownList ID="grade" runat="server" DataValueField="pkId" DataTextField="name" CssClass="input-md">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                        浏览权限：
                    </th>
                    <td>
                        <asp:DropDownList ID="gate" runat="server" CssClass="input-md">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                        显示天数：
                    </th>
                    <td>
                        <asp:TextBox ID="dating" runat="server" class="input-md w2" notNull="true" msgName="显示天数" dataType="integer" >7</asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <th>
                        广告类型：
                    </th>
                    <td>
                        <select id="adtype" onchange="ShowOption(this.form);return;" name="adtype" runat="server" class="input-md">
                            <option value="1" selected="selected">随机浮动</option>
                            <option value="2">对联广告</option>
                            <option value="4">弹出窗口</option>
                            <option value="7">上下浮动显示－右</option>
                            <option value="8">上下浮动显示－左</option>
                            <option value="9">全屏幕逐渐消失</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th>
                        类型选项：
                    </th>
                    <td>
                        <div id="div1">
                            广告规格：&nbsp;&nbsp;宽度：<asp:TextBox ID="width" runat="server" class="input-mini" notNull="true" msgName="广告规格：宽度" dataType="integer" minValue="1" maxValue="1000" >300</asp:TextBox>&nbsp;高度：&nbsp;<asp:TextBox
                                ID="height" runat="server" class="input-mini" notNull="true" msgName="广告规格：高度" dataType="integer" minValue="1" maxValue="1000" >300</asp:TextBox>
                        </div>
                        <div id="div2">
                            固定显示<asp:TextBox ID="timing" runat="server" class="input-md w2" dataType="integer" minValue="1" maxValue="1000" msgName="固定时间显示" >6</asp:TextBox>秒后自动消失
                        </div>
                        <div id="div3">
                            初始位置距滚动条距离：<asp:TextBox ID="right" runat="server" class="input-md w2" dataType="integer" minValue="1" maxValue="2000" msgName="初始位置距滚动条距离">15</asp:TextBox>&nbsp;&nbsp;上：
                            <asp:TextBox ID="top" runat="server" class="input-md w2" dataType="integer" minValue="1" maxValue="1000" msgName="初始位置距上方的距离">30</asp:TextBox>                            
                        </div>
                        <div id="div4" class="hidden">
                            <%--随机飘浮速度：隐藏掉，定死为20，因为有两个同时浮动会有问题--%>
                            <asp:TextBox ID="speed" runat="server" class="input-md w2" dataType="integer" maxValue="200" minValue="1" msgName="随机漂浮速度" Visible="false">20</asp:TextBox>
                        </div>
                        <div id="div5">
                            <asp:CheckBox ID="ShowCloseCheckBox" runat="server" Text="显示关闭按钮"></asp:CheckBox>
                        </div>
                    </td>
                </tr>
            </table>
            <div class="ft ft02">
                <div class="action-field text-center">
                    <asp:Button ID="add" runat="server" class="btn btn-sm btn-primary" Text="添 加" OnClientClick="return checkAllValidate();" OnClick="btn_Click">
                    </asp:Button>
                    &nbsp;&nbsp;
                    <asp:Button ID="cancel" runat="server" class="btn btn-sm btn-primary" Text="取 消" CausesValidation="False" OnClick="btn_Click"></asp:Button>
                </div>
                <!--/action-field-->
            </div>
        </div>
        <!--#include file = "../Css/foot.htm" -->
        <script type="text/javascript" language="javascript">
                //判断页面是否加载完毕
                document.onreadystatechange = function(){ 
                if(document.readyState == "complete"){
                    ShowOption(document.adform);
                    }
                }
        </script>
        <script type="text/javascript">
            function MM_reloadPage(init) {  //reloads the window if Nav4 resized
                if (init == true) with (navigator) {
                    if ((appName == "Netscape") && (parseInt(appVersion) == 4)) {
                        document.MM_pgW = innerWidth; document.MM_pgH = innerHeight; onresize = MM_reloadPage;
                    }
                }
                else if (innerWidth != document.MM_pgW || innerHeight != document.MM_pgH) location.reload();
            }
            MM_reloadPage(true);

            function MM_findObj(n, d) { //v4.01
                var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
                    d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
                }
                if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
                for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
                if (!x && d.getElementById) x = d.getElementById(n); return x;
            }

            function MM_showHideLayers() { //v3.0
                var i, p, v, obj, args = MM_showHideLayers.arguments;
                for (i = 0; i < (args.length - 2) ; i += 3) if ((obj = MM_findObj(args[i])) != null) {
                    v = args[i + 2];
                    if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v = 'hide') ? 'hidden' : v; }
                    obj.visibility = v;
                }
            }


            //根据广告类型显示类型选项
            function ShowOption(theform) {
                switch (theform.adtype.value) {
                    case "4":
                        MM_showHideLayers('div1', '', 'show', 'div2', '', 'hide', 'div3', '', 'hide', 'div4', '', 'hide', 'div5', '', 'hide', 'div6', '', 'hide'); break;
                    case "5":
                        MM_showHideLayers('div1', '', 'show', 'div2', '', 'show', 'div3', '', 'hide', 'div4', '', 'hide', 'div5', '', 'hide', 'div6', '', 'hide'); break;
                    case "2":
                        MM_showHideLayers('div1', '', 'show', 'div2', '', 'hide', 'div3', '', 'show', 'div4', '', 'hide', 'div5', '', 'hide', 'div6', '', 'hide'); break;
                    case "1":
                        MM_showHideLayers('div1', '', 'show', 'div2', '', 'hide', 'div3', '', 'hide', 'div4', '', 'show', 'div5', '', 'show', 'div6', '', 'hide'); break;
                    case "7":
                        MM_showHideLayers('div1', '', 'show', 'div2', '', 'hide', 'div3', '', 'show', 'div4', '', 'hide', 'div5', '', 'show', 'div6', '', 'hide'); break;
                    case "8":
                        MM_showHideLayers('div1', '', 'show', 'div2', '', 'hide', 'div3', '', 'show', 'div4', '', 'hide', 'div5', '', 'show', 'div6', '', 'hide'); break;
                    case "9":
                        MM_showHideLayers('div1', '', 'show', 'div2', '', 'show', 'div3', '', 'show', 'div4', '', 'hide', 'div5', '', 'hide', 'div6', '', 'hide'); break;
                    default:
                        MM_showHideLayers('div1', '', 'show', 'div2', '', 'hide', 'div3', '', 'hide', 'div4', '', 'hide', 'div5', '', 'hide', 'div6', '', 'hide'); break;
                }
            }



    </script>
    
    <script type="text/javascript">
        //自定义上传图片控件加载，支持自定义上传图片功能需先引用三个文件，[themes/default/default.css] [kindeditor.js] [lang/zh_CN.js]
        KindEditor.ready(function (K) {
            var editor = K.editor({
                uploadJson: '../Wpedt/UserEditor/aspnet/upload_json.ashx',
                fileManagerJson: '../Wpedt/UserEditor/aspnet/file_manager_json.ashx',
                allowFileManager: true
            });
            debugger; K('#uploadimg').click(function () {
                editor.loadPlugin('zdyimage', function () {
                    editor.plugin.zdyimageDialog({
                        zdyimageUrl: K('#showUrl').val(),
                        clickFn: function (url) {
                            K('#showUrl').val(K.formatUrl(url, 'domain'));
                            editor.hideDialog();
                        }
                    });
                });
            });
            K('#uploadswf').click(function () {
                editor.loadPlugin('zdyswf', function () {
                    editor.plugin.zdyswfDialog({
                        zdyswfUrl: K('#showUrl').val(),
                        clickFn: function (url) {
                            K('#showUrl').val(K.formatUrl(url, 'domain'));
                            editor.hideDialog();
                        }
                    });
                });
            });
        });

    </script>
    </div>
    </form>
</body>
</html>
