var dropDown = Class.create();
dropDown.prototype = {

	initialize : function (elem)
	{
		this.dropdown = elem;
		
		this.button = this.dropdown.getElementsByClassName('selectbutton')[0];
		this.optionBox = this.dropdown.getElementsByClassName('options')[0];
		
		this.myInterval = null;
		this.writeEvents();
	},
	
	writeEvents : function ()
	{

		this.button.observe('click', this.openOptions.bind(this));
	},
	
	openOptions : function ()
	{
		this.optionBox.style.display = 'block';
		this.optionBox.onmouseover = this.setMouse.bind(this);
	},
	
	setMouse : function ()
	{
		this.optionBox.onmouseout = this.intervalClose.bind(this);
		if(this.myInterval != null)
		{
			this.clearInterval(); 
		}
		
	},
	
	intervalClose : function ()
	{
		this.myInterval = window.setInterval(this.closeOptions.bind(this), 1000);
	},
	
	closeOptions : function ()
	{
		this.optionBox.style.display = 'none';
		this.clearInterval(); 
	},
	
	clearInterval : function ()
	{
		clearInterval(this.myInterval);
		this.myInterval = null;
	}

}



