﻿function ModalPopup(contentUrl, width, height) {
	this.contentUrl = contentUrl;
	this.width = width;
	this.height = height;
	this.dialogX = null;

	ModalPopup.prototype.getWidth = function () {
		return this.width;
	};
	ModalPopup.prototype.getHeight = function () {
		return this.height;
	};
	ModalPopup.prototype.show = function () {
		var _html = '<div id="div_popup" style="padding: 0px; margin: 0px; overflow:hidden;background-color: #595e64;" scrolling="no"><iframe scrolling="no" frameborder="0" width="' + (this.width) + '" height="' + (this.height) + '" style="margin:0px;padding:0px;"></iframe></div>';
		this.dialogX = $(_html).dialog(
				{
					close: function (e, ui) { window.currentPopup = null; },
					resizable: false,
					modal: true,
					width: this.width,
					height: this.height,
					show: 'slide, 100'
				});
		this.dialogX.dialog();
		this.dialogX.find("iframe").attr("src", this.contentUrl);
	};
	ModalPopup.prototype.resize = function (width, height) {
		//alert('Dialog: ' + this.dialogX.height() + ' - Iframe: ' + this.dialogX.find("iframe").height());
		this.dialogX.css("width", width).css("height", height);
		this.dialogX.find("iframe").css('width', width).css('height', height);
		//alert('Dialog: ' + this.dialogX.height() + ' - Iframe: ' + this.dialogX.find("iframe").height());
	};
	ModalPopup.prototype.close = function () {
		this.dialogX.dialog('close');
	};
}


