﻿$().ready(function(){if($("#mdl_overlay")!=null){$(window).resize(function(){var wW=$(window).width();var wH=document.documentElement.clientHeight;$("#mdl_overlay").css({width:wW,height:wH});if($("#mdl_dialog")!=null){$("#mdl_dialog").css({left:(wW-$("#mdl_dialog").width())/2,top:(wH-$("#mdl_dialog").height()-100)/2});}});}});(function($){var isIe6=(jQuery.browser.msie&&jQuery.browser.version=="6.0");$.fn.MrJ=function(option){var overlay=70,ajaxUrl=null,ajaxType="GET",ajaxData=null,width="auto",height="auto";if(option.overlay!=null||option.overlay>=0)overlay=option.overlay;if(option.ajaxType!=null)ajaxType=option.ajaxType;if(option.width!=null||option.width!=undefined){if(option.width<900)width=option.width;else
width=900;}if(option.height!=null||option.height!=undefined){if(option.height<650)height=option.height;else
height=650;}if(option.ajaxUrl!=null){jQuery.ajax({url:option.ajaxUrl,data:ajaxData,type:ajaxType,timeout:30000,beforeSend:function(){creatLoading(overlay);},success:function(data){showModal(data,width,height);},error:function(event,textStatus){if(textStatus=="timedout"){$("#mdl_ld").fadeOut("normal",function(){showModal("<div>连接超时,请稍候再试!</div>",300,100);});}else if(event.status>=400&&event.status<500){$("#mdl_ld").fadeOut("normal",function(){showModal("<div>无法找到该页面.</div>",300,100);});}else{$("#mdl_ld").fadeOut("normal",function(){showModal("<div>服务器错误:"+textStatus+"</div>",300,100);});}}});}else{if($(this).html()!=null)showModal($(this).html(),width,height);}};$.fn.mjShow=function(text,width,height,opacity){if(opacity==null||opacity<0)opacity=70;if(width=null||width==undefined)width=300;if(height==null||height==undefined)height=100;createOverlay(opacity);if(text==null)showModal($(this).html(),width,height,opacity);else
showModal(text,width,height,opacity);};$.fn.mjHide=function(){clearModal();};function createOverlay(opacity){var itv=setInterval(function(){if($.browser.msie&&document.readyState!="complete"){return;}else{clearInterval(itv);var wW=$(window).width();var wH=document.documentElement.clientHeight;if(isIe6)$("select").css("visibility","hidden");var sc=document.createElement("div");sc.id="mdl_overlay";$(sc).appendTo("body").addClass("mdl_overlay").css({width:wW,height:wH,opacity:opacity/100});}},100);};function creatLoading(opacity){if($.browser.msie&&document.readyState!="complete"){setTimeout(function(){creatLoading();},30);}else{clearModal();var wW=document.documentElement.clientWidth;var wH=document.documentElement.clientHeight;createOverlay(opacity);var ld=document.createElement("div");ld.id="mdl_ld";$(ld).addClass("mdl_ld").css({left:(wW-40)/2,top:(wH-150)/2});$(ld).html("<img alt='Loading' src='http://"+window.location.host+"/images/loading.gif' />");$(ld).appendTo("body");}};function clearModal(){$("[id^='mdl_']").remove();if(isIe6)$("select").css("visibility","visible");};function showModal(cont,width,height,opacity){var itv=setInterval(function(){if($.browser.msie&&document.readyState!="complete"){return;}else{clearInterval(itv);var closeBar="<div><div id='clsBar' class='mdl_bar' ><img alt='close' onclick='$().mjHide()'";closeBar+=" src='http://"+window.location.host+"/images/x.png' style='cursor:pointer; margin:2px; display:block' /></div><div style='margin:2px'>";closeBar+=cont;closeBar+="</div></div>";var dialog=document.createElement("div");$(dialog).attr("id","mdl_dialog").appendTo("body").addClass("mdl_dialog").html(closeBar);if($("#mdl_ld").width()>0){$("#mdl_ld").fadeOut("normal",function(){createModal(dialog,width,height);});}else{createModal(dialog,width,height);}}},100);};function createModal(dialog,width,height){var wW=document.documentElement.clientWidth;var wH=document.documentElement.clientHeight;if($(dialog).width()>900){$(dialog).css({overflow:"scroll"});}if($(dialog).height()>650){$(dialog).css({overflow:"scroll"});}$(dialog).css({left:(wW-$(dialog).width())/2,top:(wH-$(dialog).height()-100)/2}).slideDown("fast",function(){$("#clsBar").css({"float":"left"});});};})(jQuery);
