
function alertPopupHelper(headerAllias, messageAllias, confirmAllias, cancelAllias, callbackTrue, callbackFalse) {

	this.messageAllias = messageAllias;
	this.headerText = phrases[headerAllias];
	this.messageText = phrases[messageAllias]; 
	this.confirmText = phrases[confirmAllias];
	this.cancelText = phrases[cancelAllias];
	
	if (!callbackTrue || (typeof callbackTrue) != 'function') {
		
		callbackTrue = function() { 
			return true;
		}
	}
	
	this.callbackFalse = callbackFalse;
	
	this.callbackTrue = callbackTrue;

	if (!callbackFalse || (typeof callbackFalse) != 'function') {
	
		callbackFalse = function() { 
			this.hide();
		}
	}
	
	this.callbackFalse = callbackFalse;
	
	this.init();
}

alertPopupHelper.prototype.init = function() { 
	
	var Owner = this;
	
	this.whiteLayer = $('#screen').click(function(){Owner.hide()});
	this.container = $('#popup');
	
	$('#button-popup-close').live('click', function(event) {
		
		event.preventDefault();
		Owner.callbackFalse();
	})
	
	$('#button-popup-confirm').live('click', function(event) {
		
		event.preventDefault();
		Owner.callbackTrue();
	})
	
	$('#button-popup-cancel').live('click', function(event) {
		
		event.preventDefault();
		Owner.callbackFalse();
	});
	
	$('.tabs li').click(function(){
		var id = $(this).attr('rel');
		$('.popup-body').hide();
		$('.popup-body[rel=' + id + ']').show();
	})
	
	$('.tabs li:first').trigger('click');
	$('.tabs li:first').addClass('active');
	$('.tabs li').click(function(){
	
			$('.tabs li').removeClass('active');
			$(this).addClass('active');
	})
	
}

alertPopupHelper.prototype.hide = function() {
	
	this.hideBox();
	this.hideBackground();
}

alertPopupHelper.prototype.hideBox = function() {

	this.container.hide();
	//this.container.html('');
}

alertPopupHelper.prototype.hideBackground = function() {

	this.whiteLayer.hide();
}

alertPopupHelper.prototype.showBackground = function() {

	this.whiteLayer.show();
}

alertPopupHelper.prototype.show = function(showDeclineIcon, showConfirmButton, showDeclineButton, cssClass) {
	
	this.whiteLayer.show(); 
	
	if(
		this.messageAllias=='subscribed_to_news' || this.messageAllias=='terms_and_conditions' || this.messageAllias=='requested_to_news' ||
		this.messageAllias=='text_mass_delete_image_warning' || this.messageAllias=='text_delete_image_warning'
	)
	{

		jQuery("html, body").animate({scrollTop:0}, "slow");
		
		if (showDeclineIcon) {
			this.container.append('<div id="button-popup-close" class="close">x</div>');
		}
		
		this.container.append(
			'<h3>' + this.headerText + '</h3><div id="popup-body">' + this.messageText + '</div>'
		);	
		
		if (showConfirmButton) {
			this.container.append('<div class="btn inline" id="button-popup-confirm"><span><b>' + phrases["button_confirm"] + '</b></span></div>');
		}
		
		if (showDeclineButton) {
			this.container.append('<div class="btn inline" id="button-popup-cancel"><span><b>' + phrases["button_cancel"] + '</b></span></div>');
		}
		
		jQuery('#popup #side-nav').hide();
	}
	
	this.container.show();
}
