<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../client/fckeditor/fckeditor.asp"-->
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript" src="../client/fckeditor/fckeditor.js"></script>
<title>Untitled Document</title>
<script type="text/javascript">
//<![CDATA[
function getEditorTextContents(EditorName) { 
  var oEditor = FCKeditorAPI.GetInstance(EditorName);
  var oDOM = oEditor.EditorDocument;
  var iLength ;
  if(document.all){
    iLength = oDOM.body.innerText.length;
  }else{
    var r = oDOM.createRange();
    r.selectNodeContents(oDOM.body);
    iLength = r.toString().length;
  }
  return iLength;
}
function postPrevFilter(fString){
    if(fString==""){
        return;
    }else{        
        //fString =fString.replace(/'/g,"&#39;").replace(/\(/g,"&#40;").replace(/\)/g,"&#41;");		
        fString=fString.replace(/'/g,"¡¯");
        fString=fString.replace(/"/g,"¡±");
        fString=fString.replace(/\(/g,"£¨");
        fString=fString.replace(/\)/g,"£©");
        return fString;
    }
}
function alterMessage(mStatus,dName,mContent){
    if(typeof document.getElementById(dName)!='undefined'){
        try{
            var messContainer=document.getElementById(dName); 
            messContainer.innerHTML=(mStatus)?"<font color=\"green\">"+mContent+"</font>":"<font color=\"red\">"+mContent+"</font>";
        }catch(e){}
    }
}
function filterEditorContents(EditorName){
    var oEditor=FCKeditorAPI.GetInstance(EditorName);
    //oEditorConn=postPrevFilter(oEditor.GetData());  
    oEditorConn=postPrevFilter(oEditor.GetXHTML(true));  
    oEditor.SetData(oEditorConn);    
}
function checkthisform(strForm){
    if(getEditorTextContents("summary")==0){
        alterMessage(false,"message","please write something!");			 
	return false;
    }
    if(getEditorTextContents("summary")<10){    
	alterMessage(false,"message","character is so small!");                
        FCKeditorAPI.GetInstance("summary").Focus();
        return false;
    }   
    filterEditorContents("summary");
    if(getEditorTextContents("summary")>100){
        alterMessage(false,"message","character is so more !");  
        return false;
    }
    strForm.filterconn.value=postPrevFilter(FCKeditorAPI.GetInstance("summary").GetData());
    if(strForm.filterconn.value==""){
        strForm.filterconn.focus();
        alert("make dispatch textarea is empty!")
        return false;
    }
    alert(strForm.filterconn.value);
    return true;
    //return false;
}
//]]>
</script>
</head>

<body>
<div id="results">
        <form name="form1" method="post" action="4.asp" onsubmit="return checkthisform(this);">
        <span id="message"></span>
       <dl>
             <dt>FCKEditor demo</dt>
             <dd><%Dim oFCKeditor
                   Set oFCKeditor = New FCKeditor
                   oFCKeditor.BasePath = "../client/fckeditor/"
                   oFCKeditor.ToolbarSet = "GuestUser"
                   oFCKeditor.Value = ""
                   oFCKeditor.Create "summary"
			  %></dd>
                <dd>so little 10 so more 100 per character</dd>
                <dd><textarea name="filterconn" rows="7" cols="150"></textarea></dd>
       </dl>
       <label><input type="submit" name="btn2" value="post" /></label>
       </form>
</div>
</body>
</html>
