<%@ Page Language="c#" Inherits="Web.User.addPicNews" CodeBehind="addPicNews.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" -->

    <script type="text/javascript" src="../Wpedt/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
    <form id="addNews" method="post" runat="server">
        <div class="edit-func-box func-box">
            <div class="hd">
                编辑
            </div>
            <div class="bd">
                <table class="edit-table">
                    <tr>
                        <th>文章标题：
                        </th>
                        <td >
                            <asp:TextBox ID="intactTitle" runat="server" notNull="true" msgName="文章标题" class="input-md w3" MaxLength="200"></asp:TextBox>&emsp;
                        <asp:CheckBox ID="useListTitle" runat="server" Text="使用链接标题" onclick="showsubmenu();"></asp:CheckBox>
                            <asp:TextBox ID="listTitleUrl" runat="server" class="input-md w3" MaxLength="200" ToolTip="请填写自定义网址" Style="display: none;">http://</asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>副标题：
                        </th>
                        <td>
                            <asp:TextBox ID="subheading" runat="server" class="input-md w3" MaxLength="200"></asp:TextBox>&emsp;
                        <asp:CheckBox ID="useSubHeading" runat="server" Text="使用副标题" onclick="hiddenList();"></asp:CheckBox>
                         &emsp;&emsp;<asp:CheckBox ID="isTop" runat="server" Text="固顶" CssClass="chkbox"></asp:CheckBox>
                         &emsp;&emsp;<asp:CheckBox ID="isRecommand" runat="server" Text="推荐到今日导读" CssClass="chkbox"></asp:CheckBox>
                        </td>
                    </tr>
                    <tr>
                        <th>标题配图：
                        </th>
                        <td >
                            <div class="pull-left">
                                <div id="pho" runat="server" class="pic-div pull-left"></div>
                                <div class="pull-left">
                                    <p><a id="uploadimg" href="javascript:void(0);" class="blue">上传图片</a></p>
                                    <p><a href="javascript:void(0);" onclick="updateImg();" class="blue">从内容中自动选取</a></p>
                                    <br />
                                    <p class="lgrey">图片尺寸：<asp:Label ID="lbpic" runat="server" Text="width * height"></asp:Label>(像素)</p>
                                </div>
                            </div>
                        
                        <div runat="server" id="trdescript" class="pull-left" style="margin-left:93px;" visible="false">
                            <span class="pull-left" style="line-height:105px;">文章简介：</span>
                            <asp:TextBox ID="tbDescript" runat="server" notNull="true" msgName="文章简介" Width="300px" TextMode="MultiLine" Height="100px" MaxLength="400" CssClass="input-md pull-left fn-mr20"></asp:TextBox>
                            <asp:Label ID="lbdeslen" runat="server" CssClass="lgrey"></asp:Label><br />
                            <span id="lastlen" style="color:red;"></span>
                        </div>
                            </td>
                    </tr>
                    <tr>
                        <th></th>
                        <td >
                            <div class="more-edit" id="more-edit">
                                <div class="more-edit-fn">
                                    发布时间：<asp:TextBox ID="releasetime" runat="server" class="input-md" MaxLength="19"  notNull="true" msgName="发布时间" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" CssClass="input-md"></asp:TextBox>
                                    &nbsp;作者：<asp:TextBox ID="author" runat="server" class="input-md" MaxLength="50"></asp:TextBox>
                                    &nbsp;来源：<asp:TextBox ID="copyFrom" runat="server" class="input-md" MaxLength="50"></asp:TextBox>
                                    &nbsp;&nbsp;
                    <asp:Label ID="cslabel" runat="server">
                                    <a href="javascript:void(0);" id="select" ><span class="blue">抄送</span></a>
                                    &nbsp;
                                    <a href="javascript:void(0);" onclick="clearDuplicate();" ><span class="blue">取消抄送</span></a>
                    </asp:Label>
                                    <asp:TextBox ID="txtDuplicateBigClass" runat="server" ReadOnly="True" class="input-md" Style="display: none;"></asp:TextBox>
                                    &nbsp;
                                    <asp:CheckBox ID="issynchronization" runat="server" Text="同步更新源信息" Visible="false" />
                                    <a class="more-edit-fn-btn" href="#more-edit">更多设置</a>
                                </div>
                                <div class="more-edit-data">
                                    <span class="arrow"></span>
                                    <a class="close" href="#">&times;</a>
                                    <table class="more-edit-data-table">
                                        <tbody>
                                            <tr>
                                                <th>所属专题：</th>
                                                <td>
                                                    <asp:DropDownList ID="special1" runat="server" DataValueField="pkId" DataTextField="name" class="input-md"></asp:DropDownList>
                                                </td>
                                                <th>部门：</th>
                                                <td>
                                                    <asp:DropDownList ID="department" runat="server" DataValueField="pkId" DataTextField="name" class="input-md"></asp:DropDownList>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>浏览权限：</th>
                                                <td>
                                                    <asp:DropDownList ID="gate" runat="server" class="input-md">
                                                        <asp:ListItem Value="0">无限制</asp:ListItem>
                                                        <asp:ListItem Value="1">仅内网可见</asp:ListItem>
                                                        <asp:ListItem Value="2">仅登录可见</asp:ListItem>
                                                        <asp:ListItem Value="3">内网或登录可见</asp:ListItem>
                                                    </asp:DropDownList>
                                                </td>
                                                <th>显示等级：</th>
                                                <td>
                                                    <asp:DropDownList ID="grade" runat="server" DataValueField="pkId" DataTextField="name" class="input-md"></asp:DropDownList>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>文章模板：</th>
                                                <td>
                                                    <asp:DropDownList ID="itemType" runat="server" DataValueField="pkId" DataTextField="name" class="input-md"></asp:DropDownList>
                                                </td>
                                                <th>初始点击率：</th>
                                                <td>
                                                    <asp:TextBox ID="defaultClick" runat="server" notNull="true" dataType="integer" maxValue="99999999" minValue="0" msgName="初始点击率" class="input-md"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>作者信箱：</th>
                                                <td>
                                                    <asp:TextBox ID="authorMail" runat="server" regex="/^(\w)+(\.\w+)*@(\w)+((\.\w{2,3}){1,3})$/" regexMsg="信箱格式不正确" class="input-md" MaxLength="50"></asp:TextBox>
                                                </td>
                                                <th>来源地址：</th>
                                                <td>
                                                    <asp:TextBox ID="copyFromLink" runat="server" class="input-md" MaxLength="50"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>有效期设置：</th>
                                                <td colspan="3">
                                                    <asp:DropDownList ID="ValidDaysOption" runat="server" onchange="ValidDaysOptionOnChange(this);" class="input-md">
                                                        <asp:ListItem Selected="True" Value="-1">永不过期</asp:ListItem>
                                                        <asp:ListItem Value="1">显示截止日期</asp:ListItem>
                                                        <asp:ListItem Value="0">已经过期</asp:ListItem>
                                                    </asp:DropDownList>
                                                    &nbsp;
                                                    <asp:TextBox ID="ValidDays" runat="server" Text="-1" class="input-md" Style="display: none;" onclick="WdatePicker()"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>相关信息：</th>
                                                <td colspan="3">
                                                    <asp:TextBox ID="about" runat="server" regex="[^&quot;^'^\*^\?^,^\.^(^)]+" regexMsg="相关信息格式不正确" MaxLength="50" class="input-md" Style="width: 384px;"></asp:TextBox>
                                                    <p class="lgrey">用来查找相关文章，中间用“|”隔开；不能出现""'*?,.()等字符</p>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>内容分页：</th>
                                                <td colspan="3">
                                                    <asp:DropDownList ID="pageType" runat="server" CssClass="input-md" onchange="ShowPageTag(this.selectedIndex);">
                                                        <asp:ListItem Value="0">不分页</asp:ListItem>
                                                        <asp:ListItem Value="2">分页</asp:ListItem>
                                                    </asp:DropDownList>
                                                    <a id="pageTagA" href="javascript:void(0);" onclick="InsertPagingTag();" data-toggle="tooltip" data-placement="bottom" title="插入文章内容分页标记" style="display: none;"><span class="blue">插入分页标记</span></a>
                                                </td>

                                            </tr>


                                            <tr style="display: none">
                                                <th>分页字数(old)：</th>
                                                <td>
                                                    <asp:TextBox ID="autoPageCharNum" runat="server" Width="96px" Visible="False">10000</asp:TextBox></td>
                                                <th>阅读点数(old)：</th>
                                                <td>
                                                    <asp:Panel ID="ReadPointPanel" runat="server" Visible="False">
                                                        <asp:TextBox ID="readPoint" runat="server">0</asp:TextBox>
                                                    </asp:Panel>
                                                </td>

                                            </tr>
                                        </tbody>
                                    </table>

                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>文章内容：</th>
                        <td>
                            <textarea name="content" style="width: 100%; height: 385px; visibility: hidden;"></textarea>
                        </td>
                    </tr>
                </table>

            </div>
            <div class="ft">
                <div class="action-field text-center">
                    <asp:Button ID="ok" runat="server" class="btn btn-sm btn-primary" Text="添 加" OnClientClick="return checkAll()" OnClick="ok_Click"></asp:Button>
                    &nbsp;
                <asp:Button ID="cancel" runat="server" class="btn btn-sm btn-primary" Text="取 消" CausesValidation="False" OnClick="cancel_Click"></asp:Button>
                    &nbsp;
                <input id="btnView" type="button" class="btn btn-sm btn-primary" value="预 览" onclick="javascript:SubmitPreview();" style="display: none" />
                    <input id="btnWord" type="button" class="btn btn-sm btn-primary" value="Word导入"  style="display:none;" />&nbsp;
                <asp:Button ID="btnDraft" runat="server" CssClass="btn btn-sm btn-primary" Text="存为草稿" OnClientClick="return checkDraft();" OnClick="btnDraft_Click" />
                </div>
            </div>
            <div>
                <input id="content1" type="hidden" name="content1" runat="server" />
                <input id="imageName" type="hidden" name="imageName" runat="server" value="../Images/uploadfiles/nopic.gif" />
                <input id="listTitle" type="hidden" name="listTitle" runat="server" />
                <input id="hiddenName" runat="server" type="hidden" />
                <input id="hiddenValue" runat="server" type="hidden" />
                <input id="hiddenOldValue" runat="server" name="hiddenOldValue" type="hidden" />
                <input id="hiddenIsDup" runat="server" name="hiddenIsDup" type="hidden" />
                <input id="hiddenOldNewsId" runat="server" name="hiddenOldNewsId" type="hidden" />
            </div>
        </div>

        <!--#include file = "../Css/foot.htm" -->
            <script type="text/javascript">
                jQuery(function ($) { 

                    $("#select").click(function (){
                        return true; 
                    }).fancybox({
                        'type': 'iframe',
                        'width':540,
                        'height': 450,
                        'hideOnOverlayClick': false,
                        autoSize:false,
                        'href': 'selectBigClass.aspx?menuId=<%=menuId %>&bigClassId=<%=bigClassId %>',
                'padding':'0'
            }); 

            //设置作者、部门的默认值
            var edit= "<%=edit  %>" ;
            if (edit=="False")
            {
                loadauthor();
                //loaddepartment(); 
            } 
        })

    </script>
        <script type="text/javascript">  
            var WpEditor;   //声明编辑器
        
            KindEditor.ready(function(K) {
                WpEditor = K.create('textarea[name="content"]');
			
                K('#uploadimg').click(function() {
                    WpEditor.loadPlugin('zdyimage', function() {
                        WpEditor.plugin.zdyimageDialog({
                            zdyimageUrl : K('#imageName').val(),
                            clickFn : function(url) {
                                K('#imageName').val(K.formatUrl(url, 'domain'));
                                WpEditor.hideDialog();
                                change();   //加载预览图片
                            }
                        });
                    });
                });
                K('#btnWord').click(function() {
                    WpEditor.loadPlugin('word', function() {
                        WpEditor.plugin.wordDialog({
                            clickFn : function(url) {
                                WpEditor.hideDialog();
                                $.ajax({
                                    type: "post",
                                    url: "addnews.aspx/LoadHtml",
                                    data: "{'url':'" + K.formatUrl(url, 'domain') + "','fileName':'" + url + "'}",
                                    contentType: "application/json; charset=utf-8",
                                    dataType: "json",
                                    success: function(data) {
                                        var initcontxt=document.getElementById("content1");
                                        initcontxt.value=data;
                                        editor.insertHtml(initcontxt.value);
                                        contentTxt=WpEditor;
                                    },
                                    error: function(err) {
                                        alert(err);
                                    }
                                });
                            }
                        });
                    });
                });
				
                var initcontxt=document.getElementById("content1");
                WpEditor.insertHtml(initcontxt.value);  //加载初始内容
			
            });
			
        </script>

        <script type="text/javascript">
    
            //更多设置
            $(".more-edit-fn-btn").click(function(){
                $(this).parent().next(".more-edit-data").toggle();
            });
            $(".more-edit-data .close").click(function(){
                $(this).parent().hide();
            })
	
            //加载预览图片  （201407 shijian 统一把document.formID.objectID.**写法替换为 $("ID").写法）
            function change() {
                var arr = $("#imageName").val();
                if (arr != "") {
                    //if (arr.indexOf("http://") > -1 )
                    //{
                    //    arr = "" + arr;
                    //}
                    var imgstr = "<img src=" + arr + " height=" + $("#height").val() + " width=" + $("#width").val() + " />";
                    $("#pho").html(imgstr);
                }
            }
    
            //显示列表标题
            function showsubmenu()
            {
                if (document.getElementById("useListTitle").checked == true)
                {
                    document.getElementById("useSubHeading").checked = false;
                    document.getElementById("listTitleUrl").style.display="inline-block";
                }
                else
                {
                    document.getElementById("listTitleUrl").style.display="none";
                }
            }
            //使用列表标题和使用副标题只能选一个
            function hiddenList()
            {
                if (document.getElementById("useSubHeading").checked == true)
                {
                    document.getElementById("useListTitle").checked = false;
                    document.getElementById("listTitleUrl").style.display="none";
                }
            }
    
            // 显示分页标记
            function ShowPageTag(selectedIndex)
            {
                if (selectedIndex!=1)
                {
                    document.getElementById("pageTagA").style.display = "none";
                }
                else
                {
                    document.getElementById("pageTagA").style.display = "";
                }		
            }
            //插入文章内容分页标记
            function InsertPagingTag()
            {
                WpEditor.focus();
                WpEditor.insertHtml("<button id=\"ZDSOFTPAGINGTAG\">分页标记</button>");
                WpEditor.focus();
            } 
	
            //选择抄送栏目
            //	function ShowDialog(menuId, bigClassId)
            //	{
            //	    showModalDialog("selectBigClass.aspx?menuId=" + menuId + "&bigClassId=" + bigClassId, window, "dialogWidth:30.5em; dialogHeight:22em;help:no;scroll:no;status:no");			
            //	}
	
            //取消抄送
            function clearDuplicate()
            {
                document.getElementById("txtDuplicateBigClass").value = "";
                document.getElementById("txtDuplicateBigClass").style.display="none";  
                document.getElementById("hiddenName").value = "";
                document.getElementById("hiddenValue").value = ""; 
            }
	
            //检查抄送栏目
            function checkform(optionName, optionValue)
            {
                if(optionName.LTrim().RTrim().length==0)
                {
                    clearDuplicate();
                }
                else
                {
                    document.getElementById("txtDuplicateBigClass").style.display="";    
                }
                if(optionName.indexOf("|")==0)
                {
                    optionName = optionName.substring(1, optionName.length);    
                    optionValue = optionValue.substring(1, optionValue.length);
                }
                document.getElementById("hiddenName").value = optionName;
                document.getElementById("hiddenValue").value = optionValue;
                document.getElementById("txtDuplicateBigClass").value = optionName;
            }
	
            String.prototype.Trim = function() 
            { 
                return this.replace(/(^\s*)|(\s*$)/g, ""); 
            } 

            String.prototype.LTrim = function() 
            {
                return this.replace(/(^\s*)/g, ""); 
            } 

            String.prototype.RTrim = function() 
            {
                return this.replace(/(\s*$)/g, ""); 
            }
    
    
            //obj.value值含义
            //-1:永久有效
            //0: 无效
            //1: 输入一个有效天数
            function ValidDaysOptionOnChange(obj)
            {
                var i = obj.value;
                var o = document.getElementById("ValidDays");
                if (i == 1)
                {
                    if (o.value < 1)
                    {
                        if (o.getAttribute("validDays") && o.getAttribute("validDays") > 0)
                        {
                            o.value = o.getAttribute("validDays");
                            EditValidDays();
                        }
                        else
                        {
                            var d = new Date();
                            o.value = (d.getFullYear() + 1).toString() + "-" + (d.getMonth() + 1).toString() + "-" + d.getDate();
                        }
                    }
                    o.style.display = "";
                }
                else
                {
                    o.style.display = "none";
                    o.value = i;
                }
            }
     
            //保存草稿
            function checkDraft()
            {
                //验证
                if (checkAllValidate()){
                    //转换有效期
                    try
                    {
                        var vdo = document.getElementById("ValidDaysOption");
                        if (vdo.value != 1)
                        {
                            //保存
                            if (esave())
                            {   
                                //草稿状态下判断不能有抄送新闻
                                if(document.getElementById("txtDuplicateBigClass").value == "" )
                                {
                                    //document.getElementById("txtDuplicateBigClass").value = "";
                                    document.getElementById("hiddenName").value = "";
                                    document.getElementById("hiddenValue").value = "";
                                    return true ;
                                }
                                else
                                {
                                    alert("草稿状态下不能抄送信息!");
                                    return false ;
                                }
                            }else{
                                return false ;
                            }
                        }
                        var vd = document.getElementById("ValidDays");
                        var d = vd.value.split("-");
                        if (d.length < 3)
                        {
                            alert("有效期设置有误!");
                            return false;
                        }
                        var validday = new Date();                
                        validday.setDate(d[2]);
                        validday.setMonth(d[1] - 1);
                        validday.setFullYear(d[0]);
                        var sub = DaysBetween(validday, new Date());
                        if (sub < 0)
                        {
                            alert("有效期设置有误!");
                            return false;
                        }
                        vd.value = sub;
                    }
                    catch(err)
                    {
                        alert("有效期设置有误!");
                        return false;
                    } 
                    //保存
                    if (esave())
                    {   
                        //草稿状态下判断不能有抄送新闻
                        if(document.getElementById("txtDuplicateBigClass").value == "" )
                        {
                            //document.getElementById("txtDuplicateBigClass").value = "";
                            document.getElementById("hiddenName").value = "";
                            document.getElementById("hiddenValue").value = "";
                            return true ;
                        }
                        else
                        {
                            alert("草稿状态下不能抄送信息!");
                            return false ;
                        }
                
                    }else{
                        return false ;
                    }
                }else{
                    return false ;
                }
            }
     
            //在保存之前,验证输入是否正确；将有效日期值转换成相应的有效天数
            function checkAll()
            {
                //验证
                if (checkAllValidate()){
                    //转换有效期
                    try
                    {
                        var vdo = document.getElementById("ValidDaysOption");
                        if (vdo.value != 1)
                        {
                            //保存
                            if (esave())
                            {   
                                return true ;
                            }else{
                                return false ;
                            }
                        }
                        var vd = document.getElementById("ValidDays");
                        var d = vd.value.split("-");
                        if (d.length < 3)
                        {
                            alert("有效期设置有误!");
                            return false;
                        }
                        var validday = new Date();                
                        validday.setDate(d[2]);
                        validday.setMonth(d[1] - 1);
                        validday.setFullYear(d[0]);
                        sub = DaysBetween(validday, new Date());
                        if (sub < 0)
                        {
                            alert("有效期设置有误!");
                            return false;
                        }
                        vd.value = sub;
                    }
                    catch(err)
                    {
                        alert("有效期设置有误!");
                        return false;
                    }
                    //保存
                    if (esave())
                    {   
                        return true ;
                    }else{
                        return false ;
                    }
                }else{
                    return false ;
                }
            }
        
            function EditValidDays()
            {
                var vdo = document.getElementById("ValidDaysOption");
                if (vdo.value != 1)
                {
                    return;
                }    
                var v = document.getElementById("ValidDays");
                var now = new Date();
                now.setHours(0);
                now.setMinutes(0);
                now.setSeconds(0);
                var r = new Date(now.getTime() + 1000 * 60 * 60 * 24 * v.value);
                v.value = r.getFullYear().toString() + "-" + (r.getMonth()+1).toString() + "-" + r.getDate().toString();
            }
        
            //计算两个日期之间的天数
            function DaysBetween(d1, d2)
            {
                var ONE_DAY = 1000 * 60 * 60 *24;
                var date1_ms = d1.getTime();
                var date2_ms = d2.getTime();
                var diff_ms = date1_ms - date2_ms;
                return Math.round(diff_ms / ONE_DAY);
            }
    
    
            //添加保存
            function esave(){
    
                //判断是否使用了副标题
                if(document.getElementById("useSubHeading").checked == true){
                    var usubhead=document.getElementById("subheading");
                    if (usubhead.value=="" ||usubhead.value==null){
                        alert("使用副标题时，副标题内容不能为空！");
                        return false ;
                    }
                }
        
                //判断内容是否为空
                var etxtisempty = WpEditor.isEmpty();
                if(etxtisempty){
                    alert("文章内容不能为空！");
                    return false ;
                }else{
                    //获取文章内容
                    var gettxttitle= WpEditor.html();
                    var contxt=document.getElementById("content1");
                    contxt.value =gettxttitle;
                }
                return true ;
            }
    
    
            function SubmitPreview()
            {
                document.getElementById("sTitle").value = document.getElementById("<%=intactTitle.ClientID %>").value;
                document.getElementById("sContent").value = document.getElementById("<%=content1.ClientID %>").value;
                document.getElementById("sItemType").value = document.getElementById("<%=itemType.ClientID %>").value;
                document.getElementById("preview").submit();
            }
        
        
            //若是选择显示过期时间 则加载ValidDays显示 hezl
            function checkvalidday(){
                var editvdo= document.getElementById("ValidDaysOption");
                if (editvdo.value==1){
                    document.getElementById("ValidDays").style.display="";
                }
            }

            //获取默认作者为当前登录用户真实名称
            function loadauthor()
            {
                var thisauthor=document.getElementById("author");
                if(thisauthor.value=="")
                {
                    thisauthor.value="<%=FullName %>";
        }
    }
    
    function getSelectedText(name)
    {        
        var obj =document.getElementById(name);
        for(i=0;i<obj.length;i++){
            if(obj[i].selected==true){
                return obj[i].innerHTML; //关键是通过option对象的innerText属性获取到选项文本『注』要兼容Firefox需使用innerHTML属性
            }
        }
    }
    //来源默认为部门名称
    function loaddepartment()
    {
        var thisdep=document.getElementById("copyFrom");
        if(thisdep.value=="")
        {
            thisdep.value=getSelectedText("department");
        }
    }
    //判断页面是否加载完毕
    document.onreadystatechange = function(){ 
        if(document.readyState == "complete"){
            checkvalidday();
            EditValidDays();
            //获取默认作者为当前登录用户真实名称
            //loadauthor();
            //来源默认为部门名称
            //loaddepartment();
        }
    }
    
    ShowPageTag(document.all.pageType.selectedIndex);
    //从内容中获取图片
    var uicounts=0;
    function updateImg()
    {
        var uistr = WpEditor.html();
        //var test = /\/([^\/]*?\.(jpg|bmp|gif))"\/>/gi;
        var test = /src="([^"]*)"/gi;
        var result = []; 
        var img ; 
        while(img = test.exec(uistr)){ 
            result .push(img[1]);
        } 
        if(result.length<=0)
        {
            alert("在内容中未检测到图片!");
        }
        else
        {
            var imgurl;
            if(uicounts < result.length )
            {
                imgurl = result[uicounts];
                uicounts=uicounts+1;
            }
            else
            {
                uicounts= 1;
                imgurl = result[0];
            }
            document.getElementById("imageName").value=imgurl;
            change();//加载预览图片
        }
    }
    function ta(obj)
    {
        if(<%=deslength %>!="0") 
        {
            var len=<%=deslength %>;
            var text=$(obj).val();
            var textlen=getLength(text);
            if(textlen<=2*len)
            {  
                var word=len-Math.ceil(textlen/2);
                $("#lastlen").html("还剩余 "+word+"字");
                $("#lastlen").show();
            }
            else
            {
                var word=Math.ceil(textlen/2)-len;
                $("#lastlen").html("已超出 "+word+"字");
                $("#lastlen").show();
            }
        }
    }
    
        </script>

    </form>
    <form id="preview" action="../newsInfo.aspx" method="post" target="_blank">
        <input id="sTitle" type="hidden" name="sTitle" />
        <input id="sContent" type="hidden" name="sContent" />
        <input id="sItemType" type="hidden" name="sItemType" />
        <input id="IsView" type="hidden" name="IsView" value="1" />
    </form>
</body>
</html>
