style: 'default',
path: CowAjax.path + 'components/dialog/',
whatId: null,
show: function(what, title, width) {
dlg = this.getDialog(true, width);
if (dlg) {
this.whatId = what;
dlg.getElementsByTagName('span').item(0).innerHTML = title;
what = document.getElementById(what);
var put = document.createElement('div');
put.id = '__put';
put.style.display = 'none';
what.parentNode.insertBefore(put, what);
var put = dlg.getElementsByTagName('div').item(3);
while(put.childNode) {
put.removeElement(place.childNode);
}
what.oldCss = what.style.cssText;
what.style.display = 'block';
what.style.position = 'static';
put.appendChild(what);
dlg.style.position = 'absolute';
dlg.style.top = '25%';
dlg.style.left = '32%';
dlg.style.zIndex = '1000000000';
if (width) {
dlg.style.width = width;
} else {
dlg.style.width = '';
}
LightBox.show(dlg);
}
},
close: function() {
var what = document.getElementById(this.whatId);
var put = document.getElementById('__put');
put.parentNode.replaceChild(what, put);
what.style.cssText = what.oldCss;
what.oldCss = null;
LightBox.hide(this.getDialog());
},
getDialog: function(create) {
var dlg = document.getElementById('modaldlg');
if (create && !dlg) {
dlg = this.createDialog();
}
return dlg;
},
createDialog: function() {
var dlg = document.createElement('div');
dlg.id = 'modaldlg';
dlg.className = 'modaldlg';
var border = document.createElement('div');
border.className = 'modaldlgborder';
dlg.appendChild(border);
var title = document.createElement('div');
title.className = 'modaldlgtitle';
title.onmousedown = function() {
Drag.start(arguments[0], this.parentNode.parentNode);
};
var span = document.createElement('span');
title.id = 'modaldlgtitle';
var close = document.createElement('div');
close.className = 'modaldlgclose';
close.onclick = function() {
Dialog.close();
}
var img = document.createElement('img');
img.alt = 'Close';
img.src = this.path + 'style/' + this.style + '/img/close_modal_dlg.gif';
close.appendChild(img);
title.appendChild(span);
title.appendChild(close);
border.appendChild(title);
var body = document.createElement('div');
body.className = 'modaldlgbody';
body.id = 'modaldlgbody';
border.appendChild(body);
dlg.appendChild(border);
document.body.appendChild(dlg);
return dlg;
}
};
0 comments:
Post a Comment