
function listBox(id){
    var _this = this
	this.obj = null;
	this.contentItems = null
	this.contentMain = null
	this.selectedItem = null;
	this.visibility = false
	this.eventTimeHandler=null;
	this.mouseout
	this.events=({
	    mouseout:function()
	            {
	                if(_this.eventTimeHandler)
	                {
	                    window.clearTimeout(_this.eventTimeHandler);
	                    _this.eventTimeHandler=null;
	                }
	                _this.eventTimeHandler=window.setTimeout(function(){_this.contentShow(false);_this.eventTimeHandler=null},1000);
	            },
	    mouseover:function()
	            {
	                
	                window.clearTimeout(_this.eventTimeHandler);
	                _this.eventTimeHandler=null;
	            }
	            })
	this.contentShow = function (bool) {
	        if(bool){this.updatePos()};
	        this.contentItems.style.display = bool ? "block" : "none";
	        this.visibility = bool;
		}
	this.updatePos = function (){
		with(this.contentItems){
			style.top = this.contentMain.offsetHeight+this.contentMain.getBoundingClientRect().top-3+"px"
			style.position = "fixed" 
			style.left = this.contentMain.getBoundingClientRect().left+"px"
			style.width = this.contentMain.offsetWidth+"px"
			style.height = "100px"
			}
		}
	this.init = function (){
		this.obj = document.getElementById(id);
			for(var i=0;i<this.obj.childNodes.length;i++){
				if(this.obj.childNodes[i].className){
					if(this.obj.childNodes[i].className.toUpperCase()=="CONTENTMAINCUSTOMDROPLIST"){
						this.contentMain = this.obj.childNodes[i]
					}else if(this.obj.childNodes[i].className.toUpperCase()=="CONTENTITEMSCUSTOMDROPLIST"){
						this.contentItems = this.obj.childNodes[i]
					}
				}
				
			}
		
		
		listen("click",this.contentMain,function() {_this.contentShow(true);_this.contentItems.focus()})
        listen("blur",this.contentItems,function() {window.setTimeout(function(){_this.contentShow(false)},500)})
        listen("click",this.contentItems,function() {_this.contentShow(false);})
        
    
        listen("mouseover",this.contentItems,function(){_this.contentShow(true);_this.events.mouseover()})
        listen("mouseover",this.contentMain,function(){_this.events.mouseover()})
        listen("mouseout",this.contentItems,function(){_this.events.mouseout()})
		
		
		if(ToolKit.navegadorIsGecko){listen("resize",window,function() {_this.updatePos()})}
		if(ToolKit.navegadorIsGecko){listen("scroll",window,function() {_this.updatePos()})}
		
		this.contentItems.style.overflowX = "hidden"
		this.contentItems.style.overflowY = "scroll"
		this.contentShow(false);
		this.updatePos();
		}
	}

