if (!Pure) var Pure={};


Pure.NavigatorPopup = function(element) {
	this.base = $id(element);
	this.pop = $class('inner_popup',this.base)[0];
	this.menu = $class('popup_menu',this.base)[0];
	this.addBehavior();
	this.open = false;
}

Pure.NavigatorPopup.prototype.addBehavior = function() {
	var self = this;
	this.pop.onclick = function(e) {self.showMenu();Atira.Event.stop(e)};
	this.hider = function(e) {
		self.hideMenu();
	};
	this.menu.onclick = function(e) {Atira.Event.stop(e)};
}

Pure.NavigatorPopup.prototype.showMenu = function() {
	this.menu.style.display = 'block';
	this.menu.style.top = (Atira.Element.getTop(this.base)+Atira.Element.getHeight(this.base)-1)+'px';
	//this.menu.style.left = Atira.Element.getLeft(this.base)+'px';
	Atira.Event.addListener(document.body,'click',this.hider);
	this.open = true;
	var self = this;
	this.pop.onclick = function(e) {self.hideMenu();Atira.Event.stop(e)};
}

Pure.NavigatorPopup.prototype.hideMenu = function() {
	this.menu.style.display = 'none';
	Atira.Event.removeListener(document.body,'click',this.hider);
	this.open = false;
	var self = this;
	this.pop.onclick = function(e) {self.showMenu();Atira.Event.stop(e)};
}