function usDateFormatter(n){var r=new Date(n),t=r.getDate(),i=r.getMonth()+1,f=r.getFullYear(),u;return t<10&&(t="0"+t),i<10&&(i="0"+i),u=i+"/"+t+"/"+f}function ukDateFormatter(n){var r=new Date(n),t=r.getDate(),i=r.getMonth()+1,f=r.getFullYear(),u;return t<10&&(t="0"+t),i<10&&(i="0"+i),u=t+"/"+i+"/"+f}var Site={resources:[],errorCheckString:"shl-server-error",serverMessageContainer:"",cloneProjectId:{},addProductsProjectId:{},addProductsProjectName:{},addProductsForAllCandidates:{},addProductsForFutureCandidates:{},addProductsCandidateIds:{},init:function(n){this.resources=n,Site.setupAjax(),$("#SearchTerm").val(""),$(".shl-datetime").each(function(){var n="#"+$(this).attr("id")+"_Alt",t=$(this).attr("beforeShowDay");t==undefined?$(this).datepicker({showOn:"both",altField:n,altFormat:"yy-mm-dd",changeMonth:!0,changeYear:!0,minDate:$(this).attr("minDate"),maxDate:$(this).attr("maxDate"),onSelect:function(){$(this).valid(),$(this).hasClass("DateWithEmailUpdate")&&$("#IsDateChanged").val("True")}}).next(".ui-datepicker-trigger").addClass($(this).attr("class")):$(this).datepicker({showOn:"both",altField:n,altFormat:"yy-mm-dd",changeMonth:!0,changeYear:!0,minDate:$(this).attr("minDate"),maxDate:$(this).attr("maxDate"),beforeShowDay:function(n){var i=new Function("date",t);return i(n)},onSelect:function(){$(this).valid(),$(this).hasClass("DateWithEmailUpdate")&&$("#IsDateChanged").val("True")}}).next(".ui-datepicker-trigger").addClass($(this).attr("class"))}),Site.CountrySection.initCountryListPopup(".country-list-popup",".country-change-link, .culture-change-link",".country-popup-cancel"),Site.CountrySection.checkCountryListAutoPopup(".country-list-popup",".country-change-link, .culture-change-link","shl-hidden"),Site.AccountSelection.initAccountSelectionAutoPopup(".account-selection-popup"),Site.jQueryButtons(),Site.applyStyling(),Site.updateSearchTextBox(),$(window).resize(function(){Site.updateSearchTextBox()}),Site.updateCurrentWidth(),$(window).resize(function(){Site.updateCurrentWidth()}),Site.initTooltips(this.resources),Site.setDisabled(),Site.setupSkipLink(),Site.annotateRequiredFields()},setupAjax:function(){$(document).ready(function(){$.ajaxSetup({async:!0,cache:!1}),$(document).ajaxSend(function(n,t,i){var r,u;i.type=="POST"&&(r=$("#ajaxAntiForgeryForm input[name=__RequestVerificationToken]").val(),r&&(u="__RequestVerificationToken="+encodeURIComponent(r),i.data=i.data?[i.data,u].join("&"):u,i.contentType!==!1&&t.setRequestHeader("Content-Type",i.contentType)))}),$.ajaxPrefilter(function(n){if(n.success){var r=n.success;n.success=function(n){Site.isRedirectionDuringAjax(n)||r.apply(this,arguments)}}else n.success=function(n){Site.isRedirectionDuringAjax(n)}}),$(document).ajaxError(function(n,t,i,r){i.error==null&&Site.alert(Site.resources.ServerError+r)})})},isRedirectionDuringAjax:function(n){return n&&n.RedirectUrl?(window.location=n.RedirectUrl,!0):!1},cloneProject:function(){Site.loadingOpen(Site.resources.CloneProjectLoading),$.ajax({type:"POST",url:Site.resources.CloneProjectUrl,data:{ProjectId:Site.cloneProjectId},success:function(n){if(n.indexOf(Site.errorCheckString)!=-1)Site.loadingClose(),$(Site.serverMessageContainer).html(n);else{var r=Site.resources.DoneCloneProjectUrl,u=r.indexOf("project/");u>=0&&(r=r.slice(0,u+7)),window.location=r}},error:function(n,t,i){Site.loadingClose(),Site.alert(Site.resources.CloneProjectError+i)}})},checkCloneProject:function(n,t,i){Site.cloneProjectId=n,t?Site.alert(Site.resources.UnTrainedCloneProjectOverride):Site.resources.IsZaBureauUser==="True"?Site.alertInputAjaxGetRequest(i,Site.resources.CheckCloneNewProjectUrl,Site.cloneProject,"",!0):Site.confirmAjaxGetRequest(i,Site.resources.CheckCloneNewProjectUrl,Site.cloneProject)},checkCreateNewProject:function(n){Site.confirmAjaxGetRequest(n,Site.resources.CheckCreateNewProjectUrl,Site.createNewProject)},checkAddProductsToExistingProject:function(n,t,i,r,u,f,e){var c,s,o,l,h;e==="True"||e=="true"?(s="",$.ajax({type:"GET",url:Site.resources.checkAddProductsToExistingProjectUrl,data:{ProjectId:n,ProjectName:t},success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(Site.serverMessageContainer).append(n):(s=$(n).find("span").first().text(),s.length>0?n.indexOf(Site.resources.AddProductsUnassignedProjectMsgText)!=-1||n.indexOf(Site.resources.AddProductsAssignedProjectMsgText)!=-1?(c=1,Site.alert(s)):c=0:c=0)},error:function(n,t,i){Site.alert(Site.resources.CheckOverrideProjectError+i)}})):(i=="true"?(o=$("#addProductsToProjectConfirmation"),l=jQuery.validator.format(Site.resources.AddProductsToExistingProjectPopupTitle,t)):(o=$("#addProductsToSelectedCandidatesConfirmaton"),l=jQuery.validator.format(Site.resources.AddProductsToExistingProjectForSelectedCandidatesPopupTitle,t,u.length)),h=[],h.push({text:Site.resources.AddProductsToExistingProjectContinue,click:function(){Site.checkAddProductsToExistingProjectContinue(this,n,t,i,r,u,f)}}),h.push({text:Site.resources.AddProductsToExistingProjectCancel,click:function(){$(this).dialog("close")}}),o.dialog({title:l,autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,600),buttons:h}),o!=undefined&&o.dialog("open"))},checkAddProductsToExistingProjectContinue:function(n,t,i,r,u,f,e){$(n).dialog("close"),Site.addProductsProjectId=t,Site.addProductsProjectName=i,Site.addProductsForAllCandidates=r,Site.addProductsForFutureCandidates=u,Site.addProductsCandidateIds=f,Site.serverMessageContainer=e,$.ajax({type:"GET",url:Site.resources.checkAddProductsToExistingProjectUrl,data:{ProjectId:t,ProjectName:i},success:function(n){if(n.indexOf(Site.errorCheckString)!=-1)$(Site.serverMessageContainer).append(n);else{var r=$(n).find("span").first().text();r.length>0?n.indexOf(Site.resources.AddProductsUnassignedProjectMsgText)!=-1||n.indexOf(Site.resources.AddProductsAssignedProjectMsgText)!=-1?Site.alert(r):Site.confirm(r,Site.addProductsToExistingProject):Site.addProductsToExistingProject()}},error:function(n,t,i){Site.alert(Site.resources.CheckOverrideProjectError+i)}})},inputAjaxGetRequest:function(n,t,i,r){Site.alertInputAjaxGetRequest(n,t,i,r,!1)},alertInputAjaxGetRequest:function(n,t,i,r,u){Site.serverMessageContainer=n,$.ajax({type:"GET",url:t,data:{inputId:r},success:function(n){if(n.indexOf(Site.errorCheckString)!=-1)$(Site.serverMessageContainer).append(n);else{var e="";e=r===""?$(n).find("span").first().text():$(n).html(),e.length>0?u?Site.alert(e):Site.confirm(e,i):i()}},error:function(n,t,i){Site.alert(Site.resources.CheckOverrideProjectError+i)}})},confirmAjaxGetRequest:function(n,t,i){Site.inputAjaxGetRequest(n,t,i,"")},createNewProject:function(){$.ajax({type:"GET",url:Site.resources.CreateNewProjectUrl,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(Site.serverMessageContainer).append(n):window.location=$(n).find("span").first().text()},error:function(n,t,i){Site.alert(Site.resources.CreateNewProjectError+i)}})},addProductsToExistingProject:function(){$.ajax({type:"GET",url:Site.resources.AddProductsToExistingProjectUrl,data:{ProjectId:Site.addProductsProjectId,ProjectName:Site.addProductsProjectName,AddProductsForAllCandidates:Site.addProductsForAllCandidates,AddProductsForFutureCandidates:Site.addProductsForFutureCandidates,CandidateIds:Site.addProductsCandidateIds.toString()},success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(Site.serverMessageContainer).append(n):window.location=$(n).find("span").first().text()},error:function(n,t,i){Site.alert(Site.resources.AddProductsToExistingProjectError+i)}})},setupSkipLink:function(){var i=navigator.userAgent.toLowerCase().indexOf("webkit")>-1,t=navigator.userAgent.toLowerCase().indexOf("opera")>-1,n;(i||t)&&(n=document.getElementById("skiptarget"),n.href="#skiptarget",n.innerText=Site.resources.StartOfMainContent,n.setAttribute("tabindex","0"),document.getElementById("skiplink").setAttribute("onclick","document.getElementById('skiptarget').focus();"))},annotateRequiredFields:function(){var n=$('[required="required"][requirement-skip!="true"]');n.after('<span class="shl-required-field">'+Site.resources.RequiredFieldsIndicator+"</span>"),n.closest("section").find("fieldset").before('<p class="shl-required-field">'+Site.resources.RequiredFields+"</p>")},disableFormSubmissionOnEnter:function(n){$(n).on("keypress",function(n){var t=n.keyCode||n.which;if(t==13)return n.preventDefault(),!1})},getDialogWidth:function(n,t,i,r){var f,u;return n!=undefined&&n!=null&&t!=undefined&&t!=null&&alert(Site.resources.GetDialogWidthError+": "+Site.resources.ChooseEitherPercentageOrPixels),i>r&&alert(Site.resources.GetDialogWidthError+": "+Site.resources.MinWidthGreaterThanMaxWidth),f=$(window).width(),u=0,u=n!=undefined&&n!=null?f*n:t,u>r&&(u=r),u<i&&(u=i),u},setDisabled:function(){$(".shl-disabled").each(function(){$(this).unbind("click"),$(this).attr("aria-disabled","true"),$(this).attr("disabled","disabled"),$(this).attr("href")!=undefined&&($(this).attr("data-href",$(this).attr("href")),$(this).attr("href","javascript:void(0);"))})},setEnabled:function(n){$.each(n,function(){$(this).attr("aria-disabled","false"),$(this).removeAttr("disabled"),$(this).attr("href")!=undefined&&$(this).attr("href",$(this).attr("data-href"))})},alert:function(n){var t=$(".shl-alert-popup"),i=$(".shl-alert-editable-content",t);i.html(n),t.dialog({bgiframe:!0,closeOnEscape:!0,modal:!0,resizable:!1,width:Site.getDialogWidth(.4,null,320,600),buttons:[{text:Site.resources.AlertOk,click:function(){$(this).dialog("close")}}]})},message:function(n){var t=$(".shl-message-popup"),i=$(".shl-message-editable-content",t);i.html(n),t.dialog({bgiframe:!0,closeOnEscape:!0,modal:!0,resizable:!1,width:Site.getDialogWidth(.4,null,320,600),buttons:[{text:Site.resources.AlertOk,click:function(){$(this).dialog("close")}}]})},success:function(n){var t=$(".shl-success-popup"),i=$(".shl-success-editable-content",t);i.html(n),t.dialog({bgiframe:!0,closeOnEscape:!0,modal:!0,resizable:!1,width:Site.getDialogWidth(.4,null,320,600),buttons:[{text:Site.resources.AlertOk,click:function(){$(this).dialog("close")}}]})},loadingOpen:function(n){var t=$(".shl-loading-popup"),i=$(".shl-loading-editable-content",t);i.html(n),$("a.ui-dialog-titlebar-close",t).remove(),t.dialog({bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.4,null,320,600)})},loadingClose:function(){var n=$(".shl-loading-popup");$(n).dialog("close")},confirm:function(n,t,i,r){var u=$(".shl-confirm-popup"),f=$(".shl-confirm-editable-content",u);f.html(n),i=i!=null&&i.length>0?i:Site.resources.ConfirmYes,r=r!=null&&r.length>0?r:Site.resources.ConfirmNo,u.dialog({bgiframe:!0,closeOnEscape:!0,modal:!0,resizable:!1,width:Site.getDialogWidth(.4,null,320,600),buttons:[{text:i,click:function(){$(this).dialog("close"),t()}},{text:r,click:function(){$(this).dialog("close")}}]})},updateCurrentWidth:function(){var n=$(".shl-current-width").parent().width()+40;$(".shl-current-width").text(Site.resources.CurrentScreenWidth+": "+n+"px")},jQueryButtons:function(){$(":submit, :button,  .shl-button-link").button()},applyStyling:function(){$("html.no-boxshadow").length>0&&$(".shl-drop-shadow").append('<div class="border-top"></div><div class="border-right"></div><div class="border-bottom"></div><div class="border-left"></div>'),$(".shl-chopped-corner").append('<div class="chopped-corner"></div>')},updateSearchTextBox:function(){var n=$(".shl-masthead"),t=$(".shl-search"),i=$('input[type="text"]',t),r;n.width()<540?(r=$('input[type="submit"]',t),i.width(n.width()-r.outerWidth()-20)):i.width("250px")},getQueryStrings:function(){var t={},i=function(n){return decodeURIComponent(n.replace(/\+/g," "))},f=location.search.substring(1),r=f.split("&"),u,n;for(u in r)n=r[u].split("="),n.length>1&&(t[i(n[0])]=i(n[1]));return t},initTooltips:function(n){$(".shl-tooltip-content").hide(),$(".shl-tooltip").live("click",function(){var i=$(this).next(".shl-tooltip-content").html(),t=$(".shl-tooltip-popup"),r=$(".shl-tooltip-editable-content",t);r.html(i),t.dialog({bgiframe:!0,closeOnEscape:!0,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,600),buttons:[{text:n.Close,click:function(){$(this).dialog("close")}}],dialogClass:"shl-tooltip-container"})}),$(".shl-profile-tooltip").tooltip(),$("#RegTooltip").tooltip(),$("#AccountTooltip").tooltip()},matchHeight:function(n){var t=0;$(n).height("auto"),$(n).each(function(){t=$(this).height()>t?$(this).height():t}),$(n).height(t)},resetValidation:function(){$("form").removeData("validator"),$("form").removeData("unobtrusiveValidation"),$.validator.unobtrusive.parse("form")},htmlEncode:function(n){if(n==null)return"";return n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},htmlDecode:function(n){if(n==null)return"";return n.replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")},Aria:{hiddenAlert:function(n){$("#siteHiddenAlert").attr("role","alert").text(n)}},Array:{Remove:function(n,t){var i=$.inArray(t,n);i!=-1&&n.splice(i,1)},Add:function(n,t){var i=$.inArray(t,n);i==-1&&n.push(t)}},CountrySection:{initCountryListPopup:function(n,t,i){var r=$(n);Site.resources.HideCountryPopup!=="True"&&($(t).live("click",function(){$("#CybotCookiebotDialog").hide(),$.ajax({type:"GET",url:Site.resources.CountryListUrl,success:function(n){$("#CybotCookiebotDialog").hide(),r.html(n),r.dialog({bgiframe:!0,closeOnEscape:!0,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,800),open:function(){$("#CybotCookiebotDialog").hide()},close:function(){location.reload()}}),Site.jQueryButtons(),r.removeClass("shl-off-screen")}})}),$(i).live("click",function(){r.dialog("close")}))},checkCountryListAutoPopup:function(n,t,i){if(!$(n).hasClass(i)){var r=$(t);r.click()}}},AccountSelection:{initAccountSelectionAutoPopup:function(n){$(document).ready(function(){var t=$(n);t.hasClass("shl-hidden")||$.ajax({type:"GET",url:Site.resources.AccountSelectionUrl,success:function(n){$("#CybotCookiebotDialog").hide(),t.html(n),t.dialog({bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,height:300,width:300}),Site.jQueryButtons(),t.removeClass("shl-off-screen"),$("#CurrentClientAccount").change(function(){Site.AccountSelection.refreshAccountSelection(t)})}})})},refreshAccountSelection:function(n){$.ajax({type:"GET",url:Site.resources.RefreshAccountSelectionUrl,data:{DNumber:$("#CurrentClientAccount option:selected").val()},success:function(t){n.html(t),Site.jQueryButtons(),$("#CurrentClientAccount").change(function(){Site.AccountSelection.refreshAccountSelection(n)})}})}},Ajax:{pagersSetup:function(n,t){$(".shl-pager-ajax",$(n).parent()).click(function(){t(this)})}}},usDate="mm/dd/yy";$('input[name="DeadlineDate"], input[name$=".DeadlineDate"], input[name$="Reminder"]').change(function(){$('input[name="DeadlineDate"], input[name$=".DeadlineDate"], input[name$="Reminder"]').valid()}),jQuery.validator.unobtrusive.adapters.add("futuredeadlinedateif",["checkerpropertyname","dateformat","minimumdelay","maxdate","usemaxandminpropertyname","mindatepropertyname","addmonthmethod","maxyears"],function(n){n.rules.futuredeadlinedateif=n.params;var t=n.params.usemaxandminpropertyname;n.messages.futuredeadlinedateif=n.message?$('input[name="'+t+'"], input[name$=".'+t+'"]').eq(0).val().toLowerCase()=="true"?n.message:ProjectDetails.resources.NotFutureDeadlineDateText:"Invalid deadline date";$(n.element).on("change",function(){$('input[name="'+n.params.checkerpropertyname+'"], input[name$=".'+n.params.checkerpropertyname+'"]').val("true")})}),jQuery.validator.addMethod("futuredeadlinedateif",function(n,t,i){var v=i.checkerpropertyname,a=i.usemaxandminpropertyname,l=i.mindatepropertyname,e=i.maxyears,o=i.dateformat.toLowerCase().replace("yyyy","yy"),r,c,b,u;try{if(n==null||n=="")return!0;if(r=$.datepicker.parseDate(o,$.trim(n)),e!=undefined&&e!=""&&(c=$.datepicker.parseDate(o,e),r>c))return!1;var k=$('input[name="'+v+'"], input[name$=".'+v+'"]').eq(0).val().toLowerCase()=="true",y=$('input[name="'+a+'"], input[name$=".'+a+'"]').eq(0).val().toLowerCase()=="true",p=usDateFormatter(new Date),f=$.datepicker.parseDate(usDate,p);if(y==!0){var w=$.datepicker.parseDate(o,$('input[name="'+l+'"], input[name$=".'+l+'"]').val()),h=usDateFormatter(w),s=$.datepicker.parseDate(usDate,h);if(f=new Date(new Date(s).setDate(s.getDate()+parseInt(i.minimumdelay))),i.maxdate!=undefined&&i.maxdate!=""&&(b=!0,u=$.datepicker.parseDate(usDate,h),u.setMonth(+u.getMonth()+ +i.maxdate),u<r||r<f))return!1}if(!k||r>=f)return!0;throw!1;}catch(d){return!0}}),jQuery.validator.unobtrusive.adapters.add("datewithinrange",["maxdatepropertyname","dateformat","minimumdaysstartdelay","maxdaysstartdelay","mindatepropertyname","weekdaysonly","maxyears"],function(n){n.rules.datewithinrange=n.params,n.messages.datewithinrange=n.message?n.message:"Invalid date"}),jQuery.validator.addMethod("datewithinrange",function(n,t,i){var f=i.maxdatepropertyname,e=i.mindatepropertyname,s=i.maxyears,u=i.dateformat.toLowerCase().replace("yyyy","yy"),r,o,h,c,l,a;try{if(n==null||n=="")return!0;if(($('input[name="Details.DeadlineDate"]').valid(),r=$.datepicker.parseDate(u,n),o=$.datepicker.parseDate(usDate,usDateFormatter(r)),o.setDate(o.getDate()+parseInt(i.maxdaysstartdelay)),h=$.datepicker.parseDate(u,i.minimumdaysstartdelay),i.weekdaysonly=="True"&&(r.getDay()==0||r.getDay()==6))||f!=undefined&&f!=""&&(c=$.datepicker.parseDate(u,$('input[name="'+f+'"], input[name$=".'+f+'"]').val()),o>c)||e!=undefined&&e!=""&&(l=$.datepicker.parseDate(u,$('input[name="'+e+'"], input[name$=".'+e+'"]').val()),r<l)||s!=undefined&&s!=""&&(a=$.datepicker.parseDate(u,s),r>a))return!1;if(h<=r)return!0;throw!1;}catch(v){return!1}}),jQuery.validator.unobtrusive.adapters.add("reminderwithindeadlinedateif",["deadlinedatepropertyname","checkerpropertyname","dateformat"],function(n){n.rules.reminderwithindeadlinedateif=n.params,n.messages.reminderwithindeadlinedateif=n.message?n.message:"Invalid reminder",$('input[name$="Reminder"]').change(function(){$('input[name="'+n.params.checkerpropertyname+'"], input[name$=".'+n.params.checkerpropertyname+'"]').val("true")})}),jQuery.validator.addMethod("reminderwithindeadlinedateif",function(n,t,i){var u=i.deadlinedatepropertyname,f=i.checkerpropertyname,c=i.dateformat.toLowerCase().replace("yyyy","yy"),e,r,o,s,h;try{if(n!=null&&n!=""&&parseInt(n)>0&&(e=$('input[name="'+f+'"], input[name$=".'+f+'"]').eq(0).val().toLowerCase()=="true",e)){r=null,o=$('input[name="'+u+'"], input[name$=".'+u+'"]').eq(0).val();try{if(r=$.datepicker.parseDate(c,o),r==null)return!0}catch(l){return!0}if(s=(new Date).setHours(0,0,0,0),h=Math.floor((r-s)/864e5),parseInt(n)>h)throw!1;}return!0}catch(l){return!1}}),jQuery.validator.unobtrusive.adapters.add("comparereminders",["otherreminderpropertynames","lesserthanother","datatype","dateformat"],function(n){n.rules.comparereminders=n.params,n.messages.comparereminders=n.message?n.message:"Invalid reminder"}),jQuery.validator.addMethod("comparereminders",function(n,t,i){var r=i.otherreminderpropertynames.split(",");try{return n!=null&&n!=""&&$.each(r,function(t,r){var u=$('input[name="'+r+'"], input[name$=".'+r+'"]').eq(0).val();if(i.datatype=="DateTime"){var f=i.dateformat.toLowerCase().replace("yyyy","yy"),e=$.datepicker.parseDate(f,n),o=$.datepicker.parseDate(f,u);if(i.lesserthanother=="True"){if(e>=o)throw!1;}else if(e<=o)throw!1;}else if(i.lesserthanother=="True"){if(parseInt(n)!=0&&parseInt(n)>=parseInt(u))throw!1;}else if(parseInt(n)!=0&&parseInt(n)<=parseInt(u))throw!1;}),!0}catch(u){return!1}}),$('input[name="DataProtectionPolicyAccepted"], input[name$=".DataProtectionPolicyAccepted"]').click(function(){$('input[name="DataProtectionPolicyAccepted"], input[name$=".DataProtectionPolicyAccepted"]').valid()}),jQuery.validator.unobtrusive.adapters.add("mustbetrue",function(n){n.element.tagName.toLowerCase()=="input"&&n.element.type.toLowerCase()=="checkbox"&&(n.rules.required=!0,n.messages.required=n.message?n.message:"Mandatory checkbox")}),jQuery.validator.unobtrusive.adapters.add("requiredif",["checkerpropertyname","checkerpropertyvalue"],function(n){n.rules.requiredif=n.params,n.message?(n.messages.requiredif=n.message,n.messages.required=n.message):n.messages.requiredif="Mandatory value"}),jQuery.validator.addMethod("requiredif",function(n,t,i){var r=i.checkerpropertyname,e=i.checkerpropertyvalue,u,f;try{if(u=$('input[name="'+r+'"], input[name$=".'+r+'"]'),f=u.eq(0).val().toLowerCase()==e.toLowerCase(),f&&(n==null||$.trim(n).length==0))throw!1;return!0}catch(o){return!1}}),jQuery.validator.unobtrusive.adapters.add("equaltoif",["otherpropertyname","checkerpropertyname"],function(n){n.rules.equaltoif=n.params,n.messages.equaltoif=n.message?n.message:"Values must match"}),jQuery.validator.addMethod("equaltoif",function(n,t,i){var r=i.otherpropertyname,u=i.checkerpropertyname,f,e;try{if(f=$('input[name="'+u+'"], input[name$=".'+u+'"]').eq(0).val().toLowerCase()=="true",e=$('input[name="'+r+'"], input[name$=".'+r+'"]').eq(0).val(),f&&n!=e)throw!1;return!0}catch(o){return!1}}),jQuery.validator.unobtrusive.adapters.add("regularexpressionmatch",["pattern","ispatternformatch"],function(n){n.rules.regularexpressionmatch=n.params,n.messages.regularexpressionmatch=n.message?n.message:"Invalid value"}),jQuery.validator.addMethod("regularexpressionmatch",function(n,t,i){if(n==null||n=="")return!0;var r=new RegExp(i.pattern),u=i.ispatternformatch.toLowerCase()=="true";return u?r.test(n):!r.test(n)});var Home={resources:[],init:function(n){this.resources=n,this.adjustSections(),$(window).resize(function(){Home.adjustSections()})},adjustSections:function(){$sections=$(".shl-same-height"),$buttons=$sections.find(".shl-button-link"),$buttons.css("left","auto").css("bottom","auto").css("position","relative"),$sections=$(".shl-same-height").height("auto");var t=$sections.map(function(){return $(this).height()}).get(),n=Math.max.apply(null,t);$sections.each(function(){var r=parseInt($(this).css("padding-top").slice(0,-2)),u=parseInt($(this).css("padding-bottom").slice(0,-2)),i,f,e;$(this).height(n+r+u),$.browser.msie&&parseInt($.browser.version)<=7&&(r=15,u=15,$(this).height(n)),i=$(".shl-button-link",$(this)),i!=null&&(f=Math.floor($(this).outerWidth()-i.outerWidth()-15),e=Math.floor($(this).outerHeight()-i.outerHeight()-15),i.css("left",f+"px").css("top",e+"px").css("position","absolute"))})}},Grid={actionUpdateClass:"shl-update",actionRemoveClass:"shl-remove",actionCancelClass:"shl-cancel",actionSaveClass:"shl-save",sortClass:"shl-sort",sortAscClass:"shl-asc",sortDescClass:"shl-desc",sortAsc:"Asc",sortDesc:"Desc",sortExpAttr:"data-sort",rowEditClass:"shl-edit",checkBoxCsv:"CheckboxIdCsv",keyTables:{},setup:function(n,t,i,r,u,f,e,o,s){t==undefined&&(t=0),i==undefined&&(i="shl-id"),r==undefined&&(r=null),u==undefined&&(u=null),f==undefined&&(f=null),o==undefined&&(o=!0),s==undefined&&(s=null),Grid.removeUserRow(n+" ."+Grid.actionRemoveClass,t,i,r,f,s),o&&Grid.updateUserRow(n+" ."+Grid.actionUpdateClass),Grid.cancelUserRow(n+" ."+Grid.actionCancelClass,t,i),Grid.saveUserRow(n+" ."+Grid.actionSaveClass,u),e!=undefined&&Grid.sortColumns(n+" thead th",e),Grid.setupCheckboxSelectors(n,i),$(n+" tbody "+i).each(function(){Grid.isDisplayFieldPopulated(this)||$(this).val()!="0"||Grid.editOrDisplayUserRow(this,!0)})},setupCheckboxSelectors:function(n,t){$(".headerCheckbox",n).click(function(){var i=$(this).is(":checked");$("td.shl-table-checkbox input[type=checkbox]",n).each(function(){$(this).attr("checked",i),Grid.updateCheckboxesSelectedIds(n,this,t)}),Grid.updateCheckboxSelectedCount(n)}),$("td.shl-table-checkbox input[type=checkbox]",n).click(function(){Grid.updateCheckboxesSelectedIds(n,this,t),Grid.updateCheckboxSelectedCount(n)}),$(".shl-"+n.replace("#","")+" .shl-selected-clear").click(function(){Grid.clearCheckboxSelection(n,t)}),Grid.highlightCheckboxSelectedRows(n,t),Grid.updateCheckboxSelectedCount(n)},clearCheckboxSelection:function(n,t){$(".headerCheckbox",n).attr("checked",!1),$(n+Grid.checkBoxCsv).val(""),Grid.highlightCheckboxSelectedRows(n,t),Grid.updateCheckboxSelectedCount(n)},highlightCheckboxSelectedRows:function(n,t){var i=Grid.getCheckboxSelection(n);$("td.shl-table-checkbox input[type=checkbox]",n).each(function(){var n=Grid.getRowIdentifier(this,t);i!=undefined&&i!=null&&$.inArray(n,i)!=-1?($(this).attr("checked",!0),Grid.highlightCheckboxSelectedRow(this)):($(this).attr("checked",!1),Grid.highlightCheckboxSelectedRow(this))})},updateCheckboxSelectedCount:function(n){var t=Grid.getCheckboxSelection(n);$(".shl-"+n.replace("#","")+" .shl-selected-count").text(t!=undefined?t.length:0)},getCheckboxSelection:function(n){var t=$(n+Grid.checkBoxCsv).val(),i;return t==undefined||t==""?null:(i=t.split(","),i.splice(0,1),i)},updateCheckboxesSelectedIds:function(n,t,i){var u=$(t).is(":checked"),f=Grid.getRowIdentifier(t,i),e=$(n+Grid.checkBoxCsv),r=e.val().split(","),o=$.inArray(f,r);o==-1?u&&r.push(f):u||r.splice(o,1),Grid.highlightCheckboxSelectedRow(t),e.val(r.join(","))},highlightCheckboxSelectedRow:function(n){var t=$(n).parents("tr").first(),i=$(n).is(":checked");i?t.addClass("shl-selected"):t.removeClass("shl-selected")},getRowIdentifier:function(n,t){var i=$(n).parents("tr").first();return i.find(t).val()},setupKeyboardNav:function(n){var t=n.replace("#",""),i=document.getElementById(t);i!=null&&(Grid.keyTables[t]=new KeyTable({table:i,focusClass:"shl-focus",initScroll:!1,form:!0}),Grid.keyTables[t].event.focus(null,null,function(t){$(n).find("td").attr("aria-selected","false"),$(t).attr("aria-selected","true")}),Grid.keyTables[t].event.action(null,null,function(n){var e=Grid.getFirstNodeAction(n),u,f;e.length>0?($(n).parent("tr").addClass(Grid.rowEditClass),e.focus(),Grid.keyTables[t].block=!0):$(n).parent("tr").find(".editor-field").length>1?(u=Grid.getFirstNodeControl(n),u.length>0&&Grid.editOrDisplayUserRow(u,!0)):(f=$(n).find("a, input, select").first(),f.length>0&&(f.focus(),Grid.keyTables[t].block=!0))}))},getCellValue:function(n,t){var i=$(n).parents("tr").first(),r=i.find(t).first();return r.val()},getFirstNodeAction:function(n){return $(n).find("."+Grid.actionUpdateClass+":visible,."+Grid.actionRemoveClass+":visible,."+Grid.actionSaveClass+":visible,."+Grid.actionCancelClass+":visible").first()},getFirstNodeControl:function(n){var t=$("input:not(input[type=hidden]):first",n);return t.length==0&&(t=$("select:first",n)),t},sortColumns:function(n,t){Grid.sortColumnCss(n),$("a",n).unbind("click"),$("a",n).click(function(){var r=$(this).parent().attr(Grid.sortExpAttr),u=$(this).parent().hasClass(Grid.sortAscClass)?Grid.sortDesc:$(this).parent().hasClass(Grid.sortDescClass)?Grid.sortAsc:Grid.sortDesc,f;$(n).removeClass(Grid.sortClass),$(n).removeClass(Grid.sortAscClass),$(n).removeClass(Grid.sortDescClass),$(this).parent().addClass(u==Grid.sortAsc?Grid.sortAscClass:Grid.sortDescClass),Grid.sortColumnCss(n),f=r.indexOf("Dynamic_")!=-1?"_":"",t(r+f+u)})},sortColumnCss:function(n){$(n).removeClass(Grid.sortClass),$(n).each(function(){var i=$(this).attr(Grid.sortExpAttr),n,t,r;$(this).hasClass(Grid.sortDescClass)||$(this).hasClass(Grid.sortAscClass)||i==undefined||$(this).addClass(Grid.sortClass),i!=undefined&&(n=$.trim($(this).html()),t=n,n.indexOf("<a ")!=-1&&(t=$(n).text()),r='<a href="javascript:void(0);" aria-label="'+Site.resources.GridOrderBy.replace("{0}",t)+'">'+t+"</a>",$(this).html(r))})},getSortExpression:function(n){var i=$(n+" thead th["+Grid.sortExpAttr+"]").not("."+Grid.sortClass),t=i.attr(Grid.sortExpAttr),r=t.indexOf("Dynamic_")!=-1?"_":"";return i.hasClass(Grid.sortAscClass)?t+r+Grid.sortAsc:t+r+Grid.sortDesc},saveUserRow:function(n,t){$(n).unbind("click"),$(n).click(function(n){$(this).attr("disabled")===undefined&&(Grid.isUserRowValid(this)?(Grid.setDisplayFields(this),t!=null&&t!=undefined?t(this):Grid.editOrDisplayUserRow(this,!1)):n.preventDefault())})},setDisplayFields:function(n){var t=$(n).parents("tr").first();t.find(".editor-field").each(function(n,t){var u=$(this).prevAll(".display-field:first"),i,f,r,e;Grid.isActionDiv(u.html())||(i=$(this).find("input:visible:first").val(),i==undefined&&(f=$(this).find("select:visible:first option:selected").text(),i=f),r=i==undefined?"undefined":i,u.html(r),e=$(t).siblings(".editor-label").first().find("label").text(),$(t).parent().attr("aria-label",e+" = "+r))})},isUserRowValid:function(n){var t=!0,i=$(n).parents("tr").first();return i.find("input, select").each(function(){$(this).attr("type")=="radio"||$(this).valid()||(t=!1)}),t},removeUserRow:function(n,t,i,r,u,f){$(n).unbind("click"),$(n).click(function(n){var s;if($(this).attr("disabled")===undefined){var o=this,e=$(this).parents("tr").first(),h=e.parents("tbody").first();Grid.getTotalRows(e,i)>t?(s=f==null?Site.resources.GridConfirmRemoveRow:f,Site.confirm(s,function(){u!=null&&u!=undefined?u(o):(Grid.insertIDIntoRemoveField(e,r,i),Grid.removeRow(o))})):(n.preventDefault(),Site.alert(Site.resources.GridAlertRemoveMinRowConflict.replace("{0}",t)))}})},getTotalRows:function(n,t){var i=n.find(t+"TotalRows").val();return i==undefined?n.parents("tbody").first().find("tr").length:i},insertIDIntoRemoveField:function(n,t,i){if(t!=null&&t!=undefined){var r=n.find(i).val();r!=0&&$(t).val($(t).val()+r+",")}},removeRow:function(n){if($(this).attr("disabled")===undefined){var t=$(n).parents("tr").first();t.fadeOut().remove()}},updateUserRow:function(n){$(n).unbind("click"),$(n).click(function(){if($(this).attr("disabled")===undefined){Grid.editOrDisplayUserRow(this,!0);var n=Grid.getFirstNodeControl($(this).parents("tr").first());n.focus()}})},getPage:function(n){var t=$(n).parent().find(".shl-pager a.selected").attr("data-page"),i=$(n).find("tbody tr").length;return i==0&&(t=t-1,t<1&&(t=1)),t},cancelUserRow:function(n,t,i){$(n).unbind("click"),$(n).click(function(n){var r,u,f;$(this).attr("disabled")===undefined&&(r=this,Grid.isDisplayFieldPopulated(r)?Grid.editOrDisplayUserRow(r,!1):(u=$(r).parents("tr").first(),f=u.parents("tbody").first(),Grid.getTotalRows(u,i)>t?Site.confirm(Site.resources.GridConfirmCancelRow,function(){var n=$(r).parents(".shl-table").first().attr("id").replace("#","");Grid.keyTables[n]!=undefined?(Grid.keyTables[n].block=!1,Grid.removeRow(r)):Grid.removeRow(r)}):(n.preventDefault(),Site.alert(Site.resources.GridAlertCancelMinRowConflict.replace("{0}",t)))))})},isDisplayFieldPopulated:function(n){var i=$(n).parents("tr").first(),r=i.find(".display-field:first"),t=i.find(".editor-field:first").children().first();return t.val()==undefined?!0:t.val().length>0&&r.html().indexOf(t.val())!=-1},isActionDiv:function(n){return n.indexOf(Grid.actionUpdateClass)!=-1||n.indexOf(Grid.actionRemoveClass)!=-1||n.indexOf(Grid.actionSaveClass)!=-1||n.indexOf(Grid.actionCancelClass)!=-1},editOrDisplayUserRow:function(n,t){var i=$(n).parents("tr").first(),u=i.find(".display-label, .display-field"),f=i.find(".editor-label, .editor-field"),r=i.parents("table.shl-table").first().attr("id").replace("#","");t?(f.show(),u.hide(),Site.matchHeight(i.find(".editor-label")),i.addClass(Grid.rowEditClass),Grid.keyTables[r]!=undefined&&(Grid.keyTables[r].block=!0),$(n).focus()):(f.hide(),u.show(),i.removeClass(Grid.rowEditClass),Grid.keyTables[r]!=undefined&&(Grid.keyTables[r].block=!1))},disableEnableUserRowActions:function(n,t,i){for(var f=t.split(","),u,r=0;r<f.length;r++)u=n.find(".shl-"+f[r]),i?u.show():u.hide()},getUserRowData:function(n){var t={},i=$(n).parents("tr").first(),r=$.each(i.find(".editor-field input, .editor-field select, .editor-field textarea").serializeArray(),function(n,i){t[i.name]=i.value});return t},getRowDataField:function(n,t,i){var r="";return $.each(n,function(n,u){if(n.indexOf(t)!=-1&&(r=u,i===1)){var f=n.trim().split(".");if(f.length>0&&f[f.length-1]==t.trim())return!1}}),r}},DashBoard={resources:[],recentActivity:"",recentActivitySearch:"",recentActivitySearchFor:"",recentActivitySearchForClear:"",recentActivitySearchButton:"",recentActivityMessage:"",recentActivityDefaultOrdering:"TimestampDesc",recentActivityRefreshError:"",init:function(n){this.resources=n,this.initRecentActivity(),this.setupRecentActivity(),this.setupRecentActivitySearch(),this.setupClearRecentActivitySearch(),this.initOpenCloseSearchForm(".shl-message-search-open-close-link",".shl-message-search-form","#MessageSearchFormOpen",this.resources.MessageList_Close_SearchForm,this.resources.MessageList_Open_SearchForm),this.initOpenCloseMessageBody(".shl-message",".shl-message-header",".shl-message-body","shl-open"),this.initPreAjaxRequest("#btnMessageSearch",this.resources.MessageList_Search_InProgress,!1),this.initPreAjaxRequest("#btnMessageDelete",this.resources.MessageList_Delete_InProgress,!0,"#MessageSearchFormOpen"),this.initPreAjaxRequest("#btnMessageRead",this.resources.MessageList_Read_InProgress,!0,"#MessageSearchFormOpen")},initRecentActivity:function(){DashBoard.recentActivity="#"+DashBoard.resources.RecentActivity,DashBoard.recentActivitySearch=DashBoard.recentActivity+"Search",DashBoard.recentActivitySearchFor=DashBoard.recentActivitySearch+"For",DashBoard.recentActivitySearchForClear=DashBoard.recentActivitySearchFor+"Clear",DashBoard.recentActivitySearchButton=DashBoard.recentActivitySearch+"Button",DashBoard.recentActivityMessage=DashBoard.recentActivity+"Message",DashBoard.recentActivityRefreshError=DashBoard.resources.RecentActivityRefreshError},setupRecentActivity:function(){Grid.setup(DashBoard.recentActivity,0,".shl-list-id",null,null,null,DashBoard.sortRecentActivityColumn),Site.Ajax.pagersSetup(DashBoard.recentActivity,DashBoard.pageRecentActivity)},sortRecentActivityColumn:function(n){DashBoard.refreshRecentActivity(Grid.getPage(DashBoard.recentActivity),n)},refreshRecentActivity:function(n,t,i){n=n==undefined?Grid.getPage(DashBoard.recentActivity):n,t=t==undefined?Grid.getSortExpression(DashBoard.recentActivity):t,i=i==undefined?$(DashBoard.recentActivitySearchFor+" .shl-term").text():i;var r={Page:n==undefined?1:n,OrderBy:t==undefined?DashBoard.recentActivityDefaultOrdering:t,SearchTerm:i==undefined||i.length==0?"":i};$.ajax({type:"GET",url:this.resources.RecentActivityUrl,data:r,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(DashBoard.recentActivityMessage).append(n):($(DashBoard.recentActivity).parent().html(n),DashBoard.setupRecentActivity(),Site.resetValidation(),Site.jQueryButtons(),$(DashBoard.recentActivity).find("a:first").focus())},error:function(n,t,i){Site.alert(DashBoard.recentActivityRefreshError+i)}})},pageRecentActivity:function(n){var t=$(n).attr("data-page");DashBoard.refreshRecentActivity(t,Grid.getSortExpression(DashBoard.recentActivity))},setupRecentActivitySearch:function(){$(DashBoard.recentActivitySearchButton).click(function(){DashBoard.searchRecentActivity()}),$(DashBoard.recentActivitySearch).keypress(function(n){n.which==13&&(n.preventDefault(),DashBoard.searchRecentActivity())})},searchRecentActivity:function(){if($(DashBoard.recentActivitySearch).valid()){var n=$(DashBoard.recentActivitySearch).val();n.length>0&&($(DashBoard.recentActivitySearchFor+" .shl-term").text(n),$(DashBoard.recentActivitySearchFor).parents(".row-fluid.shl-hide").first().removeClass("shl-hide"),DashBoard.refreshRecentActivity(1,undefined,n))}},setupClearRecentActivitySearch:function(){$(DashBoard.recentActivitySearchForClear).click(function(){$(DashBoard.recentActivitySearch).val(""),$(DashBoard.recentActivitySearch).valid(),$(DashBoard.recentActivitySearchFor+" .shl-term").text(""),$(DashBoard.recentActivitySearchFor).parents(".row-fluid").first().addClass("shl-hide"),DashBoard.refreshRecentActivity(1,Grid.getSortExpression(DashBoard.recentActivity))})},initOpenCloseSearchForm:function(n,t,i,r,u){$(n).live("click",function(){$(t).is(":hidden")?($(t).slideDown("fast"),$(this).attr("title",r).text(r),$(i).val("True")):($(t).slideUp("fast"),$(this).attr("title",u).text(u),$(i).val("False"))}),this.openCloseSearchForm(n,t,i,r,u)},openCloseSearchForm:function(n,t,i,r,u){$(i).val()=="True"?($(t).show(),$(n).attr("title",r).text(r)):($(t).hide(),$(n).attr("title",u).text(u))},initOpenCloseMessageBody:function(n,t,i,r){$(t).live("click",function(){var t=$(this).parent(n),u=$(this).next(i),f=t.hasClass(r);f?(t.removeClass(r),u.slideUp("fast")):($(i).slideUp("fast"),$(n).removeClass(r),t.addClass(r),u.slideDown("fast"))})},initPreAjaxRequest:function(n,t,i,r){$(n).live("click",function(){return i&&$('<input id="MessageSearchFormOpen" name="MessageSearchFormOpen" type="hidden" value="'+$(r).val()+'">').appendTo($(this).parent()),$(this).attr("disabled",!0).val(t).submit(),!0})}},ProductsSearch={resources:[],init:function(n){this.resources=n,FacetedSearch.init(this.resources),ProductsBar.init(".shl-pb",this.resources),Product.init(".shl-product-more-description-link",".shl-product-more-description",this.resources)}},FacetedSearch={resources:[],init:function(n){$("#fsgroup-YourSelections, #fsgroup-ProductTypes",this.fs).accordion({autoHeight:!0,collapsible:!0,active:0}),$("#fsgroup-JobLevels, #fsgroup-Industries, #fsgroup-Languages, #fsgroup-AssessmentTypes, #fsgroup-Propositions, #fsgroup-TrainingLevels",this.fs).accordion({autoHeight:!0,collapsible:!0,active:!1}),$("#fsSelections a").click(function(){var t=$(this).parent().find("span").first().text()+n.fsRemovedFromSelection;$("#fsSelections").children().length==1&&(t=n.fsNothingSelected),Site.Aria.hiddenAlert(t)}),$(".shl-fs-item").click(function(){var t=$(this).text();Site.Aria.hiddenAlert(t+n.fsAddedToSelection)})}},ProductsBar={resources:[],pb:null,init:function(n,t){this.resources=t,this.pb=$(n),$("select",this.pb).change(function(){location.href=$(this).val()})}},Product={resources:[],init:function(n,t,i){$(n).live("click",function(){var n=$(this).next(t).eq(0);n.is(":hidden")?(n.slideDown("fast"),$(this).attr("title",i.pcHideMore).text(i.pcHideMore)):(n.slideUp("fast"),$(this).attr("title",i.pcShowMore).text(i.pcShowMore))}),$(document).moreless({startHeight:37,lessText:i.LessText,moreText:i.MoreText})}},ProductTree={init:function(n){var t=ProductTree.getState();ProductTree.initTabs(t),ProductTree.initTree(t,n,"#productSelectionAssessments",1),ProductTree.initTree(t,n,"#productSelectionReports",2),ProductTree.initSelection(t,n)},getState:function(){var n=window.location.hash.split("_");return{productTypeId:parseInt(n[0])||null,selectedId:parseInt(n[1])||null,languageCode:n[2]||null,jobId:parseInt(n[1])||null}},setState:function(n){window.location.hash=n.productTypeId.toString()+n.selectedId.toString()},initTabs:function(n){$("#productSelectionTabs").tabs(),n.productTypeId&&$("#productSelectionTabs").tabs("select",n.productTypeId-1)},initTree:function(n,t,i,r){$(i).bind("select_node.jstree",function(n,i){var u=i.rslt.obj.data("id");ProductTree.getState().selectedId!=u&&(ProductTree.setState({productTypeId:r,selectedId:u}),ProductTree.getSelectedProduct(t,u))}).jstree({core:{animation:0,strings:{loading:t.LoadingTree}},themes:{theme:"apple",url:"/content/jsTree/themes/apple/style.css"},json_data:{ajax:{method:"GET",url:t.GetProductsUrl,data:function(t){return{categoryId:t==-1?null:t.data("id"),productTypeId:r,selectedId:n.selectedId}}}},ui:{select_limit:1,initially_select:["Leaf"+n.selectedId]},types:{types:{Group:{hover_node:!1,select_node:function(n){return this.toggle_node(n),!1}}}},plugins:["themes","json_data","ui","types"]})},initSelection:function(n,t){n.selectedId&&ProductTree.getSelectedProduct(t,n.selectedId,n.languageCode,n.jobId)},getSelectedProduct:function(n,t,i,r){Site.loadingOpen(n.LoadingSelection),$.ajax({type:"GET",url:n.SelectedProductUrl,data:{id:t,languageCode:i,jobId:r},success:function(t){$("#selectedProduct").html(t),Site.jQueryButtons(),Site.annotateRequiredFields(),Site.resetValidation(),Product.init(".shl-product-more-description-link",".shl-product-more-description",n),ProductTree.initButtons(n),Site.loadingClose()}})},initButtons:function(n){$("input[name=btnAddToBasket]").click(function(){if($(".formAdd2Basket").valid()){Site.loadingOpen(n.LoadingBasket);var t=[];$("#selectedProduct input[type=checkbox]:checked").each(function(){var i=$(this).closest("article"),r=$(".selProductId",i).val(),u="SelectedLanguage"+r,f="SelectedJob"+r,n=$("[name="+f+"]",i).val();n=n==undefined?0:n,t.push(r+":"+$("[name="+u+"]",i).val()+"|"+n)}),$.ajax({type:"POST",url:n.AddToBasketUrl,data:{selectedIds:t.join()},success:function(n){$("aside.basket-widget").replaceWith(n),Site.jQueryButtons(),Site.loadingClose()}})}return!1}),$(".formAdd2Basket article.shl-product-add-to-basket").each(function(){var n=$(".selProductId",this).val(),t="SelectedLanguage"+n,i="SelectedJob"+n;$("[name=SelectedLanguage]",this).attr("name",t),$("[name=SelectedJob]",this).attr("name",i),$(".shl-product-language-validation > span",this).attr("data-valmsg-for",t),$(".shl-product-job-validation > span",this).attr("data-valmsg-for",i)});var t=$(".formAdd2Basket input[type=checkbox][name=Selected]");t.change(function(){$(this).closest("article").find("select").prop("disabled",!this.checked)}),t.change()}},Profile={resources:[],hideClass:"shl-hide",disabledCheckbox:"disabled-checkbox",btnCancelId:"#btnCancel",isNewUserId:'input[name="IsNewUser"]',isSuperAdmin:'input[name="IsSuperAdmin"]',emailId:'input[name="Email"]',accountNumberId:'input[name="AccountNumber"]',accountNumberValidIconClass:"account-number-valid-icon",addAccountPrefix:"AddAccount",addAccountContainerId:"#AddAccountContainer",addAccountNumberId:'input[name="AddAccount.AccountNumber"]',addAccountResultsContainerId:"#AddAccountResultsContainer",btnGetRegistratioNumbersForAccountNumberId:"#btnGetRegistratioNumbersForAccountNumber",registrationNumbersDropDownId:'select[name="AddAccount.RegistrationNumber"]',btnAddRegistrationNumberId:"#btnAddRegistrationNumber",userAccountsPrefix:"UserAccounts",userAccountsTableId:"#UserAccountsTable",userAccountsRowClass:"user-accounts-row",userAccountsEmptyRowClass:"user-accounts-empty-row",noUserAccountsRowClass:"no-user-accounts-row",userAccountsIsPrimary:"user-accounts-is-primary",userAccountsSelectClass:"user-accounts-select",userAccountsSelectAllClass:"user-accounts-select-all",btnRemoveAccountsId:"#btnRemoveAccounts",init:function(n){this.resources=n,Profile.initCancelButton(),Profile.initDisabledCheckBoxes(),Profile.initAccountNumberField(),Profile.initAddAccountForm(),Profile.initUserAccountsTable(),Profile.initTitleAutocomplete()},initCancelButton:function(){$(Profile.btnCancelId).click(function(){Site.confirm(Profile.resources.Message_DiscardChanges_Confirm,function(){window.location.reload()})})},initDisabledCheckBoxes:function(){$("."+Profile.disabledCheckbox).click(function(){$(this).is(":checked")?$(this).removeAttr("checked").val("False"):$(this).attr("checked","checked").val("True")})},initAccountNumberField:function(){var i=$(Profile.isNewUserId),t=$(Profile.emailId),n=$(Profile.accountNumberId);i.length==1&&i.val().toLowerCase()=="true"&&t.length==1&&n.length==1&&($(Profile.accountNumberId+", "+Profile.emailId).change(function(){if($("."+Profile.accountNumberValidIconClass).hide(),t.valid()&&n.valid()){if($.trim(n.val())=="")return}else return;Site.loadingOpen(Profile.resources.Message_ValidatingAccount_Progress),$.ajax({type:"POST",url:Profile.resources.ValidateAccountNumberAndEmailUrl,data:{AccountNumber:n.val(),Email:t.val()},success:function(t){t.ErrorMessage?(Profile.showErrorMessage(n,t.ErrorMessage),t.ConfirmationMessage&&Site.confirm(t.ConfirmationMessage,function(){window.location=Profile.resources.Olb1BaseUrl},Profile.resources.Global_OK,Profile.resources.Global_Cancel)):t.Success&&t.Success.toLowerCase()=="true"&&$("."+Profile.accountNumberValidIconClass).show(),Site.loadingClose()},error:function(){Site.loadingClose(),Site.alert(Profile.resources.ErrorOccurred)}})}),Site.disableFormSubmissionOnEnter(Profile.accountNumberId+", "+Profile.emailId))},initAddAccountForm:function(){$(Profile.btnGetRegistratioNumbersForAccountNumberId).click(function(){var i=$(Profile.emailId),t=$(Profile.isSuperAdmin).attr("checked")=="checked",n=$(Profile.addAccountNumberId);if(n.length!=1)return Site.alert(Profile.resources.Message_MissingData_Error),!1;if(n.valid()){if($.trim(n.val())=="")return Profile.showErrorMessage(n,Profile.resources.Message_AccountNumberRequired_Error),!1}else return!1;Site.loadingOpen(Profile.resources.Message_SearchingForAccount_Progress),$.ajax({type:"POST",url:Profile.resources.GetRegistratioNumbersForAccountNumberUrl,data:{AccountNumber:n.val(),Email:i.val(),IsSuperAdmin:t},success:function(n){$(Profile.addAccountContainerId).html(n),Profile.initAddAccountForm(),Profile.removeAlreadyExistingAccounts(!0),Site.jQueryButtons(),Site.loadingClose()},error:function(){Site.loadingClose(),Site.alert(Profile.resources.ErrorOccurred)}})}),$(Profile.btnAddRegistrationNumberId).click(function(){var u,n;try{if(u=$(Profile.registrationNumbersDropDownId).eq(0),n=u.val(),n==null||n=="")return Profile.showErrorMessage(u,Profile.resources.Message_NoSelectedRegistrationNumber_Error),!1;if($("."+Profile.userAccountsPrefix+"."+n).length>0)return Profile.showErrorMessage(u,Profile.resources.Message_SelectedRegistrationNumberAlreadyExists_Error),!1;Profile.hideErrorMessage(u);var t="."+Profile.addAccountPrefix+"."+n+".",o=$(Profile.userAccountsTableId).eq(0),f=$("."+Profile.userAccountsEmptyRowClass,o).eq(0),r=f.clone(!0).removeClass(Profile.userAccountsEmptyRowClass).removeClass(Profile.hideClass).addClass(Profile.userAccountsRowClass),e=$(t+"IsZaUser").val()=="True"?"shl-disabled":"",i=1;r.find("div").eq(i).text(Site.htmlDecode($(t+"CompanyName").val())+" ("+Site.htmlDecode($(t+"AccountNumber").val())+")").append(Profile.buildHiddenField(n,"AccountNumber",$(t+"AccountNumber").val(),Profile.userAccountsPrefix+" "+n)).append(Profile.buildHiddenField(n,"CompanyName",$(t+"CompanyName").val())).append(Profile.buildHiddenField(n,"BusinessUnit",$(t+"BusinessUnit").val())).append(Profile.buildHiddenField(n,"CurrencyIsoCode",$(t+"CurrencyIsoCode").val())).append(Profile.buildHiddenField(n,"CountryCode",$(t+"CountryCode").val())).append(Profile.buildHiddenField(n,"VatNumber",$(t+"VatNumber").val())).append(Profile.buildHiddenField(n,"PurchaseOrderRequired",$(t+"PurchaseOrderRequired").val())).append(Profile.buildHiddenField(n,"IsPrePaidUser",$(t+"IsPrePaidUser").val())).append(Profile.buildHiddenField(n,"ParentAccountNumber",$(t+"ParentAccountNumber").val())).append(Profile.buildHiddenField(n,"RegistrationNumber",$(t+"RegistrationNumber").val())).append(Profile.buildHiddenField(n,"Email",$(t+"Email").val())).append(Profile.buildHiddenField(n,"FirstName",$(t+"FirstName").val())).append(Profile.buildHiddenField(n,"LastName",$(t+"LastName").val())).append(Profile.buildHiddenField(n,"Phone",$(t+"Phone").val())).append(Profile.buildHiddenField(n,"AddressLine1",$(t+"AddressLine1").val())).append(Profile.buildHiddenField(n,"AddressLine2",$(t+"AddressLine2").val())).append(Profile.buildHiddenField(n,"AddressLine3",$(t+"AddressLine3").val())).append(Profile.buildHiddenField(n,"City",$(t+"City").val())).append(Profile.buildHiddenField(n,"State",$(t+"State").val())).append(Profile.buildHiddenField(n,"Country",$(t+"Country").val())).append(Profile.buildHiddenField(n,"PostCode",$(t+"PostCode").val())),i=i+1,r.find("div").eq(i).text(Site.htmlDecode($(t+"FirstName").val())+" "+Site.htmlDecode($(t+"LastName").val())+" ("+Site.htmlDecode($(t+"RegistrationNumber").val())+")"),i=i+1,r.find("div").eq(i).append(Profile.buildCheckBox(n,"IsPrimaryAccount",$(t+"IsPrimaryAccount").val(),Profile.userAccountsIsPrimary)),i=i+1,r.find("div").eq(i).append(Profile.buildCheckBox(n,"IsOtTrained",$(t+"IsOtTrained").val(),e)),i=i+1,r.find("div").eq(i).append(Profile.buildCheckBox(n,"IsHPCSATrained",$(t+"IsHPCSATrained").val(),"shl-disabled")),i=i+1,r.find("div").eq(i).append(Profile.buildCheckBox(n,"IsTATrained",$(t+"IsTATrained").val(),"shl-disabled")),i=i+1,r.find("div").eq(i).append(Profile.buildCheckBox(n,"IsOpqTrained",$(t+"IsOpqTrained").val(),e)),$("."+Profile.noUserAccountsRowClass).addClass(Profile.hideClass),r.insertBefore(f),Profile.updateUserAccountsSelectAll(),Profile.removeAlreadyExistingAccounts(!1)}catch(s){Site.alert(Profile.resources.ErrorOccurred)}}),$(Profile.registrationNumbersDropDownId).change(function(){Profile.hideErrorMessage($(this))})},removeAlreadyExistingAccounts:function(n){var t=$(Profile.registrationNumbersDropDownId);t.length==1&&(Profile.removeDuplicateResults(),t.children("option").length<=1&&($(Profile.addAccountResultsContainerId).remove(),n&&Profile.showErrorMessage($(Profile.addAccountNumberId),Profile.resources.Message_NoResultsReturned_Error)))},removeDuplicateResults:function(){for(var i=$(Profile.registrationNumbersDropDownId)[0],t,n=0;n<i.options.length;n++)if(t=i.options[n],$(t).val()!=null&&$(t).val()!=""&&$("."+Profile.userAccountsPrefix+"."+$(t).val()).length>0){$("."+Profile.addAccountPrefix+"."+$(t).val()).remove(),i.options.remove(n),Profile.removeDuplicateResults();break}},buildHiddenField:function(n,t,i,r){t=Profile.userAccountsPrefix+"["+n+"]."+t;var u=' name="'+t+'"',f=' id="'+t.replace(/\[/g,"_").replace(/\]/g,"_").replace(/\./g,"_")+'"',e=i!=null&&i!=""?' value="'+Site.htmlEncode(i)+'"':" value",o=r!=null&&r!=""?' class="'+r+'"':"";return $('<input type="hidden"'+o+f+u+e+">")},buildCheckBox:function(n,t,i,r){t=Profile.userAccountsPrefix+"["+n+"]."+t;var f=' name="'+t+'"',e=' id="'+t.replace(/\[/g,"_").replace(/\]/g,"_").replace(/\./g,"_")+'"',o=i!=null&&i.toLowerCase()=="true"?' checked="checked"':"",u=r!=null&&r!=""?' class="'+r+'"':"";return r=="shl-disabled"&&(u=u+' readonly="readonly" disabled="disabled" aria-disabled="true"'),$('<input type="checkbox"'+u+e+f+' value="true"'+o+"><input"+f+' type="hidden" value="'+i+'">')},initUserAccountsTable:function(){$("."+Profile.userAccountsIsPrimary).live("click",function(){$(this).is(":checked")?($("."+Profile.userAccountsIsPrimary).removeAttr("checked").val("False"),$(this).attr("checked","checked").val("True")):$(this).val("False")}),$("."+Profile.userAccountsSelectAllClass).click(function(){$(this).is(":checked")?($("."+Profile.userAccountsSelectClass).attr("checked","checked"),$("."+Profile.userAccountsSelectClass,$("."+Profile.userAccountsEmptyRowClass)).removeAttr("checked")):$("."+Profile.userAccountsSelectClass).removeAttr("checked"),Profile.updateUserAccountsSelectAll()}),$("."+Profile.userAccountsSelectClass).click(function(){Profile.updateUserAccountsSelectAll()}),$(Profile.btnRemoveAccountsId).click(function(){var n=$("."+Profile.userAccountsSelectClass+":checked");if(n.length==0)return Site.alert(Profile.resources.Message_NoAccountsSelected_Error),!1;Site.confirm(Profile.resources.Message_RemoveAccounts_Confirm,function(){$.each(n,function(n,t){$(t).parents("tr."+Profile.userAccountsRowClass).remove()}),$("."+Profile.userAccountsPrefix).length==0&&$("."+Profile.noUserAccountsRowClass).removeClass(Profile.hideClass),Profile.updateUserAccountsSelectAll()})})},updateUserAccountsSelectAll:function(){$("."+Profile.userAccountsSelectClass).length>=2&&$("."+Profile.userAccountsSelectClass).length==$("."+Profile.userAccountsSelectClass+":checked").length+1?$("."+Profile.userAccountsSelectAllClass).attr("checked","checked"):$("."+Profile.userAccountsSelectAllClass).removeAttr("checked")},showErrorMessage:function(n,t){n.removeClass("input-validation-valid").removeClass("valid").addClass("input-validation-error"),n.parent().next().children().removeClass("field-validation-valid").addClass("field-validation-error").append('<span for="'+n.attr("id")+'" generated="true">'+t+"</span>")},hideErrorMessage:function(n){n.addClass("input-validation-valid").addClass("valid").removeClass("input-validation-error"),n.parent().next().children().addClass("field-validation-valid").removeClass("field-validation-error").children("span").remove()},initTitleAutocomplete:function(){$("#Title").autocomplete({minLength:1,source:function(n,t){$.ajax({url:"/Account/SearchTitle",type:"POST",dataType:"json",data:{searchText:n.term},success:function(n){t($.map(n,function(n){return{label:n.Value}}))}})},focus:function(n,t){return $("#Title").val(t.item.value),!1}}).data("autocomplete")._renderItem=function(n,t){return $("<li></li>").data("item.autocomplete",t).append("<a>"+t.label+"</a>").appendTo(n)}}},UserList={resources:[],rowIdClass:".shl-list-id",serverMessageContainer:"#userListMessage",searchFormId:"#UserListSearchForm",txtFirstName:'input[name="FirstName"][type="text"]',txtLastName:'input[name="LastName"][type="text"]',txtEmail:'input[name="Email"][type="text"]',chkIsSubAdminOnly:'input[name="IsSubAdminOnly"][type="checkbox"]',chkIsSuperAdminOnly:'input[name="IsSuperAdminOnly"][type="checkbox"]',hdnFirstName:'input[name="FirstName"][type="hidden"]',hdnLastName:'input[name="LastName"][type="hidden"]',hdnEmail:'input[name="Email"][type="hidden"]',hdnIsSubAdminOnly:'input[name="IsSubAdminOnly"][type="hidden"]',hdnIsSuperAdminOnly:'input[name="IsSuperAdminOnly"][type="hidden"]',searchButtonId:"#UserListSearchButton",searchTermClass:".shl-searched .shl-term",userListId:"#UserList",init:function(n){this.resources=n,UserList.setupUserList(),UserList.setupUserListSearch(),UserList.setupUserListActions()},setupUserList:function(){Grid.setup(UserList.userListId,null,null,null,null,null,UserList.sortUserList,!1),Site.Ajax.pagersSetup(UserList.userListId,UserList.pageUserList),$(UserList.userListId).find("a:first").focus()},sortUserList:function(n){UserList.refreshUserList(1,n)},pageUserList:function(n){var t=$(n).attr("data-page");UserList.refreshUserList(t,Grid.getSortExpression(UserList.userListId))},refreshUserList:function(n,t){n=n==null?Grid.getPage(UserList.userListId):n,t=t==null?Grid.getSortExpression(UserList.userListId):t;var i={Page:n,OrderBy:t,FirstName:$(UserList.hdnFirstName).val(),LastName:$(UserList.hdnLastName).val(),Email:$(UserList.hdnEmail).val(),IsSubAdminOnly:$(UserList.hdnIsSubAdminOnly).val(),IsSuperAdminOnly:$(UserList.hdnIsSuperAdminOnly).val()};$.ajax({type:"GET",url:UserList.resources.GetUserListUrl,data:i,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(UserList.serverMessageContainer).append(n):($(UserList.userListId).parent().html(n),UserList.setupUserList(),UserList.setupUserListActions(),Site.resetValidation(),$(UserList.serverMessageContainer).html(""))},error:function(){Site.alert(UserList.resources.ErrorOccurred)}})},searchUserList:function(){if($(UserList.searchFormId).valid()){$(UserList.hdnFirstName).val($.trim($(UserList.txtFirstName).val())),$(UserList.hdnLastName).val($.trim($(UserList.txtLastName).val())),$(UserList.hdnEmail).val($.trim($(UserList.txtEmail).val())),$(UserList.hdnIsSubAdminOnly).val($(UserList.chkIsSubAdminOnly).is(":checked")?"true":"false"),$(UserList.hdnIsSuperAdminOnly).val($(UserList.chkIsSuperAdminOnly).is(":checked")?"true":"false");var n="";$(UserList.hdnFirstName).val()!=""&&(n+=(n!=""?", ":"")+$(UserList.hdnFirstName).val()),$(UserList.hdnLastName).val()!=""&&(n+=(n!=""?", ":"")+$(UserList.hdnLastName).val()),$(UserList.hdnEmail).val()!=""&&(n+=(n!=""?", ":"")+$(UserList.hdnEmail).val()),$(UserList.hdnIsSubAdminOnly).val()=="true"&&(n+=(n!=""?", ":"")+UserList.resources.SubAdminsOnly),$(UserList.hdnIsSuperAdminOnly).val()=="true"&&(n+=(n!=""?", ":"")+UserList.resources.SuperAdminsOnly),$(UserList.searchTermClass).text(n),$(UserList.searchTermClass).parents(".row-fluid").eq(1).toggleClass("shl-hide",$(UserList.searchTermClass).text()==""),UserList.refreshUserList(1)}},setupUserListSearch:function(){$(UserList.searchButtonId).click(function(){UserList.searchUserList()}),$(UserList.txtFirstName+","+UserList.txtLastName+","+UserList.txtEmail).keypress(function(n){n.which==13&&(n.preventDefault(),UserList.searchUserList())}),$(UserList.chkIsSubAdminOnly+","+UserList.chkIsSuperAdminOnly).click(function(){UserList.searchUserList()})},setupUserListActions:function(){$(".shl-actions",UserList.userListId).change(function(){var n=this;$("option:selected",n).each(function(){var t=$(n).parents("tr").first().find(UserList.rowIdClass).val();switch($(this).val()){case"1":location.href=UserList.resources.ViewProfileUrl.replace("0",t);break;case"2":location.href=UserList.resources.ViewOrdersUrl.replace("0",t);break;case"3":location.href=UserList.resources.ViewCandidatesUrl.replace("0",t)}$(n).val("")})})}},Basket={resources:[],idClass:"shl-product-id",langClass:"shl-product-lang",productCode:"shl-product-ProductCode",jobidClass:"shl-product-jobid",init:function(n){this.resources=n,Grid.setup("#BasketTable",0,Basket.idClass,null,null,Basket.removeProduct,null,null,null);var t=$("input[id=SelectedServiceType_ProductId]"),i=jQuery.grep(t,function(n){return n.checked==!0});$("#submitContinue").click(function(){var i=$("input:radio[name=SelectedServiceType.ProductId]:checked").val(),n=$("input:checkbox[name=i.UseSms]"),t;$("[name=NewManagedServiceId]").attr("value",i),n.length>0&&(t=n.is(":checked"),$("[name=UseSms]").attr("value",t))}),i.length>0&&Basket.enableContinue(),t.change(function(){$("input:radio[name=SelectedServiceType.ProductId]:checked").val()!="0"?$("#showSmsFlag").show():$("#showSmsFlag").hide(),Basket.enableContinue()})},removeProductFromBasket:function(n){var i=Grid.getCellValue(n,"."+Basket.idClass),t=Grid.getCellValue(n,"."+Basket.jobidClass),r=Grid.getCellValue(n,"."+Basket.langClass);(t==""||t.length==0)&&(t=0),$.ajax({type:"POST",url:Basket.resources.RemoveFromBasketUrl,data:{ProductId:i,JobId:t,LanguageCode:r},success:function(n){n.indexOf(Site.errorCheckString)!=-1?$("#basketMessage").append(n):location=window.location},error:function(n,t,i){Site.alert(Basket.resources.RemoveProductError+": "+i)}})},removeProduct:function(n){var i=Grid.getCellValue(n,"."+Basket.idClass),r=Grid.getCellValue(n,"."+Basket.langClass),t=Grid.getCellValue(n,"."+Basket.productCode);$("."+Basket.jobidClass).length==1&&Basket.resources.BasketLimitResx!==""?Site.alert(Basket.resources.BasketLimitResx):t=="True"?Site.confirm(Basket.resources.RemoveProductConfirmText,function(){Basket.removeProductFromBasket(n)},Site.resources.Confirm,Site.resources.Cancel):Basket.removeProductFromBasket(n)},enableContinue:function(){if($("#OriginalContinueDisabled").val()=="False"){var n=$("[name=continueButton]");n.removeAttr("disabled"),n.removeAttr("aria-disabled"),n.removeClass("shl-disabled ui-button-disabled ui-state-disabled")}}},CreditCard={resources:[],init:function(n){this.resources=n,this.setupExpiryChecks(),this.setupPaymentButton()},setupExpiryChecks:function(){$("#card_expirationMonth, #card_expirationYear").change(function(){CreditCard.checkExpiry()})},setupPaymentButton:function(){$("#PayByCreditCard").click(function(n){n.preventDefault(),$("#formPaymentDetails").valid()&&CreditCard.checkExpiry()&&CreditCard.validatePaymentAmount()})},checkExpiry:function(){var i=$("#card_expirationMonth"),n=$("#card_expirationYear"),t=$("#CCExpiryError");if(i.val()==""||n.val()=="")return t.addClass("hidden"),!1;var r=new Date,f=r.getMonth()+1,u=r.getFullYear();return u<n.val()||u==n.val()&&f<=i.val()?(t.addClass("hidden"),!0):(t.removeClass("hidden"),!1)},validatePaymentAmount:function(){$.ajax({type:"GET",url:CreditCard.resources.ConfirmTransactionAmountUrl,success:function(n){n==$("#PaymentTotal").text()?CreditCard.submitCreditCardPayment():Site.alert(CreditCard.resources.PriceMismatch)}})},submitCreditCardPayment:function(){var n=$(".shl-loading-popup"),r=$(".shl-loading-editable-content",n),t,i;if(r.html($("#paymentProcessingPopup").html()),n.dialog({bgiframe:!0,closeOnEscape:!0,modal:!0,resizable:!1,width:Site.getDialogWidth(.4,null,320,600)}),$("#card_expiry_date").length){var u=$("#card_expirationMonth").val(),f=$("#card_expirationYear").val(),e=u+"-"+f;$("#card_expiry_date").val(e),CreditCard.signFields(),t=$("#PurchaseOrder").val(),$("#merchant_defined_data6").val(t),$("#card_expirationMonth").remove(),$("#card_expirationYear").remove(),$('[name="AcceptedTerms"]').remove(),$('[name="PayByCreditCard"]').remove()}i=$("#CybersourcePostURL").val(),$("#formPaymentDetails").attr("action",i),$("#formPaymentDetails").attr("onsubmit",""),$("#__EVENTVALIDATION").attr("value",""),$("#__VIEWSTATE").attr("value",""),$("#formPaymentDetails").submit()},signFields:function(){var n=CreditCard.resources.SignSecureAcceptanceFieldsUrl,t=$("#access_key").val(),i=$("#profile_id").val(),r=$("#transaction_uuid").val(),u=$("#signed_field_names").val(),f=$("#unsigned_field_names").val(),e=$("#signed_date_time").val(),o=$("#locale").val(),s=$("#transaction_type").val(),h=$("#reference_number").val(),c=$("#amount").val(),l=$("#currency").val(),a=$("#payment_method").val(),v=$("#card_cardType").val();$.ajax({url:n,async:!1,type:"POST",data:{access_key:t,profile_id:i,transaction_uuid:r,signed_field_names:u,unsigned_field_names:f,signed_date_time:e,locale:o,transaction_type:s,reference_number:h,amount:c,currency:l,payment_method:a,card_type:v},error:function(){},success:function(n){$("#signature").val(n.Signature),$("#signed_date_time").val(n.Time)}})}},OrderList={resources:[],OrderListId:"#OrdersList",rowIdClass:".shl-list-id",searchTextId:"#ordersListSearch",serverMessageContainer:"#orderListMessage",init:function(n){this.resources=n,OrderList.setupOrdersListGrid(),OrderList.setupOrdersListSearch(),OrderList.setupOrderListActions()},setupOrdersListGrid:function(){Grid.setup(OrderList.OrderListId,0,OrderList.rowIdClass,null,null,null,OrderList.sortOrdersListColumn),Site.Ajax.pagersSetup(OrderList.OrderListId,OrderList.pageOrderList)},sortOrdersListColumn:function(n){OrderList.refreshOrderList(Grid.getPage(OrderList.OrderListId),n)},refreshOrderList:function(n,t,i){n=n==undefined?Grid.getPage(OrderList.OrderListId):n,t=t==undefined?Grid.getSortExpression(OrderList.OrderListId):t,i=i==undefined?$("#ordersListSearchFor .shl-term").text():i;var r=Site.getQueryStrings(),u={Page:n==undefined?1:n,OrderBy:t==undefined?"LastUpdated":t,SearchTerm:i==undefined||i.length==0?"":i,UserGuid:r.userguid};$.ajax({type:"GET",url:OrderList.resources.GetOrdersForUserListUrl,data:u,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(OrderList.serverMessageContainer).append(n):($(OrderList.OrderListId).parent().html(n),OrderList.setupOrdersListGrid(),OrderList.setupOrderListActions(),Site.resetValidation(),Site.jQueryButtons(),Site.Ajax.pagersSetup(OrderList.OrderListId,OrderList.pageOrderList),$(OrderList.OrderListId).find("a:first").focus())},error:function(n,t,i){Site.alert(OrderList.resources.RefreshMyOrdersErr+": "+i)}})},pageOrderList:function(n){var t=$(n).attr("data-page");OrderList.refreshOrderList(t,Grid.getSortExpression(OrderList.OrderListId))},setupOrdersListSearch:function(){$("#ordersListSearchButton").click(function(){OrderList.searchList()}),$(OrderList.searchTextId).keypress(function(n){n.which==13&&(n.preventDefault(),OrderList.searchList())})},searchList:function(){if($(OrderList.searchTextId).valid()){var n=$(OrderList.searchTextId).val();n.length>0&&($("#ordersListSearchFor .shl-term").text(n),$("#ordersListSearchFor").parents(".row-fluid.shl-hide").first().removeClass("shl-hide"),OrderList.refreshOrderList(1,undefined,n))}},setupOrderListActions:function(){$(".shl-actions",OrderList.OrderListId).change(function(){var n=this;$("option:selected",n).each(function(){var t=$(n).parents("tr").first().find(OrderList.rowIdClass).val(),i=$(n).parents("tr").first().find("a").text();switch($(this).val()){case"1":location.href=OrderList.resources.viewProjectUrl.replace("0",t)}$(n).val("")})})}},PendingOrdersList={resources:[],PendingOrdersListId:"#PendingOrdersList",rowIdClass:".shl-list-id",searchTextId:"#pendingOrdersListSearch",serverMessageContainer:"#pendingOrdersListMessage",init:function(n){this.resources=n,PendingOrdersList.setupPendingOrdersListGrid(),PendingOrdersList.setupPendingOrdersListSearch()},setupPendingOrdersListGrid:function(){Grid.setup(PendingOrdersList.PendingOrdersListId,0,PendingOrdersList.rowIdClass,null,null,null,PendingOrdersList.sortPendingOrdersListColumn),Site.Ajax.pagersSetup(PendingOrdersList.PendingOrdersListId,PendingOrdersList.pagePendingOrderList)},sortPendingOrdersListColumn:function(n){PendingOrdersList.refreshPendingOrdersList(Grid.getPage(PendingOrdersList.PendingOrdersListId),n)},refreshPendingOrdersList:function(n,t,i){n=n==undefined?Grid.getPage(PendingOrdersList.PendingOrdersListId):n,t=t==undefined?Grid.getSortExpression(PendingOrdersList.PendingOrdersListId):t,i=i==undefined?$("#pendingOrdersListSearchFor .shl-term").text():i;var r=Site.getQueryStrings(),u={Page:n==undefined?1:n,OrderBy:t==undefined?"LastUpdated":t,SearchTerm:i==undefined||i.length==0?"":i,UserGuid:r.userguid};$.ajax({type:"GET",url:PendingOrdersList.resources.GetPendingOrdersForUserListUrl,data:u,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(PendingOrdersList.serverMessageContainer).append(n):($(PendingOrdersList.PendingOrdersListId).parent().html(n),PendingOrdersList.setupPendingOrdersListGrid(),Site.resetValidation(),Site.jQueryButtons(),Site.Ajax.pagersSetup(PendingOrdersList.PendingOrdersListId,PendingOrdersList.pagePendingOrderList),$(PendingOrdersList.PendingOrdersListId).find("a:first").focus())},error:function(n,t,i){Site.alert(PendingOrdersList.resources.RefreshMyOrdersErr+": "+i)}})},pagePendingOrderList:function(n){var t=$(n).attr("data-page");PendingOrdersList.refreshPendingOrdersList(t,Grid.getSortExpression(PendingOrdersList.PendingOrdersListId))},setupPendingOrdersListSearch:function(){$("#pendingOrdersListSearchButton").click(function(){PendingOrdersList.searchList()}),$(PendingOrdersList.searchTextId).keypress(function(n){n.which==13&&(n.preventDefault(),PendingOrdersList.searchList())})},searchList:function(){if($(PendingOrdersList.searchTextId).valid()){var n=$(PendingOrdersList.searchTextId).val();n.length>0&&($("#pendingOrdersListSearchFor .shl-term").text(n),$("#pendingOrdersListSearchFor").parents(".row-fluid.shl-hide").first().removeClass("shl-hide"),PendingOrdersList.refreshPendingOrdersList(1,undefined,n))}}},ProjectCandidates={resources:[],serverMessageId:"#projectCandidateMessage",candidateListId:"#CandidatesList",rowIdClass:".shl-candidate-id",disabledClass:"shl-disabled",init:function(n){this.resources=n,ProjectCandidates.setupCandidatesGrid(),ProjectCandidates.setupSupervisorList(),ProjectCandidates.setupTitlesList(),ProjectCandidates.setupDataProtectionPolicyValidationAndSave(),ProjectCandidates.setupDataProtectionPolicyPopup(),ProjectCandidates.initOrgUnitsAutocomplete(),ProjectCandidates.initOrgUnitsAutocomplete()},setupSupervisorList:function(){$(".shl-supervisorid").val($("#Supervisor").val()),$("#Supervisor").change(function(){$(".shl-supervisorid").val($(this).val())})},setupTitlesList:function(){$("#Title").change(function(){$(this).val()=="NA"?$("#TitleTextValidation").removeClass("hidden"):$("#TitleTextValidation").addClass("hidden")})},setupCandidatesGrid:function(){Grid.setup(ProjectCandidates.candidateListId,0,ProjectCandidates.rowIdClass,null,ProjectCandidates.saveCandidate,ProjectCandidates.removeCandidate,ProjectCandidates.sortCandidateColumn),Site.Ajax.pagersSetup(ProjectCandidates.candidateListId,ProjectCandidates.pageCandidateList)},sortCandidateColumn:function(n){ProjectCandidates.refreshCandidateList(ProjectCandidates.serverMessageId,ProjectCandidates.candidateListId,Grid.getPage(ProjectCandidates.candidateListId),n)},addCandidateSuccess:function(){$(".shl-add-candidate input[type=text], .shl-add-candidate input[type=email]").val(""),ProjectCandidates.refreshCandidateList(ProjectCandidates.serverMessageId,ProjectCandidates.candidateListId),AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.raterListId)},addCandidateError:function(n,t,i){Site.alert(ProjectCandidates.resources.AddCandidateError+i)},pageCandidateList:function(n){var t=$(n).attr("data-page");ProjectCandidates.refreshCandidateList(ProjectCandidates.serverMessageId,ProjectCandidates.candidateListId,t,Grid.getSortExpression(ProjectCandidates.candidateListId))},refreshCandidateList:function(n,t,i,r){i=i==undefined?Grid.getPage(ProjectCandidates.candidateListId):i;var u={Page:i==undefined?1:i,OrderBy:r==undefined?Grid.getSortExpression(ProjectCandidates.candidateListId):r};$.ajax({type:"GET",url:ProjectCandidates.resources.GetCandidatesListUrl,data:u,success:function(i){i.indexOf(Site.errorCheckString)!=-1?$(n).append(i):($(t).parent().html(i),ProjectCandidates.setupCandidatesGrid(),Site.resetValidation(),Site.jQueryButtons(),Site.Ajax.pagersSetup(ProjectCandidates.candidateListId,ProjectCandidates.pageCandidateList)),ProjectCandidates.initOrgUnitsAutocomplete()},error:function(n,t,i){Site.alert(ProjectCandidates.resources.RefreshCandidatesListError+i)}})},refreshFileList:function(n,t,i){i=i==undefined?Grid.getPage(ProjectCandidates.fileListId):i,$.ajax({type:"GET",url:ProjectCandidates.resources.GetFilesListUrl,success:function(i){i.indexOf(Site.errorCheckString)!=-1?$(n).append(i):($(t).parent().html(i),ProjectCandidates.setupProjectFileGrid(),Site.resetValidation(),Site.jQueryButtons(),Site.Ajax.pagersSetup(ProjectCandidates.fileListId,ProjectCandidates.pageCandidateList))},error:function(n,t,i){Site.alert(ProjectCandidates.resources.RefreshCandidatesListError+i)}})},setContinueButtonsState:function(){var n=$(".shl-continue");$("tbody tr td",ProjectCandidates.candidateListId).length==1?(n.addClass(ProjectCandidates.disabledClass),Site.setDisabled()):(n.removeClass(ProjectCandidates.disabledClass),Site.setEnabled(n),ProjectCandidates.setupDataProtectionPolicyValidationAndSave())},saveCandidate:function(n){var t=Grid.getUserRowData(n),i={ID:Grid.getRowDataField(t,"ID"),Title:Grid.getRowDataField(t,"Title"),FirstName:Grid.getRowDataField(t,"FirstName"),LastName:Grid.getRowDataField(t,"LastName"),Email:Grid.getRowDataField(t,"Email"),LanguageCode:Grid.getRowDataField(t,"LanguageCode"),Supervisor:Grid.getRowDataField(t,"Supervisor"),Ericsson_CorporateId:Grid.getRowDataField(t,"Ericsson_CorporateId"),Ericsson_Source:Grid.getRowDataField(t,"Ericsson_Source"),Ericsson_Purpose:Grid.getRowDataField(t,"Ericsson_Purpose"),Ericsson_Region:Grid.getRowDataField(t,"Ericsson_Region"),Ericsson_Country:Grid.getRowDataField(t,"Ericsson_Country"),Ericsson_OrgUnit:Grid.getRowDataField(t,"Ericsson_OrgUnit"),Sms:Grid.getRowDataField(t,"Sms")};$(ProjectCandidates.serverMessageId).html(""),$.ajax({type:"POST",url:ProjectCandidates.resources.SaveCandidateUrl,data:i,success:function(t){t.indexOf("Model is invalid")!=-1?Site.alert(ProjectCandidates.resources.UpdateCandidateStatusError+": "):($(ProjectCandidates.serverMessageId).html(t),Grid.editOrDisplayUserRow(n,t.indexOf(Site.errorCheckString)!=-1),t.indexOf(Site.errorCheckString)==-1&&(ProjectCandidates.refreshCandidateList(ProjectCandidates.serverMessageId,ProjectCandidates.candidateListId),AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.raterListId)))},error:function(n,t,i){Site.alert(ProjectCandidates.resources.SaveCandidateError+i)}})},removeCandidate:function(n){var t=Grid.getUserRowData(n),i={ID:Grid.getRowDataField(t,"ID")};$(ProjectCandidates.serverMessageId).html(""),$.ajax({type:"POST",url:ProjectCandidates.resources.RemoveCandidateUrl,data:i,success:function(t){$(ProjectCandidates.serverMessageId).html(t),Grid.editOrDisplayUserRow(n,t.indexOf(Site.errorCheckString)!=-1),t.indexOf(Site.errorCheckString)==-1&&(Grid.removeRow(n),ProjectCandidates.refreshCandidateList(ProjectCandidates.serverMessageId,ProjectCandidates.candidateListId),AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.raterListId))},error:function(n,t,i){Site.alert(ProjectCandidates.resources.RemoveCandidateError+": "+i)}})},setupDataProtectionPolicyValidationAndSave:function(){var n=$(".shl-continue:not(.shl-disabled)");n.unbind("click"),n.click(function(){var n=$(".shl-data-protection-policy"),t;return n.length?n.valid()?$(".shl-candidate-idTotalRows").length==0?(Site.message(ProjectCandidates.resources.Message_AddAtLeastOneCandidate_Info),!1):(t=!1,$.ajax({type:"POST",url:ProjectCandidates.resources.SetDataProtectionPolicyFlagUrl,async:!1,success:function(n){n.Success==!0?t=!0:Site.alert(ProjectCandidates.resources.FailedSetDataProtectionFlag)},error:function(){Site.alert(ProjectCandidates.resources.FailedSetDataProtectionFlag)}}),t):(n.focus(),!1):!0})},setupDataProtectionPolicyPopup:function(){$(".shl-data-protection-policy-link").click(function(){$.ajax({type:"GET",url:ProjectCandidates.resources.GetDataProtectionNoticeUrl,success:function(n){var t=$(".shl-data-protection-policy-popup");t.html(n),t.dialog({bgiframe:!0,closeOnEscape:!0,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,900),height:600,buttons:[{text:ProjectCandidates.resources.CloseText,click:function(){$(this).dialog("close")}}]})},error:function(){Site.alert(ProjectCandidates.resources.FailedGetDataProtectionFlag)}})})},initOrgUnitsAutocomplete:function(){var n=!0;$(".Ericsson_OrgUnit").length>0&&($(".Ericsson_OrgUnit").autocomplete({minLength:1,select:function(t){(t.currentTarget.childElementCount>1||t.currentTarget.childElementCount!=1&&t.target.value==t.currentTarget.firstChild.firstChild.innerText)&&(n=!1)},close:function(t){if(!n){var r=$(t.target);r.autocomplete("search",t.target.value),n=!0}return!1},source:function(n,t){$.ajax({url:"/Candidate/SearchEricssonOrgUnit",type:"POST",dataType:"json",data:{searchText:n.term},success:function(n){t($.map(n,function(n){return{label:n}}))}})}}).data("autocomplete")._renderItem=function(n,t){return $("<li></li>").data("item.autocomplete",t).append("<a>"+t.label+"</a>").appendTo(n)})}},ProjectDetailTabs={resources:[],candidatesListId:"#CandidatesScalesList",RatersListId:"#RatersListDetailSummary",rowIdClass:".shl-candidate-id",serverMessageContainer:"#detailsSummaryServerMessage",startSupervisedAssessmentsInputSelector:".shl-supervised-assessments input[type=checkbox]",rowRaterIdClass:".shl-rater-id",init:function(n){this.resources=n,this.resources.tab==1&&(ProjectDetailTabs.setupCandidatesGrid(),ProjectDetailTabs.setupCandidateActions(),ProjectDetailTabs.setupRaterGrid())},GetMFSQuestionnaire:function(n,t){$.ajax({type:"GET",url:ProjectDetailTabs.resources.GetMFSQuestionnaireCurrent+"?questionnaireId="+n+"&title="+t,success:function(n){if(n.indexOf(Site.errorCheckString)==-1){var u="",r=$("#partialDiv");r.html(n),r.dialog({title:ProjectDetailTabs.resources.MFSQuestionnaire,autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,1e3)}),r.dialog("open"),MFS.ClosePopup()}},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.ViewMFSError+": "+i)}})},showSelectedCandidates:function(n,t,i){n!=undefined&&n!=null&&$.ajax({type:"GET",url:ProjectDetailTabs.resources.GetSelectedCandidatesListByProductUrl+"?ProductId="+n+"&ProductLanguage="+t+"&ProjectId="+i,success:function(n){if(n.indexOf(Site.errorCheckString)!=-1)$(ProjectDetailTabs.serverMessageContainer).html(n);else{var r=$("#divSelectedCandidateList"),u=[];u.push({text:ProjectDetailTabs.resources.dialogButtonClose,click:function(){$(this).dialog("close")}}),r.html(n),r.dialog({autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,600),buttons:u}),r.dialog("open")}},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.ShowCandidatesSelectedError+": "+i)}})},setupCandidatesGrid:function(){Grid.setup(ProjectDetailTabs.candidatesListId,0,ProjectDetailTabs.rowIdClass,null,null,null,ProjectDetailTabs.sortCandidatesListColumn),Site.Ajax.pagersSetup(ProjectDetailTabs.candidatesListId,ProjectDetailTabs.pageCandidateList),$(".shl-selected-invite").click(function(){var n=Grid.getCheckboxSelection(ProjectDetailTabs.candidatesListId);n==null?Site.alert(ProjectDetailTabs.resources.dialogAlertNoSelections):ProjectDetailTabs.sendResendCandidateInvites(n)}),$(".shl-selected-addproduct").click(function(){var n=Grid.getCheckboxSelection(ProjectDetailTabs.candidatesListId);if(n==null)Site.alert(ProjectDetailTabs.resources.dialogAlertNoSelections);else{var t=$("#projectId").val(),i=$("#projectName").val(),r=$("#hasPendingBasket").val();Site.checkAddProductsToExistingProject(t,i,"false","false",n,"#detailsSummaryServerMessage",r)}})},setupRaterGrid:function(){Grid.setup(ProjectDetailTabs.RatersListId,0,ProjectDetailTabs.rowRaterIdClass,null,null,null,ProjectDetailTabs.sortRatersListColumn),Site.Ajax.pagersSetup(ProjectDetailTabs.RatersListId,ProjectDetailTabs.pageRatersList)},sortCandidatesListColumn:function(n){ProjectDetailTabs.refreshCandidateList(Grid.getPage(ProjectDetailTabs.candidatesListId),n)},sortRatersListColumn:function(n){ProjectDetailTabs.refreshRaterList(Grid.getPage(ProjectDetailTabs.RatersListId),n)},refreshRaterList:function(n,t){var u="",r,i,f;t!=undefined&&(r="",i=t.toString().indexOf("Asc"),i>0?(r=t.toString().substring(0,i),u="_"+r+"_Asc"):(i=t.toString().indexOf("Desc"),i>0&&(r=t.toString().substring(0,i),u="_"+r+"_Desc"))),n=n==undefined?Grid.getPage(ProjectDetailTabs.RatersListId):n,f={container:ProjectDetailTabs.RatersListId,projectId:$("#projectId").val(),candidateId:0,Page:n==undefined?1:n,OrderBy:t==undefined?null:t,OrderByDynamic:u},$.ajax({type:"GET",url:ProjectDetailTabs.resources.GetRatersListUrl,data:f,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(ProjectDetailTabs.serverMessageContainer).html(n):($(ProjectDetailTabs.RatersListId).parent().html(n),ProjectDetailTabs.setupRaterGrid(),Site.Ajax.pagersSetup(ProjectDetailTabs.RatersListId,ProjectDetailTabs.pageRatersList),Site.resetValidation(),Site.jQueryButtons())},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.RefreshCandidateListError+": "+i)}})},refreshCandidateList:function(n,t){var o;n=n==undefined?Grid.getPage(ProjectDetailTabs.candidatesListId):n,t=t==undefined?Grid.getSortExpression(ProjectDetailTabs.candidatesListId):t;var r=t==undefined?"LastNameAsc":t,f="",u="Dynamic",e=r.indexOf(u+"_");e!=-1&&(f=r.substring(e+u.length,r.length),r=u),o={ProjectId:$("#projectId").val(),Page:n==undefined?1:n,OrderBy:r,OrderByDynamic:f},$.ajax({type:"GET",url:ProjectDetailTabs.resources.GetProjectCandidatesListUrl,data:o,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(ProjectDetailTabs.serverMessageContainer).html(n):($(ProjectDetailTabs.candidatesListId).parent().html(n),ProjectDetailTabs.setupCandidatesGrid(),ProjectDetailTabs.setupCandidateActions(),Site.resetValidation(),Site.jQueryButtons(),Site.Ajax.pagersSetup(ProjectDetailTabs.candidatesListId,ProjectDetailTabs.pageCandidateList))},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.RefreshCandidateListError+": "+i)}})},pageCandidateList:function(n){var t=$(n).attr("data-page");ProjectDetailTabs.refreshCandidateList(t,Grid.getSortExpression(ProjectDetailTabs.candidatesListId))},pageRatersList:function(n){var t=$(n).attr("data-page");ProjectDetailTabs.refreshRaterList(t,Grid.getSortExpression(ProjectDetailTabs.RatersListId))},setupCandidateActions:function(){$(".shl-actions",ProjectDetailTabs.candidatesListId).change(function(){var n=this;$("option:selected",n).each(function(){var t=$(n).parents("tr").first().find(ProjectDetailTabs.rowIdClass).val(),i=Grid.getCellValue($(n),".shl-candidate-projectId");switch($(this).val()){case"1":ProjectDetailTabs.viewCandidate(t);break;case"2":ProjectDetailTabs.progressCandidate(t);break;case"4":ProjectDetailTabs.startSupervisedAssessments(t,i);break;case"5":ProjectDetailTabs.sendResendCandidateInvites(t);break;case"7":var r=$("#projectName").val(),u=[t],f=$("#hasPendingBasket").val();Site.checkAddProductsToExistingProject(i,r,"false","false",u,"#detailsSummaryServerMessage",f);break;case"8":ProjectDetailTabs.checkRegenerateCandidateReports(t)}$(n).val("0")})})},checkRegenerateCandidateReports:function(n){var i,r,t;n!=undefined&&n!=null&&(i=$("#regenerateReportsForCandidateConfirmation"),r=ProjectDetailTabs.resources.RegenerateReportsForSelectedCandidatePopupTitle,t=[],t.push({text:ProjectDetailTabs.resources.dialogRegenerateReportsButtonContinue,click:function(){$(this).dialog("close"),ProjectDetailTabs.regenerateReports(n)}}),t.push({text:ProjectDetailTabs.resources.dialogRegenerateReportsButtonClose,click:function(){$(this).dialog("close")}}),i.dialog({title:r,autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,400),buttons:t}),i.dialog("open"))},regenerateReports:function(n){n!=undefined&&n!=null&&(Site.loadingOpen(ProjectDetailTabs.resources.dialogLoadingRegenerateReportsMessage),$.ajax({type:"GET",url:ProjectDetailTabs.resources.RegenerateCandidateReportsUrl+"?candidateId="+n,success:function(n){Site.loadingClose(),n.indexOf(Site.errorCheckString)!=-1?$(ProjectDetailTabs.serverMessageContainer).html(n):Site.success(ProjectDetailTabs.resources.dialogSendResendSuccess),Grid.clearCheckboxSelection(ProjectDetailTabs.candidatesListId,ProjectDetailTabs.rowIdClass),ProjectDetailTabs.refreshCandidateList(Grid.getPage(ProjectDetailTabs.candidatesListId),Grid.getSortExpression(ProjectDetailTabs.candidatesListId))},error:function(n,t,i){Site.loadingClose(),Site.alert("Candidates Invite Continue Error: "+i)}}))},startSupervisedAssessments:function(n,t){n!=undefined&&n!=null&&$.ajax({type:"GET",url:ProjectDetailTabs.resources.GetStartSupervisedAssessmentsUrl+"?candidateId="+n,success:function(i){var f,e;i.indexOf(Site.errorCheckString)!=-1?$(ProjectDetailTabs.serverMessageContainer).html(i):(f=[],f.push({text:ProjectDetailTabs.resources.dialogStartSuperContinueButton,"class":"shl-supervised-assessments-continue",click:function(){ProjectDetailTabs.startSelectedSupervisedAssessments(this,n,t)}},{text:ProjectDetailTabs.resources.dialogInviteButtonClose,click:function(){$(this).dialog("close")}}),e=$("#candidateStartSupervised"),e.html(i),e.dialog({bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,800),buttons:f}))},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.StartSupervisedAssessmentsError+": "+i)}})},startSelectedSupervisedAssessments:function(n,t,i){$(n).dialog("close"),Site.loadingOpen(ProjectDetailTabs.resources.dialogLoadingStartsAssessmentsMessage);var r="";$(ProjectDetailTabs.startSupervisedAssessmentsInputSelector+":checked").not(":disabled").each(function(){r+=$(this).attr("id")+","}),$.ajax({type:"POST",url:ProjectDetailTabs.resources.StartSupervisedAssessmentsUrl,data:{CandidateId:t,ProjectId:i,InstrumentIds:r},success:function(n){n.indexOf(Site.errorCheckString)!=-1?(Site.loadingClose(),$(ProjectDetailTabs.serverMessageContainer).html(n)):ProjectDetailTabs.logOffUserAndRedirect($(n).find("span").first().text())},error:function(n,t,i){Site.loadingClose(),Site.alert(ProjectDetailTabs.resources.StartSupervisedAssessmentsError+": "+i)}})},logOffUserAndRedirect:function(n){$.ajax({type:"POST",url:ProjectDetailTabs.resources.LogOffUrl,data:{RedirectUrl:n},success:function(){location=n},error:function(n,t,i){Site.loadingClose(),Site.alert(ProjectDetailTabs.resources.LogOffUserAndRedirectError+": "+i)}})},setupSupervisedAssessments:function(){var n="shl-hide",t=".shl-supervised-assessments-continue",i=".shl-no-continue-msg";$(ProjectDetailTabs.startSupervisedAssessmentsInputSelector).click(function(){var r=$(ProjectDetailTabs.startSupervisedAssessmentsInputSelector+":checked").length,u=$(ProjectDetailTabs.startSupervisedAssessmentsInputSelector+":checked:disabled").length,f=r>0&&u<r;f?($(t).removeClass(n),$(i).addClass(n)):($(t).addClass(n),$(i).removeClass(n))})},sendResendCandidateInvites:function(n){n!=undefined&&n!=null&&$.ajax({type:"GET",url:ProjectDetailTabs.resources.GetInviteCandidatesUrl+"?candidateIds="+n+"&projectId="+$("#projectId").val(),success:function(n){if(n.indexOf(Site.errorCheckString)!=-1)$(ProjectDetailTabs.serverMessageContainer).html(n);else{var r=$("#candidateInvite"),f=n.search("YesCanInvite"),u=[];f!=-1&&u.push({text:ProjectDetailTabs.resources.dialogInviteButtonContinue,click:function(){ProjectDetailTabs.candidatesInviteContinue(this,$("#inviteIds").val(),$("#resendIds").val())}}),u.push({text:ProjectDetailTabs.resources.dialogInviteButtonClose,click:function(){$(this).dialog("close")}}),r.html(n),r.dialog({autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,600),buttons:u}),r.dialog("open")}},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.SendResendCandidateInviteError+": "+i)}})},candidatesInviteContinue:function(n,t,i){$(n).dialog("close"),Site.loadingOpen(ProjectDetailTabs.resources.dialogLoadingSendResendMessage),$.ajax({type:"GET",url:ProjectDetailTabs.resources.SendResendCandidateInvitesUrl+"?inviteIds="+t+"&resendIds="+i,success:function(n){Site.loadingClose(),n.indexOf(Site.errorCheckString)!=-1?$(ProjectDetailTabs.serverMessageContainer).html(n):Site.success(ProjectDetailTabs.resources.dialogSendResendSuccess),Grid.clearCheckboxSelection(ProjectDetailTabs.candidatesListId,ProjectDetailTabs.rowIdClass),ProjectDetailTabs.refreshCandidateList(Grid.getPage(ProjectDetailTabs.candidatesListId),Grid.getSortExpression(ProjectDetailTabs.candidatesListId))},error:function(n,t,i){Site.loadingClose(),Site.alert(ProjectDetailTabs.resources.CandidatesInviteContinueError+": "+i)}})},progressCandidate:function(n){$.ajax({type:"GET",url:ProjectDetailTabs.resources.GetCandidateProgressStatusUrl+"?candidateId="+n,success:function(t){if(t.indexOf(Site.errorCheckString)!=-1)$(ProjectDetailTabs.serverMessageContainer).html(t);else{var u=$("#progressCandidateView"),f=$(window).width();u.html(t),u.dialog({autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,550),buttons:[{text:ProjectDetailTabs.resources.dialogProgressCandidateButtonContinue,click:function(){$.ajax({type:"POST",url:ProjectDetailTabs.resources.UpdateCandidateProgressStatusUrl,data:{CandidateId:n},success:function(n){$(ProjectDetailTabs.serverMessageContainer).html(n),$(this).dialog("close"),ProjectDetailTabs.refreshCandidateList(Grid.getPage(ProjectDetailTabs.candidatesListId),Grid.getSortExpression(ProjectDetailTabs.candidatesListId))},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.UpdateProgressCandidateStatusError+": "+i)}}),$(this).dialog("close")}},{text:ProjectDetailTabs.resources.dialogViewButtonClose,click:function(){$(this).dialog("close")}}]}),u.dialog("open")}},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.ViewCandidateError+": "+i)}})},checkDuplicateEmail:function(){$("#Email").val().length>0&&$.ajax({url:"/Project/IsDuplicateEmail",type:"POST",cache:!1,data:{email:$("#Email").val()},success:function(n){n=="True"?$("#LabelDuplicate").show():$("#LabelDuplicate").hide()},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.UpdateCandidateCheckDuplicateEmailError+": "+i)}})},updateCandidate:function(){var n=ProjectDetailTabs.resources.saveCandidateId,t=ProjectDetailTabs.resources.saveCandidateResendInvitation,i={CandidateId:n,Title:$("#Title").val(),FirstName:$("#FirstName").val(),LastName:$("#LastName").val(),Email:$("#Email").val(),LanguageCode:$("#LanguageCode").val(),ResendInvite:t,Ericsson_CorporateId:$("#Ericsson_CorporateId").val(),Ericsson_Source:$("#Ericsson_Source").val(),Ericsson_Purpose:$("#Ericsson_Purpose").val(),Ericsson_Region:$("#Ericsson_Region").val(),Ericsson_Country:$("#Ericsson_Country").val(),Ericsson_OrgUnit:$("#Ericsson_OrgUnit").val(),Sms:$("#Sms").val()};$.ajax({type:"POST",url:ProjectDetailTabs.resources.UpdateCandidateUrl,data:i,success:function(n){n.indexOf("Model is invalid")!=-1?Site.alert(ProjectDetailTabs.resources.UpdateCandidateStatusError+": "):($(ProjectDetailTabs.resources.saveCandidateDialog).dialog("close"),ProjectDetailTabs.refreshCandidateList(Grid.getPage(ProjectDetailTabs.candidatesListId),Grid.getSortExpression(ProjectDetailTabs.candidatesListId)),ProjectDetailTabs.refreshRaterList(Grid.getPage(ProjectDetailTabs.RatersListId),Grid.getSortExpression(ProjectDetailTabs.RatersListId)))},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.UpdateCandidateStatusError+": "+i)}})},viewCandidate:function(n){$.ajax({type:"GET",url:ProjectDetailTabs.resources.GetViewCandidateUrl+"?candidateId="+n+"&isMfs="+$(".shl-candidate-isMFSProduct").val(),success:function(t){if(t.indexOf(Site.errorCheckString)!=-1)$(ProjectDetailTabs.serverMessageContainer).html(t);else{var f=$("#candidateView"),l=$(window).width(),c=t.search("ShowSaveButton"),e=t.search("ShowSaveAndResendInvitationButton"),o=t.search("SelectTitleDropdown"),u=[],s=/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,h=/[0-9()+ ]+$/;e!=-1&&u.push({text:ProjectDetailTabs.resources.dialogSaveCandidateAndResendInviteButton,click:function(){var t=$("#Sms").val(),u=$("#Email").val(),i=!0,f,e,r;o!=-1&&(f=$("#Title").val(),f==""&&(i=!1)),e=s.test(u),r=h.test(t),e&&(r||typeof t=="undefined"||t=="")&&i?(ProjectDetailTabs.resources.saveCandidateId=n,ProjectDetailTabs.resources.saveCandidateResendInvitation=!0,ProjectDetailTabs.resources.saveCandidateDialog=this,Site.confirm(ProjectDetailTabs.resources.dialogSaveCandidateAndResendInviteConfirmation,ProjectDetailTabs.updateCandidate,Site.resources.Confirm,Site.resources.Cancel)):r?Site.alert(jQuery.validator.format(ProjectDetailTabs.resources.MessageInvalidSMS,t)):i?Site.alert(jQuery.validator.format(ProjectDetailTabs.resources.MessageInvalidEmail,u)):Site.alert(jQuery.validator.format(ProjectDetailTabs.resources.MessageInvalidTitle,""))}}),c!=-1&&u.push({text:ProjectDetailTabs.resources.dialogSaveCandidateButton,click:function(){var t=$("#Sms").val(),u=$("#Email").val(),i=!0,f,c,r;o!=-1&&(f=$("#Title").val(),f==""&&(i=!1)),c=s.test(u),r=h.test(t),c&&(r||typeof t=="undefined"||t=="")&&i?(ProjectDetailTabs.resources.saveCandidateId=n,ProjectDetailTabs.resources.saveCandidateResendInvitation=!1,ProjectDetailTabs.resources.saveCandidateDialog=this,e!=-1?Site.confirm(ProjectDetailTabs.resources.dialogSaveCandidateConfirmation,ProjectDetailTabs.updateCandidate,Site.resources.Confirm,Site.resources.Cancel):(ProjectDetailTabs.updateCandidate(),$(this).dialog("close"))):r?Site.alert(jQuery.validator.format(ProjectDetailTabs.resources.MessageInvalidSMS,t)):i?Site.alert(jQuery.validator.format(ProjectDetailTabs.resources.MessageInvalidEmail,u)):Site.alert(jQuery.validator.format(ProjectDetailTabs.resources.MessageInvalidTitle,""))}}),u.push({text:ProjectDetailTabs.resources.dialogViewButtonClose,click:function(){$(this).dialog("close")}}),f.html(t),f.dialog({autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,1e3),buttons:u}),f.dialog("open")}ProjectCandidates.initOrgUnitsAutocomplete()},error:function(n,t,i){Site.alert(ProjectDetailTabs.resources.ViewCandidateError+": "+i)}})}},ProjectEmails={resources:[],init:function(n){this.resources=n,this.buildDialog(),this.getProjectEmailTemplate(".updateInvitation","#InvitationLanguages","CandidateInvitation"),this.getProjectEmailTemplate(".updateReminder","#ReminderLanguages","CandidateReminder"),this.getProjectEmailTemplate(".updateReport","#ReportLanguages","CandidateReport"),this.getProjectEmailTemplate(".updateMFSInvitation","#InvitationLanguages","MFSCandidateInvitation"),this.getProjectEmailTemplate(".updateMFSReminder","#ReminderLanguages","MFSCandidateReminder"),this.getProjectEmailTemplate(".updateRater","#RaterLanguages","RaterInvitation"),this.setupSaveCopyRecipient()},buildDialog:function(){$("#updateDialog").dialog({autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,900),open:function(){window.setTimeout(function(){$(document).unbind("mousedown.dialog-overlay").unbind("mouseup.dialog-overlay")},100)},buttons:[{text:ProjectEmails.resources.Save,id:"btnSave",click:function(){$("#updateProjectEmailTemplate").submit()}},{text:ProjectEmails.resources.Cancel,id:"btnCancel",click:function(){$(this).dialog("close")}},{text:ProjectEmails.resources.ResetDefault,id:"btnReset",click:function(){ProjectEmails.deleteProjectEmailTemplate()}}]})},getProjectEmailTemplate:function(n,t,i){$(n).click(function(){return $.ajax({type:"GET",url:ProjectEmails.resources.GetEmailTemplateUrl+"?ProjectId="+$("#projectId").val()+"&EmailType="+i+"&LanguageCode="+$(t).val(),success:function(n){var i=$("#updateDialog"),t;i.html(n),t=$("#updateProjectEmailTemplate"),t.unbind(),t.data("validator",null),$.validator.unobtrusive.parse(document),t.validate(t.data("unobtrusiveValidation").options),$("#btnReset").toggle($("#ID").val()>0),i.dialog("open")},error:function(){Site.alert(ProjectEmails.resources.FailedGetTemplate)}}),!1})},deleteProjectEmailTemplate:function(){$.ajax({type:"POST",url:ProjectEmails.resources.DeleteProjectEmailTemplateUrl,data:{ProjectId:$("#ProjectId").val(),EmailTypeId:$("#EmailTypeId").val(),LanguageCode:$("#LanguageCode").val()},success:function(n){n.Success==!0?$("#updateDialog").dialog("close"):Site.alert(ProjectEmails.resources.FailedResetTemplate)},error:function(){Site.alert(ProjectEmails.resources.FailedResetTemplate)}})},updateSuccess:function(n){n.Success==!0?$("#updateDialog").dialog("close"):Site.alert(ProjectEmails.resources.FailedUpdateTemplate)},setupSaveCopyRecipient:function(){$("#copyRecipientEmailSave").click(function(n){n.preventDefault();var t=$("#copyRecipientEmail");t.valid()&&$.ajax({type:"POST",url:ProjectEmails.resources.UpdateCopyRecipientWithServerMessageUrl,data:{ProjectId:$("#projectId").val(),CopyRecipient:t.val()},success:function(n){$("#detailsSummaryServerMessage").html(n)},error:function(){alert(ProjectEmails.resources.SetupError)}})})}},ProjectDetails={resources:[],serverMessageId:"#projectDetailsMessage",rowIdClass:".shl-user-id",cancelInput:"cancelInput",onceSubmit:"false",prevOwner:"",init:function(n){this.resources=n,String.prototype.format=String.prototype.f=function(){for(var n=this,t=arguments.length;t--;)n=n.replace(new RegExp("\\{"+t+"\\}","gm"),arguments[t]);return n},ProjectDetails.prevOwner=$("input[name=Details.Owner]:checked").val(),ProjectDetails.getPartialViewOnClick("#ReportRecipientsAddNew .shl-add-new","#ReportRecipients tbody",'#ReportRecipients tbody tr input[name$=".Email"]'),ProjectDetails.getPartialViewOnClick("#SupervisorsAddNew .shl-add-new","#Supervisors tbody",'#Supervisors tbody tr input[name$=".Email"]'),ProjectDetails.setupGrids(),ProjectDetails.setupDateButton(),this.initDialog()},EnableDisableProgressButton:function(){var r=$("#OldProjectAdmin").val(),u=$("#ProjectAdminSelected").val(),f=$("#Details_IsProgressed").val(),t=$("input[name=Details.Owner]:checked").val(),i=$("#userHelper_CurrentUser_UserID").val(),n=0;u!=null&&(n=u.split("|")[0]),f=="True"?(n!=null&&n.trim().length>0&&r!=n&&t===i&&$("[name=Progress]").each(function(){$(this).removeClass("shl-disabled"),$(this).attr("disabled")!==undefined&&$(this).removeAttr("disabled")}),(n.trim().length==0||r==n||t!==i)&&($("[name=Progress]").hasClass("shl-disabled")||($("[name=Progress]").addClass("shl-disabled"),$("[name=Progress]").attr("disabled","disabled")))):t===i?$("[name=Progress]").each(function(){$(this).removeClass("shl-disabled"),$(this).attr("disabled")!==undefined&&$(this).removeAttr("disabled")}):$("[name=Progress]").hasClass("shl-disabled")||($("[name=Progress]").addClass("shl-disabled"),$("[name=Progress]").attr("disabled","disabled"))},EnableDisableForm:function(){ProjectDetails.EnableDisableProgressButton();var i=$("#Details_IsProgressed").val(),n=$("input[name=Details.Owner]:checked").val(),t=$("#userHelper_CurrentUser_UserID").val(),r=$("#CurrentOrderProjectState_IsSessionOrderProject").val(),u=$("#CurrentOrderProjectState_IsAddingProductToExistingProject").val();n!==undefined&&$("#ProjectAdminSelected").length!=0&&$("#ProjectAdminSelected").val()!==t&&(r=="True"&&(i=="True"||n!==t||u==="True")?($(":input."+ProjectDetails.resources.OwnerEdit).each(function(){$(this).valid()&&ProjectDetails.DisableEdit(this)}),$("select."+ProjectDetails.resources.OwnerEdit).each(function(){$("option:selected",this).length>0&&ProjectDetails.DisableEdit(this)}),$("."+ProjectDetails.resources.OwnerEdit+".shl-button-link,a."+ProjectDetails.resources.OwnerEdit).each(function(){ProjectDetails.HideButton(this)}),$("button.ui-datepicker-trigger").each(function(){ProjectDetails.HideButton(this)})):ProjectDetails.EnableForm(),i=="True"||n!==t?($("#CancelOrderButton").each(function(){ProjectDetails.HideButton(this)}),$(".OwnerWriteOnlyAndCanAddToExistingProjectAndEdit").each(function(){ProjectDetails.DisableEdit(this)})):($("#CancelOrderButton").each(function(){ProjectDetails.ShowButton(this)}),$(".OwnerWriteOnlyAndCanAddToExistingProjectAndEdit").each(function(){ProjectDetails.EnableEdit(this)})),i=="False"||n!==t?$("[name=TakeControl]").each(function(){ProjectDetails.DisableButton(this)}):$("[name=TakeControl]").each(function(){ProjectDetails.EnableButton(this)}))},EnableForm:function(){$("."+ProjectDetails.resources.OwnerEdit).each(function(){ProjectDetails.EnableEdit(this)}),$("."+ProjectDetails.resources.OwnerEdit+".shl-button-link,a."+ProjectDetails.resources.OwnerEdit).each(function(){ProjectDetails.ShowButton(this)}),$("button.ui-datepicker-trigger").each(function(){ProjectDetails.ShowButton(this)})},HideButton:function(n){ProjectDetails.DisableButton(this),$(n).hide()},ShowButton:function(n){ProjectDetails.EnableButton(this),$(n).show()},DisableButton:function(n){$(n).addClass("shl-disabled")},EnableButton:function(n){$(n).removeClass("shl-disabled")},DisableEdit:function(n){$(n).attr("disabled")===undefined&&$(n).attr("disabled","disabled")},EnableEdit:function(n){$(n).attr("disabled")!==undefined&&$(n).removeAttr("disabled")},setupGrids:function(n){$("#CancelOrderButton").click(function(){Site.inputAjaxGetRequest(ProjectDetails.serverMessageId,ProjectDetails.resources.CancelOrderPopup,ProjectDetails.cancelOrder,ProjectDetails.cancelInput)}),$(".DateWithEmailUpdate").change(function(){$("#IsDateChanged").val("True")}),$("#ProjectAdminSelected").change(ProjectDetails.EnableDisableProgressButton),$("input[name=Details.Owner]:radio").change(ProjectDetails.ChangeOwner),ProjectDetails.EnableDisableForm(),$("[name=TakeControl]").click(function(){if(!$(this).hasClass("shl-disabled")){var t=$("#ProjectAdminSelected").val();t!=null&&t.trim().length>0?$.ajax({type:"POST",url:ProjectDetails.resources.checkAlreadyTakenControlAnotherProjectUrl,success:function(n){var r=n.split(","),u=r[0].indexOf("True")!=-1;u?Site.alert(Site.resources.OpenBasketMsgText):Site.confirmAjaxGetRequest(ProjectDetails.serverMessageId,ProjectDetails.resources.ConfirmTakeControlUrl,ProjectDetails.takeControlFromPA)},error:function(n,t,i){Site.alert(ProjectDetails.resources.Error+": "+i)}}):Site.alert("Please select Project Admin")}}),$("#projectDetailsForm").submit(function(n){n.preventDefault(),ProjectDetails.EnableForm(),$(this).valid()&&ProjectDetails.onceSubmit.indexOf("false")>=0&&(this.submit(),ProjectDetails.onceSubmit="True"),setTimeout(function(){ProjectDetails.EnableDisableForm()},100)}),$("[name=Progress]").click(function(n){($("#projectDetailsForm").validate(),$("#projectDetailsForm").valid())&&(n.preventDefault(),$.ajax({type:"POST",url:ProjectDetails.resources.CheckProjectAdminBasketUrl,data:{projectAdminId:$("#ProjectAdminSelected").val()},success:function(n){var r=n.indexOf("True")!=-1;r&&$("#CurrentOrderProjectState_IsSessionOrderProject").val()==="True"?Site.alert(ProjectDetails.resources.PABasketExists):($('input[type="hidden"]#Continue').remove(),$("#projectDetailsForm").submit())},error:function(n,t,i){i.length>0&&Site.alert(ProjectDetails.resources.Error+": "+i)}}))}),n==undefined?(ProjectDetails.setupReportRecipientsGrid(),ProjectDetails.setupSupervisorsGrid()):(n.indexOf("ReportRecipients")!=-1&&ProjectDetails.setupReportRecipientsGrid(),n.indexOf("Supervisors")!=-1&&ProjectDetails.setupSupervisorsGrid())},ChangeOwner:function(){var n=ProjectDetails.prevOwner,t=$(this).val(),i=Grid.getUserRowData($(this));n!=t&&(ProjectDetails.prevOwner=t,$("#ReportRecipients").length>0&&(ProjectDetails.RemoveRow("#ReportRecipients","#ReportRecipientsRemoveIds",n),ProjectDetails.AddRow("ReportRecipients",i)),$("#Supervisors").length>0&&(ProjectDetails.RemoveRow("#Supervisors","#SupervisorsRemoveIds",n),ProjectDetails.AddRow("Supervisors",i)),$("input:radio[name=Details.Owner] :radio[value="+n+"]").prop("checked",!1),$("input:radio[name=Details.Owner] :radio[value="+t+"]").prop("checked",!0),ProjectDetails.EnableDisableForm())},RemoveRow:function(n,t,i){$(n).find(".UserId_Real[value="+i+"]").each(function(n,i){Grid.insertIDIntoRemoveField($(i).parents("tr").first(),t,ProjectDetails.rowIdClass),Grid.removeRow(i)})},AddRow:function(n,t){var i={collectionname:n,maxIndex:ProjectDetails.getMaxIndex("#"+n+' tbody tr input[name$=".Email"]'),userId:Grid.getRowDataField(t,"UserId"),firstname:Grid.getRowDataField(t,"FirstName"),surname:Grid.getRowDataField(t,"LastName"),email:Grid.getRowDataField(t,"Email")};ProjectDetails.getPartialViewClickFunction("#"+n,"#"+n+" tbody",ProjectDetails.resources.AddUserRowUrl,i,!1)},takeControlFromPA:function(){$.ajax({type:"POST",url:ProjectDetails.resources.takeControlProjectAdminUrl,data:{projectAdminId:$("#ProjectAdminSelected").val(),projectId:$("#Details_ProjectID").val(),isSessionOrder:$("#CurrentOrderProjectState_IsSessionOrderProject").val()},success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(ProjectDetails.serverMessageId).append(n):window.location.replace($(n).find("span").first().text())},error:function(n,t,i){Site.alert(ProjectDetails.resources.Error+": "+i)}})},deleteNewProjectBeforeTakeControl:function(){$.ajax({type:"POST",url:ProjectDetails.resources.deleteNewProjectBeforeTakeControlUrl,data:{projectId:$("#Details_ProjectID").val()},success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(ProjectDetails.serverMessageId).append(n):ProjectDetails.takeControlFromPA()},error:function(n,t,i){Site.alert(ProjectDetails.resources.Error+": "+i)}})},cancelOrder:function(){$("#"+ProjectDetails.cancelInput).val()!==$("#Details_SFCaseNumber").val()?Site.alert(ProjectDetails.resources.CancelFailedMessage):$.ajax({type:"POST",data:{projectAdminId:$("#ProjectAdminSelected").val(),projectName:$("#Details_Name").val(),jobRole:$("#Details_JobRole").val(),sFcaseNum:$("#Details_SFCaseNumber").val()},url:ProjectDetails.resources.CancelOrderUrl,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(ProjectDetails.serverMessageId).append(n):window.location.replace(n)},error:function(n,t,i){Site.alert(ProjectDetails.resources.Error+": "+i)}})},setupDateButton:function(){$(".ui-datepicker-trigger .ui-button-text").text(ProjectDetails.resources.DeadlineDateButtonText),$(".ui-datepicker-trigger").addClass("ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only",0,"")},RemoveWeekdaysFromDateSelector:function(n){var t=n.getDay();return[n.getDay()!=0&&n.getDay()!=6,"",t!="Sat"&&t!="Sun"?"":ProjectDetails.resources.WeekdayOnlyText]},setupReportRecipientsGrid:function(){Grid.setup("#ReportRecipients",1,ProjectDetails.rowIdClass,"#ReportRecipientsRemoveIds",null,null)},setupSupervisorsGrid:function(){Grid.setup("#Supervisors",1,ProjectDetails.rowIdClass,"#SupervisorsRemoveIds",ProjectDetails.addSupervisor,ProjectDetails.removeSupervisor)},getPartialViewOnClick:function(n,t,i){$(n).unbind("click"),$(n).click(function(){return ProjectDetails.getPartialViewClickFunction(n,t,this.href+"&maxIndex="+ProjectDetails.getMaxIndex(i),null,!0),!1})},getMaxIndex:function(n){var t=-1;return $(n).each(function(){var n=$(this).attr("name"),i=n.indexOf("["),u=n.indexOf("]"),r;i>=0&&u>i&&(r=parseInt(n.substring(i+1,u)),r>t&&(t=r))}),t},getPartialViewClickFunction:function(n,t,i,r,u){return $(ProjectDetails.serverMessageId).html(""),$.ajax({type:"GET",url:i,data:r,success:function(i){if(!$(n).hasClass("shl-disabled")){$(t).append(i),ProjectDetails.setupGrids(t),Site.resetValidation(),Site.jQueryButtons();var o=$(t).find("tr").last().first("td"),e=Grid.getFirstNodeControl(o);e.length>0&&Grid.editOrDisplayUserRow(e,u)}},error:function(n,t,i){Site.alert(ProjectDetails.resources.GetPartialViewOnClickError+": "+i)}}),!1},addSupervisor:function(n){if(ProjectDetails.resources.CheckSupervisorTrainingUrl!==""){var t=Grid.getUserRowData(n),i={email:Grid.getRowDataField(t,"Email")};$.ajax({type:"POST",url:ProjectDetails.resources.CheckSupervisorTrainingUrl,data:i,success:function(n){n!==""}})}Grid.editOrDisplayUserRow(n,!1)},removeSupervisor:function(n){var t=Grid.getUserRowData(n),i=Grid.getRowDataField(t,"ID",1),r;i>0?(r={UserId:i,email:Grid.getRowDataField(t,"Email")},$(ProjectDetails.serverMessageId).html(""),$.ajax({type:"POST",url:ProjectDetails.resources.CanRemoveSupervisorUrl,data:r,success:function(t){var u,f;u=$.browser.mozilla?String.prototype.indexOf(t,Site.errorCheckString)!=-1:t.indexOf(Site.errorCheckString)!=-1,u?($(ProjectDetails.serverMessageId).html(t),Grid.editOrDisplayUserRow(n,u)):(f=$(n).parents("tr").first(),Grid.insertIDIntoRemoveField(f,"#SupervisorsRemoveIds",ProjectDetails.rowIdClass),Grid.removeRow(n))},error:function(n,t,i){Site.alert(ProjectDetails.resources.RemoveSupervisorError+": "+i)}})):Grid.removeRow(n)}},ProjectList={resources:[],projectListId:"#ProjectsList",rowIdClass:".shl-list-id",searchTextId:"#projectsListSearch",serverMessageContainer:"#projectListMessage",init:function(n){this.resources=n,ProjectList.setupProjectsListGrid(),ProjectList.setupProjectsListSearch(),ProjectList.setupProjectListActions()},setupProjectsListGrid:function(){Grid.setup(ProjectList.projectListId,0,ProjectList.rowIdClass,null,null,null,ProjectList.sortProjectsListColumn),Site.Ajax.pagersSetup(ProjectList.projectListId,ProjectList.pageProjectList)},sortProjectsListColumn:function(n){ProjectList.refreshProjectList(Grid.getPage(ProjectList.projectListId),n)},refreshProjectList:function(n,t,i){n=n==undefined?Grid.getPage(ProjectList.projectListId):n,t=t==undefined?Grid.getSortExpression(ProjectList.projectListId):t,i=i==undefined?$("#projectsListSearchFor .shl-term").text():i;var r={Page:n==undefined?1:n,OrderBy:t==undefined?"LastUpdated":t,SearchTerm:i==undefined||i.length==0?"":i};$.ajax({type:"GET",url:ProjectList.resources.GetProjectsListUrl,data:r,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(ProjectList.serverMessageContainer).append(n):($(ProjectList.projectListId).parent().html(n),ProjectList.setupProjectsListGrid(),ProjectList.setupProjectListActions(),Site.resetValidation(),Site.jQueryButtons(),Site.Ajax.pagersSetup(ProjectList.projectListId,ProjectList.pageProjectList),$(ProjectList.projectListId).find("a:first").focus())},error:function(n,t,i){Site.alert(ProjectList.resources.RefreshMyProjectsError+": "+i)}})},pageProjectList:function(n){var t=$(n).attr("data-page");ProjectList.refreshProjectList(t,Grid.getSortExpression(ProjectList.projectListId))},setupProjectsListSearch:function(){$("#projectsListSearchButton").click(function(){ProjectList.searchList()}),$(ProjectList.searchTextId).keypress(function(n){n.which==13&&(n.preventDefault(),ProjectList.searchList())})},searchList:function(){if($(ProjectList.searchTextId).valid()){var n=$(ProjectList.searchTextId).val();n.length>0&&($("#projectsListSearchFor .shl-term").text(n),$("#projectsListSearchFor").parents(".row-fluid.shl-hide").first().removeClass("shl-hide"),ProjectList.refreshProjectList(1,undefined,n))}},setupProjectListActions:function(){$(".shl-actions",ProjectList.projectListId).change(function(){var n=this;$("option:selected",n).each(function(){var t=$(n).parents("tr").first().find(ProjectList.rowIdClass).val(),i=$(n).parents("tr").first().find("a").text(),r,u;switch($(this).val()){case"1":location.href=ProjectList.resources.viewProjectUrl.replace("0",t);break;case"2":r=Site.checkAddProductsToExistingProjectContinue(null,t,i,"true","false","","#projectListMessage");break;case"4":location.href=ProjectList.resources.updateProjectUrl.replace("0",t);break;case"5":location.href=ProjectList.resources.updateProjecEmailtUrl.replace("0",t);break;case"6":u=Site.checkCloneProject(t,ProjectList.resources.IsSAUnTrainedUser,"#projectListMessage")}$(n).val("")})})}},ProjectSummary={resources:[],productIdClass:"shl-product-id",languageCodeClass:"shl-product-lang",init:function(n){this.resources=n,Grid.setup("#BasketTable",1,ProjectSummary.productIdClass,null,null,ProjectSummary.removeProduct)},removeProduct:function(n){var t=Grid.getCellValue(n,"."+ProjectSummary.productIdClass),i=Grid.getCellValue(n,"."+ProjectSummary.languageCodeClass);$.ajax({type:"POST",url:ProjectSummary.resources.RemoveFromBasketUrl,data:{ProductId:t,LanguageCode:i},success:function(n){n.indexOf(Site.errorCheckString)!=-1?$("#summaryMessage").append(n):location=window.location},error:function(n,t,i){Site.alert(ProjectSummary.resources.RemoveProductError+": "+i)}})},RefreshTotalPaymentsSuccess:function(n){n.indexOf("Error:")==-1&&location.reload(!0)}},UserCandidatesList={resources:[],userCandidatesListId:"#UserCandidatesList",rowIdClass:".shl-list-id",searchTextId:"#candidatesListSearch",serverMessageContainer:"#userCandidatesListMessage",init:function(n){this.resources=n,UserCandidatesList.setupUserCandidatesListGrid(),UserCandidatesList.setupUserCandidatesListSearch()},setupUserCandidatesListGrid:function(){Grid.setup(UserCandidatesList.userCandidatesListId,0,UserCandidatesList.rowIdClass,null,null,null,UserCandidatesList.sortUserCandidatesListColumn),Site.Ajax.pagersSetup(UserCandidatesList.userCandidatesListId,UserCandidatesList.pageUserCandidatesList)},sortUserCandidatesListColumn:function(n){UserCandidatesList.refreshUserCandidatesList(Grid.getPage(UserCandidatesList.userCandidatesListId),n)},refreshUserCandidatesList:function(n,t,i){n=n==undefined?Grid.getPage(UserCandidatesList.userCandidatesListId):n,t=t==undefined?Grid.getSortExpression(UserCandidatesList.userCandidatesListId):t,i=i==undefined?$("#candidatesListSearchFor .shl-term").text():i;var r=Site.getQueryStrings(),u={Page:n==undefined?1:n,OrderBy:t==undefined?"CandidatesInvitedDesc":t,SearchTerm:i==undefined||i.length==0?"":i,UserGuid:r.userguid};$.ajax({type:"GET",url:UserCandidatesList.resources.GetUserCandidatesListUrl,data:u,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$(UserCandidatesList.serverMessageContainer).append(n):($(UserCandidatesList.userCandidatesListId).parent().html(n),UserCandidatesList.setupUserCandidatesListGrid(),Site.resetValidation(),Site.jQueryButtons(),Site.Ajax.pagersSetup(UserCandidatesList.userCandidatesListId,UserCandidatesList.pageUserCandidatesList),$(UserCandidatesList.userCandidatesListId).find("a:first").focus())},error:function(n,t,i){Site.alert(UserCandidatesList.resources.RefreshMyCandidatesError+": "+i)}})},pageUserCandidatesList:function(n){var t=$(n).attr("data-page");UserCandidatesList.refreshUserCandidatesList(t,Grid.getSortExpression(UserCandidatesList.userCandidatesListId))},setupUserCandidatesListSearch:function(){$("#candidatesListSearchButton").click(function(){UserCandidatesList.searchList()}),$(UserCandidatesList.searchTextId).keypress(function(n){n.which==13&&(n.preventDefault(),UserCandidatesList.searchList())})},searchList:function(){if($(UserCandidatesList.searchTextId).valid()){var n=$(UserCandidatesList.searchTextId).val();n.length>0&&($("#candidatesListSearchFor .shl-term").text(n),$("#candidatesListSearchFor").parents(".row-fluid.shl-hide").first().removeClass("shl-hide"),UserCandidatesList.refreshUserCandidatesList()(1,undefined,n))}},viewCandidatePopup:function(n){$.ajax({type:"GET",url:UserCandidatesList.resources.GetViewCandidateUrl+"?candidateId="+n+"&editable=false&isMfs=false",success:function(n){if(n.indexOf(Site.errorCheckString)!=-1)$(UserCandidatesList.serverMessageContainer).append(n);else{var r=$("#candidateView"),f=$(window).width(),u=[];u.push({text:UserCandidatesList.resources.dialogViewButtonClose,click:function(){$(this).dialog("close")}}),r.html(n),r.dialog({autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,1e3),buttons:u}),r.dialog("open")}},error:function(n,t,i){Site.alert(UserCandidatesList.resources.ViewCandidateError+": "+i)}})}},AddNewRegisteredUser={resources:[],init:function(n){this.resources=n,this.initDialog()},initDialog:function(){$("#dialog").dialog({autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,550),title:AddNewRegisteredUser.resources.AddRegisteredUser}),$(".shl-project-AddNewRegisteredUser").click(function(){$.ajax({type:"GET",url:AddNewRegisteredUser.resources.AddRegisteredUserUrl,success:function(n){$("#dialog").html(n),$("#dialog").dialog("open")}})}),$("#OkButton").click(function(){var n=$(this).parents("form");$.ajax({type:"POST",url:n.attr("action"),data:n.serialize(),success:function(){$("#dialog").dialog("close"),location.reload(!0)},error:function(){}})}),$("#CancelButton").click(function(){$("#dialog").dialog("close")})}},PJM={resources:[],pjmJobsId:"#PJMGrid",rowIdClass:".shl-list-id",pjmContainerId:"#PJMContainer",pjmInvalidData:"#pjmInvalidData",pjmAddJobInvalidData:".invalidData",searchTextId:"#pjmListSearch",init:function(n){this.resources=n,this.initDialog(),this.PJMContinue(),PJM.setupPJMJobsGrid(),PJM.setupPJMListSearch()},setupPJMListSearch:function(){$("#pjmListSearchButton").click(function(){PJM.searchList()}),$(PJM.searchTextId).keypress(function(n){n.which==13&&(n.preventDefault(),PJM.searchList())})},searchList:function(){if($(PJM.searchTextId).valid()){var n=$(PJM.searchTextId).val();n.length>0&&($("#pjmListSearchFor .shl-term").text(n),$("#pjmListSearchFor").parents(".row-fluid.shl-hide").first().removeClass("shl-hide"),PJM.refreshPJMJobsList(1,n))}},setupPJMJobsGrid:function(){Site.Ajax.pagersSetup(PJM.pjmContainerId,PJM.pagePJMList)},pagePJMList:function(n){var t=$(n).attr("data-page");PJM.refreshPJMJobsList(t)},refreshPJMJobsList:function(n,t){n=n==undefined?Grid.getPage(PJM.pjmContainerId):n,t=t==undefined?$("#pjmListSearchFor .shl-term").text():t;var i={Page:n==undefined?1:n,SearchTerm:t==undefined||t.length==0?"":t,CanPublish:PJM.resources.CanPublish==!0?!0:!1};$.ajax({type:"GET",url:PJM.resources.GetPJMJobs,data:i,success:function(n){$(PJM.pjmContainerId).parent().html(n),PJM.setupPJMJobsGrid(),Site.resetValidation()},error:function(){Site.alert(PJM.resources.ErrorOccurred)}})},CreateNewPJM:function(n,t){var i=[],u,r;i[0]=$('[name="Competency[0].ElementTag"]:radio:checked').val(),i[1]=$('[name="Competency[1].ElementTag"]:radio:checked').val(),i[2]=$('[name="Competency[2].ElementTag"]:radio:checked').val(),i[3]=$('[name="Competency[3].ElementTag"]:radio:checked').val(),i[4]=$('[name="Competency[4].ElementTag"]:radio:checked').val(),i[5]=$('[name="Competency[5].ElementTag"]:radio:checked').val(),i[6]=$('[name="Competency[6].ElementTag"]:radio:checked').val(),i[7]=$('[name="Competency[7].ElementTag"]:radio:checked').val(),i[8]=$('[name="Competency[8].ElementTag"]:radio:checked').val(),i[9]=$('[name="Competency[9].ElementTag"]:radio:checked').val(),i[10]=$('[name="Competency[10].ElementTag"]:radio:checked').val(),i[11]=$('[name="Competency[11].ElementTag"]:radio:checked').val(),i[12]=$('[name="Competency[12].ElementTag"]:radio:checked').val(),i[13]=$('[name="Competency[13].ElementTag"]:radio:checked').val(),i[14]=$('[name="Competency[14].ElementTag"]:radio:checked').val(),i[15]=$('[name="Competency[15].ElementTag"]:radio:checked').val(),i[16]=$('[name="Competency[16].ElementTag"]:radio:checked').val(),i[17]=$('[name="Competency[17].ElementTag"]:radio:checked').val(),i[18]=$('[name="Competency[18].ElementTag"]:radio:checked').val(),i[19]=$('[name="Competency[19].ElementTag"]:radio:checked').val(),t&&(n=0),u={jobTitle:$("input:text[name=PJMName]").val(),ratings:i,exixtingJobId:n,assignToOrder:PJM.resources.CanPublish==!0?!1:!0},r="",$.ajax({type:"POST",url:PJM.resources.AddNewPJMJob,traditional:!0,data:u,datatype:"json",success:function(n){if(n.ErrorMessage)r=$(PJM.pjmAddJobInvalidData),r.text(n.ErrorMessage),PJM.MarkUnSelected();else{r=$(PJM.pjmAddJobInvalidData),r.empty();var t=$("#partialDiv");$(t).dialog("close"),$("#PJMMessage").html(""),PJM.refreshPJMJobsList()}},error:function(){r=$(PJM.pjmAddJobInvalidData),r.text(PJM.resources.ErrorOccurred),PJM.MarkUnSelected()}})},MarkUnSelected:function(){var n=$("#Competency > tbody > tr");n.each(function(){var t=$(this),i=t.find("td > input:checked"),n;if(i.length<1)for(n=1;n<this.cells.length;n++)t[0].cells[n].style.background="red";else for(n=1;n<this.cells.length;n++)t[0].cells[n].style.background="none"})},initDialog:function(){var n=$("#AddNewJob").click(function(){$.ajax({type:"GET",url:PJM.resources.GetPJMDefinition,success:function(n){var r,f,u;n.indexOf(Site.errorCheckString)!=-1||(r=$("#partialDiv"),f="",r.html(n),u=[],u.push({text:PJM.resources.dialogSaveJobDefinitionButton,click:function(){PJM.CreateNewPJM()}}),u.push({text:PJM.resources.dialogViewButtonClose,click:function(){$(this).dialog("close")}}),r.dialog({title:PJM.resources.PJMJobDefinition,autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,1e3),buttons:u}),r.dialog("open"))},error:function(n,t,i){Site.alert(PJM.resources.ViewInitDialogError+": "+i)}})})},deleteJob:function(n){$.ajax({type:"GET",url:PJM.resources.RemovePJMJob+"?JobId="+n,success:function(n){n.indexOf(Site.errorCheckString)!=-1||(location=window.location)},error:function(n,t,i){Site.alert(PJM.resources.ViewDeleteJobError+": "+i)}})},RemoveJobPopup:function(n){Site.confirm(Site.resources.GridConfirmRemoveRow,function(){PJM.deleteJob(n)},Site.resources.Confirm,Site.resources.Cancel)},EditJobPopup:function(n,t,i){$.ajax({type:"GET",url:PJM.resources.GetPJMDefinition+"?JobId="+n+"&JobTitle="+t+"&IsNewJob="+i,success:function(t){var o,f,e;t.indexOf(Site.errorCheckString)!=-1||(o="",f=$("#partialDiv"),f.html(t),e=[],e.push({text:PJM.resources.dialogSaveJobDefinitionButton,click:function(){PJM.CreateNewPJM(n,i)}}),e.push({text:PJM.resources.dialogViewButtonClose,click:function(){$(this).dialog("close")}}),f.dialog({title:PJM.resources.PJMJobDefinition,autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,1e3),buttons:e}),f.dialog("open"))},error:function(n,t,i){Site.alert(PJM.resources.ViewPJMError+": "+i)}})},PublishPJM:function(n){$.ajax({type:"POST",url:PJM.resources.PublishPJM+"?JobId="+n,success:function(n){n.Success==!0?(setTimeout(function(){PJM.refreshPJMJobsList()},1e4),Site.success(n.ErrorMessage)):Site.alert(n.ErrorMessage)}})},PJMContinue:function(){$("#ContinueTop,#ContinueBottom").click(function(){$.ajax({type:"GET",url:PJM.resources.GetPJMMesssage,success:function(n){n.indexOf(Site.errorCheckString)!=-1?$("#PJMMessage").html(n):($("#PJMMessage").html(""),$.ajax({type:"GET",url:PJM.resources.GetPJM,success:function(){},error:function(n,t,i){Site.alert(PJM.resources.ViewPJMContinueError+": "+i)}}))},error:function(n,t,i){Site.alert(PJM.resources.ViewPJMContinueError+": "+i)}})})}},MFS={resources:[],rowIdClass:".shl-list-id",mfsContainerId:"#MFSContainer",mfsMultiQuestionsContainerId:"#MCQuest",mfsOpenQuestionsContainerId:"#OpenQuest",openList:[],multipleChoiceList:[],init:function(n){this.resources=n,this.initDialog(),this.openQuestDisplay(),this.multipleChoiceQuestDisplay(),this.MFSContinue(),this.loadGrid(),this.RaterCheckboxSelected(),this.ClosePopup(),this.SaveClick()},initopenListArray:function(){MFS.openList.length==0&&$("#OpenQuest > tbody  > tr > td").each(function(){var n=$(this).children('input[type="hidden"][name="OpenQuestionText"]').val();n==undefined&&(n=$(this).children('input[type="hidden"][name="OpenQuestionTextEdit"]').val()),n=n.split("||");var t=n[1].trim(),i=n[2].trim(),r={Number:i,Language:t};MFS.openList.push(r)})},initMCListArray:function(){MFS.multipleChoiceList.length==0&&$("#MCQuest > tbody  > tr > td").each(function(){var n=$(this).find('input[type="hidden"][name="MultipleChoiceQuestionText"]').val();n==undefined&&(n=$(this).find('input[type="hidden"][name="MultipleChoiceQuestionTextEdit"]').val()),n=n.split("||");var t=n[1].trim(),i=n[2].trim(),r={Number:i,Language:t};MFS.multipleChoiceList.push(r)})},SaveClick:function(){$("#partialDiv").on("click","#btnSave",function(){var t=$('[id="NotApplicableInImptRating"]:radio:checked').val(),n;t?$("#ImptRatingValidationMsg").empty():$("#ImptRatingValidationMsg").append(MFS.resources.GenericRequired),n=$('[id="NotApplicableInquestionnaire"]:radio:checked').val(),n?$("#ImptCoreValidationMsg").empty():$("#ImptCoreValidationMsg").append(MFS.resources.GenericRequired)})},ClosePopup:function(){$("#partialDiv").on("click","#btnClose",function(){$("#partialDiv").dialog(AddCandidateRater.resources.dialogViewButtonClose)})},RaterCheckboxSelected:function(){$("#partialDiv").on("change","#NotApplicableInImptRating",function(){var n=$('[id="NotApplicableInImptRating"]:radio:checked').val();n&&$("#ImptRatingValidationMsg").empty()});$("#partialDiv").on("change","#NotApplicableInquestionnaire",function(){var n=$('[id="NotApplicableInquestionnaire"]:radio:checked').val();n?$("#ImptCoreValidationMsg").empty():$("#ImptCoreValidationMsg").append(MFS.resources.GenericRequired)});$("#partialDiv").on("change",".RSCB",function(){var n=!1;$("input:checkbox[id='section_DefaultSelection_Value']").each(function(){var u=$("input:checkbox[name='RaterSectionDetails[5].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[1].Value']").attr("checked"),t,i,r;u?$("#NotApplicableInImptRating").show():$("#NotApplicableInImptRating").hide(),t=$("input:checkbox[name='RaterSectionDetails[0].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[4].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[8].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[11].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[14].Value']").attr("checked"),t?$("#NotApplicableInquestionnaire").show():$("#NotApplicableInquestionnaire").hide(),i=$("input:checkbox[name='RaterSectionDetails[3].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[7].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[10].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[13].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[16].Value']").attr("checked"),i?$("#MainOpenQuestionsContent").show():$("#MainOpenQuestionsContent").hide(),r=$("input:checkbox[name='RaterSectionDetails[2].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[6].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[9].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[12].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[15].Value']").attr("checked"),r?$("#MainMCQuestionsContent").show():$("#MainMCQuestionsContent").hide(),$(this).is(":checked")&&(n=!0)}),$("input:checkbox[id='section_Value_Value']").each(function(){var u=$("input:checkbox[name='RaterSectionDetails[5].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[1].Value']").attr("checked"),t,i,r;u?(n=!0,$("#NotApplicableInImptRating").show()):$("#NotApplicableInImptRating").hide(),t=$("input:checkbox[name='RaterSectionDetails[0].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[4].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[8].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[11].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[14].Value']").attr("checked"),t?$("#NotApplicableInquestionnaire").show():$("#NotApplicableInquestionnaire").hide(),i=$("input:checkbox[name='RaterSectionDetails[3].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[7].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[10].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[13].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[16].Value']").attr("checked"),i?$("#MainOpenQuestionsContent").show():$("#MainOpenQuestionsContent").hide(),r=$("input:checkbox[name='RaterSectionDetails[2].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[6].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[9].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[12].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[15].Value']").attr("checked"),r?$("#MainMCQuestionsContent").show():$("#MainMCQuestionsContent").hide(),$(this).is(":checked")&&(n=!0)}),n?$("#NoRaterSectionSelected").empty():($("#NoRaterSectionSelected").empty(),$("#NoRaterSectionSelected").append(MFS.resources.RaterSectionSelectionRequired))})},IsDuplicate:function(n,t){var s={Number:n,Language:t},f=!1,u,e,r,o;for(MFS.openList.length==0&&(f=!0,MFS.openList.push(s)),u=!1,e=-1,r=0,o=MFS.openList.length;r<o;r++)if(!f&&MFS.openList[r].Number==n&&MFS.openList[r].Language==t){$("#textRequired").append(MFS.resources.DuplicateQuestionMessage),u=!0,e=r;break}return u},openQuestDisplay:function(){var n=0;$("#partialDiv").on("click","#btnAddOpenQuestions",function(){var n,i,r,f,u,e,o,t,s,h;if($("#textRequired").empty(),$("#ddlRequired").empty(),n=$("#ddl1").val(),i=$("#OpenQuestionText").val(),i.trim()==""||n==""){i.trim()==""?$("#textRequired").append(MFS.resources.QuestionRequired):$("#textRequired").empty(),n==""?$("#ddlRequired").append(MFS.resources.QuestionLangRequired):$("#ddlRequired").empty();return}for(r=$("#ddl2").val(),MFS.initopenListArray(),f={Number:r,Language:n},u=!1,MFS.openList.length==0&&(u=!0,MFS.openList.push(f)),e=!1,o=-1,t=0,s=MFS.openList.length;t<s;t++)if(!u&&MFS.openList[t].Number==r&&MFS.openList[t].Language==n){$("#ddlRequired").append(MFS.resources.DuplicateQuestionMessage),e=!0,o=t;break}e||($("#ddlRequired").empty(),u||MFS.openList.push(f),h={ID:0,OpenQuestion:i,languageId:n,IsMandatoryToComplete:$("#SelectOpenQuestion").val(),OpenQuestionNumber:r},MFS.addNewRow(MFS.resources.AddOpenQuestionUrl,h,"#OpenQuest",null))})},multipleChoiceQuestDisplay:function(){var n=0;$("#partialDiv").on("click","#btnAddMultipleChoiceQuestions",function(){var n,r,e,u,o,a,t,v,y;$("#mcTextRequired").empty(),$("#mcddlRequired").empty();var i=$("#ddlMC1").val(),f=$("#MultipleChoiceQuestionText").val(),s=$("#ChoiceOneText").val(),h=$("#ChoiceTwoText").val(),c=$("#ChoiceThreeText").val(),l=$("#ChoiceFourText").val();if(f.trim()==""||i==""){f.trim()==""?$("#mcTextRequired").append(MFS.resources.QuestionRequired):$("#mcTextRequired").empty(),i==""?$("#mcddlRequired").append(MFS.resources.QuestionLangRequired):$("#mcddlRequired").empty();return}if(n=0,s.trim().length>0&&(n=n+1),h.trim().length>0&&(n=n+1),c.trim().length>0&&(n=n+1),l.trim().length>0&&(n=n+1),n<2){$("#ChoiceRequired").empty(),$("#ChoiceRequired").append(MFS.resources.MCOptionTextRequired);return}for($("#ChoiceRequired").empty(),r=$("#ddlMC2").val(),MFS.initMCListArray(),e={Number:r,Language:i},u=!1,MFS.multipleChoiceList.length==0&&(u=!0,MFS.multipleChoiceList.push(e)),o=!1,a=-1,t=0,v=MFS.multipleChoiceList.length;t<v;t++)if(!u&&MFS.multipleChoiceList[t].Number==r&&MFS.multipleChoiceList[t].Language==i){$("#mcddlRequired").append(MFS.resources.DuplicateQuestionMessage),o=!0,a=t;break}o||($("#mcddlRequired").empty(),u||MFS.multipleChoiceList.push(e),y={ID:0,MCQuestion:f,languageId:i,IsMandatoryToComplete:$("#SelectOpenQuestion").val(),MCQuestionNumber:r,Choice1:s,Choice2:h,Choice3:c,Choice4:l},MFS.addNewRow(MFS.resources.AddMultiQuestionUrl,y,"#MCQuest",null))})},initDialog:function(){var n=$("#AddNewMFSQuestionnaire").click(function(){$.ajax({type:"GET",url:MFS.resources.CreateQuestionnaireDefinition,success:function(n){var r,o,u,f,e;n.indexOf(Site.errorCheckString)!=-1?alert("Error"):(r=$("#partialDiv"),o="",r.html(n),u=$("input:checkbox[name='RaterSectionDetails[5].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[1].Value']").attr("checked"),u||$("#NotApplicableInImptRating").hide(),f=$("input:checkbox[name='RaterSectionDetails[3].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[7].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[10].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[13].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[16].Value']").attr("checked"),f||$("#MainOpenQuestionsContent").hide(),e=$("input:checkbox[name='RaterSectionDetails[2].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[6].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[9].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[12].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[15].Value']").attr("checked"),e||$("#MainMCQuestionsContent").hide(),r.dialog({title:MFS.resources.MFSQuestionnaire,autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,1e3)}),r.dialog("open"),MFS.setupQuestionsGrid())},error:function(n,t,i){Site.alert(MFS.resources.ViewInitDialogErr+": "+i)}})})},loadGrid:function(){MFS.setupMFSGrid(),MFS.resources.highlightClass="highlight",$(MFS.mfsContainerId+"> tbody > tr").click(function(){$("."+MFS.resources.highlightClass+" > td > div > input").attr("checked",!1),$("."+MFS.resources.highlightClass).removeClass(MFS.resources.highlightClass),$(this).addClass(MFS.resources.highlightClass),$("."+MFS.resources.highlightClass+" > td > div > input").attr("checked",!0),MFS.setContinueButtonsState()}),$(MFS.mfsContainerId+"> tbody > tr .link").click(function(n){n.stopPropagation()})},setupMFSGrid:function(){Grid.setup(MFS.mfsContainerId,null,MFS.rowIdClass,null,null,null,null),Site.Ajax.pagersSetup(MFS.mfsContainerId,MFS.pageMFSList)},setupQuestionsGrid:function(){Grid.setup(MFS.mfsOpenQuestionsContainerId,0,MFS.rowIdClass,null,MFS.saveOpenQuestion,MFS.removeOpenQuestion,null),Grid.setup(MFS.mfsMultiQuestionsContainerId,0,MFS.rowIdClass,null,MFS.saveMultiQuestion,MFS.removeMultiQuestion,null)},saveOpenQuestion:function(n){var t=Grid.getUserRowData(n),r={ID:Grid.getRowDataField(t,"ID"),OpenQuestion:Grid.getRowDataField(t,"OpenQuestion"),LanguageId:Grid.getRowDataField(t,"LanguageId"),IsMandatoryToComplete:$("#SelectOpenQuestion").val(),OpenQuestionNumber:Grid.getRowDataField(t,"OpenQuestionNumber")},i,s,h;MFS.initopenListArray();var u=$(n).parents("tr").index(),f=Grid.getRowDataField(t,"OpenQuestionNumber"),e=Grid.getRowDataField(t,"LanguageId"),l=Grid.getRowDataField(t,"ID"),o=!1,c=-1;for(i=0,s=MFS.openList.length;i<s;i++)if(MFS.openList.length>1&&MFS.openList[i].Number==f&&MFS.openList[i].Language==e){u!=i&&($(".openErrorMessage").append(MFS.resources.DuplicateQuestionMessage),o=!0),c=i;break}h={Number:f,Language:e},o||($(".openErrorMessage").empty(),MFS.openList.splice(u,1,h),MFS.saveQuestion(n,MFS.resources.SaveOpenQuestionUrl,r),MFS.addNewRow(MFS.resources.AddOpenQuestionUrl,r,"#OpenQuest",n))},saveMultiQuestion:function(n){var t=Grid.getUserRowData(n),r={ID:Grid.getRowDataField(t,"ID"),MCQuestion:Grid.getRowDataField(t,"MCQuestion"),LanguageId:Grid.getRowDataField(t,"LanguageId"),Languages:Grid.getRowDataField(t,"Languages"),IsMandatoryToComplete:$("#SelectOpenQuestion").val(),MCQuestionNumber:Grid.getRowDataField(t,"MCQuestionNumber"),Choice1:Grid.getRowDataField(t,"Choice1"),Choice2:Grid.getRowDataField(t,"Choice2"),Choice3:Grid.getRowDataField(t,"Choice3"),Choice4:Grid.getRowDataField(t,"Choice4")},i,s,h;MFS.initMCListArray();var u=$(n).parents("tr").index(),f=Grid.getRowDataField(t,"MCQuestionNumber"),e=Grid.getRowDataField(t,"LanguageId"),l=Grid.getRowDataField(t,"ID"),o=!1,c=-1;for(i=0,s=MFS.multipleChoiceList.length;i<s;i++)if(MFS.multipleChoiceList.length>1&&MFS.multipleChoiceList[i].Number==f&&MFS.multipleChoiceList[i].Language==e){u!=i&&($(".mcErrorMessage").append(MFS.resources.DuplicateQuestionMessage),o=!0),c=i;break}h={Number:f,Language:e},o||($(".mcErrorMessage").empty(),MFS.multipleChoiceList.splice(u,1,h),MFS.saveQuestion(n,MFS.resources.SaveMultiQuestionUrl,r),MFS.addNewRow(MFS.resources.AddMultiQuestionUrl,r,"#MCQuest",n))},saveQuestion:function(n,t,i){i.ID!=0&&($(MFS.serverMessageId).html(""),$.ajax({type:"POST",url:t,data:i,success:function(n){n.indexOf("Model is invalid")!=-1?Site.alert(MFS.resources.SaveQuestionError):($(MFS.serverMessageId).html(n),n.indexOf(Site.errorCheckString)==-1)},error:function(n,t,i){Site.alert(MFS.resources.SaveQuestionError+i)}}))},addNewRow:function(n,t,i,r){$.ajax({type:"POST",url:n,data:t,success:function(n){n.indexOf("Model is invalid")!=-1?Site.alert(MFS.resources.SaveQuestionError):(r==null?$(i+" > tbody").append(n):$(r).parents("tr").replaceWith(n),MFS.setupQuestionsGrid())},error:function(n,t,i){Site.alert(MFS.resources.SaveQuestionError+i)}})},removeOpenQuestion:function(n){var t=$(n).parents("tr").index();MFS.openList.splice(t,1),MFS.removeQuestion(n,MFS.resources.RemoveOpenQuestionUrl)},removeMultiQuestion:function(n){var t=$(n).parents("tr").index();MFS.multipleChoiceList.splice(t,1),MFS.removeQuestion(n,MFS.resources.RemoveMultiQuestionUrl)},removeQuestion:function(n,t){var i=Grid.getUserRowData(n),r={ID:Grid.getRowDataField(i,"ID")};$(MFS.serverMessageId).html(""),$.ajax({type:"POST",url:t,data:r,success:function(t){var u,f;$(MFS.serverMessageId).html(t),Grid.editOrDisplayUserRow(n,t.indexOf(Site.errorCheckString)!=-1),t.indexOf(Site.errorCheckString)==-1&&(u=$(n).parents("tr").attr("hiddenId"),Grid.removeRow(n),f=$("#OpenQuest > tr [hiddenid="+u+"]"),f.fadeOut().remove())},error:function(n,t,i){Site.alert(MFS.resources.RemoveQuestionError+i)}})},pageMFSList:function(n){var t=$(n).attr("data-page");MFS.refreshMFSQuestionnaireList(t)},refreshMFSQuestionnaireList:function(n){n=n==undefined?Grid.getPage(MFS.mfsContainerId):n;var t={Page:n==undefined?1:n};$.ajax({type:"GET",url:MFS.resources.GetMFSQuestionnaires,data:t,success:function(n){$(MFS.mfsContainerId).parent().html(n),MFS.loadGrid(),Site.resetValidation()},error:function(){Site.alert("ErrorOccurred")}})},setContinueButtonsState:function(){var n=$(".shl-continue");$("tbody tr ."+MFS.resources.highlightClass,MFS.mfsContainerId).length==1?(n.addClass(ProjectCandidates.disabledClass),Site.setDisabled()):(n.removeClass(ProjectCandidates.disabledClass),Site.setEnabled(n))},EditMFSPopup:function(n,t,i){$.ajax({type:"GET",url:MFS.resources.CreateQuestionnaire+"?questionnaireId="+n+"&title="+t+"&isEditable="+i,success:function(n){var s,r,u,f,e,o;n.indexOf(Site.errorCheckString)!=-1||(s="",r=$("#partialDiv"),r.html(n),u=[],f=$("input:checkbox[name='RaterSectionDetails[5].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[1].Value']").attr("checked"),f||$("#NotApplicableInImptRating").hide(),e=$("input:checkbox[name='RaterSectionDetails[3].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[7].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[10].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[13].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[16].Value']").attr("checked"),e||$("#MainOpenQuestionsContent").hide(),o=$("input:checkbox[name='RaterSectionDetails[2].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[6].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[9].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[12].Value']").attr("checked")||$("input:checkbox[name='RaterSectionDetails[15].Value']").attr("checked"),o||$("#MainMCQuestionsContent").hide(),r.dialog({title:MFS.resources.MFSQuestionnaire,autoOpen:!1,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,1e3),buttons:u}),r.dialog("open"),MFS.setupQuestionsGrid())},error:function(n,t,i){Site.alert(MFS.resources.ViewMFSError+": "+i)}})},MFSContinue:function(){$("#ContinueTop,#ContinueBottom").click(function(){$.ajax({type:"GET",url:MFS.resources.GetPJMMesssage,success:function(n){if(n.indexOf(Site.errorCheckString)!=-1)$("#MFSMessage").html(n);else{var r=$("."+MFS.resources.highlightClass+" > input").val();$("#MFSMessage").html(""),$.ajax({type:"POST",url:MFS.resources.GetMFS,data:{questionnaireId:r},success:function(){},error:function(n,t,i){Site.alert(MFS.resources.ViewMFSContinueError+": "+i)}})}},error:function(n,t,i){Site.alert(MFS.resources.ViewMFSContinueError+": "+i)}})})}},AddCandidateRater={resources:[],serverMessageId:"#CandidateRaterMessage",raterListId:"#RatersList",addRaterListId:"#RatersListAddRater",rowIdClass:".shl-rater-id",rowMappingIdClass:".shl-raterMapping-id",addSelectedRatersInvalidData:".invalidData",rowCandidateIdClass:".shl-raterCandidate-id",init:function(n){this.resources=n,AddCandidateRater.setupRatersGrid(),AddCandidateRater.setupAddRatersGrid()},setupRatersGrid:function(){Grid.setup(AddCandidateRater.raterListId,0,AddCandidateRater.rowIdClass,null,AddCandidateRater.saveEditRater,AddCandidateRater.removeRater,AddCandidateRater.sortRaterColumn),Site.Ajax.pagersSetup(AddCandidateRater.raterListId,AddCandidateRater.pageRaterList)},setupAddRatersGrid:function(){Grid.setup(AddCandidateRater.addRaterListId,null,AddCandidateRater.rowIdClass,null,null,null,null),Site.Ajax.pagersSetup(AddCandidateRater.addRaterListId,AddCandidateRater.pageAddRaterList)},OpenAddCandidateRaterPopup:function(n,t,i,r){$.ajax({type:"GET",url:AddCandidateRater.resources.ViewCandidateRater+"?candidateid="+n+"&languageCode="+t,success:function(t){var e,s,o;t.indexOf(Site.errorCheckString)!=-1||(e=$("#partialDiv"),e.html(t),Site.resetValidation(),Site.jQueryButtons(),s=$(".NoRaters").val(),AddCandidateRater.setupAddRatersGrid(),o=[],s=="False"&&($("#AddCandidateRater").removeClass("shl-hide"),$("#searchRaters").removeClass("shl-hide"),$("#CandidateRatersList").removeClass("shl-hide"),o.push({text:AddCandidateRater.resources.AddSelectedRater,click:function(){AddCandidateRater.SaveSelectedRaters(AddCandidateRater.serverMessageId,n)}})),o.push({text:AddCandidateRater.resources.CloseText,click:function(){$(this).dialog("close"),$(ProjectCandidates.serverMessageId).html(""),AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.raterListId)}}),e.dialog({title:AddCandidateRater.resources.AddRatersForCandidate+": "+i+" "+r,autoOpen:!1,bgiframe:!0,closeOnEscape:!1,close:function(){return AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.raterListId),!1},modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,1e3),buttons:o}),e.dialog("open"))},error:function(n,t,i){Site.alert(AddCandidateRater.resources.ViewError+": "+i)}})},SaveSelectedRaters:function(n,t){var i,u,r,f;if($(".search_Term").val(""),i=[],$.each($('input[type="checkbox"]:checked'),function(n,t){i.push($(t).attr("value")+":"+$(t).closest("td").siblings("td").find("select").eq(1).val())}),u=[],i[0].indexOf("true")!=-1)for(r=1;r<i.length;r++)u[r-1]=i[r];else u=i;f={candidateId:t,raterIds:u},$.ajax({type:"POST",url:AddCandidateRater.resources.SaveSelectedCandidateRater,traditional:!0,data:f,success:function(n){$(AddCandidateRater.serverMessageId).html(n),n.indexOf(Site.errorCheckString)==-1&&AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.addRaterListId,t)},error:function(n,t,i){Site.alert(AddCandidateRater.resources.ViewError+": "+i)}})},RefreshRatersList:function(n,t,i,r,u){var o="",e,f,s;u!=undefined&&(e="",f=u.toString().indexOf("Asc"),f>0?(e=u.toString().substring(0,f),o="_"+e+"_Asc"):(f=u.toString().indexOf("Desc"),f>0&&(e=u.toString().substring(0,f),o="_"+e+"_Desc"))),r=r==undefined?Grid.getPage(t):r,s={container:t,candidateId:i==undefined?0:i,Page:r==undefined?1:r,OrderBy:u==undefined?null:u,OrderByDynamic:o},$.ajax({type:"GET",url:AddCandidateRater.resources.GetRatersListUrl,data:s,success:function(i){i.indexOf(Site.errorCheckString)!=-1?$(n).append(i):($(t).parent().html(i),t.toString().indexOf(AddCandidateRater.addRaterListId)>=0?(AddCandidateRater.setupAddRatersGrid(),Site.Ajax.pagersSetup(t,AddCandidateRater.pageAddRaterList)):(AddCandidateRater.setupRatersGrid(),Site.Ajax.pagersSetup(t,AddCandidateRater.pageRaterList)),Site.resetValidation(),Site.jQueryButtons())},error:function(n,t,i){Site.alert(ProjectCandidates.resources.RefreshCandidatesListError+i)}})},pageRaterList:function(n){var t=$(n).attr("data-page");AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.raterListId,0,t,Grid.getSortExpression(AddCandidateRater.raterListId))},pageAddRaterList:function(n){var t=$(n).attr("data-page");AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.addRaterListId,$(".RatercandidateId").val(),t)},sortRaterColumn:function(n){AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.raterListId,0,Grid.getPage(AddCandidateRater.raterListId),n)},removeRater:function(n){var t=Grid.getUserRowData(n),i={CandidateId:Grid.getRowDataField(t,"CandidateID"),RaterId:Grid.getRowDataField(t,"RaterId")};$(AddCandidateRater.serverMessageId).html(""),$.ajax({type:"POST",url:AddCandidateRater.resources.RemoveRaterUrl,data:i,success:function(t){$(AddCandidateRater.serverMessageId).html(t),Grid.editOrDisplayUserRow(n,t.indexOf(Site.errorCheckString)!=-1),t.indexOf(Site.errorCheckString)==-1&&(Grid.removeRow(n),ProjectCandidates.RefreshCandidateList(AddCandidateRater.serverMessageId,AddCandidateRater.raterListId))},error:function(n,t,i){Site.alert(AddCandidateRater.resources.RemoveCandidateError+": "+i)}})},addRaterSuccess:function(n){n.indexOf(Site.errorCheckString)==-1&&($(".shl-add-rater input[type=text], .shl-add-rater input[type=email]").val(""),$(".shl-add-rater select").val("0"),AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.addRaterListId,$("#CandidateID").val()))},addRaterError:function(n,t,i){Site.alert(ProjectCandidates.resources.AddCandidateError+i)},saveEditRater:function(n){var t=Grid.getUserRowData(n),i={CandidateId:Grid.getRowDataField(t,"CandidateID"),RaterId:Grid.getRowDataField(t,"RaterId"),RaterMappingId:Grid.getRowDataField(t,"RaterMappingID"),RaterFirstName:Grid.getRowDataField(t,"RaterFirstName"),RaterLastName:Grid.getRowDataField(t,"RaterLastName"),RaterEmail:Grid.getRowDataField(t,"RaterEmail"),RaterType:Grid.getRowDataField(t,"RaterType"),RaterLanguageCode:Grid.getRowDataField(t,"RaterLanguageCode")};$(AddCandidateRater.serverMessageId).html(""),$.ajax({type:"POST",url:AddCandidateRater.resources.SaveCandidateRater,data:i,success:function(t){t.indexOf("Model is invalid")!=-1?Site.alert(AddCandidateRater.resources.UpdateCandidateStatusError+": "):($(ProjectCandidates.serverMessageId).html(t),Grid.editOrDisplayUserRow(n,t.indexOf(Site.errorCheckString)!=-1),t.indexOf(Site.errorCheckString)==-1&&(AddCandidateRater.RefreshRatersList(AddCandidateRater.serverMessageId,AddCandidateRater.raterListId),ProjectCandidates.refreshCandidateList(ProjectCandidates.serverMessageId,ProjectCandidates.candidateListId,null,Grid.getSortExpression(ProjectCandidates.candidateListId))))},error:function(n,t,i){Site.alert(ProjectCandidates.resources.SaveCandidateError+i)}})}},promotions={resources:[],init:function(n,t){this.resources=n,this.SetUpPromotionsTable(t),this.CreatePromotionClick(),this.PromotionRowDblClick(t)},SetUpPromotionsTable:function(n){function i(n,t){var f=$("#"+t+"_from"),e=$("#"+t+"_to"),o=parseInt($(f).data("columnid"),10),i=Date.parse(n[o]),r=Date.parse($(f).val(),10),u=Date.parse($(e).val(),10);return isNaN(r)&&isNaN(u)||isNaN(u)&&r<=i||isNaN(r)&&u>=i||r<=i&&u>=i?!0:!1}var t=$("#"+n).DataTable({dom:'<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',search:{caseInsensitive:!0},scrollX:!0,orderCellsTop:!0,columnDefs:[{targets:[7],render:function(n){return parseFloat(n).toFixed(2)}}],language:{emptyTable:promotions.resources.emptyTable,zeroRecords:promotions.resources.emptyTable,pagination:{first:promotions.resources.Table_Pagination_First,last:promotions.resources.Table_Pagination_Last,next:promotions.resources.Table_Pagination_Next,previous:promotions.resources.Table_Pagination_Prev},infoFiltered:promotions.resources.Table_Info_Filtered,info:promotions.resources.Table_Info,lengthMenu:promotions.resources.Table_Show_Length_Entries}});$(".dataTables_filter").css("display","none");$("."+n+"-search-input").on("keyup change",function(){if($(this).hasClass("datepicker"))t.draw();else{var n=$(this).data("columnid"),i=$(this).val();t.columns(n).search(i).draw()}});$(".autoSelect").each(function(){var i=parseInt($(this).data("columnid")),n=$(this);$(n).append('<option value="">'+promotions.resources.Select_All+"</option>"),t.columns(i).data().eq(0).sort().unique().each(function(t){$(n).append('<option value="'+t+'">'+t+"</option>")})});$(".autoSelect").on("change",function(){var n=$(this).data("columnid"),i=$(this).val();t.columns(n).search(i).draw()});$(".datepicker").datepicker({dateFormat:"yy-mm-dd",showAnim:"slideDown",autoSize:!0,closeText:"Close",changeMonth:!0,changeYear:!0}),$.fn.dataTable.ext.search.push(function(n,t){return i(t,"dateModified")&&i(t,"startdate")&&i(t,"enddate")?!0:!1}),$("#promotionTable").mousedown(function(n){n.preventDefault()})},CreatePromotionClick:function(){$("#createPromotion").click(function(){promotions.ShowCreateEditPromotionDialog($(this))})},PromotionRowDblClick:function(n){$("#"+n+" tbody").on("dblclick","tr.promotionRow",function(){promotions.ShowCreateEditPromotionDialog($(this))})},ShowCreateEditPromotionDialog:function(n){var r=$(n).data("promotionid"),t=$(n).data("promotioncode"),i=t==""?promotions.resources.Create_Promotion:promotions.resources.Edit_Promotion;$.ajax({type:"GET",url:"/Promotions/PromotionEditView",data:{promotioncode:t},success:function(n){var u=$("#partialDiv");u.html(n),u.dialog({title:i,autoOpen:!0,bgiframe:!0,closeOnEscape:!1,modal:!0,resizable:!1,width:Site.getDialogWidth(.8,null,320,1e3)}),u.dialog("open")},error:function(n,t,i){Site.alert(MFS.resources.ViewInitDialogErr+": "+i)}})}}