var Disclaimer = Class.create();
Disclaimer.prototype = {
	initialize: function() {

		var oBody = document.getElementsByTagName("body").item(0);

		// Add overlay
		var oOverlay = document.createElement("div");
		oOverlay.onclick = function() { MyDisclaimer.end(); return false; }
		oOverlay.setAttribute( 'id','overlay' );
		oOverlay.style.display = 'none';
		oBody.appendChild( oOverlay );

		// Resize overlay to full browser
		var aSize = getPageSize();
		oOverlay.style.width = aSize[0] + 'px';
		oOverlay.style.height = aSize[1] + 'px';	

		// Fade in overlay
		new Effect.Appear('overlay', { duration: 0.5, from: 0.0, to: 0.5 });

		// Add disclaimer frame
		this.oDisclaimer = document.createElement( 'div' );
		this.oDisclaimer.setAttribute( 'id', 'disclaimer' );
		oBody.appendChild( this.oDisclaimer );

		// Add HTML to login screen
		//new Ajax.Request('templates/tpl.disclaimer.html', {
		new Ajax.Request('ajax/html_disclaimer.php', {
			onSuccess: this.onHtmlSuccess,
			onFailure: this.onHtmlFailure } );
	},
	
	onHtmlSuccess: function( p_oResult ) {
		$('disclaimer').update( p_oResult.responseText );
		$('close').onclick = function() { MyDisclaimer.end(); return false; }
	},

	onHtmlFailure: function() {
	},

	end: function() {
		// Remove the login overlay.
		Element.remove( 'disclaimer' );
		new Effect.Fade( 'overlay', {duration: 0.3} );
	},

}