<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Email.aspx.cs" Inherits="JuSNS.Web.system.sys.Email" %>

<!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>
    <link href="../images/css/style.css" rel="stylesheet" type="text/css" />

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

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


</head>
<body>
    <table width="99%" border="0" align="center" cellpadding="5" cellspacing="1">
        <tr>
            <td width="120" align="center" valign="top">
                <div class="menu">
                    <ul>
                        <%=this.GetSystemMenu(sort)%>
                    </ul>
                </div>
            </td>
            <td valign="top">
                <div class="navip">
                    <span class="Blue">
                    <a href="index.aspx">空间管理</a> 
                    <a href="Email.aspx">电子邮件设置</a> 
                    <a href="EmailSend.aspx">邮件通知</a> 
                    <a href="EmailSys.aspx">发送邮件内容编辑</a> 
                    <a href="SysKey.aspx">关键字过滤</a> 
                    <a href="gbook.aspx">留言管理</a> 
                    <a href="EmailSTMP.aspx">邮件服务器设置</a> 
                    <a href="Area.aspx">地区管理</a> 
                        </span>
                </div>
               <div style="padding:6px 8px 0px 8px;">
                <form id="form1" runat="server">
                        <table width="100%" border="0" cellpadding="3" cellspacing="1" class="maintable">
                        <tr class="maintablelist">
                            <td align="right" style="width: 200px;">
                                选择要插入的内容标签</td>
                            <td align="left" style="width: 678px">
                                <select name="ParentID" id="selLable" runat="server" onchange="toAdd();">
                                <option value="{UserName}">收信人姓名</option>
                                <option value="{SiteName}">站点名称</option>
                                <option value="{Url}">确认链接</option>
                                <option value="{Domain}">站点地址</option>
                                <option value="{Content}">邮件内容</option>
                                <option value="{Date}">时间</option>
                                </select>
                            </td>
                        </tr>
                        <tr class="maintablelist">
                            <td align="right" style="width: 200px; height: 92px;">
                                邮件内容</td>
                            <td align="left">
                               <textarea  id="txtContent"  runat="server" style="width: 100%; height: 500px;"></textarea>
                            </td>
                        </tr>
                        <tr class="maintablelist">
                            <td align="right" style="width: 200px">
                            </td>
                            <td align="left" colspan="2">
                                <input  type="button" value="预览" onclick="openwindow();" />  <asp:Button ID="Button1" runat="server" Text=" 保 存 " OnClick="Button1_Click" />
                            </td>
                        </tr>
                    </table>
                </form>
                </div> 
                
            </td>
        </tr>
    </table>
</body>
</html>
<script type="text/javascript" language="javascript">
function getContent(ID)
{
    self.location="?type="+ID;
}

function AddOnPos(obj, charvalue)
{
    //obj代表要插入字符的输入框
    //value代表要插入的字符

    obj.focus();
    var r = document.selection.createRange();
    var ctr = obj.createTextRange();
    var i;
    var s = obj.value;

    //注释掉的这种方法只能用在单行的输入框input内
    //对多行输入框textarea无效
    //r.setEndPoint("StartToStart", ctr);
    //i = r.text.length;
    //取到光标位置----Start----
    var ivalue = "&^asdjfls2FFFF325%$^&"; 
    r.text = ivalue;
    i = obj.value.indexOf(ivalue);
    r.moveStart("character", -ivalue.length);
    r.text = "";
    //取到光标位置----End----
    //插入字符
    obj.value = s.substr(0,i) + charvalue + s.substr(i,s.length);
    ctr.collapse(true);
    ctr.moveStart("character", i + charvalue.length);
    ctr.select();
}

function toAdd()
{
    if(window.confirm("你确定要插入这个标签吗？"))
    {
        var obj=document.all("txtContent");
        var str=document.all("selLable").value;
        AddOnPos(obj, str);
    }
}

function openwindow()
{
   window.open("EmailLook.aspx?type=3","newwindow","height=385, width=815, top=150, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");
}
</script>