
function inlaypopup() {
	var structureElement;
	var _id;
	function closeAll() {
		for(var a = getElementsByClassName('inlaypopup'), i=0,j=a.length;i<j;i++) a[i].closePopup();
	}
}


inlaypopup.prototype = {
	setStructure: function(obj) {
		this.structureElement = obj;
	},
	show: function(pos_x, pos_y) {
		this._id = 'inlaypopup_' + parseInt(Math.random() * 1024);
		this.structureElement.id = this._id;	
		this.structureElement.className += ' inlaypopup';
		this.structureElement.style.left = pos_x+'px';
		this.structureElement.style.top = pos_y+'px';	
		this.structureElement.style.opacity = '0';
		this.structureElement.closePopup = function(instant) {	
			var morph = new Fx.Morph(this.id, {duration: 400});
			morph.start({
				opacity: 0
			});
			var a=this;
			if (!instant) {
				window.setTimeout(function() { a.parentNode.removeChild(a); },400);
			}
			else {
				a.parentNode.removeChild(a);
			}
		}
		document.body.appendChild(this.structureElement);
		var morph = new Fx.Morph(this._id, {duration: 400});
		morph.start({opacity: [0,1]});
		return this._id;
	},
	closeAll: function(instant) {
		for(var a = getElementsByClassName('inlaypopup'), i=0,j=a.length;i<j;i++) a[i].closePopup(instant);
	}
}


