ModalWindow = function()
{
var div, transpDiv;
var isShowed;
var iframe;
var frmBody;
var self;
this.isShowed = false;
}
ModalWindow.prototype =
{
createDiv: function(width,height,content)
{
if(!this.isShowed)
{
var bodyWidth, bodyHeight;
if (self.innerHeight)
{ // all except Explorer
bodyWidth = self.innerWidth;
bodyHeight = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
{
// Explorer 6 Strict Mode
bodyWidth = document.documentElement.clientWidth;
bodyHeight = document.documentElement.clientHeight;
}
else if (document.body)
{// other Explorers
bodyWidth = document.body.clientWidth;
bodyHeight = document.body.clientHeight;
}
this.div = document.createElement('DIV');
this.div. className = "ModalBox";
this.div.style.left = (bodyWidth/2)-(width/2) + 'px';
this.div.style.top = '100px';
this.div.style.width = width;
document.body.appendChild(this.div);
this.self = this;
var a;
a = document.createElement('A');
a.innerHTML = "Закрыть[X]";
this.div.appendChild(a);
a.onclick = function()
{
self.closeMessage();
}
this.iframe = document.createElement('iframe');
this.iframe.src = content;
this.iframe.frameBorder = "no";
this.iframe.scrolling = "no";
this.iframe.style.height = height + 'px';
this.iframe.style.width = width + 'px';
this.div.appendChild(this.iframe);
this.transpDiv = document.createElement('DIV');
this.transpDiv.className = "transparentLayer";
this.transpDiv.style.left = "0px";
this.transpDiv.style.top = "0px";
this.transpDiv.style.width = '100%';
this.transpDiv.style.height = '100%';
document.body.appendChild(this.transpDiv);
isShowed = true;
}
}
,
closeMessage: function()
{
this.div.style.display='none';
this.transpDiv.style.display='none';
this.isShowed = false;
}
}