(function(a){a.fn.bPopup=function(d){function f(b){popupOptions=c.data(l);void 0===popupOptions&&(popupOptions=a.extend({},w));void 0!==b&&(popupOptions=a.extend({},popupOptions,b));popupOptions.scrollBar||a("html").css("overflow","hidden");t=m.height()>c.outerHeight(!0)+20;q=m.data(l)?m.data(l)+1:1;g="bPopup"+q;centerModal(c);D(c.attr("id"));return c.each(function(){if(popupOptions.modal){var b=popupOptions,d=a('<div id="'+g+'" class="bModal '+g+'"></div>');!a.IEData.isIE||7!=a.IEData.verIE&&7!=
a.IEData.docModeIE?d.css({"background-color":b.modalColor,height:"100%",left:0,opacity:0,position:"fixed",top:0,width:"100%","z-index":b.zIndex+q}).appendTo(h(b)).animate({opacity:b.opacity},b.fadeSpeed):d.css({"background-color":b.modalColor,height:"100%",left:0,position:"absolute",top:0,width:"100%","z-index":b.zIndex+q}).appendTo(h(b))}c.data(l,popupOptions).data("id",g);e(popupOptions)})}function e(b){c.find("script").remove();c.css({position:"fixed","z-index":b.zIndex+q+1}).appendTo(h(b)).hide(1,
function(){a.isFunction(b.onOpen)&&b.onOpen.call(c);if(null!=b.loadUrl)switch(b.contentContainer=null==b.contentContainer?c:a(b.contentContainer),b.content){case "iframe":a('<iframe scrolling="no" frameborder="0"></iframe>').attr("src",b.loadUrl).appendTo(b.contentContainer);break;default:b.contentContainer.load(b.loadUrl)}}).fadeIn(b.fadeSpeed,function(){a.isFunction(x)&&x()});centerModal(c);a.browser.msie&&9>parseFloat(a.browser.version)&&k();E(b)}function h(b){return 0<a(b.appendTo).length?b.appendTo:
"body"}function k(){var b=c.outerHeight(),a=c.find(".bTitle"),d=c.find(".bActions");a&&(b-=41);d&&(b-=41);c.find(".bContent").height(b)}function p(b){m=a(window);n=a(document);c.attr("OpenerWindow")&&""!=c.attr("OpenerWindow")&&null!=b?y(top.$("#"+c.attr("OpenerWindow"))[0].contentWindow,b):null!=b&&y(window,b);popupOptions=c.data(l);popupOptions=c.data(l);1>=a(".bModal iframe").length?a("html").css("overflow","auto"):null==popupOptions||popupOptions.scrollBar||a("html").css("overflow","hidden");
a("."+popupOptions.closeClass).die("click."+g);a(".bModal."+g).die("click");n.unbind("keydown."+g);m.unbind("."+g);a(".bModal."+c.data("id")).remove();c.hide();null!=popupOptions&&null!=popupOptions.loadUrl&&popupOptions.contentContainer.empty();if(popupOptions&&a.isFunction(popupOptions.onClose))setTimeout(function(){popupOptions.onClose.call(c)},popupOptions.fadeSpeed);else if("function"===typeof window[c.attr("id")+"_OnClose"])window[c.attr("id")+"_OnClose"]();c.attr("RemoveOnClose")&&c.remove();
F();(a.browser.msie||a.BrowserData.isIE)&&setTimeout(function(){a(":input[type='text']:enabled:visible:first").focus()},1);return!1}function y(b,a){null!=b[a.openerAction]&&"function"===typeof b[a.openerAction]&&b[a.openerAction].apply(b,a.openerActionArgs)}function E(b){m.data(l,q);a("."+b.closeClass).live("click."+g,p);b.modalClose&&a(".bModal."+g).live("click",p).css("cursor","pointer");b.follow[2]||!b.follow[0]&&!b.follow[1]||m.bind("scroll."+g,function(){t&&c.stop().animate({left:b.follow[1]?
n.scrollLeft()+r:r,top:b.follow[0]?n.scrollTop()+s:s},b.followSpeed)}).bind("resize."+g,function(){if(t=m.height()>c.outerHeight(!0)+20)u=getCenterPositionForPopUp(c,b.amsl),b.follow[0]&&(s=z?s:u[0]),b.follow[1]&&(r=A?r:u[1]),c.stop().animate({left:A?r:r+n.scrollLeft(),top:z?s:s+n.scrollTop()},b.followSpeed)});b.escClose&&n.bind("keydown."+g,function(a){27==a.which&&p()})}function B(){0==top.$("#ModalsStack").length&&a(top.document.createElement("input")).attr({id:"ModalsStack",type:"hidden"}).appendTo(top.$("body")).val(JSON.stringify([]));
return jQuery.parseJSON(top.$("#ModalsStack").val())}function C(a){top.$("#ModalsStack").val(JSON.stringify(a))}function D(a){var c=B();c.push(a);C(c)}function F(){var a=B(),c=a.pop();C(a);return c}var n,m,t,r,s,q,u,g,z,A,x,l="bPopup",c=this;n=a(document);m=a(window);var w={autoOpen:!1,amsl:50,appendTo:"#frmMainForm",closeClass:"bClose",content:"ajax",contentContainer:null,escClose:!1,fadeSpeed:0,follow:[!0,!0,!0],followSpeed:500,loadUrl:null,modal:!0,modalClose:!0,modalColor:"#000",onClose:null,
onOpen:null,opacity:0.7,position:["auto","auto"],scrollBar:!1,zIndex:9999},v={init:function(b,d){this.data(l)||(a.isFunction(b)&&(b=null),popupOptions=a.extend({},w,b),c.data(l,popupOptions),c.hasClass("bDialog")||c.addClass("bDialog"),popupOptions.autoOpen&&f(popupOptions))},open:function(a){f(a)},openSupportView:function(b){f(b.modalOptions);var d="no";b.modalOptions&&b.modalOptions.iframeScrollbar&&(d="auto");var e=c.find("#"+c.attr("id")+"_content");0<e.length&&(e.html('<iframe id="'+b.windowName+
'" name="'+b.windowName+'" src="'+b.windowURL+'" frameborder="0" style="position:relative;width:100%; height:100%;" scrolling="'+d+'"></iframe>'),a.browser.msie&&9>parseFloat(a.browser.version)&&a("#"+b.windowName).height("100%").width("100%"));var g=a("#"+b.windowName),h=b.windowURL;a(g).on("load",function(){try{var b=a(g).contents().get(0).location.href.toLowerCase(),c=h.toLowerCase();-1!=b.split("?")[0].indexOf("/login.aspx")&&-1==c.split("?")[0].indexOf("/login.aspx")&&window.location.reload()}catch(d){console.log("Error on Redirect Modal on Invalid Session (because redirection): "+
d)}})},close:function(a){p(a)},centerModal:function(a){centerModal(a,!0)}};if(v[d])return v[d].apply(this,Array.prototype.slice.call(arguments,1));if("object"!==typeof d&&d)a.error("Method "+d+" does not exist on jQuery.bPopup");else return v.init.apply(this,arguments)};a.fn.bPopupExternal=function(d,f){var e=a(window),h="dynamicModal"+(e.data("bPopupExternal")?e.data("bPopupExternal")+1:1),e=a('<div id="'+h+'" class="VortalModalDialog" style="display:none"></div>');a("body").append(e);d.onClose=
function(){a("#"+h).remove()};e.bPopup(d,f);e.bPopup("open")}})(jQuery);
function createAndOpenSupportModal(a){var d=$(document.createElement("div")).attr({id:a.modalId}).addClass(a.cssClass).hide(),f=$(document.createElement("div")).attr({border:"0",cellspacing:"0",style:"height:100%;width:100%;margin:0px;padding:0px;"});d.append(f);d.css("width",a.modalWidth);d.css("height",a.modalHeight);var e=a.modalHeight;if(null!=a.showTitle&&a.showTitle){var h=$(document.createElement("div")).addClass("bTitle VortalModalDialogTitle"),k=$(document.createElement("span")),p="";null!=
a.title&&(p=a.title);$(k).text(p);h.append(k);f.append(h);k=$(document.createElement("input")).attr({type:"button",value:"X",style:"position:relative;float:right;"}).addClass("VortalBlueButton").click(function(){top.$("#"+a.modalId).bPopup("close")});h.append(k);e-=44}e=$(document.createElement("div")).attr({id:a.modalId+"_content",style:"height:"+e+"px;"});f.append(e);self==top?($("body").append(d),d.bPopup("openSupportView",a.supportOptions)):(d.appendTo(top.$("body")),top.$("#"+a.modalId).bPopup("openSupportView",
a.supportOptions));centerModal(d);self!=top&&d.attr("OpenerWindow",self.name);d.attr("RemoveOnClose","true")}function centerModal(a,d){var f=$(window.top).height(),e=$(window.top).width(),h=a.height(),k=a.width(),f=(f-h)/2*100/f+"%",e=(e-k)/2*100/e+"%",k=a.css("z-index");d?a.css({left:e,position:"fixed",top:f,right:0,"z-index":k+1}):a.css({left:e,position:"fixed",top:f,right:0})}
function getUrlVars(){for(var a=[],d,f=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),e=0;e<f.length;e++)d=f[e].split("="),a.push(d[0]),a[d[0]]=d[1];return a}function CloseModalSupportView(){var a=getUrlVars().isModal;null!=a&&"true"==a?window.parent.$("#"+window.name.substring(0,window.name.length-7)).bPopup("close"):window.close()}function CloseModalDialog(a){$(a).closest(".bModal").bPopup("close");$("html").css("overflow","auto")}
function getCenterPositionForPopUp(a,d){var f=($(window).height()-a.outerHeight(!0))/2-d,e=($(window).width()-a.outerWidth(!0))/2+getDistanceToBodyFromLeft();return[20>f?20:f,e]}function getDistanceToBodyFromLeft(){return $(window).width()<$("body").width()?0:($("body").width()-$(window).width())/2}$(window).resize(function(){$(".VortalModalDialog").each(function(){var a=$(this);centerModal(a,!1)})});
