﻿/*
取得用户信息
*/
function GetUserInfoUrl(cUserName)
{
	return _WebRoot+"/"+cUserName+".card"; // CFH 当中链接到用户的名片上
}

// 要定义好 全局变量 WebConfig

// 上面的内容由使用本编辑器的网站负责填写.
//  以后将这个编辑器修改为类库时就不用这么写了, 目前赶时间,先按这个弄
///////////////////////////////////////////////////////////////////////////////////


function LoadCategoryCtrlHtml(config)
{
    showDebuginfo("COWiki.js--LoadCategoryCtrlHtml","加载频道信息");
	if (typeof config!="object" || config==null)
	{
		ShowMsg("没有指定应用程序的类别，不能加载编辑器！");
		return "";
	}
	
	
	var CateHtml = "<span id='title_cate' class='fldcaption'>";
	
	if (typeof config.AppEntryName=="string")
		CateHtml += config.AppEntryName;
		
	CateHtml += "&nbsp;&nbsp;栏目</span>";
		
	if (typeof config.AppName=="string")
		CateHtml += '<input type="hidden" name="AppName" id="AppName" value="'+config.AppName+'" />';
	if (typeof config.AppEntryId=="string")
		CateHtml += '<input type="hidden" name="AppEntryId" id="AppEntryId" value="'+config.AppEntryId+'" />';
	
	if (typeof config.CategoryList=="object")
	{
		if (typeof config.CategoryList.length=="number")
		{
			if (config.CategoryList.length>0)
			{
				CateHtml += '<select name="Category" id="Category">';
				$.each(config.CategoryList,
					   function(i,data)
					   {
						   if ((typeof data.Id=="string")&&(typeof data.Name =="string"))
							   CateHtml += '<option value="'+data.Id+'">'+data.Name+'</option>';
					   }
					);
				CateHtml += '</select>';
			}
		}
	}
	return CateHtml;
}

/*
    清除当前文档的内容(但是没有清除频道/分类等信息)
*/
function ClearContent()
{
	$("#Id").val("");
	$("#Title").val("");
	$("#Author").val("");
	$("#Author_Signature").val("");
	$("#AuthorOrg_Signature").val("");
	$("#KeyWords").val("");
	$("#IsOriginal").attr("checked",true);
	$("#CopyrightString").val("");
	$("#Source").val('');
	$("#SourceUrl").val('');
	$("#Content").val('');
	$("#Abstract").val('');
	$("#Reference").val('');
	$("#ShareMode").val('Public');
	$("#IsDraft").removeAttr("checked"); 
	$("#IsAuthorLocked").removeAttr("checked"); 
}

/*
    设定文档 ID
*/
function SetDocId(cId)
{
    showDebuginfo("COWikiEditor--SetDocId(cId)","cId="+cId);
    $("#Id").val(cId);
}

/*
    判断是否是文档对象
*/
function IsDocValid(jDoc)
{
    if (typeof jDoc=="object")
    {
        if ((typeof jDoc.Id=="string")&&(typeof jDoc.Title=="string")&&(typeof jDoc.Author=="string")&&(typeof jDoc.Content=="string"))
            return true;
    }
    showDebuginfo("COWikiEditor--IsDocValid","结果不是文档对象类型");
    return false;
}


/*
    将文档加载到编辑器当中
*/
function LoadDocContent(cContainerID,jDoc,EditMode)
{
	if (!IsDocValid(jDoc))
	{
		ShowMsg("COWiki编辑器：没有指定有效文档,无法显示！");
		return false;
	}
	
	// 首先清除页面上以前文档的信息
	ClearContent();
		
	if (!LoadDocEditor(cContainerID))
	{
		ShowMsg("文档格式不对，无法显示！");
		return false;		
	}
	/*
	
  "AppName": "Blog",
  "AppEntryId": "Bruce_Blog",
  "Id": "doc01",
  "Title": "央视配楼大火",
  "ContentFormat": "COWiki",
  "Content": "",
  "Author": "bruce",
  "PostIP": "192.168.248.128",
  "UpdateTime": "\/Date(1234866412000+0800)\/",
  "Audit": {
    "AuditMark": 2,
    "AuditMsg": "",
    "Auditor": "",
    "AuditTime": "\/Date(1234866412000+0800)\/"
  },
  "HasDeleted": false,
  "Author_Signature": "警告",
  "AttachPhoto": false,
  "AttachMovie": false,
  "AttachAudio": false,
  "AttachFile": false,
  "Category": "BruceBlogCate01",
  "Tags": "",
  "Copyright": {
    "IsOriginal": true,
    "Source": "",
    "SourceUrl": "",
    "CopyrightString": ""
  },
  "ShareMode": 0,
  "Password": "",
  "Lang": 2,
  "KeyWords": "",
  "Abstract": "",
  "Reference": "",
  "IsDraft": false,
  "IsAuthorLocked": false,
  "CreateTime": "\/Date(1234800000000+0800)\/",
  "HotIndex": 0,
  "IsElite": false,
  "AuthorOrg_Signature": "XXX"
  
	*/
	// 加载文档字段到编辑区
	if (typeof jDoc.Id == "string")
	{
		$("#Id").val(jDoc.Id);
		WebConfig.CurrentDoc.ResId = jDoc.Id;
		//alert("加载文档：WebConfig.CurrentDoc.ResId="+WebConfig.CurrentDoc.ResId);
	}
	if (typeof jDoc.Title == "string")
		$("#Title").val(jDoc.Title);
	if (typeof jDoc.Category == "string")
		$("#Category").val(jDoc.Category);
	if (typeof jDoc.Author == "string")
		$("#Author").val(jDoc.Author);
	if (typeof jDoc.Author_Signature == "string")
		$("#Author_Signature").val(jDoc.Author_Signature);
	if (typeof jDoc.UpdateTime == "string")
	    $("#UpdateTime").val(GetDateLocaleString(jDoc.UpdateTime));
	if (typeof jDoc.AuthorOrg_Signature == "string")
		$("#AuthorOrg_Signature").val(jDoc.AuthorOrg_Signature);
	if (typeof jDoc.KeyWords == "string")
		$("#KeyWords").val(jDoc.KeyWords);
	if (typeof jDoc.Copyright.IsOriginal == "boolean")
		$("#IsOriginal").attr("checked",jDoc.Copyright.IsOriginal);
	if (typeof jDoc.Copyright.CopyrightString == "string")
		$("#CopyrightString").val(jDoc.Copyright.CopyrightString);
	if (typeof jDoc.Copyright.Source =="string")
		$("#Source").val(jDoc.Copyright.Source);
	if (typeof jDoc.Copyright.SourceUrl =="string")
		$("#SourceUrl").val(jDoc.Copyright.SourceUrl);
	if (typeof jDoc.Content == "string")
		$("#Content").val(jDoc.Content);
	if (typeof jDoc.Abstract == "string")
		$("#Abstract").val(jDoc.Abstract);
	if (typeof jDoc.Reference == "string")
		$("#Reference").val(jDoc.Reference);
	if (typeof jDoc.ShareMode == "string")
		$("#ShareMode").val(jDoc.ShareMode);
	if (typeof jDoc.IsDraft == "boolean")
	{
		if (jDoc.IsDraft)
			$("#IsDraft").attr("checked","checked");
		else
			$("#IsDraft").removeAttr("checked"); 
	}
	if (typeof jDoc.IsAuthorLocked == "boolean")
	{
		if (jDoc.IsAuthorLocked)
			$("#IsAuthorLocked").attr("checked","checked");
		else
			$("#IsAuthorLocked").removeAttr("checked"); 
	}
	if (typeof jDoc.Lang == "number")
	{
        // TODO： 添加语言选项	     
	}
	
	// 加载完毕	
	
	// 编辑模式或者阅读模式
	if (typeof EditMode=="string")
	{
		if (EditMode=="edit")
		{
			EditDoc();
			return;
		}
	}
	
	ViewDoc();
	return true;
}


// 加载一个空白文档编辑器
function LoadDocEditor(cContainerID)
{
	// 加载应用程序类别
	var CateHtml = LoadCategoryCtrlHtml(WebConfig);
	if (CateHtml.length<10)
	{
		ShowMsg("指定的应用程序类别无效，不能加载编辑器！");
		return false;
	}
	
	// 加载文档
	
	var EditorHtml = '<div class="COWiki_Editor" id="Editor_'+cContainerID+'\">';
	EditorHtml += "<div id=\"DocEditor\">";
	EditorHtml += "<table width=\"600\" border=\"0\" cellspacing=\"0\">";
	EditorHtml += "<tr>";
	EditorHtml += "<td width=\"60\">&nbsp;</td>";
	EditorHtml += "<td width=\"240\">&nbsp;</td>";
	EditorHtml += "<td width=\"60\">&nbsp;</td>";
	EditorHtml += "<td width=\"240\">&nbsp;</td>";
	EditorHtml += "</tr>";
	EditorHtml += "<tr>";
	EditorHtml += "<td>&nbsp;</td>";
	EditorHtml += "<td colspan='3' algin='left'>";

	/*
	EditorHtml += "<span id='title_cate' class='fldcaption'>栏目</span>";
	EditorHtml += '<select name="AppEntryId" id="AppEntryId">';
	EditorHtml += '<option value="ZSBlog">张三的Blog</option>';
	EditorHtml += '</select>';
	EditorHtml += '<select name="Category" id="Category">';
	EditorHtml += '<option value="MyDev">网站开发</option>';
	EditorHtml += '<option value="Idea">生活感悟</option>';
	EditorHtml += '</select>';
	*/
	EditorHtml += CateHtml;
	
	EditorHtml += '<span class="fldcaption">Language</span>';
	EditorHtml += '<select name="Lang" id="Lang" onchange="LanguageChanged(this);">';
	EditorHtml += '<option value="Zh" selected="selected">中文</option>';
	EditorHtml += '<option value="En">English</option>';
	EditorHtml += '</select></td>';
	
	EditorHtml += '</tr>';
	EditorHtml += '<tr>';
	EditorHtml += '<td colspan="4">&nbsp;</td>';
	EditorHtml += '</tr>';
	
	EditorHtml += '<tr>';
	EditorHtml += '<td><span id="title_title">标题</span></td>';
	EditorHtml += '<td colspan="3"><input name="Title" type="text" class="txt" id="Title" /></td>';
	EditorHtml += '</tr>';
	
	EditorHtml += '<tr>';
	EditorHtml += '<td><span id="title_author_signature">笔名</span></td>';
	EditorHtml += '<td><input name="Author_Signature" type="text" class="halftxt" id="Author_Signature" /></td>';
	EditorHtml += '<td><span id="title_author_org">作者单位</span></td>';
	EditorHtml += '<td><input name="AuthorOrg_Signature" type="text" class="halftxt" id="AuthorOrg_Signature" /></td>';
	EditorHtml += '<input type="hidden" name="UpdateTime" id="UpdateTime" value="" />';
	EditorHtml += '</tr>';
	
	EditorHtml += '<tr>';
	EditorHtml += '<td><span id="title_keywords">关键词</span></td>';
	EditorHtml += '<td colspan="3"><input name="KeyWords" type="text" class="txt" id="KeyWords" /></td>';
	EditorHtml += '</tr>';
	EditorHtml += '<tr>';
	EditorHtml += '<td><span id="title_copyright">版权</span></td>';
	EditorHtml += '<td colspan="3">';
	EditorHtml += '<input name="IsOriginal" type="checkbox" id="IsOriginal" checked="checked" /><label id="title_isoriginal">原创作品</label>';
	EditorHtml += '<span id="title_copyright_comment" style="margin-left:20px; margin-right:20px;">版权声明</span>';
	EditorHtml += '<input name="CopyrightString" type="text" class="halftxt" id="CopyrightString" style="width:350px;" />';
	EditorHtml += '</td>';
	EditorHtml += '</tr>';
	EditorHtml += '<tr>';
	EditorHtml += '<td><span id="title_source">来源</span></td>';
	EditorHtml += '<td><input name="Source" type="text" class="halftxt" id="Source" /></td>';
	EditorHtml += '<td><span id="title_sourceurl">网址</span></td>';
	EditorHtml += '<td><input name="SourceUrl" type="text" class="halftxt" id="SourceUrl" /></td>';
	EditorHtml += '</tr>';
	EditorHtml += '<tr><td></td><td colspan="3">&nbsp;</td></tr>';
	EditorHtml += '<tr><td></td><td colspan="3"><span id="title_help" class="CmdTxt" style="width:60px;" onclick="$(\'#COWikiHelp\').toggle();">格式帮助</span></td></tr>';	
	EditorHtml += '<tr><td></td>';
	EditorHtml += '<td colspan="3">';
	EditorHtml += '<div id="COWikiHelp" style="display:none;">';

	EditorHtml += '<TABLE CELLSPACING="0" border="1" align="center">';
	EditorHtml += '<TR bgcolor="#CC9900" style="color: #FFFFFF; font-weight: bold"><TD>效果</TD><TD>格式</TD></TR>';
	EditorHtml += '<TR><TD>●</TD><TD><span class="note">* &nbsp;&nbsp;</span>行首星号</TD></TR>';
	EditorHtml += '<TR><TD>○</TD><TD><span class="note">** &nbsp;&nbsp;</span>行首两个星号</TD></TR>';
	EditorHtml += '<TR><TD>◎</TD><TD><span class="note">*** &nbsp;&nbsp;</span>行首三个星号</TD></TR>';
	EditorHtml += '<TR><TD><B>Bold</B></TD><TD><span class="note">\'\'Bold\'\'</span>两个英文引号括起来</TD></TR>';
	EditorHtml += '<TR><TD><STRIKE>Strikethrough</STRIKE></TD><TD><span class="note">==Strikethrough==</span></TD></TR>';
	EditorHtml += '<TR><TD><U>Underline</U></TD><TD><span class="note">__Underline__</span>两个下划线括起来</TD></TR>';
	EditorHtml += '<TR><TD><I>Italic</I></TD><TD><span class="note">//Italic//</span></TD></TR>';
	EditorHtml += '<TR><TD>2<sup>3</sup>=8</TD><TD><span class="note">2^3^=8</span></TD></TR>';
	EditorHtml += '<TR><TD>a<sub>ij</sub> = -a<sub>ji</sub></TD><TD><span class="note">a~~ij~~ = -a~~ji~~</span></TD></TR>';
	EditorHtml += '<TR><TD>水平线</TD><TD><span class="note">----</span>两行之间的4个短横线自动变成水平线</TD></TR>';
	EditorHtml += '<TR><TD><img src="'+_WebRoot+'/data/user/guest.jpg" alt="用户头像" /></TD>';
	EditorHtml += '<TD>[img[用户头像|'+_WebRoot+'/data/user/guest.jpg]]<br /><span class="note">[img[图像解释|图像URL]]</span><br /></TD>';
	EditorHtml += '<TR><TD><a href="'+_WebRoot+'/">CFH</a></TD><TD>[[CFH|'+_WebRoot+']]<span class="note">(超链接)</span></TD>';
	EditorHtml += '<TR>';
	EditorHtml += '<TD><a href="'+_WebRoot+'/wiki.aspx?w=Acer">Acer</a></TD>';
	EditorHtml += '<TD align="left">[[Acer]]<span class="note">链接到CFH百科词条</span><br />';
	EditorHtml += '其他链接方式:<br />';
	EditorHtml += 'wiki词条解释:<span class="note">[wiki[Acer]]</span><br />';
	EditorHtml += '“互动百科”词条解释:<span class="note">[hdwiki[Acer]]</span><br />';
	EditorHtml += 'google词条解释:<span class="note">[google[Acer]]</span><br />';
	EditorHtml += '</TD>';
	EditorHtml += '</TR>';
	EditorHtml += '</TABLE>';


	EditorHtml += '</div>';
	EditorHtml += '</td>';
	EditorHtml += '</tr>';
	EditorHtml += '<tr><td><span id="title_content">正文</span></td><td colspan="3"><textarea name="Content" cols="45" rows="20" class="edt" id="Content"></textarea></td></tr>';
	EditorHtml += '<tr><td>&nbsp;</td><td colspan="3">';
	EditorHtml += '<span id="title_expandeditarea" class="CmdTxt" onclick=\'var vHeight=$("#Content").attr("rows");$("#Content").attr("rows",vHeight+5);\'>增大编辑区</span>';
	EditorHtml += '<span id="title_smalleditarea" class="CmdTxt" onclick=\'var vHeight=$("#Content").attr("rows"); if (vHeight>10) $("#Content").attr("rows",vHeight-5);\'>缩小编辑区</span></td>';
	EditorHtml += '</tr>';
	EditorHtml += '<tr><td>&nbsp;</td><td colspan="3">&nbsp;</td></tr>';
	EditorHtml += '<tr><td><span id="title_abstract">摘要</span></td><td colspan="3"><textarea name="Abstract" cols="45" rows="5" class="edt" id="Abstract"></textarea></td></tr>';
	EditorHtml += '<tr><td><span id="title_ref">参考文献</span></td><td colspan="3"><textarea name="Reference" cols="45" rows="5" class="edt" id="Reference"></textarea></td></tr>';
	EditorHtml += '<tr><td>&nbsp;</td><td colspan="3">';
	EditorHtml += '<span id="title_sharemode" style="margin:10px;">共享模式</span>';
	EditorHtml += '<select name="ShareMode" id="ShareMode">';
	EditorHtml += '<option value="Public" selected="selected">Public</option>';
	EditorHtml += '<option value="Friend">Friend</option>';
	EditorHtml += '<option value="Private">Private</option>';
	EditorHtml += '</select>';
	EditorHtml += '<input name="IsDraft" type="checkbox" id="IsDraft" value="Yes" /><label id="title_isdraft">保存为草稿</label>';
	EditorHtml += '<input name="IsAuthorLocked" type="checkbox" id="IsAuthorLocked" value="Yes" /><label id="title_userlock">用户锁定</label>';
	EditorHtml += '</td>';
	EditorHtml += '</tr>';
	EditorHtml += '<tr>';
	EditorHtml += '<td>&nbsp;</td><td colspan="3">';
	EditorHtml += '<input name="ContentFormat" type="hidden" id="ContentFormat" value="COWiki" />';
	EditorHtml += '<input type="hidden" name="Id" id="Id" />';
	EditorHtml += '<input type="hidden" name="Author" id="Author" />';
	EditorHtml += '<input type="hidden" name="AttachPhoto" id="AttachPhoto" />';
	EditorHtml += '<input type="hidden" name="AttachMovie" id="AttachMovie" />';
	EditorHtml += '<input type="hidden" name="AttachAudio" id="AttachAudio" />';
	EditorHtml += '<input type="hidden" name="AttachFile" id="AttachFile" />';
	EditorHtml += '<input type="hidden" name="DocType" id="DocType" value="article" />';
	
	EditorHtml += '</td>';
	EditorHtml += '</tr>';
	EditorHtml += '<tr><td>&nbsp;</td><td colspan="3"><hr size="1"/></td></tr>';
	EditorHtml += '<tr><td>&nbsp;</td><td colspan="3">';
	EditorHtml += '<input id="btn_preview" type="button" name="Preview" value="效果预览" onclick="ViewDoc();" />';
	EditorHtml += '<input id="btn_save" type="button" name="save" value="保存文档" onclick="SubmitDoc();" />';
	EditorHtml += '</td>';
	EditorHtml += '</tr>';
	EditorHtml += '</table>';
	EditorHtml += '</div>';
	// 文档的显示区
	EditorHtml += '<div id="DocView" style="display:none;">';
	//EditorHtml += '<div id="title_dvbtn_edit" class="DivBtn" style="width:80px;" onclick=\'$("#DocEditor").show();$("#DocView").hide();\'>编辑</div>';
	EditorHtml += '<div class="DocTopHeader"><span id="DocTopHeader_SiteName">';
	EditorHtml += WebConfig.AppEntryName;
	EditorHtml += '</span>&nbsp;&nbsp;';
	EditorHtml += '<span id="DocURL">';
	EditorHtml += '</span></div>';
	EditorHtml += '<hr size="1" width="100%" />';
	EditorHtml += '<p style="margin-top:30px;">';
	EditorHtml += '<div id="view_Title" class="title">文章标题</div>';
	EditorHtml += '<div class="author_row"><span id="view_Author_Signature" class="author">作者署名</span><span id="view_UpdateTime" class="time">最后更新时间</span></div>';
	EditorHtml += '<div id="view_AuthorOrg_Signature" class="org">作者单位</div>';
	EditorHtml += '<div class="smalltxt">';
	EditorHtml += '<span id="title_v_source" class="fldTitle">来源:</span>';
	EditorHtml += '<span id="view_IsOriginal">引用自</span>';
	EditorHtml += '<span id="view_Source">《人民日报》</span>';
	EditorHtml += '<span id="view_SourceUrl">http://renmin.com/</span>';
	EditorHtml += '</div>';
	EditorHtml += '<div class="smalltxt" id="view_Abstract_line">';
	EditorHtml += '<span id="title_v_abstarct" class="fldTitle">摘 要:</span>';
	EditorHtml += '<span id="view_Abstract" class="fld"></span>';
	EditorHtml += '</div>';
	EditorHtml += '<div class="smalltxt" id="view_keywords_line">';
	EditorHtml += '<span id="title_v_keywords" class="fldTitle">关键词:</span>';
	EditorHtml += '<span id="view_KeyWords" class="fld"></span>';
	EditorHtml += '</div>';
	EditorHtml += '<div id="view_Content" class="content">正文内容</div>';
	EditorHtml += '<div style="height:20px;width:90%; clear:both;"></div>';
	EditorHtml += '<div id="title_v_ref" class="fldTitle">【参考文献】</div>';
	EditorHtml += '<div id="view_Reference" class="ref">参考文献</div>';
	EditorHtml += '<div id="view_CopyrightString"></div>';
	EditorHtml += '</p>';
	EditorHtml += '</div>';
	EditorHtml += '</div>';
	
	$("#"+cContainerID).html(EditorHtml);
	return true;
}

/*
界面语言转换后的事件
*/
function LanguageChanged(lang)
{
	var language = lang.options[lang.selectedIndex].value;
	if (language=="Zh")
	{
		$("#title_cate").text("栏目");
		$("#title_title").text("标题");	
		$("#title_author_signature").text("作者署名");
		$("#title_author_org").text("作者单位");
		$("#title_keywords").text("关键词");
		$("#title_content").text("正文");
		$("#title_copyright").text("版权");
		$("#title_isoriginal").text("原创");
		$("#title_copyright_comment").text("版权声明");
		$("#title_source").text("来源");
		$("#title_sourceurl").text("网址");
		$("#title_abstract").text("摘要");
		$("#title_ref").text("参考文献");
		$("#title_isdraft").text("保存为草稿");
		$("#title_userlock").text("锁定");
		$("#title_sharemode").text("共享模式");
		$("#title_expandeditarea").text("扩大编辑区");
		$("#title_smalleditarea").text("缩小编辑区");
		$("#title_help").text("帮助");
	
		$("#btn_preview").val("预览");
		$("#btn_save").val("保存");
		$("#title_dvbtn_edit").text("编辑");
		//--------------------------------------
		$("#title_v_source").text("来源：");
		$("#title_v_keywords").text("关键词：");
		$("#title_v_abstarct").text("摘要：");	
		$("#title_v_ref").text("【参考文献】");
	}
	else
	{
		$("#title_cate").text("Category");
		$("#title_title").text("Title");
		$("#title_author_signature").text("Author Signature");
		$("#title_author_org").text("Author Organization");
		$("#title_keywords").text("Keywords");
		$("#title_content").text("Content");
		$("#title_copyright").text("Copyrights");
		$("#title_isoriginal").text("Original");
		$("#title_copyright_comment").text("Statement");		
		$("#title_source").text("Source");
		$("#title_sourceurl").text("Source URL");
		$("#title_abstract").text("Abstract");
		$("#title_ref").text("Reference");
		$("#title_isdraft").text("Save As Draft");
		$("#title_userlock").text("Lock");
		$("#title_sharemode").text("Share mode");
		$("#title_expandeditarea").text("Expand editing area");
		$("#title_smalleditarea").text("Narrow editing area");
		$("#title_help").text("Help");
		
		$("#btn_preview").val("Preview");
		$("#btn_save").val("Save");
		$("#title_dvbtn_edit").text("Edit");
		//--------------------------------------
		$("#title_v_source").text("Source: ");
		$("#title_v_keywords").text("Keywords: ");
		$("#title_v_abstarct").text("Abstract: ");
		$("#title_v_ref").text("[Reference] ");
	}
}

// JavaScript Document
// Wiki 中的原文内容格式化为 HTML 编码
//---------------------------------------------
function WikiFormat(cString)
{
    if (cString.substring(0,13).toLowerCase()=="doctype:index")
    {
        SetCurrentDocType("index"); // 将当前的文档类型设置为检索表类型
        cString = cString.substring(14);
        //alert("--"+cString);
        cString =  WikiIndexFormat(cString);
        //alert(cString);
        return cString;
    }
	cString = cString.replace(/ /mg,"&nbsp;");					// 保留空格
	cString = cString.replace(/^\*{3}/mg,"&nbsp;&nbsp;&nbsp;◎&nbsp;");		// *** 【缩进三格加◎】
	cString = cString.replace(/^\*{2}/mg,"&nbsp;&nbsp;○&nbsp;");  			// ** 【缩进两格加○】
	cString = cString.replace(/^\*/mg,"&nbsp;●&nbsp;");				// * 【缩进一格加●】
	cString = cString.replace(/\n-{4,}\n/mg,"\n<hr size='1' />\n");			// ---- 【4个短横线变成水平线】
	cString = cString.replace(/('')(.*?)('')/mg, "<b>$2</b>");			// ''XX''【两个英文单引号变成加粗】
	cString = cString.replace(/(==)(.*?)(==)/mg, "<strike>$2</strike>");		// ==XX==【连续两个等号括起来代表删除线】
	cString = cString.replace(/(__)(.*?)(__)/mg, "<u>$2</u>");			// __XX__【连续两个下划线括起来代表加下划线】
	cString = cString.replace(/(\/\/)(.*?)(\/\/)/mg, "<em>$2</em>");		// //XX//【//括起来代表斜体】	
	cString = cString.replace(/(~~)(.*?)(~~)/mg, "<sub>$2</sub>");			// ~~XX~~【~~括起来代表下标】
	cString = cString.replace(/(\^)(.*?)(\^)/mg, "<sup>"+"$2</sup>");		// ^^XX^^【^^括起来代表上标】
	
	// [google[Wiki]]【google词条解释】
	// [wiki[Wiki]]【wiki词条解释】
	// [[Wiki]]【CFH词条解释】
	// [hdwiki[Wiki]]【互动百科词条解释】
	// [baidu[Wiki]]【百度知道解释】 --- 中文词URL不能识别
	
	cString = cString.replace(/(\[google\[)([^\n\r\|]+)(\]\])/mg, "<a class=\"wikilink\" href='http://www.google.cn/search?q=$2' title=\"点击查看google解释\">$2</a>");  	
	cString = cString.replace(/(\[wiki\[)([^\n\r\|]+)(\]\])/mg, "<a class=\"wikilink\" href='http://zh.wikipedia.org/w/index.php?title=$2' title=\"点击查看wiki解释\">$2</a>");
	cString = cString.replace(/(\[baidu\[)([^\n\r\|]+)(\]\])/mg, "<a class=\"wikilink\" href=\"http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&lm=0&fr=search&word=$2\" title=\"“百度知道”解释\">$2</a>"); 
	cString = cString.replace(/(\[hdwiki\[)([^\n\r\|]+)(\]\])/mg, "<a class=\"wikilink\" href='http://www.hudong.com/wiki/$2' title=\"点击查看“互动百科”解释\">$2</a>"); 
	cString = cString.replace(/(\[\[)([^\n\r\|]+)(\]\])/mg, "<a class=\"wikilink\" href='"+_WebRoot+"/wiki/word.aspx?w=$2' title=\"CFH百科解释\">$2</a>"); 
	
	// [[草本|http://www.126.com]]
	cString = cString.replace(/(\[\[)(.+)(\|)(.+)(\]\])/mg, "<a class=\"link\" href=\"$4\" title=\"打开链接\">$2</a>");		
	
	//	普通图像: [img[陈建平|http://wuk.plantlib.net/attachments/month_0606/n2006610154018.jpg]]
	cString = cString.replace(/(\[)([\>]+)(img\[)([^\[\n\r]+)(\|)([^\[\n\r]+)(\]\])/mg, "<img src='$6' alt='$4' align='right' class='WikiInlineImg' />");
    cString = cString.replace(/(\[)([\<]+)(img\[)([^\[\n\r]+)(\|)([^\[\n\r]+)(\]\])/mg, "<img src='$6' alt='$4' align='left'class='WikiInlineImg' />");
    cString = cString.replace(/(\[)(img\[)([^\[\n\r]+)(\|)([^\[\n\r]+)(\]\])/mg, "<img src='$5' alt='$3' class='WikiInlineImg' />");
    
    //  表情
    cString = cString.replace(/\[Happy\]/mg, "<span class='Smilies_Happy'>&nbsp;</span>");
    cString = cString.replace(/\[Angry\]/mg, "<span class='Smilies_Angry'>&nbsp;</span>");
    cString = cString.replace(/\[Sad\]/mg, "<span class='Smilies_Sad'>&nbsp;</span>");
    cString = cString.replace(/\[Surprised\]/mg, "<span class='Smilies_Surprised'>&nbsp;</span>");
    cString = cString.replace(/\[Cool\]/mg, "<span class='Smilies_Cool'>&nbsp;</span>");
    cString = cString.replace(/\[Love\]/mg, "<span class='Smilies_Love'>&nbsp;</span>");
    cString = cString.replace(/\[Question\]/mg, "<span class='Smilies_Question'>&nbsp;</span>");
    cString = cString.replace(/\[Warning\]/mg, "<span class='Smilies_Warning'>&nbsp;</span>");
    
    
    cString = cString.replace(/\[喜\]/mg, "<span class='Smilies_Happy'>&nbsp;</span>");
    cString = cString.replace(/\[怒\]/mg, "<span class='Smilies_Angry'>&nbsp;</span>");
    cString = cString.replace(/\[哀\]/mg, "<span class='Smilies_Sad'>&nbsp;</span>");
    cString = cString.replace(/\[惊\]/mg, "<span class='Smilies_Surprised'>&nbsp;</span>");
    cString = cString.replace(/\[酷\]/mg, "<span class='Smilies_Cool'>&nbsp;</span>");
    cString = cString.replace(/\[爱\]/mg, "<span class='Smilies_Love'>&nbsp;</span>");
    cString = cString.replace(/\[问\]/mg, "<span class='Smilies_Question'>&nbsp;</span>");
    cString = cString.replace(/\[警\]/mg, "<span class='Smilies_Warning'>&nbsp;</span>");
    

	//  照片:[photo[title|guid:xxx]] 
	cString = cString.replace(/(\[\photo\[)([^|\n\r\[\]]+)(\|guid:)([^\[\]\n\r]+)(\]\])/mg, "<a href='"+_WebRoot+"/photoview/guid/$4'><img src='"+_WebRoot+"/photolink/guid/$4.Thumbnail' alt='$2' /></a>");
	
	//  相册: [album[title|guid:xxx]]
	cString = cString.replace(/(\[\album\[)([^|\n\r\[\]]+)(\|guid:)([^\[\]\n\r]+)(\]\])/mg, "<a href='"+_WebRoot+"/albumview/guid/$4'><img src='"+_WebRoot+"/albumlink/guid/$4.Thumbnail' alt='$2' /></a>");
	
	//  mp3: [mp3[title|url:xxx]]  <SPAN class="mp3" id="dy" url="mp3/dy.mp3" onclick="ShowMp3(this);">毒药</SPAN>
	cString = cString.replace(/(\[\mp3\[)([^|\n\r\[\]]+)(\|url:)([^\]]+)(\]\])/mg, "<span class='mp3' url='$4' onclick='ShowMp3(this);' >$2</a></span>");

	//  media: [media[title|url:xxx]] <a class="media" href="media/test.flv">FLV</a> <br />
	cString = cString.replace(/(\[\media\[)([^|\n\r\[\]]+)(\|url:)([^\[\]\n\r]+)(\]\])/mg, "<a class='media' href='$4'>$2</a>");

	// @@color(颜色代码):文字@@
	cString = cString.replace(/(\@\@color\()(#[^\@\@]*)(\):)([^\@\@]*)(\@\@)/mg,"<span style='color:$2'>$4</span>");
	// @@bgcolor(颜色代码):文字@@
	cString = cString.replace(/(\@\@bgcolor\()(#[^\@\@]*)(\):)([^\@\@]*)(\@\@)/mg,"<span style='background-color:$2'>$4</span>");
	
	/* 对应 h1 --  h5
	!标题 1
	!!标题 2
	!!!标题 3
	!!!!标题 4
	!!!!!标题 5
	*/
	
   	/*  隐藏的内容(作者编辑了1半,临时隐藏)
	/% 不想被看到的內容 %/
	*/
	cString = cString.replace(/(\/\%)(.*?)(\%\/)/mg,"");
	
    /*
	    其他待加入的功能：
	    表情符[微笑]、[鬼脸]...
	    常用图标...
	*/
	
    
    /*  源码方式: 这期间的代码会不会已经被别的处理器处理过了？
	{{{
	}}}
	*/
	cString = cString.replace(/({{{)([^{{{}}}]*)(}}})/mg,"<pre>$2</pre>");
	
	/* 引用时的缩排
	<<<
	第一個文章段落…
	<<<
	*/
	cString = cString.replace(/(<<<)([^<<<]+)(<<<)/mg,"<BLOCKQUOTE>$2</BLOCKQUOTE>");
   
   	// 段落处理
	cString = cString.replace(/\n(.*)\n/mg,"<p>$1</p>");	// 换行会被自动转换为段落
	cString = cString.replace(/\n/mg,"<br />");	// 换行会被自动转换为 <br />

	return cString;
}

function ViewDoc()
{
	var currentLanguage = $("select[name=Lang] option:selected").val();
	
	$("#view_Title").html($("#Title").val());
	
	$("#DocURL").text(_WebRoot+"/"+$("#Id").val()+"@"+$("#Author").val()+".blogdoc");
	var v_Author_Signature = $("#Author_Signature").val();
	if (IsNotEmptyString(v_Author_Signature))
	{
		$("#view_Author_Signature").html("<a href='"+GetUserInfoUrl($("#Author").val())+"'>"+v_Author_Signature+"</a>");
		$("#view_Author_Signature").show();
    }
    else
    {
        $("#view_Author_Signature").html("");
        $("#view_Author_Signature").hide();
    }
    
	$("#view_UpdateTime").html($("#UpdateTime").val());
	
	var v_AuthorOrg_Signature=$("#AuthorOrg_Signature").val();
	if (IsNotEmptyString(v_AuthorOrg_Signature))
	{
	    $("#view_AuthorOrg_Signature").html("(<a href='http://www.hudong.com/wiki/"+$("#AuthorOrg_Signature").val()+"'>"+v_AuthorOrg_Signature+"</a>)");
	}
	else
	{
	    $("#view_AuthorOrg_Signature").html("");
	    $("#view_AuthorOrg_Signature").hide();
	}
	
	if ($("#IsOriginal").attr("checked"))
	{
		if (currentLanguage=="Zh")
			$("#view_IsOriginal").html("原创");
		else
			$("#view_IsOriginal").html("Original");
		$("#view_SourceUrl").html("");
		$("#view_Source").html("");
	}
	else
	{
		if (currentLanguage=="Zh")
			$("#view_IsOriginal").html("引用自");
		else
			$("#view_IsOriginal").html("Citing ");
		
		$("#view_SourceUrl").html("<a href='"+$("#SourceUrl").val()+"'>"+ $("#SourceUrl").val() +"</a>");
		$("#view_Source").html("<a href='"+$("#SourceUrl").val()+"'>"+ $("#Source").val() +"</a>");
	}
		
    var v_Abstract = $("#Abstract").val();
    if (IsNotEmptyString(v_Abstract))
    {
	    $("#view_Abstract").html(v_Abstract);
	    $("#view_Abstract_line").show();
	}
	else
	{
	    $("#view_Abstract_line").hide();
	}
	
	var v_KeyWords = $("#KeyWords").val();
	if (IsNotEmptyString(v_KeyWords))
	{
		$("#view_KeyWords").html(v_KeyWords);
		$("#view_keywords_line").show();
	}
	else
	{
	    $("#view_keywords_line").hide();
	}
	
	$("#view_Content").html(WikiFormat($("#Content").val()));
	
	var v_view_Reference = $("#Reference").val();
	if (IsNotEmptyString(v_view_Reference))
	{
		$("#view_Reference").html(WikiFormat(v_view_Reference));
		$("#view_Reference").show();
		$("#title_v_ref").show();
	}
	else
	{
		$("#view_Reference").hide();
		$("#title_v_ref").hide();	    
	}
	
	if ($("#CopyrightString").val().length>2)
		$("#view_CopyrightString").html("<div class='copyrightString'>"+$("#CopyrightString").val()+"</div>");
	else
		$("#view_CopyrightString").html("");
	
	$("#DocView").show(); 
	
	/*  自动执行的动作    */
	if (GetCurrentDocType()=="article")
	{
	    $(".media").media(); // 自动打开所有的 Media
	    ResizeWikiImg();
	}
	if (GetCurrentDocType()=="index")
	{
	    //ShowIndexEntry();  /* 仅仅显示第一小节 */
	    ActiveLink();	
	}	
	
	$("#DocEditor").hide();
}

function EditDoc()
{
	$("#DocView").hide("slow"); 
	$("#DocEditor").show("slow");
}

function ShowMsg(cMsg)
{
	alert(cMsg);
}

/*
    从编辑器当中重新取得JSON的Doc对象
*/
function GetDocFromEditor()
{
/*
  "AppName": "Blog",
  "AppEntryId": "Bruce_Blog",
  "Id": "doc01",
  "Title": "央视配楼大火",
  "ContentFormat": "COWiki",
  "Content": "",
  "Author": "bruce",
  "PostIP": "192.168.248.128",
  "UpdateTime": "\/Date(1234866412000+0800)\/",
  "Audit": {
    "AuditMark": 2,
    "AuditMsg": "",
    "Auditor": "",
    "AuditTime": "\/Date(1234866412000+0800)\/"
  },
  "HasDeleted": false,
  "Author_Signature": "警告",
  "AttachPhoto": false,
  "AttachMovie": false,
  "AttachAudio": false,
  "AttachFile": false,
  "Category": "BruceBlogCate01",
  "Tags": "",
  "Copyright": {
    "IsOriginal": true,
    "Source": "",
    "SourceUrl": "",
    "CopyrightString": ""
  },
  "ShareMode": 0,
  "Password": "",
  "Lang": 2,
  "KeyWords": "",
  "Abstract": "",
  "Reference": "",
  "IsDraft": false,
  "IsAuthorLocked": false,
  "CreateTime": "\/Date(1234800000000+0800)\/",
  "HotIndex": 0,
  "IsElite": false,
  "AuthorOrg_Signature": "XXX"
*/
    var jsonDoc = 
    {
        AppName:$("#AppName").val(),
        AppEntryId:$("#AppEntryId").val(),
	    Category: $("#Category").val(),
	    Id:$("#Id").val(),
	    Title : $("#Title").val(),
	    Author:$("#Author").val(),
	    PostIP:$("#PostIP").val(),
	    UpdateTime:$("#UpdateTime").val(),
	    Author_Signature:$("#Author_Signature").val(),
	    AuthorOrg_Signature:$("#AuthorOrg_Signature").val(),
	    KeyWords:$("#KeyWords").val(),
	    IsOriginal:$("#IsOriginal").attr("checked"),
	    CopyrightString:$("#CopyrightString").val(),
	    Source:$("#Source").val(),
	    SourceUrl:$("#SourceUrl").val(),
	    Content:$("#Content").val(),
	    Abstract:$("#Abstract").val(),
	    Reference:$("#Reference").val(),
	    ShareMode:$("#ShareMode").val(),
	    IsDraft:$("#IsDraft").attr("checked"),
	    IsAuthorLocked:$("#IsAuthorLocked").attr("checked"),
	    CreatTime:"",
	    IsElite:false,
	    Tags:""
    };
    return jsonDoc;
}

// 提交内容
function SubmitDoc()
{
    var doc = {
			    Appname:$("#AppName").val(),
				Appentryid:$("#AppEntryId").val(),
				Category:$("#Category").val(),
				Id:$("#Id").val(),
				Title:$("#Title").val(),
				Author:$("#Author").val(),
				Author_signature: $("#Author_Signature").val(),
				AuthorOrg_signature:$("#AuthorOrg_Signature").val(),
				Keywords:$("#KeyWords").val(),
				IsOriginal:$("#IsOriginal").attr("checked"),
				CopyrightString:$("#CopyrightString").val(),
				Source:$("#Source").val(),
				SourceUrl:$("#SourceUrl").val(),
				Contentformat:$("#ContentFormat").val(),
				Content:$("#Content").val(),
				Abstract:$("#Abstract").val(),
				Reference:$("#Reference").val(),
				ShareMode:$("#ShareMode").val(),
				IsDraft:$("#IsDraft").attr("checked"),
				IsAuthorlocked:$("#IsAuthorLocked").attr("checked")
		   };
    SaveDoc(doc);
}


	
function ShowMp3(spanObj)
{
	if ($(spanObj).html().substring(1,7).toLowerCase()=="object") 
	{ 
		//alert("已经有了控件!");
		return;
	}
	else
	{ 
		$(spanObj).jmp3({ backcolor: '000000',	forecolor: '00ff00', width: 100, showdownload: 'true'}); 
	}
	
}	


/*
下载当前文档的 PDF 版本
*/
function DownloadPdf()
{
	alert("下载PDF");
}
/*
下载当前文档的 Word 版本
*/
function DownloadWord()
{
	alert("下载Word");
}

function resizeImage(img)
{
    var width = 500;
	var image=new Image(); 
	image.src=img.src; 
	var temp = image.width;
	img.width = temp = (temp>width)?width:temp;
	img.style.display = "inline";
}

function ResizeWikiImg()
{
    if ($.browser.version==6&&$.browser.msie) 
    {  
       $(".WikiInlineImg").each(function(){ resizeImage(this); });
    }
}

/***************************************************************

    植物检索表功能

****************************************************************/
function ActiveLink()
{
	$(".index_link_label").click(function(){hightListSection($(this).attr("IndexName"),$(this).attr("tableid"),$(this).attr("rowid"),$(this).text());});
	$(".index_link_url").click(function(){skiptoUrl($(this).attr("url"),$(this).text());});
	$(".index_sn").click(function(){ActiveSection($(this).parents(".IndexSection").attr("id"));});
	$(".index_desc").click(function(){ActiveSection($(this).parents(".IndexSection").attr("id"));});
	
}
function ActiveSection(cSection)
{
	$("#"+cSection+" tr").show();
	$("#"+cSection).show();
	$("#"+cSection).css("background-color","#cf6");
	// 隐藏此节后面的所有小节
	$("#"+cSection).nextAll().hide();	
}
function hightListSection(cIndexName,cTableId,cRowId,cTarget)
{
	$("table").css("background-color","");

	$("#"+cIndexName+"_"+cTableId+" tr").hide();
	$("#"+cIndexName+"_"+cTableId+"_"+cRowId).show();
	
	/*  在不隐藏其他小节时，可以采用在页面节点之间滑动滑动显示
    var targetOffset = $("#"+cIndexName+"_"+cTarget).offset().top;
    $('html,body').animate({scrollTop: targetOffset-20}, 500);
	*/
	
	ActiveSection(cIndexName+"_"+cTarget);
}
/*
    function ShowIndex(cContainerDOMId)
    {
	    var IndexGUID = getGuid();
	    var resultWiki = "<div class=\"WikiIndex\" id=\""+IndexGUID+"\">";
	    resultWiki += WikiIndexFormat(IndexGUID,raw_Content);
	    resultWiki += "</div>";

	    $("#"+cContainerDOMId).html(resultWiki);
	    ShowIndexEntry(IndexGuid);
	    ActiveLink();
    }
*/
function skiptoUrl(cUrl,cTitle)
{
	location.href=cUrl;
}
/*
	显示检索表的入口
*/
function ShowIndexEntry()
{
	// $("#"+cIndexName+"_1").show();
	var cSection = $(".WikiIndex").attr("id")+"_1";
	ActiveSection(cSection);
}
/*
	显示检索表的全部条目
*/
function ShowAllEntrys(cIndexName)
{
	$("#"+cIndexName+" table tr").show();
	$("#"+cIndexName+" table").show();
}
function WikiIndexFormat(cString)
{
	// level: (属|Genus|genus|...)

	// 可选的信息		
	// author:张三
	// desc:检索表的描述信息
	
	// DocType:Index
	
	var cIndexName = getGUID();
	//alert(cIndexName);
	
	// !Title
	cString = cString.replace(/^!(.+)$/mg,'<table width="100%"><tr><td class="index_title">$1</td></tr></table>');
	// root:[[caption|id:0231]]   // 1b XXXX***[[CName|Name]]
	cString = cString.replace(/^root:\[\[([^\n\r\]]+)\|([^\n\r\]]+)\]\]$/mg,'<table class="index_cmdpanel" width="100%"><tr><td class="index_root_title">($1<span class="link_taxon">分类系统</span><span class="link_wiki">Wiki</span>)</td><td><span class="link_cmd" onclick="ShowAllEntrys(\''+cIndexName+'\');">显示全部</span><span class="link_cmd" onclick="ActiveSection(\''+cIndexName+"_1"+'\');">重新开始</span></td></tr></table>');
	
	// 1a XXXX***2 
	cString = cString.replace(/^(\d+)a\s+([^\n\r\*]+)(:?\*{3})(\d+)$/mg,'<table class="IndexSection" border="0" cellspacing="0" cellpadding="0" id="'+cIndexName+'_$1"><tr id="'+cIndexName+'_$1_a"><td width="50" class="index_sn">$1</td><td class="index_desc">$2</td><td width="10">&nbsp;</td></tr><tr><td>&nbsp;</td><td class="index_target" align="right"><span class="index_link_label" IndexName="'+cIndexName+'" tableid="$1" rowid="b">$4</span></td><td>&nbsp;</td></tr>');
	// 1a XXXX***[[CName|id:2564]]
	cString = cString.replace(/^(\d+)a\s+([^\n\r\*]+)(:?\*{3})\[\[([^\n\r\]]+)\|id:([^\n\r\]]+)\]\]$/mg,'<table class="IndexSection" border="0" cellspacing="0" cellpadding="0" id="'+cIndexName+'_$1"><tr><td width="50" class="index_sn">$1</td><td class="index_desc">$2</td><td width="10">&nbsp;</td></tr><tr><td>&nbsp;</td><td class="index_target" align="right"><span class="index_link_url" url="'+ _WebRoot +'/showsp.aspx?id=$5" tableid="$1" rowid="a">$4</span></td><td>&nbsp;</td></tr>');
	// 1a XXXX***[[CName|Name]]
	cString = cString.replace(/^(\d+)a\s+([^\n\r\*]+)(:?\*{3})\[\[([^\n\r\]]+)\|([^\n\r\]]+)\]\]$/mg,'<table class="IndexSection" border="0" cellspacing="0" cellpadding="0" id="'+cIndexName+'_$1"><tr><td width="50" class="index_sn">$1</td><td class="index_desc">$2</td><td width="10">&nbsp;</td></tr><tr><td>&nbsp;</td><td class="index_target" align="right"><span class="index_link_url" url="'+ _WebRoot +'/Spdb/spsearch.aspx?aname=$4" tableid="$1" rowid="a">$4</span></td><td>&nbsp;</td></tr>');
	
	// 1b XXXX***2
	cString = cString.replace(/^(\d+)b\s+([^\n\r\*]+)(:?\*{3})(\d+)$/mg,'<tr id="'+cIndexName+'_$1_b"><td width="50" class="index_sn">$1</td><td class="index_desc">$2</td><td width="10">&nbsp;</td></tr><tr><td>&nbsp;</td><td class="index_target" align="right"><span class="index_link_label" IndexName="'+cIndexName+'" tableid="$1" rowid="b">$4</span></td><td>&nbsp;</td></tr></table>');
	// 1b XXXX***[[CName|id:2564]]
	cString = cString.replace(/^(\d+)b\s+([^\n\r\*]+)(:?\*{3})\[\[([^\n\r\]]+)\|id:([^\n\r\]]+)\]\]$/mg,'<tr id="'+cIndexName+'_$1_b"><td width="50" class="index_sn">$1</td><td class="index_desc">$2</td><td width="10">&nbsp;</td></tr><tr><td>&nbsp;</td><td class="index_target" align="right"><span class="index_link_url" url="'+_WebRoot+'/showsp.aspx?id=$5" tableid="$1" rowid="b">$4</span></td><td>&nbsp;</td></tr></table>');
	// 1b XXXX***[[CName|Name]]
	cString = cString.replace(/^(\d+)b\s+([^\n\r\*]+)(:?\*{3})\[\[([^\n\r\]]+)\|([^\n\r\]]+)\]\]$/mg,'<tr><td width="50" class="index_sn">$1</td><td class="index_desc">$2</td><td width="10">&nbsp;</td></tr><tr><td>&nbsp;</td><td class="index_target" align="right"><span class="index_link_url" url="'+_WebRoot+'/showsp.aspx?name=$5" tableid="$1" rowid="a">$4</span></td><td>&nbsp;</td></tr></table>');
 
	cString = "<div class=\"WikiIndex\" id=\""+cIndexName+"\">"+cString+"</div>";
    
    
	return cString;
}
/*********      植物检索表功能结束      **************/

function SetCurrentDocType(cType)
{
    $("#DocType").val(cType);
}
function GetCurrentDocType()
{
    return $("#DocType").val();
}
