function pageLoad(){PageLoadFunctions.Execute()}var PageLoadFunctions=function(){var n=[],t=function(t){$.inArray(t,n)<0&&n.push(t)},i=function(){for(var t=0;t<n.length;t++)n[t].call()};return{Add:t,Execute:i}}(),DialogBase=function(){var n={OnDialogContentLoaded:"dialog.ondialogcontentloaded",OnPanelContentLoaded:"panel.onpanelcontentloaded"},i=function(n){var t=$(".modal-body",n)[0],i=new Spinner({lines:10,length:0,width:5,radius:9,corners:1,rotate:0,direction:1,color:"#002655",speed:1,trail:50,left:"50%"});i.spin(t)},r=function(t,i,r){$(".modal-body",i).html(t);$("button",$(".modal-footer",i)).prop("disabled",!1);$(document).trigger(n.OnDialogContentLoaded,[i,r])},t=function(n,i){return $.each(i,function(i,r){if(r.OnClick!=null&&r.Id==null&&(r.Id="btnSubmit"+n,n++),r.Buttons!=null){var u=t(n,r.Buttons);n=u}}),n};return{ConfigureButtons:t,OnGetContents:r,ShowSpinner:i,Events:n}}(),Dialog=function(n){var r=n.Events,u=function(t){var i=$.extend({title:"PRISMS",buttons:[{Text:"Ok",IsCancel:!0}],contentController:null,contentData:null,callbackOnCreated:null,callbackOnClose:null,html:null,height:0,width:0,canDrag:!0},t),r,u;n.ConfigureButtons(0,i.buttons);r="/Home/GetDialog";u={title:i.title,buttons:i.buttons};$.ajax({url:r,type:"POST",contentType:"application/json, charset=utf-8",data:JSON.stringify(u),dataType:"html",success:function(n){f(n,i)},error:function(n,t,i){Common.HandleAjaxError(n,t,i)}})},f=function(r,u){var f=$(r);$("body").append(f);f.modal();u.canDrag&&$(".modal-content",f).drags({handle:".modal-header"});u.height>0&&$(".modal-body",f).css("height",u.height);u.width>0&&$(".modal-body",f).css("width",u.width);setTimeout(function(){$("input:text:visible:first",f).focus()},500);f.on("hidden.bs.modal",function(){f.remove();f.off();$(".modal:last-child").focus();u.callbackOnClose&&u.callbackOnClose()});t(u.buttons,f);$("button",$(".modal-footer",f)).not("[data-dismiss]").prop("disabled",!0);n.ShowSpinner(f);u.contentController?$.ajax({url:u.contentController,type:"POST",data:u.contentData,dataType:"html",success:function(t){n.OnGetContents(t,f,u.callbackOnCreated)},error:function(n,t,r){i(f);common.handleAjaxError(n,t,r)}}):u.html&&n.OnGetContents(u.html,f,u.onDialogCreated)},t=function(n,i){$.each(n,function(n,r){if(r.OnClick!=null&&r.Id!=null){var u=function(){r.OnClick()};i.on("click","#"+r.Id,u)}r.Buttons!=null&&t(r.Buttons,i)});i.on("keypress",function(n){n.keyCode!=$.ui.keyCode.ENTER||$("button:focus,textarea:focus",i).length||($("button[data-accept]:enabled",i).trigger("click"),n.preventDefault())})},i=function(n){$(n).modal("hide")},e=function(n,t){$("#frmDownload").length?$("#frmDownload").attr("src",t):$("<iframe>",{id:"frmDownload",src:t}).hide().appendTo(n)};return{create:u,close:i,events:r,download:e}}(DialogBase),Message=function(n){var o,t,e,f="/Common/DialogForUserMessage",l="/Common/DialogForValidationMessage",s=450,r="PRISMS",a=function(t,e,o){e||(e=r);var s={Id:"btnOK",Text:"OK",IsAccept:!0,OnClick:i},h={title:e,buttons:[s],contentController:f,callbackOnCreated:u,contentData:{text:htmlEncode(t)},width:o};n.create(h)},v=function(t,e,o,s){e||(e=r);var h=function(){i();window.location=o},c={Id:"btnOK",Text:"OK",IsAccept:!0,OnClick:h},l={title:e,buttons:[c],contentController:f,callbackOnCreated:u,contentData:{text:htmlEncode(t)},width:s};n.create(l)},y=function(e,o,h,l,a,v){var y,p;o||(o=r);a||(a="OK");t=l;t||(t=function(){i();window.__doPostBack(h.name,"")});y={Id:"btn"+a,Text:a,IsAccept:!0,OnClick:c};v||(v=s);p={title:o,buttons:[y],contentController:f,callbackOnCreated:u,contentData:{text:htmlEncode(e)},width:v};n.create(p)},h=function(i,o,h,l,a,v,y,p,w){var k,d,g;o||(o=r);y||(y="Yes");t=l;t||(t=function(){var n=v;n||(n="");WaitIndicator.Show();window.__doPostBack(h.name,n)});k={Id:"btn"+y,Text:y,IsAccept:!0,OnClick:c};p||(p="No");e=a;d={Id:"btn"+p,Text:p,IsCancel:!0,OnClick:b};w||(w=s);g={title:o,buttons:[k,d],contentController:f,callbackOnCreated:u,contentData:{text:htmlEncode(i)},width:w};n.create(g)},p=function(n,t,i,r){h(n,t,null,i,null,null,null,null,r)},w=function(t,f,e){f||(f=r);var o={Id:"btnOK",Text:"OK",IsAccept:!0,OnClick:i},s={title:f,buttons:[o],contentController:l,callbackOnCreated:u,contentData:{message:htmlEncode(t)},width:e};n.create(s)},u=function(n){o=n;WaitIndicator.Hide()},c=function(n){i();t&&t(n)},b=function(n){i();e&&e(n)},i=function(){n.close(o);$("button.btnClickDisable").prop("disabled",!1);$("button.btnClickDisable").removeClass("btnClickDisableClicked")};return{Alert:a,AlertRedirect:v,AlertAction:y,Confirm:h,ConfirmAction:p,Close:i,ValidationAlert:w}}(Dialog),Popup=function(n){var r=10004,t=function(i){var e={title:"PRISMS",buttons:[{Text:"Ok",Id:"btnCancel",IsCancel:!0}],contentController:null,contentData:null,callbackOnCreated:null,html:null,height:0,width:0,position:{my:"centre top+100",at:"centre top",of:window},canDrag:!0},r=$.extend(e,i),f;n.ConfigureButtons(0,r.buttons);f={title:r.title,buttons:r.buttons};$.ajax({url:"/Home/GetPopup",type:"POST",contentType:"application/json, charset=utf-8",data:JSON.stringify(f),dataType:"html",success:function(n){u(n,r)},error:function(n){t({title:"Error",html:n.responseText})}})},u=function(r,u){var o=$(r);$("body").append(o);f(o);u.canDrag&&$(".modal-dialog",o).drags({handle:".modal-header"});u.height>0&&$(".modal-body",o).css("height",u.height);u.width>0&&$(".modal-body",o).css("width",u.width);o.position(u.position);e(u.buttons,o);$("button",$(".modal-footer",o)).not("[data-dismiss]").prop("disabled",!0);n.ShowSpinner(o);u.contentController?$.ajax({url:u.contentController,type:"POST",data:u.contentData,dataType:"html",success:function(t){n.OnGetContents(t,o,u.callbackOnCreated)},error:function(n){i(o);t({title:"Error",html:n.responseText})}}):u.html&&n.OnGetContents(u.html,o,u.onDialogCreated)},f=function(n){n.css("position","absolute");n.css("z-index",r);var t=$(".popup",n);t.length>0&&t.hasClass("fade")&&($(".popup",n)[0].offsetWidth,$(".popup",n).addClass("in").attr("aria-hidden",!1));n.onclick=function(n){common.cancelBubble(n)};n.onmouseup=n.onclick},e=function(n,t){$.each(n,function(n,r){if(r.OnClick!=null&&r.Id!=null){var u=function(){r.OnClick()};t.on("click","#"+r.Id,u)}else if(r.IsCancel)t.on("click","#"+r.Id,function(){i(t)})});t.on("keypress",function(n){n.keyCode!=$.ui.keyCode.ENTER||$("button:focus",t).length||($("button[data-accept]:enabled",t).trigger("click"),n.preventDefault())})},i=function(n){$(".popup",n).fadeOut(300,function(){n.remove();n.off()})};return{Create:t,Close:i}}(DialogBase),DialogState=function(){var n=function(n,t,i){common.ajaxPost("/Common/SaveDialogStateToSession",i,{key:n,data:JSON.stringify(t)},!1,null,!0)};return{Persist:n}}(),DialogStateKey={PENDING_SUPERSEDED_EMAIL:"DialogForSearchingPendingSupersedeEmail",COMPLETED_SUPERSEDED_EMAIL:"DialogForSearchingCompletedSupersedeEmail",ORGANISATION_DATA:"ChooseOrganisationData",ORGANISATION_EXPORT:"ChooseOrganisationExportData",AGENT_LIST:"DialogForSearchingAgentList",PROVIDER_AGENT_LIST:"DialogForSearchingProviderAgentList",PROVIDER_AGENCY_LIST:"DialogForSearchingAgencyList",PROVIDER_AGENCY_BRANCH_LIST:"DialogForSearchingAgencyBranchList",BULK_COURSE_CANCEL_NOTIFICATION:"DialogForSearchingBulkCourseCancelNotificationEmail",BULK_COURSE_CANCEL_BATCH:"DialogForSearchingBulkCourseCancelBatch",LOCATION_LINK_SEARCH:"DialogForSearchingLocationLink",LOCATION_LINK_ACCEPT:"Accept-Location-Link",LOCATION_LINK_REJECT:"Reject-Location-Link",REF_TABLE_SEARCH:"DialogForSearchingRefTable",CHOOSE_AGENT_ORGANISATION:"DialogForChoosingAgentOrganisation",AGENT_COE_EXPORT:"DialogForAgentCoeExportFilter",AGENCY_SEARCH:"Agency-Search",PROVIDER_CAPACITY_CHART:"ProviderCapacityChart"},Export=function(){var n=function(n){n?window.location="/Common/Download?contentKey="+n:Message.Alert("There is no data associated with your selection.")},t=function(t,i){common.ajaxPost(t,n,i,!0,null,!0)};return{Download:t}}()