var PopupManager = {
	CONST_OPENLINKCLASS: 'openpopup',
	CONST_CLOSELINKCLASS: 'close',
	
	open: function(popupel) {
		Element.setStyle(popupel, {display: 'block'});
	},
	
	close: function(popupel) {
		Element.setStyle(popupel, {display: 'none'});
	},
	
	setUpOpenEvents: function(parent) {
		var openlinks = document.getElementsByClassName(this.CONST_OPENLINKCLASS, parent||document);
		for ( i=openlinks.length-1; i>=0; i-- ) {
			var linkoobj = $(openlinks[i]);
			if ( linkoobj ) {
				var popupel = $(linkoobj.rel);
				this.setUpCloseEvents(popupel);
				Event.observe(linkoobj, 'click', this.open.bind(this, popupel), false);
			}
		}
	},
	
	setUpCloseEvents: function(popupel) {
		var closelinks = document.getElementsByClassName(this.CONST_CLOSELINKCLASS, popupel||document);
		for ( j=closelinks.length-1; j>=0; j-- ) {
			var linkcobj = $(closelinks[j]);
			if ( linkcobj ) {
				Event.observe(linkcobj, 'click', this.close.bind(this, popupel), false);
			}
		}
	},
	
	openOnLoad: function(popupid) {
		var popupel = $(popupid);
		this.setUpCloseEvents(popupel);
		this.open(popupel);
	}
}
//Event.observe(window, 'load', PopupManager.openOnLoad.bind(PopupManager, 'floatSpot'), false);

var DisclaimerLink = {
	openLink: function(link, target, disclaimer) {
		if ( confirm(disclaimer) )
			if ( target=='blank' )
				window.open(link);
			else
				document.location.href=link;
	}
}