function SpellChecking(n,t){t.show(),n.spellchecker({url:$("#spellCheckAPI").text(),lang:$("#Lang").val(),engine:"google",suggestBoxPosition:"below"}).spellchecker("check",function(i){t.hide(),n.hasClass("hd_mrgn")&&$("#spellcheck-badwords").addClass("mrgn_tp_none"),n.hasClass("fge_suppdocs")&&$("#spellcheck-badwords").width("82%"),i&&DisplayMessages($("#noSplErrMsg").text())})}function GetWindowCentered(n,t,i){var r=0,u=0,f,e;typeof window.innerWidth=="number"?(r=window.innerHeight,u=window.innerWidth):document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)?(r=document.documentElement.clientHeight,u=document.documentElement.clientWidth):document.body&&(document.body.clientWidth||document.body.clientHeight)&&(r=document.body.clientHeight,u=document.body.clientWidth),f=(r-i)/2,e=(u-t)/2,f<0&&(f=0),e<0&&(e=0),n.style.top=0,n.style.left=0,n.style.top=f+"px",n.style.left=e+"px"}function ChangeAllCtrlsIdAndName(n,t,i){try{n.find(":hidden").each(function(){ChangeCtrlIdAndName(this,t,i)}),n.find("textarea").each(function(){ChangeCtrlIdAndName(this,t,i)}),n.find("select").each(function(){ChangeCtrlIdAndName(this,t,i)}),n.find(":checkbox").each(function(){ChangeCtrlIdAndName(this,t,i)})}catch(r){}}function ChangeCtrlIdAndName(n,t,i){var r;try{(n.name!=""||n.name!=undefined)&&(n.name=ReplaceAll(n.name,t,i)),(n.id!=""||n.id!=undefined)&&(n.id=ReplaceAll(n.id,t,i)),n.name.indexOf(".index")>-1&&(n.value=ReplaceAll(n.value,t,i))}catch(u){}}function ReplaceAll(n,t,i){var r="",u;try{u=n.split(t),r=u.join(i)}catch(f){}return r}function ValidatePhoneFax(n){var t=!1,i;try{i=/^\(?([0-9]{1,3})\)?[-. ]?([0-9]{2,3})[-. ]?([0-9]{4})$/,t=i.test(n)}catch(r){}return t}function WordCount(n){var i=0,t,r=[];try{t=$.trim($(n).val()),t.length==0?i=0:(t=t.replace(/\s/g,"+"),t=t.replace(new RegExp("\\–","gm"),"+"),t=t.replace(/^\s/g,"+"),t=t.replace(/\+*$/gi,""),t=t.replace(/\++/g," "),r=t.split(" "),i=r.length)}catch(u){}return i}function CloseDisplayMessages(){$("#dMsg").hide(),$("#mask").hide()}function HideLoadingDiv(){ShowLoading(!1,"")}function ShowWordCountsValidation(n,t,i){try{var r=WordCount(n);r>i?($("#"+t).text($("#dwrdlmit").text().replace("{0}",i).replace("{1}",r)),$("#"+t).show()):($("#"+t).text(""),$("#"+t).hide())}catch(u){}}function ApplyMaskingDiv(){}function RemoveMaskingDiv(n){try{var t=document.getElementById("MaskedDiv");t.style.display="none",t.innerHTML="",n&&(t.style.zIndex=n),popElement&&(popElement.innerHTML="")}catch(i){}}function UpdateMaskZIndex(n){try{document.getElementById("MaskedDiv").style.zIndex=n}catch(t){}}function ShowLoadingDiv(){try{var n=document.getElementById("divLoading");n==null&&(n=document.createElement("divLoading"),n.id="divLoading",document.body.appendChild(n)),n.style.display="block"}catch(t){}}function HideLoadingDiv(){try{var n=document.getElementById("divLoading");n.style.display="none"}catch(t){}}function IsIEBrowser(){var n=!0,t;try{/MSIE (\d+\.\d+);/.test(navigator.userAgent)?(t=new Number(RegExp.$1),t>=8?n=!0:t>=7?n=!0:t>=6?n=!0:t>=5&&(n=!0)):n=!1}catch(i){}return n}function ShowLoading(n,t,i){if(n==!0){var r=$(window).height(),u=$(window).width();$("#mask").css({width:$(window).width(),height:$(document).height()}),$("#mask").fadeTo("fast",.5),$("#mask").css({"z-index":"500"}),$("#divShowLoadingText").html(t),$("#divShowLoading").css({top:r/2-($("#divShowLoading").height()/2+60),left:u/2-$("#divShowLoading").width()/2,display:"block",width:i}),BringLoadingtoFront_Popup(),$("#divShowLoadingText").show()}else n==!1?($("#mask").hide(),$("#divShowLoading").css("display","None")):$("#divShowLoadingText").html(n)}function BringLoadingtoFront_Popup(){$("#divShowLoading").css({"z-index":"10000"}),$("#divShowLoadingText").css({"z-index":"10001"})}function DisplayMessages(n){var t=$(window).height(),i=$(document).width();$("#dMsg").css({"z-index":"10005",top:t/2-90,left:i/2-100}),$("#dMsg #Message").empty().html(n),SendLoadingBackto_Popup(),$("#mask").css({"z-index":"1000"}),$("#dMsg").show(),$("#btnOk").focus()}function SendLoadingBackto_Popup(){var n=$(document).height(),t=$(document).width();$("#mask").css({width:t,height:n}),$("#mask").fadeTo("fast",.5),$("#mask").css({"z-index":"500"}),$("#divShowLoading").hide(),$("#divShowLoadingText").hide()}function roundNumericStrings(n,t){var r=Math.pow(10,t),i=(Math.round(parseFloat(n)*r)/r).toString();return i!=""&&i!="NaN"&&i!=null&&i.indexOf(".")==-1?i=i+".0":(i="NaN")&&(i=""),i}function RemoveValidationClassForClone(n){$(n).find("span").each(function(){$(this).hasClass("field-validation-error")&&$(this).remove()}),$(n).find(".input-validation-error").each(function(){$(this).removeClass("input-validation-error")})}function GetGuidIndex(){var n;$.ajax({type:"POST",url:"/FGEProgramme/GetGUID",success:function(t){return n=t}})}function generateGuid(){for(var i,t="",n=0;n<32;n++)(n==8||n==12||n==16||n==20)&&(t=t+"-"),i=Math.floor(Math.random()*16).toString(16).toUpperCase(),t=t+i;return t}function RefreshChoosenSelect(n,t){$(n).find(":input").each(function(){var i=$(this).attr("type"),n;$(this).hasClass("chzn-select")&&($(this).next(".chzn-container").remove(),$(this).css({width:t}).removeClass("chzn-done"),n=$(this),setTimeout(function(){n.removeData("chosen").chosen()},0))})}function CreateClearDivAndVerticalSpace(){var n=document.createElement("div");return $(n).addClass("clear vertical_line_space"),$(n).html("<br/><hr/>"),n}function ValidateWordCount(n,t,i){var r=WordCount(n);r>i?$(t).text($("#dwrdlmit").text().replace("{0}",i).replace("{1}",r)):$(t).html(""),n.keyup(function(){var u=WordCount(n);u>i?t.text($("#dwrdlmit").text().replace("{0}",i).replace("{1}",u)):t.html("")})}function SetPercentageSignPosition(n,t){var r,u;return n==undefined?n:(u=Number(n),r=t==Cultures.ARABIC&&u>=0?"%"+n:n+"%")}function ShowHideColor(n){var i=1,t=$(n).val();i==2?$(n).parent().removeClass("ovrdue_bg nt_cmpltd_bg cmpltd_bg"):t==1?($(n).parent().removeClass("nt_cmpltd_bg cmpltd_bg"),$(n).parent().addClass("ovrdue_bg")):t==2?($(n).parent().removeClass("ovrdue_bg cmpltd_bg"),$(n).parent().addClass("nt_cmpltd_bg")):t==3?($(n).parent().removeClass("ovrdue_bg nt_cmpltd_bg"),$(n).parent().addClass("cmpltd_bg")):$(n).parent().removeClass("ovrdue_bg nt_cmpltd_bg cmpltd_bg")}function ReplaceAllOccurenceString(n,t,i){var r=i;return r.split(n).join(t)}function ConfirmationMessage(n,t,i,r,u,f){yesFunctionparent=i,NoFunctionparent=r,u=u||"Yes",f=f||"No";var e='<div id="divmask" style="position:fixed;display:block;background-color: rgba(0, 0, 0, 0.7); top: 0;left: 0;bottom: 0;right: 0; "></div> <div class="popupContact" id="F1" style="display: block; position: fixed; top: 30%; left: 30%; width:500px;"><a class="popupContactClose closeBtn" id="CB3" close" onclick="closePopUp()">X</a><div class="popup_heading">'+n+'</div><div class="poptext">'+t+'</div><br><div class="popbut"><a style="cursor:pointer" id="lnkYes" class="buttons_al" onclick="Submit()">'+u+'</a><a class="buttons_al close" style="cursor:pointer" onclick="closePopUp()">'+f+"</a></div></div>";$("body").append(e)}function Submit(){$("#F1").remove(),$("#divmask").remove(),yesFunctionparent()}function closePopUp(){NoFunctionparent!=undefined&&NoFunctionparent(),$("#F1").remove(),$("#divmask").remove()}var jaaulde=window.jaaulde||{},menu,formSubmitHandler,loadAndShowDialog,Cultures,yesFunctionparent,NoFunctionparent;jaaulde.utils=jaaulde.utils||{},jaaulde.utils.cookies=function(){var i,u,r,n,t={expiresAt:null,path:"/",domain:null,secure:!1};return i=function(n){var i,r;return typeof n!="object"||n===null?i=t:(i={expiresAt:t.expiresAt,path:t.path,domain:t.domain,secure:t.secure},typeof n.expiresAt=="object"&&n.expiresAt instanceof Date?i.expiresAt=n.expiresAt:typeof n.hoursToLive=="number"&&n.hoursToLive!==0&&(r=new Date,r.setTime(r.getTime()+n.hoursToLive*36e5),i.expiresAt=r),typeof n.path=="string"&&n.path!==""&&(i.path=n.path),typeof n.domain=="string"&&n.domain!==""&&(i.domain=n.domain),n.secure===!0&&(i.secure=n.secure)),i},u=function(n){return n=i(n),(typeof n.expiresAt=="object"&&n.expiresAt instanceof Date?"; expires="+n.expiresAt.toGMTString():"")+"; path="+n.path+(typeof n.domain=="string"?"; domain="+n.domain:"")+(n.secure===!0?"; secure":"")},r=function(){for(var r={},i,u,n,f=document.cookie.split(";"),e,t=0;t<f.length;t=t+1){i=f[t].split("="),u=i[0].replace(/^\s*/,"").replace(/\s*$/,"");try{n=decodeURIComponent(i[1])}catch(o){n=i[1]}if(typeof JSON=="object"&&JSON!==null&&typeof JSON.parse=="function")try{e=n,n=JSON.parse(n)}catch(s){n=e}r[u]=n}return r},n=function(){},n.prototype.get=function(n){var t,i,u=r();if(typeof n=="string")t=typeof u[n]!="undefined"?u[n]:null;else if(typeof n=="object"&&n!==null){t={};for(i in n)t[n[i]]=typeof u[n[i]]!="undefined"?u[n[i]]:null}else t=u;return t},n.prototype.filter=function(n){var t,i={},u=r();typeof n=="string"&&(n=new RegExp(n));for(t in u)t.match(n)&&(i[t]=u[t]);return i},n.prototype.set=function(n,t,i){if((typeof i!="object"||i===null)&&(i={}),typeof t=="undefined"||t===null)t="",i.hoursToLive=-8760;else if(typeof t!="string")if(typeof JSON=="object"&&JSON!==null&&typeof JSON.stringify=="function")t=JSON.stringify(t);else throw new Error("cookies.set() received non-string value and could not serialize.");var r=u(i);document.cookie=n+"="+encodeURIComponent(t)+r},n.prototype.del=function(n,t){var r={},i;(typeof t!="object"||t===null)&&(t={}),typeof n=="boolean"&&n===!0?r=this.get():typeof n=="string"&&(r[n]=!0);for(i in r)typeof i=="string"&&i!==""&&this.set(i,null,t)},n.prototype.test=function(){var t=!1,n="cT",i="data";return this.set(n,i),this.get(n)===i&&(this.del(n),t=!0),t},n.prototype.setOptions=function(n){typeof n!="object"&&(n=null),t=i(n)},new n}(),function(){window.jQuery&&function(n){n.cookies=jaaulde.utils.cookies;var t={cookify:function(t){return this.each(function(){var f,e=["name","id"],u,i=n(this),r;for(f in e)if(!isNaN(f)&&(u=i.attr(e[f]),typeof u=="string"&&u!=="")){i.is(":checkbox, :radio")?i.attr("checked")&&(r=i.val()):r=i.is(":input")?i.val():i.html(),(typeof r!="string"||r==="")&&(r=null),n.cookies.set(u,r,t);break}})},cookieFill:function(){return this.each(function(){for(var u,e=["name","id"],r,t=n(this),i,f=function(){return u=e.pop(),!!u};f();)if(r=t.attr(u),typeof r=="string"&&r!==""){i=n.cookies.get(r),i!==null&&(t.is(":checkbox, :radio")?t.val()===i?t.attr("checked","checked"):t.removeAttr("checked"):t.is(":input")?t.val(i):t.html(i));break}})},cookieBind:function(t){return this.each(function(){var i=n(this);i.cookieFill().change(function(){i.cookify(t)})})}};n.each(t,function(t){n.fn[t]=this})}(window.jQuery)}(),menu=function(){function t(n){this.n=n,this.h=[],this.c=[]}function f(n,t){var i=n.offsetHeight,f,r;if(i<=0&&t!=1||i>=n.mh&&t==1){t==1&&(n.style.filter="",n.style.opacity=1,n.style.overflow="visible"),clearInterval(n.t);return}f=t==1?Math.ceil((n.mh-i)/u):Math.ceil(i/u),r=i/n.mh,n.style.opacity=r,n.style.filter="alpha(opacity="+r*100+")",n.style.height=i+f*t+"px"}var i=15,r=50,u=6,n;return t.prototype.init=function(t,i){var u;n=i;var e=document.getElementById(t),f=e.getElementsByTagName("ul"),o=f.length,r=0;for(r;r<o;r++)u=f[r].parentNode,this.h[r]=u,this.c[r]=f[r],u.onmouseover=new Function(this.n+".st("+r+",true)"),u.onmouseout=new Function(this.n+".st("+r+")")},t.prototype.st=function(t,u){var e=this.c[t],s=this.h[t],o=s.getElementsByTagName("a")[0];clearInterval(e.t),e.style.overflow="hidden",u?(o.className+=" "+n,e.mh||(e.style.display="block",e.style.height="",e.mh=e.offsetHeight,e.style.height=0),e.mh==e.offsetHeight?e.style.overflow="visible":(e.style.zIndex=r,r++,e.t=setInterval(function(){f(e,1)},i))):(o.className=o.className.replace(n,""),e.t=setInterval(function(){f(e,-1)},i))},{dd:t}}(),function(){var n;n=function(){function n(){this.options_index=0,this.parsed=[]}return n.prototype.add_node=function(n){return n.nodeName==="OPTGROUP"?this.add_group(n):this.add_option(n)},n.prototype.add_group=function(n){var i,f,t,e,r,u;for(i=this.parsed.length,this.parsed.push({array_index:i,group:!0,label:n.label,children:0,disabled:n.disabled}),r=n.childNodes,u=[],t=0,e=r.length;t<e;t++)f=r[t],u.push(this.add_option(f,i,n.disabled));return u},n.prototype.add_option=function(n,t,i){if(n.nodeName==="OPTION")return n.text!==""?(t!=null&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:n.value,text:n.text,html:n.innerHTML,selected:n.selected,disabled:i===!0?i:n.disabled,group_array_index:t,classes:n.className,style:n.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},n}(),n.select_to_array=function(t){for(var f,r=new n,u=t.childNodes,i=0,e=u.length;i<e;i++)f=u[i],r.add_node(f);return r.parsed},this.SelectParser=n}.call(this),function(){var i,t,n=function(n,t){return function(){return n.apply(t,arguments)}};t=this,i=function(){function t(n,t){this.form_field=n,this.options=t!=null?t:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"":"",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return t.prototype.set_default_values=function(){return this.click_test_action=n(function(n){return this.test_active_click(n)},this),this.activate_action=n(function(n){return this.activate_field(n)},this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(){if(!this.active_field)return setTimeout(n(function(){return this.container_mousedown()},this),50)},t.prototype.input_blur=function(){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(n(function(){return this.blur_test()},this),100)},t.prototype.result_add_option=function(n){var t,i;return n.disabled?"":(n.dom_id=this.container_id+"_o_"+n.array_index,t=n.selected&&this.is_multiple?[]:["active-result"],n.selected&&t.push("result-selected"),n.group_array_index!=null&&t.push("group-option"),n.classes!==""&&t.push(n.classes),i=n.style.cssText!==""?' style="'+n.style+'"':"",'<li id="'+n.dom_id+'" class="'+t.join(" ")+'"'+i+">"+n.html+"</li>")},t.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.keyup_checker=function(n){var t,i;t=(i=n.which)!=null?i:n.keyCode,this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(n.preventDefault(),this.results_showing)return this.result_select(n);break;case 27:if(this.results_showing)return this.results_hide();break;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},t.prototype.generate_field_id=function(){var n;return n=this.generate_random_id(),this.form_field.id=n,n},t.prototype.generate_random_char=function(){var n,i,t;return n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",t=Math.floor(Math.random()*n.length),i=n.substring(t,t+1)},t}(),t.AbstractChosen=i}.call(this),function(){var n,u,i,r,f=Object.prototype.hasOwnProperty,e=function(n,t){function r(){this.constructor=n}for(var i in t)f.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n},t=function(n,t){return function(){return n.apply(t,arguments)}};r=this,n=jQuery,n.fn.extend({chosen:function(t){return n.browser.msie&&(n.browser.version==="6.0"||n.browser.version==="7.0")?this:n(this).each(function(){if(!n(this).hasClass("chzn-done"))return new u(this,t)})}}),u=function(){function u(){u.__super__.constructor.apply(this,arguments)}return e(u,AbstractChosen),u.prototype.setup=function(){return this.form_field_jq=n(this.form_field),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},u.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},u.prototype.set_up_html=function(){var t,u,r,f;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,t=n("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?t.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):t.html('<a href="javascript:void(0)" class="chzn-single"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(t),this.container=n("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),u=this.container.height(),r=this.f_width-i(this.dropdown),this.dropdown.css({width:r+"px",top:u+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=r-i(this.search_container)-i(this.search_field),this.search_field.css({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},u.prototype.register_observers=function(){return this.container.mousedown(t(function(n){return this.container_mousedown(n)},this)),this.container.mouseup(t(function(n){return this.container_mouseup(n)},this)),this.container.mouseenter(t(function(n){return this.mouse_enter(n)},this)),this.container.mouseleave(t(function(n){return this.mouse_leave(n)},this)),this.search_results.mouseup(t(function(n){return this.search_results_mouseup(n)},this)),this.search_results.mouseover(t(function(n){return this.search_results_mouseover(n)},this)),this.search_results.mouseout(t(function(n){return this.search_results_mouseout(n)},this)),this.form_field_jq.bind("liszt:updated",t(function(n){return this.results_update_field(n)},this)),this.search_field.blur(t(function(n){return this.input_blur(n)},this)),this.search_field.keyup(t(function(n){return this.keyup_checker(n)},this)),this.search_field.keydown(t(function(n){return this.keydown_checker(n)},this)),this.is_multiple?(this.search_choices.click(t(function(n){return this.choices_click(n)},this)),this.search_field.focus(t(function(n){return this.input_focus(n)},this))):void 0},u.prototype.search_field_disabled=function(){return(this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled)?(this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field()):(this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1,!this.is_multiple)?this.selected_item.bind("focus",this.activate_action):void 0},u.prototype.container_mousedown=function(t){var i;if(!this.is_disabled)return i=t!=null?n(t.target).hasClass("search-choice-close"):!1,t&&t.type==="mousedown"&&t.stopPropagation(),this.pending_destroy_click||i?this.pending_destroy_click=!1:(this.active_field?!this.is_multiple&&t&&(n(t.target)[0]===this.selected_item[0]||n(t.target).parents("a.chzn-single").length)&&(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),n(document).click(this.click_test_action),this.results_show()),this.activate_field())},u.prototype.container_mouseup=function(n){if(n.target.nodeName==="ABBR")return this.results_reset(n)},u.prototype.blur_test=function(){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},u.prototype.close_field=function(){return n(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},u.prototype.activate_field=function(){return this.is_multiple||this.active_field||(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},u.prototype.test_active_click=function(t){return n(t.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},u.prototype.results_build=function(){var t,n,i,f,u;for(this.parsing=!0,this.results_data=r.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.find("span").text(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),t="",u=this.results_data,i=0,f=u.length;i<f;i++)n=u[i],n.group?t+=this.result_add_group(n):n.empty||(t+=this.result_add_option(n),n.selected&&this.is_multiple?this.choice_build(n):n.selected&&!this.is_multiple&&(this.selected_item.find("span").text(n.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(t),this.parsing=!1},u.prototype.result_add_group=function(t){return t.disabled?"":(t.dom_id=this.container_id+"_g_"+t.array_index,'<li id="'+t.dom_id+'" class="group-result">'+n("<div />").text(t.label).html()+"</li>")},u.prototype.result_do_highlight=function(n){var t,i,r,f,u;if(n.length){if(this.result_clear_highlight(),this.result_highlight=n,this.result_highlight.addClass("highlighted"),r=parseInt(this.search_results.css("maxHeight"),10),u=this.search_results.scrollTop(),f=r+u,i=this.result_highlight.position().top+this.search_results.scrollTop(),t=i+this.result_highlight.outerHeight(),t>=f)return this.search_results.scrollTop(t-r>0?t-r:0);if(i<u)return this.search_results.scrollTop(i)}},u.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},u.prototype.results_show=function(){var n;return this.is_multiple||(this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),n=this.is_multiple?this.container.height():this.container.height()-1,this.dropdown.css({top:n+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},u.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},u.prototype.set_tab_index=function(){var t;if(this.form_field_jq.attr("tabindex"))return t=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",t):(this.selected_item.attr("tabindex",t),this.search_field.attr("tabindex",-1))},u.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},u.prototype.search_results_mouseup=function(t){var i;return i=n(t.target).hasClass("active-result")?n(t.target):n(t.target).parents(".active-result").first(),i.length?(this.result_highlight=i,this.result_select(t)):void 0},u.prototype.search_results_mouseover=function(t){var i;return i=n(t.target).hasClass("active-result")?n(t.target):n(t.target).parents(".active-result").first(),i?this.result_do_highlight(i):void 0},u.prototype.search_results_mouseout=function(t){if(n(t.target).hasClass("active-result"||n(t.target).parents(".active-result").first()))return this.result_clear_highlight()},u.prototype.choices_click=function(t){return t.preventDefault(),this.active_field&&!n(t.target).hasClass("search-choice"||n(t.target).parents(".search-choice").first)&&!this.results_showing?this.results_show():void 0},u.prototype.choice_build=function(i){var r,u;return r=this.container_id+"_c_"+i.array_index,this.choices+=1,this.search_container.before('<li class="search-choice" id="'+r+'"><span>'+i.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+i.array_index+'"></a></li>'),u=n("#"+r).find("a").first(),u.click(t(function(n){return this.choice_destroy_link_click(n)},this))},u.prototype.choice_destroy_link_click=function(t){return t.preventDefault(),this.is_disabled?t.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(n(t.target)))},u.prototype.choice_destroy=function(n){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(n.attr("rel")),n.parents("li").first().remove()},u.prototype.results_reset=function(t){return this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.show_search_field_default(),n(t.target).remove(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},u.prototype.result_select=function(n){var t,r,i,u;if(this.result_highlight)return t=this.result_highlight,r=t.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(t):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=t),t.addClass("result-selected"),u=r.substr(r.lastIndexOf("_")+1),i=this.results_data[u],i.selected=!0,this.form_field.options[i.options_index].selected=!0,this.is_multiple?this.choice_build(i):(this.selected_item.find("span").first().text(i.text),this.allow_single_deselect&&this.single_deselect_control_build()),n.metaKey&&this.is_multiple||this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change"),this.search_field_scale()},u.prototype.result_activate=function(n){return n.addClass("active-result")},u.prototype.result_deactivate=function(n){return n.removeClass("active-result")},u.prototype.result_deselect=function(t){var r,i;return i=this.results_data[t],i.selected=!1,this.form_field.options[i.options_index].selected=!1,r=n("#"+this.container_id+"_o_"+t),r.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change"),this.search_field_scale()},u.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},u.prototype.winnow_results=function(){var s,t,w,c,l,h,a,o,i,u,r,p,e,f,b,y,v;for(this.no_results_clear(),o=0,i=this.search_field.val()===this.default_text?"":n("<div/>").text(n.trim(this.search_field.val())).html(),l=new RegExp("^"+i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),p=new RegExp(i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),v=this.results_data,e=0,b=v.length;e<b;e++)if(t=v[e],!t.disabled&&!t.empty)if(t.group)n("#"+t.dom_id).css("display","none");else if(!(this.is_multiple&&t.selected)){if(s=!1,a=t.dom_id,h=n("#"+a),l.test(t.html))s=!0,o+=1;else if((t.html.indexOf(" ")>=0||t.html.indexOf("[")===0)&&(c=t.html.replace(/\[|\]/g,"").split(" "),c.length))for(f=0,y=c.length;f<y;f++)w=c[f],l.test(w)&&(s=!0,o+=1);s?(i.length?(u=t.html.search(p),r=t.html.substr(0,u+i.length)+"</em>"+t.html.substr(u+i.length),r=r.substr(0,u)+"<em>"+r.substr(u)):r=t.html,h.html(r),this.result_activate(h),t.group_array_index!=null&&n("#"+this.results_data[t.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&a===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(h))}return o<1&&i.length?this.no_results(i):this.winnow_results_set_highlight()},u.prototype.winnow_results_clear=function(){var t,r,i,f,u;for(this.search_field.val(""),r=this.search_results.find("li"),u=[],i=0,f=r.length;i<f;i++)t=r[i],t=n(t),u.push(t.hasClass("group-result")?t.css("display","auto"):!this.is_multiple||!t.hasClass("result-selected")?this.result_activate(t):void 0);return u},u.prototype.winnow_results_set_highlight=function(){var n,t;if(!this.result_highlight&&(t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),n=t.length?t.first():this.search_results.find(".active-result").first(),n!=null))return this.result_do_highlight(n)},u.prototype.no_results=function(t){var i;return i=n('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),i.find("span").first().html(t),this.search_results.append(i)},u.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},u.prototype.keydown_arrow=function(){var t,i;return this.result_highlight?this.results_showing&&(i=this.result_highlight.nextAll("li.active-result").first(),i&&this.result_do_highlight(i)):(t=this.search_results.find("li.active-result").first(),t&&this.result_do_highlight(n(t))),this.results_showing?void 0:this.results_show()},u.prototype.keyup_arrow=function(){var n;if(this.results_showing||this.is_multiple){if(this.result_highlight)return n=this.result_highlight.prevAll("li.active-result"),n.length?this.result_do_highlight(n.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())}else return this.results_show()},u.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClass("search-choice-focus"))},u.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},u.prototype.keydown_checker=function(n){var t,i;t=(i=n.which)!=null?i:n.keyCode,this.search_field_scale(),t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(n),this.mouse_on_container=!1;break;case 13:n.preventDefault();break;case 38:n.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},u.prototype.search_field_scale=function(){var o,t,h,u,f,e,i,r,s;if(this.is_multiple){for(h=0,i=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",e=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],r=0,s=e.length;r<s;r++)u=e[r],f+=u+":"+this.search_field.css(u)+";";return t=n("<div />",{style:f}),t.text(this.search_field.val()),n("body").append(t),i=t.width()+25,t.remove(),i>this.f_width-10&&(i=this.f_width-10),this.search_field.css({width:i+"px"}),o=this.container.height(),this.dropdown.css({top:o+"px"})}},u.prototype.generate_random_id=function(){for(var t="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();n("#"+t).length>0;)t+=this.generate_random_char();return t},u}(),i=function(n){var t;return t=n.outerWidth()-n.width()},r.get_side_border_padding=i}.call(this);var popElement=null,dialogs={},links=[".openpopup"];$(document).ready(function(){var t,r,i,n;$("#GranteeRegion").val()!=null&&(t=$("#GranteeRegion").val().toUpperCase(),t=="EUROPE & CENTRAL ASIA"?($(".Common").hide(),$("#Europe").show()):t=="AFRICA"?($(".Common").hide(),$("#Africa").show()):t=="AMERICAS & THE CARIBBEAN"?($(".Common").hide(),$("#America").show()):t=="ARAB STATES / MIDDLE EAST & NORTH AFRICA"?($(".Common").hide(),$("#Arab").show()):t=="ASIA & THE PACIFIC"?($(".Common").hide(),$("#Pacific").show()):($(".Common").hide(),$(".Commongrantee").hide()),r=$("#FundCode").val(),i=$("#FundID").val(),i=="1"||r=="101"?($(".FundClass").hide(),$("#UNTF").show(),$("#UNTF1").show(),$("#UNTF2").show(),$("#UNTF3").show(),$("#UNTF4").show(),$("#UNTF5").show(),$("#UNTF6").show()):i=="2"||r=="102"?($(".FundClass").hide(),$("#FGE").show(),$("#FGE1").show(),$("#FGE2").show()):($(".FundClass").hide(),$("#UNTF").show(),$("#UNTF1").show(),$("#UNTF2").show(),$("#UNTF3").show(),$("#UNTF4").show(),$("#UNTF5").show(),$("#UNTF6").show(),$("#FGE").show(),$("#FGE1").show(),$("#FGE2").show())),n=$("#RoleType").val(),i=="1"?n!="15"&&n!="16"&&($(".Common").hide(),$(".Commongrantee").hide()):i=="2"&&n!="16"&&n!="17"&&n!="15"&&($(".Common").hide(),$(".Commongrantee").hide()),n=="15"||n=="16"?$(".FooterLinkClassNameCSS").toggleClass("FooterLinkClassNameCSS BottomPagebase ftr_dvdr_grantee"):(FooterLinkClassNameCSS="BottomPagebase ftr_dvdr_admin",$(".FooterLinkClassNameCSS").toggleClass("FooterLinkClassNameCSS BottomPagebase ftr_dvdr_admin")),$(".spell_chek").click(function(n){SpellChecking($(this).prev("div").find("textarea"),$(this).parents("div").children("span:first")),n.preventDefault()}),$(".spell_chek_1").click(function(n){SpellChecking($(this).parents("tr").find("textarea"),$(this).parents("td").children("span:first")),n.preventDefault()}),$(".spell_chek_tr").click(function(n){SpellChecking($(this).parents("tr:first").find("textarea"),$(this).parents("td").children("span:first")),n.preventDefault()}),$(".spell_chek_td").click(function(n){SpellChecking($(this).parents("td:first").find("textarea"),$(this).parents("td").children("span:first")),n.preventDefault()});$(".AjaxCheckAuth").on("click",function(n){n.preventDefault();var t=$(".AuthUserURL").val(),i=$(this);$.ajax({url:t,type:"GET"}).done(function(n){n==!0?$(i).closest("form").submit():window.location=$(".HomeURL").val()})});$(document.body).on("change",".chkbaselineavailable",function(){var i=$(this).attr("id"),r,t="#"+$(this).attr("ID")+"Hidden",n="#"+String(i).replace("BaselineAvailable","BaselineValue");$(this).is(":checked")==!0?($(t).val(!1),$(n).attr("readonly","readonly"),$(n).addClass("select_disable"),$(n).val("")):($(t).val(!0),$(n).removeAttr("readonly"),$(n).removeClass("select_disable"))});$(document.body).on("change",".radiobaselineavailable",function(){var r=$(this).attr("name"),n,t=$(this).val(),i=String(r).replace("Baseline","FinalTarget");t=="true"?$("input:radio[name="+HandleSpecialCharacter(i)+"]").each(function(){n=$(this).val(),n=="true"?$(this).removeAttr("checked"):n=="false"&&$(this).attr("checked","checked")}):t=="false"&&$("input:radio[name="+HandleSpecialCharacter(i)+"]").each(function(){n=$(this).val(),n=="true"?$(this).attr("checked","checked"):n=="false"&&$(this).removeAttr("checked")})});$(document.body).on("change",".radioFinalTargetavailable",function(){var r=$(this).attr("name"),n,t=$(this).val(),i=String(r).replace("FinalTarget","Baseline");t=="true"?$("input:radio[name="+HandleSpecialCharacter(i)+"]").each(function(){n=$(this).val(),n=="true"?$(this).removeAttr("checked"):n=="false"&&$(this).attr("checked","checked")}):t=="false"&&$("input:radio[name="+HandleSpecialCharacter(i)+"]").each(function(){n=$(this).val(),n=="true"?$(this).attr("checked","checked"):n=="false"&&$(this).removeAttr("checked")})})}),jQuery.fn.AllowNumericOnly=function(){return this.each(function(){$(this).keydown(function(n){var t=n.charCode||n.keyCode||0;if(n.shiftKey)n.preventDefault();else return t==8||t==9||t==46||t>=37&&t<=40||t>=48&&t<=57||t>=96&&t<=105})})},formSubmitHandler=function(n){var t=$(this);(!t.valid||t.valid())&&$.post(t.attr("action"),t.serializeArray()).done(function(n){n=n||{},n.success?location=n.redirect||location.href:n.errors&&displayErrors(t,n.errors)}).error(function(){displayErrors(t,["An unknown error happened."])}),n.preventDefault()},loadAndShowDialog=function(n,t,i){var r=i.indexOf("?")>=0?"&":"?";dialogs[n]=$(),$.get(i+r+"content=1").done(function(n){var t=null;t=new popUpCreater({FDiv:"F1",MDiv:"M2",CBtn:"CB3"}),t.divInnerHTML=n,t.loadPopup()})},classArr=[],classArr.cssClass=["backgroundPopup","popupContact","popupContactClose"],classArr.htmlElem=["div","a"],classArr.opacity="0.7",classArr.fadeIn="fast",classArr.fadeOut="fast",popUpCreater=function(n){this.divInnerHTML="",this.divCreater(n.FDiv,n.MDiv,n.CBtn,n.popUpNumber)},popUpCreater.prototype.htmlElementCreator=function(n,t,i){var r=document.createElement(n);return r.className=i,r.id=t,r},popUpCreater.prototype.divCreater=function(n,t,i){var o=document,e,u,f;e=this.htmlElementCreator(classArr.htmlElem[0],t,classArr.cssClass[0]),u=this.htmlElementCreator(classArr.htmlElem[0],n,classArr.cssClass[1]),f=this.htmlElementCreator(classArr.htmlElem[1],i,classArr.cssClass[2]),f.innerHTML="X",this.divBack=e,this.divFront=u,this.closebtn=f,this.divFront.appendChild(this.closebtn),o.body.appendChild(this.divBack),o.body.appendChild(this.divFront),$("#"+this.closebtn.id).addClass("closeBtn"),f.onmouseup=function(){$("#"+u.id).css("display")=="block"&&($("#"+e.id).fadeOut(classArr.fadeOut),$("#"+u.id).fadeOut(classArr.fadeOut),$("#"+u.id).remove())}},popUpCreater.prototype.loadPopup=function(){$("#"+this.divFront.id).css("display")!="block"&&($("#"+this.divFront.id).append(this.divInnerHTML),$("#"+this.divBack.id).css({opacity:classArr.opacity}),$("#"+this.divBack.id).fadeIn(classArr.fadeIn),$("#"+this.divFront.id).fadeIn(classArr.fadeIn),this.centerPopup(),this.popupStatus=1)},popUpCreater.prototype.disablePopup=function(){$("#"+this.divFront.id).css("display")=="block"&&($("#"+this.divBack.id).fadeOut(classArr.fadeOut),$("#"+this.divFront.id).fadeOut(classArr.fadeOut),this.popupStatus=0)},popUpCreater.prototype.centerPopup=function(){var t=document.documentElement.clientWidth,n=document.documentElement.clientHeight,i=$("#"+this.divFront.id).height(),r=$("#"+this.divFront.id).width();$("#"+this.divFront.id).css({position:"absolute",top:n/2-i/2,left:t/2-r/2}),$("#"+this.divBack.id).css({height:n})},Cultures={ENGLISH:"en",SPANISH:"es",FRENCH:"fr",ARABIC:"ar",RUSSIAN:"ru"},yesFunctionparent="",NoFunctionparent=""