﻿AV.EditorPanel=Ext.extend(Ext.Container,{
	hidden: false,
	
	initComponent: function() {

		this.labelCt=new Ext.Container({
			cls: "x-form-item-label",
			html: this.label
		});

		this.spellObj=new Ext.form.Hidden({
			name: "txtSpell"+this.type
		});

		this.hiddenDesc=new Ext.form.Hidden({
			name: this.valuefield,
			value: this.text
		});

		this.textArea=new Ext.form.TextArea({
			id: "txt_"+this.type,
			value: this.text,
			hideLabel: true,
			listeners: {
				render: {
					fn: function(obj) {
						var n=obj.el.dom;
						while(n.className.indexOf("x-form-item")=== -1&&n.className.indexOf("x-btn")=== -1) {
							if(Ext.get(n).dom.type==="form") {
								return;
							} else {
								Ext.get(n).setStyle("margin-bottom","0px");
								Ext.get(n).setStyle("height","0px");
								n=n.parentNode;
							}
						}
					},
					scope: this
				}
			}
		});

		this.editorCt=new Ext.Container({
			autoEl: {
				tag: "div",
				style: "height:90%;width:auto;margin-bottom:5px;",
				id: "div_"+this.type+"Target"
			}
		});

		this.editorCtText=new Ext.Container({
			autoEl: {
				tag: "div",
				id: "div_"+this.type,
				html: "You must have the latest versions of Internet Explorer or Mozilla Firefox to use this editor."
			}
		});

		Ext.apply(this,{
			layout: "form",
			hidden: this.hidden,
			items: [
				this.labelCt,
				this.spellObj,
				this.hiddenDesc,
				this.textArea,
				this.editorCt,
				this.editorCtText
			]
		});

		AV.EditorPanel.superclass.initComponent.apply(this,arguments);
	}
});