﻿//声明XMLHttpRequest对象
var xmlHttp;

function createXMLHTTP() {
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest(); //mozilla浏览器
    }
    else if (window.ActiveXObject) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); //IE老版本
        }
        catch (e)
        { }
        try {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); //IE新版本
        }
        catch (e)
        { }
        if (!xmlHttp) {
            window.alert("不能创建XMLHttpRequest对象实例！");
            return false;
        }
    }
}
function GetSmallType(ReplyID, lou) {
    createXMLHTTP(); //创建XMLHttpRequest对象
    var url = "../BBS/Quote.aspx?id=" + ReplyID + "&l=" + lou;
    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = QuoteVaule;
    xmlHttp.send(null);

}
//执行检测用户名回调函数
function QuoteVaule() {
    if (xmlHttp.readyState == 4)//判断对象状态
    {
        if (xmlHttp.status == 200)//信息成功返回，开始处理信息
        {
            var oEditor = FCKeditorAPI.GetInstance("FCKeditor1");
            var num = xmlHttp.responseText.length
            oEditor.SetHTML(xmlHttp.responseText.substring(0, num - 498));
            //alert(xmlHttp.responseText.substring(0, 60));
            //alert(xmlHttp.responseText.length);
        }
    }
}
function SetContent() {

    var oEditor = FCKeditorAPI.GetInstance("FCKeditor1");
    oEditor.SetHTML("dfsdafdasfdfasfd");
}
function lengths(len) {
    if (isNaN(len) || len == null) {
        len = this.length;
    }
    else {
        if (parseInt(len) < 0 || parseInt(len) > this.length) {
            len = this.length;
        }
    }

    return this.substr(0, len);
}


