 /**  
 * @fileOverview "initEditor"
 * @author tan
 * @version 1.0  
 */  
 /**  
 * @author tan  
 * @constructor initEditor
 * @description "initEditor"
 * @date 2010-11-17
 * @since version 1.0 
 */ 
var initEditor=function(){
	 
	

	/**
	 * @description 加载编辑器
	 */
	this.lazyInitEditor=function(textareaId){
		setTimeout(function() 
				{  
			 		initXHEditor(textareaId);
			 	},0);  
	}
	
	
	
	 this.initXHEditor=function(textareaId){
		 
			$(textareaId).xheditor({
				skin:'o2007blue',
				tools:'subscript,Fullscreen,|,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,|,FontColor,BackColor,|,Removeformat,Align,List,Outdent,Indent,Link,Unlink,|,Img,Flash,Source,Map',
				upImgUrl:"uploadFile!uploadImage.action?immediate=1",
				upImgExt:"jpg,jpeg,gif,png",
				upFlashUrl:"uploadFile!uploadFlash.action",
				upFlashExt:"swf",
				upLinkUrl:'uploadFile!uploadAttr.action',
				upLinkExt:"doc,docx,xls,rar,zip,txt,pdf,gif,jpg,png,bmp,swf",
				showBlocktag:true,
				html5Upload:false,
				onUpload:insertUpload
				});
	 }
	 
	 
	 this.insertUpload=function(res){
		 
//		 
//		 var attrText=$('#attachments').text();
//		 
//		 
//		 if(attrText.indexOf("暂无附件")!=-1){
//			 
//			 $('#attachments').html("");
//		 }
//		 
//
//		 var fileExt=res.substring(res.indexOf(".")+1);
//		 var fileTypes="doc,docx,xls,rar,zip,txt,pdf";
//		 
//		 if(fileTypes.indexOf(fileExt)!=-1){
//			 $('#attachments').append(res+"<br/>");
//			 
//		 }
		 
	 }
	 
	 
 }();
 
