var langSelector = Class.create();
langSelector.prototype = {

	initialize : function (elems)
	{
		this.dropdown = elems;
		
		this.button = this.dropdown.getElementsByClassName('lang_select_button')[0];
		this.button2 = this.dropdown.getElementsByClassName("lang_current")[0];
		this.optionBox = this.dropdown.getElementsByClassName('options')[0];
		
		this.myInterval = null;

		this.button.observe('click', this.openOptions.bind(this));
		this.button2.observe('click', this.openOptions.bind(this));
		//this.button.observe('mouseover', this.openOptions.bind(this));
		//this.button2.observe('mouseover', this.openOptions.bind(this));
	},
	
	openOptions : function ()
	{
		if (this.optionBox.style.display == 'block') {
			this.closeOptions();
		} else {
			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), 500);
	},
	
	closeOptions : function ()
	{
		this.optionBox.style.display = 'none';
		this.clearInterval(); 
	},
	
	clearInterval : function ()
	{
		clearInterval(this.myInterval);
		this.myInterval = null;
	}



}


