var showConfig = function (options) {
var param = {
width: 400, height: 300, src: '', title: 'Configuration', scrollbar: true, resizable: true, isDialog: true,csslink:'',
fnOK: function () { }, fnClose: function () { }, zIndex: 500, hasButton: false, postBackClose:'', postBackType: 'parent', objArray:null
};
param = jQuery.extend(param, options);
if (param.postBackClose!=='') {
if (param.postBackType === 'parent')
window.parent[param.postBackClose] = function () { __doPostBack(param.postBackClose, ''); };
else
window.top[param.postBackClose] = function () { __doPostBack(param.postBackClose, ''); };
}
if (topWindow.zIndex === undefined)
topWindow.zIndex = 5000;
else
topWindow.zIndex = topWindow.zIndex + 1;
var eleGround;
if (param.isDialog) {
eleGround = $('
').appendTo($(topWindow.document).find('body'));
eleGround.css({ position: 'absolute', top: 0, left: 0, width: $(topWindow).innerWidth(), height: $(topWindow.document).innerHeight(),
backgroundColor: '#c0c0c0', opacity: 0.4, zIndex: topWindow.zIndex, display: 'block'
});
}
topWindow.zIndex = topWindow.zIndex + 1;
var eleWindow = $('').css({ position: 'absolute', zIndex: topWindow.zIndex, top: 0, left: 0 }).appendTo($(topWindow.document).find('body')).hide().fadeIn(200);
var eleHead = $('').appendTo(eleWindow);
var eleContainer = $('').appendTo(eleWindow);
var eleContent = $('').css({ width: param.width, height: param.height }).appendTo($(eleContainer));
eleContent.attr('src', param.src);
var head = $(eleContent).contents().find("head");
if (head != null && param.csslink !== '') $(head).append($("", { rel: "stylesheet", href: param.csslink, type: "text/css" }));
if(param.hasButton)
{
var eleButtonContainer = $('').appendTo(eleWindow);
var btnOK = $('').appendTo(eleButtonContainer);
btnOK.click(function () { param.fnOK(); eleWindow.remove() });
var btnCancel = $('').appendTo(eleButtonContainer);
}
if (param.resizable) {
$(topWindow.document).find(eleContainer).resizable({ alsoResize: eleContent });
}
var wtop = ($(topWindow).innerHeight() - eleWindow.height()) / 2;
if (wtop < 15) wtop = 15;
wtop += $(topWindow).scrollTop();
eleWindow.css({ top: wtop, left: ($(topWindow).innerWidth() - eleWindow.width()) / 2 });
eleWindow.draggable({ handle: eleHead, containment: (eleGround==null?($(topWindow.document).find('body')): eleGround), drag: function () { eleGround.width($(topWindow.document).innerWidth()), eleGround.height($(topWindow.document).innerHeight()) } });
eleWindow.find('.title').text(param.title);
$(eleHead.find('.button')).click(function () {
if (param.isDialog)
topWindow.zIndex = topWindow.zIndex - 2;
else
topWindow.zIndex = topWindow.zIndex - 1;
if (topWindow.zIndex <= 5000) topWindow.zIndex = undefined;
if (eleGround !== null || eleGround !== undefined) eleGround.hide().remove();
eleWindow.hide().remove();
param.fnClose()
});
}