function isValidDate(n){return Object.prototype.toString.call(n)!=="[object Date]"?!1:!isNaN(n.getTime())}function knockoutValidatorEx(n){if(this instanceof knockoutValidatorEx)this._containerSelector=n;else return new knockoutValidatorEx(n)}var cultureInfoDateFormat="dd.MM.yyyy",cultureInfoDateFormatJs="mm/dd/yy",dateTimeFormatDisplay="dd.MM.yy",dateTimeFormatDisplayFullYear="dd.MM.yyyy",dateTimeFullFormatDisplay="dd.MM.yy HH:mm",controls={};(function(n,t){n.lookup=n.lookup||{},n.datepicker=n.datepicker||{originalSufix:"_original"},n.setValue=function(n,t){$(n).hasClass("hasDatepicker")||$(controls.datepicker.getOriginalSelector(n)).hasClass("hasDatepicker")?controls.datepicker.setValue(n,t):$(n).hasClass("hasLookup")?controls.lookup.setValue(n,t):$(n).hasClass("input_checkbox")?t?$(n).attr("checked",!0):$(n).attr("checked",!1):$(n).val(t)},controls.addValidator=function(){return!1},n.datepicker.create=function(n,t,i,r,u,f){var y=$.datepicker.formatDate(dateTimeFormat,new Date),o=n,h=n,e=n,l=n,s;o.substring(0,1)=="#"&&(o=o.substring(1)),e.substring(0,1)!="#"&&(e="#"+e),h=o+"_hidden",l=e+"_hidden";var v='',c=$(n).parents("div"),a=!1;for(s=0;s0&&(i.length>8&&(i=i.substring(0,7)),$(n).datepicker("setDate",$.datepicker.parseDate("yymmdd",i)))},n.lookup.setValue=function(){}})(controls);var imagesUrl="",loginUrl="",logoffUrl="",utils={};(function(n,t){n.registerLogOff=function(n,i){logoffUrl=i,$(n).click(function(){return logoffUrl!=t&&logoffUrl.length>0&&(document.location=logoffUrl),!1})},n.disableElement=function(n,t){t?$("#"+n).attr("disabled","disabled"):$("#"+n).removeAttr("disabled")},n.showDialog=function(n,t,i,r,u,f,e,o,s,h){var l=function(){$("#"+n).dialog("destroy")},a="#"+n,c;return $(a+"_message").html(i),r==null&&(r=l),s==null&&(s="OK"),h==null&&(h="Inchide"),c={},e==!0&&o==!0&&(c[s]=function(){r(),$("#"+n).dialog("destroy")},c[h]=l),e==!0&&o==!1&&(c={Inchide:l}),e==!1&&o==!0&&(c={Ok:r}),$("#"+n).dialog({autoOpen:!1,closeOnEscape:!0,height:f,width:u,modal:!0,resizable:!1,position:"center",close:l,buttons:c}),$("#"+n).dialog("option","title",t),$("#"+n).dialog("open"),!1},n.destroyInfo=function(){$("#info").dialog("destroy")},n.showDialogConfig=function(n){var i,t;return n.elementID=n.elementID||"info",n.width=n.width||400,n.height=n.height||120,n.title=n.title||"TITLU GENERIC",n.message=n.message||"TEXT GENERIC",i=function(){$("#"+n.elementID).dialog("destroy")},n.buttons=n.buttons||{OK:i},t=$("#"+n.elementID),$("#"+n.elementID).html(n.title),$("#"+n.elementID).html(n.message),t.dialog({autoOpen:!1,closeOnEscape:!0,height:n.height,width:n.width,modal:!0,resizable:!1,position:"center",close:i,buttons:n.buttons,title:n.title}),t.dialog("open"),!1},n.showQuestion=function(n,t,i,r,u,f){var e=function(){$("#"+n).dialog("destroy"),f!=null&&f()},o="#"+n;return $("#"+n).dialog({autoOpen:!1,closeOnEscape:!0,height:r,width:i,modal:!0,resizable:!1,position:"center",close:e,buttons:{stringLangDA:function(){var n=u();(typeof n=="undefined"||typeof n=="boolean"&&n==!0)&&f==null&&e()},stringLangNU:e}}),$("#"+n).dialog("option","title",t),$("#"+n).dialog("open"),!1},n.showInfoMessage=function(n){this.showDialog("info","Atentie",n,null,400,"auto",!1,!0)},n.showErrorMessage=function(n){n=n||{},n.elementID=n.elementID||"info",n.title=n.title||"Eroare",n.message=n.message||"Nedefinit",n.width=n.width||400,n.height=n.height||120,this.showDialog(n.elementID,n.title,n.message,null,n.width,n.height,!1,!0)},n.showQuestionMessage=function(n,t,i){this.showDialog("question",n,t,i,400,"auto",!0,!0,stringLangDA,stringLangNU)},n.showQuestionMessageConfig=function(n){this.showDialog("question",n.title||"Title",n.message||"message",n.functionYes,400,n.height||120,!0,!0,stringLangDA,stringLangNU)},n.showSelecteazaLinieMessage=function(){this.showInfoMessage("Selectati o linie pentru a continua!")},n.showSelecteazaOSinguraLinieMessage=function(){this.showInfoMessage("Selectati o singura linie pentru a continua!")},n.showSelecteazaMinimOLinie=function(){this.showInfoMessage("Selectati cel putin o linie pentru a continua!")},n.UILoading=function(){$.blockUI({theme:!0,message:''})},n.UIBlockElement=function(n){$(n).block({theme:!0,message:''})},n.UIUnblockElement=function(n){$(n).unblock()},n.UIUnblock=function(){$.unblockUI()},n.showFormErrorMessage=function(n){$("#form_error_message").html(n),$("#form_error_message").show(),$(window).scrollTop(0)},n.hideFormErrorMessage=function(){$("#form_error_message").html(""),$("#form_error_message").hide()},n.showFormErrorIfAny=function(t){return t!=""?(n.showFormErrorMessage(t.replace("NEW_LINE","
")),!0):!1},n.getJSON=function(i,r,u,f,e){var s=function(){utils.UIUnblockElement("#masterMainContent"),n.showFormErrorMessage("Eroare!")},o=function(){utils.UIUnblockElement("#masterMainContent")};f!==t&&(s=f),e!==t&&(o=e),$.ajaxSetup({cache:!1}),$.getJSON(i,r).success(u).error(s).complete(o)},n.postData=function(i,r,u,f,e){var f=function(){n.UIUnblock(),n.showFormErrorMessage("Eroare!")},e=function(){n.UIUnblock()},o;f!==t&&(f=f),e!==t&&(e=e),$.ajaxSetup({cache:!1}),o=$("input[name^=__RequestVerificationToken]").first(),i=i+(i.indexOf("?")===-1?"?":"&")+o.serialize(),$.post(i,r).success(u).error(f).complete(e)},n.postJsonData=function(i,r,u,f,e){var f,e,o;r.__ko_mapping__!=null&&delete r.__ko_mapping__,f=function(){n.UIUnblock(),n.showFormErrorMessage("Eroare!")},e=function(){n.UIUnblock()},f!==t&&(f=f),e!==t&&(e=e),$.ajaxSetup({cache:!1,contentType:"application/json; charset=utf-8"}),o=$("input[name^=__RequestVerificationToken]").first(),i=i+(i.indexOf("?")===-1?"?":"&")+o.serialize(),$.post(i,r).success(u).error(f).complete(e)},n.doPostAjax=function(n){var t=$("input[name^=__RequestVerificationToken]").first();n.url=n.url+(n.url.indexOf("?")===-1?"?":"&")+t.serialize(),$.ajaxSetup({cache:!1}),$.ajax({type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",url:n.url,data:JSON.stringify(n.data),success:function(t){if(utils.UIUnblock(),t.success){n.onSuccess!=null&&n.onSuccess(),n.handlerOK(t);return}utils.showErrorMessage({message:t.msg})},error:function(){utils.UIUnblock(),utils.showErrorMessage({message:Messages.ERR_GENERAL})}})},n.doPostAjaxCustom=function(n){var t=$("input[name^=__RequestVerificationToken]").first();n.url=n.url+(n.url.indexOf("?")===-1?"?":"&")+t.serialize(),$.ajaxSetup({cache:!1}),$.ajax({type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",url:n.url,data:JSON.stringify(n.data),success:function(t){t.success?n.handlerOK(t):n.handlerError(t.msg)},error:function(){n.handlerError(Messages.ERR_GENERAL)}})},n.Date={GetFromDisplay:function(n){return $.datepicker.parseDate(cultureInfoDateFormatJs,n)},ParseToDisplay:function(n){var i=cultureInfoDateFormat.replace(/m/g,"M");return $.format.date(n,i)},ParseToServer:function(n){return $.format.date(n,cultureInfoDateFormat)}},n.ToDateTimeServer=function(n){try{var n=$.datepicker.parseDate(cultureInfoDateFormatJs,n),n=$.format.date(n,cultureInfoDateFormat);return n}catch(t){return null}},n.AssignDatePickers=function(){$('input[koType="Data"]').each(function(){$(this).hasClass("hasDatepicker")||$(this).attr("disabled")=="disabled"||$(this).datepicker({changeMonth:!0,changeYear:!0,numberOfMonths:1,dateFormat:cultureInfoDateFormatJs,altFormat:cultureInfoDateFormat+" 00:00:00",yearRange:"c-100:c+25"})})},n.AssignTimePickers=function(n){$('input[koType="Time"]').each(function(){var i=$(this);i.attr("isTime")===t&&(i.attr("isTime","true"),i.change(function(){utils.BindControlTime($(this),n)}),i.keydown(function(t){var i,u,r;if(t.which!=9&&t.which!=17&&t.which!=116&&t.which!=8&&t.which!=37&&t.which!=39&&t.which!=46){if(t.which==13){utils.BindControlTime($(this),n);return}if(i=$(this).val(),(t.keyCode<49||t.keyCode>58)&&i.indexOf(":")>=0){t.preventDefault();return}for(u="",r=0;r0&&t.html().endsWith(n)==!1&&t.append(n)}),$("[koValidate='comboBoxNotSpecified']").each(function(){var i=$(this).parent(),t=i.find("label[for]").first();t.length>0&&t.html().endsWith(n)==!1&&t.append(n)})}})(utils),String.prototype.ltrim=function(n){typeof n=="undefined"&&(n=" ");for(var t=this,i=200;i>0&&t.length>0&&t.indexOf(n)==0;)i--,t=t.substring(1);return t},String.prototype.rtrim=function(n){typeof n=="undefined"&&(n=" ");for(var t=this,i=200;i>0&&t.length>0&&t[t.length-1]==n;)i--,t=t.substring(0,t.length-1);return t},String.prototype.format=String.prototype.f=function(){for(var t=this,n=arguments.length;n--;)t=t.replace(new RegExp("\\{"+n+"\\}","gm"),arguments[n]);return t},typeof String.prototype.endsWith!="function"&&(String.prototype.endsWith=function(n){return n==undefined||n==null?!1:this.indexOf(n,this.length-n.length)!==-1}),String.prototype.isValidIntPozitive=function(){var n=new RegExp("^[0-9]+$");return n.test(this)},String.prototype.isValidInt=function(){return pattern=new RegExp("^[-]{0,1}[0-9]+$"),pattern.test(this)},String.prototype.isValidDecimal=function(){var n=new RegExp("^[0-9]*[.]{0,1}[0-9]+$");return n.test(this)},String.prototype.isValidEmail=function(){var n=new RegExp("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");return n.test(this)},getAsDate=function(n){var t=new Date(n);return isValidDate(t)||(t=null),t},function(n,t,i){function s(n){throw n;}function h(n){return function(){return n}}function c(r){function v(n,t,i){i&&t!==c.k.r(n)&&c.k.S(n,t),t!==c.k.r(n)&&c.a.va(n,"change")}var c="undefined"!=typeof r?r:{},y,l,a;c.b=function(n,t){for(var i=n.split("."),u=c,r=0;r",r[0];);return 4c.a.j(i,n[t])&&i.push(n[t]);return i},T:function(n,t){for(var n=n||[],r=[],i=0,u=n.length;in.length?e:n.substring(0,t.length)===t},eb:function(n,t){for(var r="return ("+n+")",i=0;i",""]||!u.indexOf("",""]||(!u.indexOf("",""]||[0,"",""],i="ignored
"+u[1]+i+u[2]+"
","function"==typeof n.innerShiv?r.appendChild(n.innerShiv(i)):r.innerHTML=i;u[0]--;)r=r.lastChild;r=c.a.L(r.lastChild.childNodes)}return r},c.a.Y=function(n,t){if(c.a.ga(n),t!==f&&t!==o)if("string"!=typeof t&&(t=t.toString()),"undefined"!=typeof jQuery)jQuery(n).html(t);else for(var r=c.a.pa(t),i=0;i"},Va:function(t,i){var r=n[t];r===o&&s(Error("Couldn't find any memo with ID "+t+". Perhaps it's already been unmemoized."));try{return r.apply(f,i||[]),u}finally{delete n[t]}},Wa:function(n,t){var f=[],u,o,r,e;for(i(n,f),u=0,o=f.length;ut;t++)n=n();return n})},c.toJSON=function(n,t,i){return n=c.Ta(n),c.a.sa(n,t,i)}}(),c.b("toJS",c.Ta),c.b("toJSON",c.toJSON),function(){c.k={r:function(n){switch(c.a.o(n)){case"option":return n.__ko__hasDomDataOptionValue__===u?c.a.f.get(n,c.c.options.oa):n.getAttribute("value");case"select":return 0<=n.selectedIndex?c.k.r(n.options[n.selectedIndex]):o;default:return n.value}},S:function(n,t){switch(c.a.o(n)){case"option":switch(typeof t){case"string":c.a.f.set(n,c.c.options.oa,o),"__ko__hasDomDataOptionValue__"in n&&delete n.__ko__hasDomDataOptionValue__,n.value=t;break;default:c.a.f.set(n,c.c.options.oa,t),n.__ko__hasDomDataOptionValue__=u,n.value="number"==typeof t?t:""}break;case"select":for(var i=n.options.length-1;0<=i;i--)if(c.k.r(n.options[i])==t){n.selectedIndex=i;break}break;default:(t===f||t===o)&&(t=""),n.value=t}}}}(),c.b("selectExtensions",c.k),c.b("selectExtensions.readValue",c.k.r),c.b("selectExtensions.writeValue",c.k.S),c.g=function(){function n(n,t){for(var i=f;n!=i;)i=n,n=n.replace(r,function(n,i){return t[i]});return n}var r=/\@ko_token_(\d+)\@/g,i=/^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i,t=["true","false"];return{D:[],W:function(t){var i=c.a.w(t),u;if(3>i.length)return[];"{"===i.charAt(0)&&(i=i.substring(1,i.length-1));for(var t=[],e=f,o,r=0;r$/:/^\s*ko\s+(.*\:.*)\s*$/,l=i?/^<\!--\s*\/ko\s*--\>$/:/^\s*\/ko\s*$/,h={ul:u,ol:u};c.e={C:{},childNodes:function(t){return n(t)?o(t):t.childNodes},ha:function(t){if(n(t))for(var t=c.e.childNodes(t),i=0,r=t.length;i"),e))}},c.c.uniqueName.gb=0,c.c.checked={init:function(n,t,i){c.a.n(n,"click",function(){var r,f;if("checkbox"==n.type)r=n.checked;else if("radio"==n.type&&n.checked)r=n.value;else return;f=t(),"checkbox"==n.type&&c.a.d(f)instanceof Array?(r=c.a.j(c.a.d(f),n.value),n.checked&&0>r?f.push(n.value):!n.checked&&0<=r&&f.splice(r,1)):c.g.$(f,i,"checked",r,u)}),"radio"==n.type&&!n.name&&c.c.uniqueName.init(n,h(u))},update:function(n,t){var i=c.a.d(t());"checkbox"==n.type?n.checked=i instanceof Array?0<=c.a.j(i,n.value):i:"radio"==n.type&&(n.checked=n.value==i)}},a={"class":"className","for":"htmlFor"},c.c.attr={update:function(n,t){var s=c.a.d(t())||{},i,r,u;for(i in s)"string"==typeof i&&(r=c.a.d(s[i]),u=r===e||r===f||r===o,u&&n.removeAttribute(i),8>=c.a.ja&&i in a?(i=a[i],u?n.removeAttribute(i):n[i]=r):u||n.setAttribute(i,r.toString()))}},c.c.hasfocus={init:function(n,t,i){function r(n){var r=t();c.g.$(r,i,"hasfocus",n,u)}c.a.n(n,"focus",function(){r(u)}),c.a.n(n,"focusin",function(){r(u)}),c.a.n(n,"blur",function(){r(e)}),c.a.n(n,"focusout",function(){r(e)})},update:function(n,t){var i=c.a.d(t());i?n.focus():n.blur(),c.a.va(n,i?"focusin":"focusout")}},c.c["with"]={p:function(n){return function(){var t=n();return{"if":t,data:t,templateEngine:c.q.K}}},init:function(n,t){return c.c.template.init(n,c.c["with"].p(t))},update:function(n,t,i,r,u){return c.c.template.update(n,c.c["with"].p(t),i,r,u)}},c.g.D["with"]=e,c.e.C["with"]=u,c.c["if"]={p:function(n){return function(){return{"if":n(),templateEngine:c.q.K}}},init:function(n,t){return c.c.template.init(n,c.c["if"].p(t))},update:function(n,t,i,r,u){return c.c.template.update(n,c.c["if"].p(t),i,r,u)}},c.g.D["if"]=e,c.e.C["if"]=u,c.c.ifnot={p:function(n){return function(){return{ifnot:n(),templateEngine:c.q.K}}},init:function(n,t){return c.c.template.init(n,c.c.ifnot.p(t))},update:function(n,t,i,r,u){return c.c.template.update(n,c.c.ifnot.p(t),i,r,u)}},c.g.D.ifnot=e,c.e.C.ifnot=u,c.c.foreach={p:function(n){return function(){var t=c.a.d(n());return!t||"number"==typeof t.length?{foreach:t,templateEngine:c.q.K}:{foreach:t.data,includeDestroyed:t.includeDestroyed,afterAdd:t.afterAdd,beforeRemove:t.beforeRemove,afterRender:t.afterRender,templateEngine:c.q.K}}},init:function(n,t){return c.c.template.init(n,c.c.foreach.p(t))},update:function(n,t,i,r,u){return c.c.template.update(n,c.c.foreach.p(t),i,r,u)}},c.g.D.foreach=e,c.e.C.foreach=u,c.t=function(){},c.t.prototype.renderTemplateSource=function(){s(Error("Override renderTemplateSource"))},c.t.prototype.createJavaScriptEvaluatorBlock=function(){s(Error("Override createJavaScriptEvaluatorBlock"))},c.t.prototype.makeTemplateSource=function(n,i){if("string"==typeof n){var i=i||t,r=i.getElementById(n);return r||s(Error("Cannot find template with ID "+n)),new c.l.i(r)}if(1==n.nodeType||8==n.nodeType)return new c.l.M(n);s(Error("Unknown template type: "+n))},c.t.prototype.renderTemplate=function(n,t,i,r){return this.renderTemplateSource(this.makeTemplateSource(n,r),t,i)},c.t.prototype.isTemplateRewritten=function(n,i){return this.allowTemplateRewriting===e||!(i&&i!=t)&&this.V&&this.V[n]?u:this.makeTemplateSource(n,i).data("isRewritten")},c.t.prototype.rewriteTemplate=function(n,i,r){var f=this.makeTemplateSource(n,r),i=i(f.text());f.text(i),f.data("isRewritten",u),!(r&&r!=t)&&"string"==typeof n&&(this.V=this.V||{},this.V[n]=u)},c.b("templateEngine",c.t),c.Z=function(){function n(n,t,i){for(var r,f,n=c.g.W(n),e=c.g.D,u=0;u/g;return{mb:function(n,t,i){t.isTemplateRewritten(n,i)||t.rewriteTemplate(n,function(n){return c.Z.zb(n,t)},i)},zb:function(r,u){return r.replace(i,function(t,i,r,f,e,o,s){return n(s,i,u)}).replace(t,function(t,i){return n(i,"",u)})},Za:function(n){return c.s.na(function(t,i){t.nextSibling&&c.ya(t.nextSibling,n,i)})}}}(),c.b("templateRewriting",c.Z),c.b("templateRewriting.applyMemoizedBindingsToNextSibling",c.Z.Za),function(){c.l={},c.l.i=function(n){this.i=n},c.l.i.prototype.text=function(){var n=c.a.o(this.i),n="script"===n?"text":"textarea"===n?"value":"innerHTML",t;if(0==arguments.length)return this.i[n];t=arguments[0],"innerHTML"===n?c.a.Y(this.i,t):this.i[n]=t},c.l.i.prototype.data=function(n){if(1===arguments.length)return c.a.f.get(this.i,"templateSourceData_"+n);c.a.f.set(this.i,"templateSourceData_"+n,arguments[1])},c.l.M=function(n){this.i=n},c.l.M.prototype=new c.l.i,c.l.M.prototype.text=function(){if(0==arguments.length){var n=c.a.f.get(this.i,"__ko_anon_template__")||{};return n.ua===o&&n.da&&(n.ua=n.da.innerHTML),n.ua}c.a.f.set(this.i,"__ko_anon_template__",{ua:arguments[0]})},c.l.i.prototype.nodes=function(){if(0==arguments.length)return(c.a.f.get(this.i,"__ko_anon_template__")||{}).da;c.a.f.set(this.i,"__ko_anon_template__",{da:arguments[0]})},c.b("templateSources",c.l),c.b("templateSources.domElement",c.l.i),c.b("templateSources.anonymousTemplate",c.l.M)}(),function(){function i(n,t,i){for(var r,t=c.e.nextSibling(t);n&&(r=n)!==t;)n=c.e.nextSibling(r),(1===r.nodeType||8===r.nodeType)&&i(r)}function h(n,t){if(n.length){var u=n[0],r=n[n.length-1];i(u,r,function(n){c.xa(t,n)}),i(u,r,function(n){c.s.Wa(n,[t])})}}function t(n){return n.nodeType?n:0c.a.ja)&&n.nodes?n.nodes():f;return t?c.a.L(t.cloneNode(u).childNodes):(n=n.text(),c.a.pa(n))},c.q.K=new c.q,c.ra(c.q.K),c.b("nativeTemplateEngine",c.q),function(){c.ma=function(){var n=this.vb=function(){if("undefined"==typeof jQuery||!jQuery.tmpl)return 0;try{if(0<=jQuery.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(n){}return 1}();this.renderTemplateSource=function(i,r,u){u=u||{},2>n&&s(Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later."));var e=i.data("precompiled");return e||(e=i.text()||"",e=jQuery.template(f,"{{ko_with $item.koBindingContext}}"+e+"{{/ko_with}}"),i.data("precompiled",e)),i=[r.$data],r=jQuery.extend({koBindingContext:r},u.templateOptions),r=jQuery.tmpl(e,i,r),r.appendTo(t.createElement("div")),jQuery.fragments={},r},this.createJavaScriptEvaluatorBlock=function(n){return"{{ko_code ((function() { return "+n+" })()) }}"},this.addTemplate=function(n,i){t.write("