// JavaScript Document

function cPopup(pLayer, pTop) {
	
	this.initialiseer = function() 
	{
		sLayer = pLayer;
		nTop = pTop;
		action = true;
		opacity= 0.8;
		frame = '';
	}
	
	this.LoadScreen = function(sId)
	{
		if(action) {
			action = false;
			frame = sId;
			var xScroll, yScroll;
			if (self.pageYOffset) {
				yScroll = self.pageYOffset;
				xScroll = self.pageXOffset;
			} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
				xScroll = document.documentElement.scrollLeft;				
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
				xScroll = document.body.scrollLeft;	
				
			}
			arrayPageScroll = new Array(xScroll,yScroll);	
			new Effect.Fade(sLayer, { 
				from: 0.0, 
				to: opacity, 
				duration: 0.5,
				beforeStart: function() {
					$(sLayer).className = 'position';
					
					
					setTimeout(function() {
						$(sLayer).show();
						$(sLayer).style.background = '#000000';
						$(sLayer).style.height = document.documentElement.scrollHeight+'px';
					}, 100);
				},
				afterFinish: function() {					
					new Effect.Fade(sId, {
						from: 0.0, 
						to: 1.0, 
						duration: 0.5,
						beforeStart: function() {
							$(sId).style.top = parseInt(arrayPageScroll[1] + nTop) + 'px';
							setTimeout(function() {
								$(sId).style.display = 'block';
							}, 100);
						},
						afterFinish: function() {
							action = true;
						}
					});
				}
			});
		}
	}
	
	this.CloseScreen = function()
	{
		if(action) {
			action = false;
			var closeframe = frame;
			new Effect.Fade(closeframe, { 
				duration: 0.5, 
				from: 1.0, 
				to: 0.0, 
				afterFinish: function() {
					$(closeframe).hide();
					new Effect.Fade(sLayer, { 
						from: opacity, 
						to: 0.0, 
						duration: 0.3, 
						afterFinish: function() {
							action = true;
						}
					});
				}
			});
		}
	}	
}
