jQuery.modal=function(a){a=jQuery.extend({type:"normal",posX:"center",posY:"center",btnYes:"Yes",btnNo:"No",actYes:function(){},actNo:function(){},header:"Header.",msg:"message",width:$(window).width()-30,height:$(window).height()-30,close:1,label:""},a);var b=$(window).width()-30,d=$(window).height()-30;b="display:none;position:absolute;width:"+b+";height:"+d;$("#modalwindow").remove();b='<table id="modalwindow" style="'+b+'" border="0" cellspacing="0" cellpadding="0"><tr><td width="10" height="10" style="background:url(/js/modal/tl.png) no-repeat transparent;"></td><td height="10" style="background:url(/js/modal/b.png) repeat-x transparent;"></td><td width="10" height="10" style="background:url(/js/modal/tr.png) no-repeat transparent;"></td></tr><tr><td width="10" style="background:url(/js/modal/b.png) repeat-y transparent;"></td><td style="background:#000;" valign="top" id="modalwindow_content"><table style="background:#999;" id="modalwindow_handle" border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td style="color:#FFF;padding-left:10px;font-family:Verdana;">'+a.label+'</td><td align="right" height="30">'+(a.close?'<img title="\u0417\u0430\u043a\u0440\u044b\u0442\u044c" id="modalwind_close" style="cursor:pointer;" src="/js/modal/close.png" />':"")+'</td><td width="6"></td></tr></table>'+a.msg+'</td><td width="10" style="background:url(/js/modal/b.png) repeat-y transparent;"></td></tr><tr><td width="10" height="10" style="background:url(/js/modal/bl.png) no-repeat transparent;"></td><td height="10" style="background:url(/js/modal/b.png) repeat-x transparent;"></td><td width="10" height="10" style="background:url(/js/modal/br.png) no-repeat transparent;"></td></tr></table>';$("body").append('<div id="blockui"></div>').css("overflow","hidden");$("#blockui").css({width:5E3,height:5E3,background:"#000",opacity:0.5,position:"absolute",left:0,top:0});$("body").append(b);$("#modalwindow").fadeIn(300);switch(a.posX){case "center":$("#modalwindow").css({left:$("body").width()/2-$("#modalwindow").width()/2});break;case "left":$("#modalwindow").css({left:10});break;case "right":$("#modalwindow").css({left:$("body").width()-$("#modalwindow").width()})}switch(a.posY){case "center":$("#modalwindow").css({top:screen.height/2-$("#modalwindow").height()/2});break;case "top":$("#modalwindow").css({top:10})}$("#modalwind_close").live("mouseover mouseout",function(e){e.type=="mouseover"?$(this).css("opacity",1):$(this).css("opacity",0.5)});var c="";$("#modalwind_close").live("click",function(){$("#modalwindow").fadeOut(500);clearTimeout(c);$("#blockui").fadeOut(500);c=setTimeout(function(){$("#modalwindow").remove();$("#blockui").remove();$("body").css("overflow","auto")},500)});$("#blockui").live("click",function(){a.close&&$("#modalwind_close").click()})};
