// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
/*清空编辑器中的内容*/
function clearEditor(id) {
    KE.g[id].iframeDoc.open();
    KE.g[id].iframeDoc.write(KE.util.getFullHtml(id));
    KE.g[id].iframeDoc.close();
    KE.g[id].newTextarea.value = '';
}

/* 编辑器中插入内容 */
function insertHtml(id, html) {
    KE.util.focus(id);
    KE.util.selection(id);
    KE.util.insertHtml(id, html);
}

function h()
{
    document.mobileform.mobile.focus();
}

function checkspace(checkstr){
    var str = '';
    for(var i = 0; i < checkstr.length; i++) {
        str = str + ' ';
    }
    return (str == checkstr);
}

function changeH(str)
{
    var    s  =  "";
    if    (str.length    ==    0)
    {
        return    "";
    }
    else
    {
        s    =    str.replace(/&/g,    "&gt;");
        s    =    s.replace(/</g,        "&lt;");
        s    =    s.replace(/>/g,        "&gt;");
        s    =    s.replace(/    /g,        "&nbsp;");
        s    =    s.replace(/\'/g,      "&#39;");
        s    =    s.replace(/\"/g,      "&quot;");
        s    =    s.replace(/\n/g,      "<br>");
        return    s;
    }
}

/*中英文字符长度*/
function len(s) {
    var l = 0;
    var a = s.split("");
    for (var i=0;i<a.length;i++) {
        if (a[i].charCodeAt(0)<299) {
            l++;
        } else {
            l+=2;
        }
    }
    return l;
}

/*去字符串两端空格*/
function   AllTrim(s)
{
    return s.replace(/^( |[\s　])+|( |[\s　])+$/g, "");
}

/**/
function AllZero(s)
{
    return s.replace(/^(\s*)(0*)(.*?)/,"")
}

