',{'class': 'overlay'}),
template = d['template'] || '
',
box = d['template_id'] || '.box',
close = d['close'] || "a[rel*='dialog_close']",
title = d['title'] || '處理中..',
html = d['html'] || '',
display = d['display'] || false,
width = d['width'] || 500,
height = d['height'] || 0,
top = d['top'] || false,
left = d['left'] || false,
preload = d['preload'] || '',
callback = d['callback'] || '';
wrap.children().remove();
wrap.prepend(overlay, $(template)).hide();
wrap.find('.content').html(html);
wrap.find('.title').html(title);
if(display){
overlay.css({'width': $(document).width(), 'height': $(document).height()}).show();
$(box).find('.message').css({'width': width - 30})
$(box).css({'width': width,'height': (height ? height : $(box).outerHeight() + 33)});
var boxHeight = $(box).outerHeight() >= 400 ? ($(box).outerHeight() / 2) : $(box).outerHeight();
$(box).css({'left': (left ? left : (wrap.parent().outerWidth() / 2) - ($(box).outerWidth() /2 )) , 'top': (top ? top : (wrap.parent().height() / 2) - boxHeight)}).show();
wrap.show();
$(window).resize(function(){
overlay.css({'width': $(document).width(), 'height': $(document).height()}).show();
$(box).css({'left': (left ? left : (wrap.parent().outerWidth() / 2) - ($(box).outerWidth() /2 )) , 'top': (top ? top : (wrap.parent().height() / 2) - boxHeight)}).show();
})
if(preload instanceof Function)preload.call();
}else{
wrap.children().remove();
overlay.hide();
}
if(typeof d['html'] != 'undefined' && d['html'] != null){
$(close).bind('click',function(){
if(callback instanceof Function)callback.call();
wrap.children().remove().hide();
overlay.hide();
});
}
}