TOOLKIT={ };

TOOLKIT.createPopup = function(id, target) {
	if (TOOLKIT.current) return;
	var siteHolder = DOM.get('siteHolder');
	var popup = DHTML.structure({ cn: 'tkPopupH', e: { infoId: id }, s: [ { cn: 'tkClose', r: 'closeBox', e: { action: 'close' } }, { cn: 'tkHolder', r: 'holder' } ], c: TOOLKIT.PopupC } );
	var x = DHTML.pageX(target);
	var y = DHTML.pageY(target);
	
	siteHolder.appendChild(popup);
	popup.moveTo(x, y-165);
	
	TOOLKIT.current = true;
}

TOOLKIT.PopupC = function() {
	this.inherit(DHTML.Base);
	this.inherit(OO.Listener);
}
TOOLKIT.PopupC.prototype = {
	initSelf: function() {
		EVENT.attachEvents(this, 'click', this.closeSelf);	
		AJAX.handlerURL = '/page/toolkit/dialog.cfm';
		var request = AJAX.create(this);
		request.setTextHandler(this, this.ajaxResponse);
		request.send(0, { coToolKit_informationId: this.infoId });
	},
	
	ajaxResponse: function(p) {
		this.holder.innerHTML = p;
	},
	
	closeSelf: function(e) {
		if (e.target.action == 'close') {
			this.parentNode.removeChild(this);
			TOOLKIT.current = false;
			OO.dispose(this);
		}
	},
	
	disposeSelf: function() {
	
	}
}

