<%@ Page Language="C#" MasterPageFile="MasterPage.Master" AutoEventWireup="true" CodeBehind="EmailSendAdd.aspx.cs" Inherits="SocoShop.Web.Admin.EmailSendAdd" %>
<%@ Register Namespace="SkyCES.EntLib" Assembly="SkyCES.EntLib" TagPrefix="SkyCES"%>
<%@ Import Namespace="SocoShop.Common" %>
<asp:Content ID="MasterContent" ContentPlaceHolderID="ContentPlaceHolder" runat="server">
<script type="text/javascript" src="/Admin/Pop/lhgdialog_ex.js"></script>
<div class="position"><img src="/Admin/Style/Images/PositionIcon.png"  alt=""/>Email营销 </div>
<div class="add">
    <ul>
		<li class="left">名称：</li>
		<li class="right"><SkyCES:TextBox ID="Name" CssClass="input" runat="server" Width="400px" CanBeNull="必填" /></li>
	</ul>
	<ul>
		<li class="left">邮件内容：</li>
		<li class="right"><input type="text" id="Title" name="Title" class="input" style="width:100px;"/> <input type="button" id="Search" name="Search" onclick="SearchEmailContent()" class="button" value=" 搜 索 "/>
		<span id="ContentIDBox"><asp:DropDownList id="ContentID"  runat="server"/></span></li>
	</ul>
	<ul>
		<li class="left">用户等级：</li>
		<li class="right"><asp:CheckBoxList ID="UserGrade" runat="server" RepeatDirection="Horizontal" /></li>
	</ul>
</div>
<div class="action">
    <asp:Button CssClass="button" ID="SubmitButton" Text=" 确 定 " runat="server"  OnClick="SubmitButton_Click"  OnClientClick="return CheckEmialContentSelect()"/>
</div>
<script language="javascript" type="text/javascript">
    function SearchEmailContent() {
        var title = o("Title").value;        
        var url = "/Admin/ProductHandler.aspx?ControlName=ContentID&Action=SearchEmailContent&Title=" + title;
        Ajax.requestURL(url, DealSearchEmailContent);
        alertMessage("正在搜索...", 1); 
    }
    function DealSearchEmailContent(data) {
        closeAlertDiv();
        var obj = o("ContentIDBox");
        obj.removeChild(o("ctl00_ContentPlaceHolder_ContentID"));
        obj.innerHTML = data;
        var emailContentListObj = o("ctl00_ContentPlaceHolder_ContentID");
        if (emailContentListObj.length== 0) {
            emailContentListObj.add(new Option("没有符合您搜索的邮件", "0"));
        }
    }
    function CheckEmialContentSelect(){
        Page_ClientValidate();
        var emailContentListObj = o("ctl00_ContentPlaceHolder_ContentID");
        if(emailContentListObj.value=="0" || emailContentListObj.value==""){
             alertMessage("请选择邮件内容"); 
             return false;
        }
        else{
            return true;
        }
    }
</script>
</asp:Content>
