/*
 * 文本输入组件，对input[type="text"]和textarea的封装，用以实现特定接口
 */
Fangbole.Textbox = Class.create({
	initialize: function(options){
		this.options = Object.extend({
			multiline: false,
			elementAttributes: null
		}, options || {})
		
		if(!this.options.multiline){
			var elAttrs = Object.extend({
				type: 'text',
				className: 'g_txt'
			}, this.options.elementAttributes || {});			
			this.element = new Element('input', elAttrs);
		}else{
			this.element = new Element('textarea', this.options.elementAttributes || {});
		}
	},
	setValue: function(value){
		this.element.value = value;
	},
	getValue: function(){
		return this.element.getValue();
	},
	render: function(element){
		element = Object.isElement(element) ? element : $(element);
		element.insert(this.element);
	},
	focus: function(){
		this.element.select();
	},
	clear: function(){
		this.element.value = '';
	}
})
