
function alertPopup(headerAllias, messageAllias, confirmAllias, cancelAllias, callbackTrue, callbackFalse) {

	this.whiteLayer = $('#' + whiteLayerId);
	this.container = $('#' + alertContainerId);
	
	this.countDownContainerId = whiteLayerId + '-count-down';
	this.countDownContainer = '';
	
	this.headerText = phrases[headerAllias];
	this.messageText = phrases[messageAllias]; 
	this.confirmText = phrases[confirmAllias];
	this.cancelText = phrases[cancelAllias];
	
	this.callbackTrue = callbackTrue;
	
	if (!callbackFalse || (typeof callbackFalse) != 'function') {
	
		callbackFalse = function() { 
			this.hide();
		}
	}
	
	this.callbackFalse = callbackFalse;
}

alertPopup.prototype.hide = function() {
	
	this.hideBox();
	this.hideBackground();
}

alertPopup.prototype.hideBox = function() {

	this.container.addClass('hidden');
	this.container.html('');
}

alertPopup.prototype.hideBackground = function() {

	this.whiteLayer.addClass('hidden');
}

alertPopup.prototype.show = function() {
	
	var Owner = this;
	
	this.whiteLayer.removeClass('hidden'); 
	
	/* center element
	this.container.css('position', 'absolute');
	this.container.css('top', ( $(window).height() - this.container.height() ) / 2 + $(window).scrollTop() + 'px');
	this.container.css('left', ( $(window).width() - this.container.width() ) / 2 + $(window).scrollLeft() + 'px');
	*/
	
	this.countDownContainer = $('<span></span>').attr('id', this.countDownContainerId);
	
	this.container.append(
		
		$('<div></div>')
			.addClass('wrapper-popup')
			.append(
				$('<div></div>')
					.addClass('header')
					.append(
						$('<div></div>')
							.addClass('title')
							.append(
								$('<b></b>')
									.text(this.headerText)
							)
					)
					/*
					.append(
						$('<a></a>')
							.attr('href', '#')
							.addClass('adm_close')
							.text('X')
							.click(function(event) {
								
								event.preventDefault()
								Owner.callbackFalse()
							})
					)
					*/	
			)
			.append(
				$('<div></div>')
					.addClass('content-popup')
					.append(
						$('<p></p>')
							.addClass('ac')
							.text(this.messageText + ' ')
							.append(
								this.countDownContainer
							)
					)
			)
			.append(
				$('<div></div>')
					.addClass('btn-ac')
					.append(
						$('<div></div>')
							.addClass('btn-red')
							.append(
								$('<a></a>')
									.attr('href', '#')
									.append(
										$('<span></span>')
											.text(this.confirmText)
									)
									.click(function(event) {
										
										event.preventDefault()
										Owner.callbackTrue()
									})
							)
					)
					.append(
						$('<div></div>')
							.addClass('btn-blue')
							.append(
								$('<a></a>')
									.attr('href', '#')
									.append(
										$('<span></span>')
											.text(this.cancelText)
									)
									.click(function(event) {
										
										event.preventDefault()
										Owner.callbackFalse()
									})
							)
					)
			)
		)
		.removeClass('hidden')
}

alertPopup.prototype.dialog = function() {
	
	var Owner = this;
	
	this.whiteLayer.removeClass('hidden'); 
	
	/* center element
	this.container.css('position', 'absolute');
	this.container.css('top', ( $(window).height() - this.container.height() ) / 2 + $(window).scrollTop() + 'px');
	this.container.css('left', ( $(window).width() - this.container.width() ) / 2 + $(window).scrollLeft() + 'px');
	*/
	
	this.countDownContainer = $('<span></span>').attr('id', this.countDownContainerId);
	
	this.container.append(
		
		$('<div></div>')
			.addClass('wrapper-popup')
			.append(
				$('<div></div>')
					.addClass('header')
					.append(
						$('<div></div>')
							.addClass('title')
							.append(
								$('<b></b>')
									.text(this.headerText)
							)
					)
			)
			.append(
				$('<div></div>')
					.addClass('content-popup')
					.append(
						$('<p></p>')
							.addClass('ac')
							.text(this.messageText + ' ')
							.append(
								this.countDownContainer
							)
					)
			)
			.append(
				$('<div></div>')
					.addClass('btn-ac')
					.append(
						$('<div></div>')
							.addClass('btn-blue')
							.append(
								$('<a></a>')
									.attr('href', '#')
									.append(
										$('<span></span>')
											.text(this.cancelText)
									)
									.click(function(event) {
										
										event.preventDefault()
										Owner.callbackFalse()
									})
							)
					)
			)
		)
		.removeClass('hidden');
}
