// JavaScript Document
function TextFieldMenu(textfield){
	var self = this;//
	var popup = window.createPopup();
	var popDocument = popup.document;
	var component = popDocument.createElement("DIV");
	popDocument.body.appendChild(component);
	var textField = textfield;

	/**
	* 设置为可见
	*/
	this.open = function(){
		x = window.screenLeft + textField.getBoundingClientRect().left;
		y = window.screenTop + textField.getBoundingClientRect().top;
		popup.show(x + 1,y + textField.clientHeight + 3,textField.clientWidth + 2,92);
	}
	
	/**
	* 设置为不可见
	*/
	this.close = function(){
		popup.hide();
	}
	
	/**
	* 返回创建在popup中指定标记的元素
	* lable - 指定标记 如:DIV,TABLE等
	*/
	this.createElement = function(lable){
		try{
			return popDocument.createElement(lable);
		}
		catch(e){
			return null;
		}
	}
	
	/**
	* 获取面板容器,这里是DIV对象.
	*/
	this.getComponent = function(){
		return component;
	}
	
	/**
	* 初始化
	*/
	this.init = function(){
		component.style.cssText = "width:100%; height:100%; border:1px solid #666666; background-color: #FFFFFF;";
		textField.onpropertychange = function(){
			if(self.onChange){
				self.onChange(textField.value);
			}
		}
	}
	this.init();
}
