jQuery.fn.center=function(params){var options={vertical:true,horizontal:true} op=jQuery.extend(options,params);return this.each(function(){var $self=jQuery(this);var width=$self.width();var height=$self.height();var paddingTop=parseInt($self.css("padding-top"));var paddingBottom=parseInt($self.css("padding-bottom"));var borderTop=parseInt($self.css("border-top-width"));var borderBottom=parseInt($self.css("border-bottom-width"));var mediaBorder=(borderTop+borderBottom)/2;var mediaPadding=(paddingTop+paddingBottom)/2;var positionType=$self.parent().css("position");var halfWidth=(width/2)*(-1);var halfHeight=((height/2)*(-1))-mediaPadding-mediaBorder;var cssProp={position:'absolute'};if(op.vertical){cssProp.height=height;cssProp.top='50%';cssProp.marginTop=halfHeight;} if(op.horizontal){cssProp.width=width;cssProp.left='50%';cssProp.marginLeft=halfWidth;} if(positionType=='static'){$self.parent().css("position","relative");} $self.css(cssProp);});};(function($){var oldWidth=0;var oldHeight=0;var resizeThreshold=30;var shouldBeaSelector;var callBack;var enable=true;jQuery.fn.hookAutoResizeEnable=function(Enable){enable=Enable;} jQuery.fn.hookAutoResize=function(aShouldBeaSelector,CallBack,options){var settings=jQuery.extend({resizeThreshold:20},options);resizeThreshold=settings.resizeThreshold;shouldBeaSelector=aShouldBeaSelector;callBack=CallBack;oldWidth=shouldBeaSelector.clientWidth;oldHeight=shouldBeaSelector.clientHeight;if(document.implementation.hasFeature('MutationEvents','2.0')||window.MutationEvent){shouldBeaSelector.addEventListener("DOMAttrModified",ResizeEventHandler,false);}else{shouldBeaSelector.onresize=ResizeEventHandler;}} function isResizeThreshold(){var width=shouldBeaSelector.clientWidth;var height=shouldBeaSelector.clientHeight;if(width>oldWidth+resizeThreshold||widtholdHeight+resizeThreshold||height").attr("id",uid+"-VIEW").attr("name",uid+"-VIEW").attr("src",url).attr("scrolling","no").css("margin","0").css("border","0").css("padding","0").css("top","0").css("left","0").css("right","0").css("bottom","0").hide().bind("load",function(event,ui){var frame=$(this);$.FrameDialog.iframeMini(frame);$('#loadmsgtext').hide();$('#iframemsg').hide();frame.show();var fuid=frame.attr("id");var cid=fuid.replace("-VIEW","");var fdocument=this.contentWindow.document;iframeDocument=fdocument;if(opts.formFocus==true){$.FrameDialog.setFormFocus(fdocument.forms);} $.FrameDialog.resizePopup(fdocument);$.FrameDialog.resizeIframe(frame);$.FrameDialog.positionIframe(cid);$.FrameDialog.scroolable(frame);var temp='$.FrameDialog.forceRefresh("'+fuid+'");' setTimeout(temp,500);if(opts.autoResize==true){var aTable=fdocument.getElementById(popupHolderId);if(aTable){iframeDocument=fdocument;jQuery.fn.hookAutoResize(aTable,reSize2);jQuery.fn.hookAutoResizeEnable(true);} else{reSize2();}} wrap.bind('resizestart',wrapresizestart);wrap.bind('resizestop',wrapresizestop);wrap.bind('dragstop',wrapdragstop);wrap.bind('dragstart',wrapdragstart);});var ret=$("
").attr("id",uid).css("margin","0").css("border","0").css("padding","0").css("top","0").css("left","0").css("right","0").css("bottom","0").hide().append(iframe).appendTo("body").dialog(opts).bind("dialogbeforeclose",function(event,ui){var frame=$(this);var uid=frame.attr("id");if(event&&event.originalTarget&&event.originalTarget.nodeName&&event.originalTarget.nodeName=="SPAN") $.FrameDialog.clearResult(uid);if(event&&event.originalEvent&&event.originalEvent.currentTarget&&event.originalEvent.currentTarget.tagName&&event.originalEvent.currentTarget.tagName=="A") $.FrameDialog.clearResult(uid);var result=$.FrameDialog._results[uid]||null;return result;}).bind('dialogclose',function(event,ui){var frame=$(this);var uid=frame.attr("id");var result=$.FrameDialog._results[uid]||null;frame.attr("result",result);$.FrameDialog.setFormFocus(top.document.forms);window.setTimeout(function(){frame.dialog('destroy') frame.remove();ret.remove();try{delete $.FrameDialog._results[uid];}catch(err){}},100);wrap.unbind('resizestart',wrapresizestart);wrap.unbind('resizestop',wrapresizestop);wrap.unbind('dragstop',wrapdragstop);wrap.unbind('dragstart',wrapdragstart);$('#iframemsg').remove();return result;});if(opts.titleImage){var img=$("").attr("alt","title").attr("src",opts.titleImage);ret.prev().children(".ui-dialog-title").prepend(img);} var loadmsgtext=$("
");var loadmsg=$("").attr("id","iframemsg").css("margin","0").css("border","0").css("padding","0").css("top",ret.css('top')).css("left",ret.css('left')).attr("width",ret.width()).attr("height",ret.height()).attr("position","absolute").attr("z-index","99999").append(loadmsgtext).appendTo(ret);var winw=$(document).width();var wrap=ret.parent(".ui-resizable") var visualEffect='';var resizePopup=function(adocument){var x=adocument.getElementById("frame");if(x){var content=x;var className=content.className;adocument.className="";adocument.className=className;}} var wrapresizestart=function(){resizeToPerform=1;jQuery.fn.hookAutoResizeEnable(false);iframe.hide(visualEffect);loadmsg.show(visualEffect);} var wrapresizestop=function(event,ui){loadmsg.hide(visualEffect);var frameId=iframe.attr("id");var fdocument=$('#'+frameId)[0].contentWindow.document;var iframeBody=fdocument.body;var tableframe=fdocument.getElementById(popupHolderId);if(!tableframe){tableframe=fdocument.getElementById("body");} if(tableframe==null)return;jQuery.fn.hookAutoResizeEnable(false);resizeToPerform=1;var realTitleHeight=ret.siblings('.ui-dialog-titlebar').outerHeight(true)||titleHeight;var tdAB=fdocument.getElementById('tdActionBar');var tdFoot=fdocument.getElementById('tdFooter');var hAB=tdAB?parseInt(parseFloat(tdAB.height)):null;var hFooter=tdFoot?parseInt(parseFloat(tdFoot.height)):null;var realFooterHeight=(hAB+hFooter)||footerHeight;var dialogWidth=wrap.width();var dialogHeight=wrap.height();var displayWidth=dialogWidth;var displayHeight=dialogHeight-realTitleHeight;ret.css('height',displayHeight+'px').css('width',displayWidth+'px');iframe.css('height',displayHeight+'px').css('width',displayWidth+'px');iframe.show(visualEffect);tableframe.style.height=displayHeight-4+'px';tableframe.style.width=displayWidth-4+'px';var adjustHeightIE=0;if(!jQuery.support.boxModel){adjustHeightIE=2;} var content=fdocument.getElementById(popupContentId);content.style.height=displayHeight-4-adjustHeightIE-realFooterHeight+'px';content.style.width=displayWidth-4+'px';resizePopup(fdocument);resizeToPerform=0;setTimeout('jQuery.fn.hookAutoResizeEnable(true);',500);} var wrapdragstart=function(){jQuery.fn.hookAutoResizeEnable(false);resizeToPerform=1;iframe.hide(visualEffect);loadmsg.show(visualEffect);} var wrapdragstop=function(){var offset=wrap.offset();var position=wrap.position();var ww=wrap.outerWidth();var wh=wrap.outerHeight();wrap.css({top:position.top-Math.min(0,offset.top),left:position.left-Math.min(0,offset.left)});offset=wrap.offset();position=wrap.position();jQuery.fn.hookAutoResizeEnable(true);resizeToPerform=0;loadmsg.hide(visualEffect);iframe.show(visualEffect);} wrap.css('width',(opts.minWidth||opts.width||200)+'px').css('height',(opts.minHeight||opts.height||120)+'px').bind('resize',function(){iframe.css('height',ret.height()+'px').css('width',ret.width()+'px');});window.setTimeout(function(){wrap.trigger('resize');},100);var ww=wrap.width();if(opts.position=='center'||(opts.position&&(opts.position[0]=='center'||opts.position[1]=='center'))){var pos=parseInt(parseFloat(winw-ww)/2);if(pos<0)pos=0;wrap.css('left',pos+'px');} if(opts.position=='right'||(opts.position&&(opts.position[0]=='right'||opts.position[1]=='right'))){var pos=winw-ww-5;if(pos<0)pos=0;wrap.css('left',pos+'px');} return ret;} $.FrameDialog.forceRefresh=function(fuid){var ie=!jQuery.support.boxModel;var frame=$('#'+fuid);if(frame==null)return;if(frame[0]==null)return;var fdocument=frame[0].contentWindow.document;var tableframe;tableframe=fdocument.getElementById(popupHolderId);if(!tableframe){tableframe=fdocument.getElementById("body");} if(ie){tableframe.style.display="none";tableframe.style.display="";} var content=fdocument.getElementById(popupContentId);if(ie){content.style.display="none";content.style.display="";} $.FrameDialog.resizeIframe(frame);} $.FrameDialog._getUid=function(){if(window.parent&&window.parent.frames&&window.parent.document&&window.parent.document.getElementsByTagName){var iframes=window.parent.document.getElementsByTagName("IFRAME");for(var i=0;i0&&forms[0].elements.length>0){var aElement;for(i=0;i=winh-100){dialogHeight=winh-100;}else{dialogHeight=fheight+realTitleHeight+4+upPadding+downPadding+adjustHeight;}} if(winw<700){dialogWidth=winw-50;}else{if(fwidth>=winw-100){dialogWidth=winw-100;}else{dialogWidth=fwidth+4+rightPadding+leftPadding+adjustWidth;}} wrap.css('height',dialogHeight).css('width',dialogWidth);jQuery.fn.hookAutoResizeEnable(true);resizeToPerform=0;var tmp='$("#'+uid+'").parent(".ui-resizable").trigger("resizestop");';setTimeout(tmp,10);} $.FrameDialog.iframeMini=function(aIframe){aIframe.css('height',30).css('width',30);} $.FrameDialog.reSize=function(aDocument){if(!aDocument){return;} var uid=$.FrameDialog._getUid();var fuid;if(window.parent&&window.parent.frames&&window.parent.document&&window.parent.document.getElementsByTagName){var iframes=window.parent.document.getElementsByTagName("IFRAME");for(var i=0;i