/**
 * @author Raymond Chau raymond.chau@ionglobal.com
 */

/**
 * Panel is an abstract class to represent any panel display objects on the page 
 * @constructor
 * @param {string} id  ID of the HTML element
 */
Panel = function(id) {    
  /**
   *  @type object
   */
   try
   {
	this.container = document.getElementById(id);
	
	this.container.timer = null;
	this.container.style.visibility = "hidden";
				
	addEvent(this.container, 'mouseover', this.show);
	addEvent(this.container, 'mouseout', this.hide);
   }
   catch (e)
   {
   }
}

Panel.prototype = {  
  /**
   * Show the panel display object
   */
	show : function()  {	
	  var container = (this.container) ? this.container : this;	  
		var visibility = container.style.visibility;
		
		container.style.visibility = "visible";
		window.clearTimeout(container.timer);
	},
	/**
   * Hide the panel display object
   */
	hide : function()  {
	  var container = (this.container) ? this.container : this;
		var visibility = container.style.visibility;		
		var setHidden = function() { 
      container.style.visibility = "hidden"; 
    };
		
		container.timer = window.setTimeout(setHidden, 1000);
	}
}

