function parseDate(n){return n?new Date(Date.parse(n)):null}function getMousePosition(n){var t,i,r;return isIE||(t=n.pageX,i=n.pageY),isIE&&(t=n.clientX+document.body.scrollLeft,i=n.clientY+document.body.scrollTop),posX=t,posY=i,r=Array(posX,posY),{x:posX,y:posY}}function parseJsonDate(n){var i,t,r;return undefined==n||null==n?null:(i=(new Date).getTimezoneOffset()*6e4,t=/\/Date\((-?\d+)([+-]\d{2})?(\d{2})?.*/.exec(n),null==t)?NaN!=parseInt(""+n,10)?(r=new Date(parseInt(""+n,10)),new Date(r)):null:(t[2]==undefined&&(t[2]=0),t[3]==undefined&&(t[3]=0),new Date(+t[1]+i+t[2]*36e5+t[3]*6e4))}function esubscriptionModel(n,t,i,r,u){var f=this;f.fio=ko.observable(t).extend({hasFocus:"Поле 'ФИО' не является обязательным к заполнению. Если Вы решили его заполнить, то необходимо указать Фамилию Имя Отчество, разделенные знаком пробел, например:<br /><strong>Иванов Иван Иванович<\/strong>"});f.phone=ko.observable(i).extend({phone:!0,placeholder:"В формате: +ХХХ(ХХ)ХХХХХХХ",hasFocus:"Поле 'Номер Вашего телефона' является обязательным к заполнению. Должно содержать телефонный номер в международном формате, например:<strong><br />+375291234567<br >+375(29)123-4567<br />80171234567<br /><\/strong>Знак '<strong>+<\/strong>' не является обязательным."});f.email=ko.observable(r).extend({email:{message:"Не верный адрес электронной почты"},hasFocus:"Поле 'Ваш E-mail' является обязательным к заполнению. На этот e-mail будет доставляться Ваша подписка."});f.amt=ko.observable(0);f.amt.viewValue=ko.observable("0");f.amt.viewValue2=ko.observable("0");f.selectedPeriods=ko.observableArray();$(".edition").each(function(){var n=parseInt(jQuery(this).children().find(".minSelected").val()),t=parseInt(jQuery(this).children().find(".maxSelected").val()),i=jQuery(this).text().replace(/(\r\n|\n|\r)/gm,"");f.selectedPeriods.push({min:isNaN(n)?0:n,max:isNaN(t)?0:t,current:0,edition:i})});f.calcAmt=function(){var n=0,t=0;$(".edition").each(function(t){try{var i=0,r=parseInt($(this).find(".count").val());$(this).find(".cbox").each(function(){if(jQuery(this).is(":checked")){i++;var t=u?parseFloat(jQuery(this).parent().children("input.amt").val().replace(",",".")):parseInt(jQuery(this).parent().children("input.amt").val());n+=(r<0?0:r)*t;u&&(n=Math.round(n*100)/100)}});f.selectedPeriods()[t].current=i;f.selectedPeriods()[t].max>0&&$(this).find(".cbox").each(function(){jQuery(this).is(":checked")||(i>=f.selectedPeriods()[t].max?jQuery(this).attr("disabled",!0):jQuery(this).attr("disabled",!1))})}catch(e){console.log(e)}});$(".tabSection > ul li:not(.current)").each(function(){n>0?$(this).addClass("disabled"):$(this).hasClass("disabled")&&$(this).removeClass("disabled")});f.amt(n<0?0:n);f.amt.viewValue(n.toString().replace(".",","));n>0&&(t=Math.round((u?n*1e4:n/1e4)*100)/100);f.amt.viewValue2(t.toString().replace(".",","))};f.showError=ko.observable(n);f.errorMessages=ko.computed(function(){try{var n=[];return(f.amt()<=0||isNaN(f.amt()))&&n.push("Не выбрано ни одно издание для подписки."),isBlankOrNotDefined(f.email())&&n.push("Поле 'E-mail' должно содержать значение."),isBlankOrNotDefined(f.phone())&&n.push("Поле 'Номер Вашего телефона' должно содержать значение."),ko.utils.arrayForEach(f.selectedPeriods(),function(t){t.min>0&&t.current>0&&t.min>t.current&&n.push(`${t.edition} - не выбрано достаточное количество подписных периодов (${t.min}).`)}),f.showError()&&n.length>0?n:null}catch(t){return null}},f);f.goStep2=function(){return(f.showError(!0),f.errors().length>0||f.errorMessages()!==null)?!1:!0};$(".cbox").on("click",f.calcAmt);$(".count").on("keyup",f.calcAmt);f.calcAmt();f.errors=ko.validation.group(f)}function subscriptionModel(n,t,i,r,u,f,e,o,s,h){function l(n){var t=$.grep(c.address2.rules(),function(n){return n.rule==="remote"});t[0].message=n}var c=this;c.fio=ko.observable(t).extend({fullName:!0,hasFocus:"Поле 'ФИО' является обязательным к заполнению. Должно содержать Фамилию Имя Отчество, разделенные знаком пробел, например:<br /><strong>Иванов Иван Иванович<\/strong>"});c.phone=ko.observable(i).extend({phone:!0,placeholder:"В формате: +ХХХ(ХХ)ХХХХХХХ",hasFocus:"Поле 'Номер Вашего телефона' является обязательным к заполнению. Должно содержать телефонный номер в международном формате, например:<strong><br />+375291234567<br >+375(29)123-4567<br />80171234567<br /><\/strong>Знак '<strong>+<\/strong>' не является обязательным."});c.email=ko.observable(r).extend({email:{message:"Не верный адрес электронной почты"},hasFocus:"Поле 'Ваш E-mail' не является обязательным к заполнению, но указав его, Вы обеспечите еще один способ связи с Вами в случае возникновения вопросов по оформлению Вашего заказа."});c.address1Msg=ko.observable("");c.address1=ko.observable(u).extend({remote:{params:{url:s,msg:c.address1Msg,data:{type:3,term:""}},message:"Поле должно состоять из трех частей: тип населенного пункта и его название, название района, название области."},hasFocus:"Необходимо указать куда будет осуществляться подписка. Поле должно содержать три блока, разделенные запятыми: населенный пункт (например, <strong>г.<\/strong>) и его название, название района, область. По мере Вашего набора будет отображен выпадающий список с подсказкой. Пример заполнения:<strong><br />г.Минск, Минский р-н, Минская область<br />д.Вильча, Глусский р-н, Могилевская область<\/strong>"});c.dataTypeAddr2=ko.observable(f==="Address"?4:5);c.address2Msg=ko.observable("");c.address2HasFocus=ko.observable("Необходимо указать куда будет осуществляться подписка. Поле должно содержать три блока, разделенные запятыми: тип улицы и ее название, тип строения и его номер (через '<strong>/<\/strong>' указывается корпус), тип помещения и его номер. Например:<strong><br>пр.Независимости, д.1, кв.3<br />ул.Ф.Скорины, д.2/4, кв.12<br />ул.Цветочная, д.7<\/strong>");c.address2=ko.observable(e).extend({remote:{params:{url:s,msg:c.address2Msg,data:{type:c.dataTypeAddr2,term:""}},message:"Поле может содержать до трех частей: тип улицы и ее название, тип строения и его номер, тип помещения и его номер (это необязательная часть)."},hasFocus:c.address2HasFocus()});c.postCodeHasFocus=ko.observable("Поле 'Почтовый индекс' является обязательным к заполнению. Для ввода допустимы только цифры.");c.postCode=ko.observable(o).extend({postCode:!0,hasFocus:c.postCodeHasFocus()});c.amt=ko.observable(0);c.amtOld=ko.observable(0);c.amt.viewValue=ko.observable("0");c.amt.viewValue2=ko.observable("0");c.amtOld.viewValue=ko.observable("0");c.amtOld.viewValue2=ko.observable("0");c.deliveryType=ko.observable(f);c.showAddress2=ko.observable(f!=="OnDemand");c.address2Label=ko.observable("Улица, дом, квартира");c.calcAmt=function(){var n=0,i=0,t=0,r=0;$(".edition").each(function(){try{var i=parseInt($(this).find(".count").val());$(this).find(".cbox").each(function(){var r,u;jQuery(this).is(":checked")&&(r=h?parseFloat(jQuery(this).parent().children("input.amt").val().replace(",",".")):parseInt(jQuery(this).parent().children("input.amt").val()),n+=(i<0?0:i)*r,h&&(n=Math.round(n*100)/100),u=h?parseFloat(jQuery(this).parent().children("input.amt-old").val().replace(",",".")):parseInt(jQuery(this).parent().children("input.input.amt-old").val()),t+=(i<0?0:i)*u,h&&(t=Math.round(t*100)/100))})}catch(r){console.log(r)}});$(".tabSection > ul li:not(.current)").each(function(){n>0?$(this).addClass("disabled"):$(this).hasClass("disabled")&&$(this).removeClass("disabled")});c.amt(n<0?0:n);c.amtOld(t<0?0:t);c.amt.viewValue(n.toString().replace(".",","));c.amtOld.viewValue(t.toString().replace(".",","));n>0&&(i=Math.round((h?n*1e4:n/1e4)*100)/100);t>0&&(r=Math.round((h?t*1e4:t/1e4)*100)/100);c.amt.viewValue2(i.toString().replace(".",","));c.amtOld.viewValue2(r.toString().replace(".",","))};c.showError=ko.observable(n);c.errorMessages=ko.computed(function(){try{var n=[];return(c.amt()<=0||isNaN(c.amt()))&&n.push("Не выбрано ни одно издание для подписки."),isBlankOrNotDefined(c.fio())&&n.push("Поле 'ФИО' должно содержать значение."),c.fio.isValid()||n.push("Поле 'ФИО' должно содержать фамилию, имя и отчество"),isBlankOrNotDefined(c.phone())&&n.push("Поле 'Номер Вашего телефона' должно содержать значение."),isBlankOrNotDefined(c.address1())&&n.push("Поле 'Населенный пункт, район, область' должно содержать значение."),isBlankOrNotDefined(c.deliveryType()==="Address"&&c.address2())&&n.push("Поле 'Улица, дом, квартира' должно содержать значение."),isBlankOrNotDefined(c.deliveryType()==="POBox"&&c.address2())&&n.push("Поле 'Номер ящика' должно содержать значение."),isBlankOrNotDefined((c.deliveryType()==="OnDemand"||c.deliveryType()==="POBox"||c.deliveryType()==="Address")&&c.postCode())&&n.push("Поле 'Почтовый индекс' должно содержать значение."),c.showError()&&n.length>0?n:null}catch(t){return null}},c);c.goStep2=function(){return(c.showError(!0),c.errors().length>0||c.errorMessages()!==null)?!1:!0};$(".cbox").on("click",c.calcAmt);$(".count").on("keyup",c.calcAmt);jQuery("#sr_subscrAddress_formAddress1").autocomplete({minLength:1,source:function(n,t){jQuery.ajax({url:s,dataType:"json",type:"POST",data:{term:n.term,type:1},success:function(n){t(jQuery.map(n.items,function(t){return{cityId:t.uidCity,cityType:t.cityType,cityTypeShort:t.cityTypeShort,cityTypeId:t.uidCityType,city:t.city,area:t.area,region:t.region,label:n.label}}))}})},select:function(n,t){cityTypeId=t.item.cityTypeId;cityId=t.item.cityId;var i=t.item.cityTypeShort;return null!==t.item.city&&(i+=t.item.city),null!==t.item.area&&(i+=", "+t.item.area),null!==t.item.region&&(i+=", "+t.item.region),c.address1(i),!1},focus:function(){return!1}}).data("ui-autocomplete")._renderItem=function(n,t){return $("<li><\/li>").data("ui-autocomplete-item",t).append(function(){var i=null,u=null!==t.label?t.label.replace(/\s*,\s*/gi,", "):null,r,n;return"00000000-0000-0000-0000-000000000000"===t.cityId?i="<a><strong>"+t.cityTypeShort+"<\/strong> ("+t.cityType+")<\/a>":(r=t.cityTypeShort+t.city+", "+t.area+", "+t.region,n=r.split(u),i=n[0]===null||n.length<2?"<a>"+r+"<\/a>":"<a><span>"+u+"<\/span><strong>"+n[1]+"<\/strong><\/a>"),i}).appendTo(n)};c.deliveryType.subscribe(function(n){c.address2("");switch(n){case"Address":c.address2Label("Улица, дом, квартира");c.showAddress2(!0);c.dataTypeAddr2(4);l("Поле может содержать до трех частей: тип улицы и ее название, тип строения и его номер, тип помещения и его номер (это необязательная часть).");c.address2HasFocus("Необходимо указать куда будет осуществляться подписка. Поле должно содержать три блока, разделенные запятыми: тип улицы и ее название, тип строения и его номер (через '<strong>/<\/strong>' указывается корпус), тип помещения и его номер. Например:<strong><br>пр.Независимости, д.1, кв.3<br />ул.Ф.Скорины, д.2/4, кв.12<br />ул.Цветочная, д.7<\/strong>");c.postCodeHasFocus("Поле 'Почтовый индекс' является обязательным к заполнению. Для ввода допустимы только цифры.");break;case"POBox":c.address2Label("Номер ящика");c.showAddress2(!0);c.dataTypeAddr2(5);l("Поле должно содержать только цифровое обозначение номера абонентского ящика.");c.address2HasFocus("Необходимо указать номера абонентского ящика куда будет осуществляться подписка.");c.postCodeHasFocus("Поле 'Почтовый индекс' является обязательным к заполнению. Для ввода допустимы только цифры.");break;case"OnDemand":c.showAddress2(!1);l("");c.postCodeHasFocus("Поле 'Почтовый индекс' является обязательным к заполнению. Для ввода допустимы только цифры.");break;default:l("");c.showAddress2(!1)}});jQuery("#sr_subscrAddress_formAddress2").autocomplete({minLength:1,source:function(n,t){jQuery.ajax({url:s,dataType:"json",type:"POST",data:{term:n.term,type:c.dataTypeAddr2()===4?2:6},success:function(n){if(n.items!==undefined)t(jQuery.map(n.items,function(t){return{streetType:t.streetType,streetTypeShortName:t.streetTypeShortName,streetTypeName:t.streetTypeName,street:t.street,buildingType:t.buildingType,buildingTypeShortName:t.buildingTypeShortName,buildingTypeName:t.buildingTypeName,building:t.building,subBuilding:t.subBuilding,apartmentType:t.apartmentType,apartmentTypeShortName:t.apartmentTypeShortName,apartmentTypeName:t.apartmentTypeName,apartment:t.apartment,label:n.label}}));else return n}})},select:function(n,t){var i=null;return null!==t.item.streetType&&(i=t.item.streetTypeShortName),null!==t.item.street&&(i+=" "+t.item.street),null!==t.item.buildingType&&(i+=", "+t.item.buildingTypeShortName),null!==t.item.building&&(i+=" "+t.item.building),null!==t.item.subBuilding&&(i+="/"+t.item.subBuilding),null!==t.item.apartmentType&&(i+=", "+t.item.apartmentTypeShortName),null!==t.item.apartment&&(i+=" "+t.item.apartment),this.value=i.replace(/ +/g," ").replace(/\. +/g,"."),!1},focus:function(){return!1}}).data("ui-autocomplete")._renderItem=function(n,t){return $("<li><\/li>").data("ui-autocomplete-item",t).append(function(){var n=null,i=t.label.split(",");return null!==t.streetType&&null===t.buildingType&&null===t.apartmentType&&i.length<=1?n="<a><strong>"+t.streetTypeShortName+"<\/strong> ("+t.streetTypeName+")<\/a>":null!==t.streetType&&null!==t.buildingType&&null===t.apartmentType&&i.length===2?n="<a><span>"+t.streetTypeShortName+t.street+",<\/span> <strong>"+t.buildingTypeShortName+" ("+t.buildingTypeName+") <\/strong><\/a>":null!==t.streetType&&null!==t.buildingType&&null!==t.apartmentType&&i.length===3&&(n="<a><span>"+t.streetTypeShortName+t.street+", "+t.buildingTypeShortName+t.building+(null!==t.subBuilding?"/"+t.subBuilding:"")+",<\/span> <strong>"+t.apartmentTypeShortName+" ("+t.apartmentTypeName+") <\/strong><\/a>"),n}).appendTo(n)};c.calcAmt();c.errors=ko.validation.group(c)}function confirmModel(n){var t=this;t.isAgree=ko.observable(!1);t.showError=ko.computed(function(){return n&&!t.isAgree()},t);t.goStep3=function(){return t.isAgree()?!0:!1}}function editionsModel(){var n=this;n.isSelected=ko.observable($(".userAction").is(":checked"));n.showError=ko.observable(!1);n.goStep1=function(){return n.isSelected()?!0:(n.showError(!0),!1)};$(".userAction").click(function(){n.isSelected($(".userAction").is(":checked"))})}function alfaclickModel(n,t,i){var r=this;r.phone=ko.observable().extend({phone:!0,placeholder:"В формате: +ХХХ(ХХ)ХХХХХХХ",hasFocus:"Поле 'Номер телефона' является обязательным к заполнению. Должно содержать телефонный номер в международном формате, например:<strong><br />+375291234567<br >+375(29)123-4567<br /><\/strong>Знак '<strong>+<\/strong>' не является обязательным."});r.isFormVisible=ko.observable(!0);r.isShowLoading=ko.observable(!1);r.isShowResult=ko.observable(!1);r.message=ko.observable("");r.publisherMode=t;r.uuid=n;r.postBill=function(){!isBlankOrNotDefined(r.phone())&&r.isValid()&&(r.isFormVisible(!1),r.isShowLoading(!0),jQuery.ajax({url:i,dataType:"json",type:"POST",data:{uuid:r.uuid,phone:r.phone().replace(/[^0-9]/,""),mode:r.publisherMode},success:function(n){r.isShowLoading(!1);n?r.message("Успешное завершение. Перейдите в Альфа-Клик или Альфа-Мобайл для совершения оплаты."):r.message("Счет не выставлен в систему Альфа-Клик.")},error:function(){r.message("Произошла непредвиденная ошибка.")},complete:function(){r.isShowResult(!0)}}))};ko.validation.group(r)}var isIE;if(function(n){function o(i,r,f,o){var s={data:o||(r?r.data:{}),_wrap:r?r._wrap:null,tmpl:null,parent:r||null,nodes:[],calls:d,nest:g,wrap:nt,html:tt,update:it};return i&&n.extend(s,i,{nodes:[],parent:r}),f&&(s.tmpl=f,s._ctnt=s._ctnt||s.tmpl(n,s),s.key=++e,(h.length?u:t)[e]=s),s}function s(t,i,u){var f,e=u?n.map(u,function(n){return typeof n=="string"?t.key?n.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+r+'="'+t.key+'" $2'):n:s(n,t,n._ctnt)}):t;return i?e:(e=e.join(""),e.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(t,i,r,u){f=n(r).get();b(f);i&&(f=c(i).concat(f));u&&(f=f.concat(c(u)))}),f?f:c(e))}function c(t){var i=document.createElement("div");return i.innerHTML=t,n.makeArray(i.childNodes)}function p(t){return new Function("jQuery","$item","var $=jQuery,call,_=[],$data=$item.data;with($data){_.push('"+n.trim(t).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(t,i,r,u,f,e,o){var h=n.tmpl.tag[r],c,s,a;if(!h)throw"Template command not found: "+r;return c=h._default||[],e&&!/\w$/.test(f)&&(f+=e,e=""),f?(f=l(f),o=o?","+l(o)+")":e?")":"",s=e?f.indexOf(".")>-1?f+e:"("+f+").call($item"+o:f,a=e?s:"(typeof("+f+")==='function'?("+f+").call($item):("+f+"))"):a=s=c.$1||"null",u=l(u),"');"+h[i?"close":"open"].split("$notnull_1").join(f?"typeof("+f+")!=='undefined' && ("+f+")!=null":"true").split("$1a").join(a).split("$1").join(s).split("$2").join(u?u.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g,function(n,t,i,r){return r=r?","+r+")":i?")":"",r?"("+t+").call($item"+r:n}):c.$2||"")+"_.push('"})+"');}return _;")}function w(t,i){t._wrap=s(t,!0,n.isArray(i)?i:[v.test(i)?i:n(i).html()]).join("")}function l(n){return n?n.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function k(n){var t=document.createElement("div");return t.appendChild(n.cloneNode(!0)),t.innerHTML}function b(f){function p(f){function p(n){n=n+a;s=v[n]=v[n]||o(s,t[s.parent.key+a]||s.parent,null,!0)}var y,h=f,c,s,l;if(l=f.getAttribute(r)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(y=h.getAttribute(r)));y!==l&&(h=h.parentNode?h.nodeType===11?0:h.getAttribute(r)||0:0,(s=t[l])||(s=u[l],s=o(s,t[h]||u[h],null,!0),s.key=++e,t[e]=s),i&&p(l));f.removeAttribute(r)}else i&&(s=n.data(f,"tmplItem"))&&(p(s.key),t[s.key]=s,h=n.data(f.parentNode,"tmplItem"),h=h?h.key:0);if(s){for(c=s;c&&c.key!=h;)c.nodes.push(f),c=c.parent;delete s._ctnt;delete s._wrap;n.data(f,"tmplItem",s)}}for(var a="_"+i,c,l,v={},h,s=0,y=f.length;s<y;s++)if((c=f[s]).nodeType===1){for(l=c.getElementsByTagName("*"),h=l.length-1;h>=0;h--)p(l[h]);p(c)}}function d(n,t,i,r){if(!n)return h.pop();h.push({_:n,tmpl:t,item:this,data:i,options:r})}function g(t,i,r){return n.tmpl(n.template(t),i,r,this)}function nt(t,i){var r=t.options||{};return r.wrapped=i,n.tmpl(n.template(t.tmpl),t.data,r,t.item)}function tt(t,i){var r=this._wrap;return n.map(n(n.isArray(r)?r.join(""):r).filter(t||"*"),function(n){return i?n.innerText||n.textContent:n.outerHTML||k(n)})}function it(){var t=this.nodes;n.tmpl(null,null,null,this).insertBefore(t[0]);n(t).remove()}var a=n.fn.domManip,r="_tmplitem",v=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,t={},u={},f,y={key:0,data:{}},e=0,i=0,h=[];n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(r,u){n.fn[r]=function(e){var o=[],h=n(e),c,s,a,v,l=this.length===1&&this[0].parentNode;if(f=t||{},l&&l.nodeType===11&&l.childNodes.length===1&&h.length===1)h[u](this[0]),o=this;else{for(s=0,a=h.length;s<a;s++)i=s,c=(s>0?this.clone(!0):this).get(),n.fn[u].apply(n(h[s]),c),o=o.concat(c);i=0;o=this.pushStack(o,r,h.selector)}return v=f,f=null,n.tmpl.complete(v),o}});n.fn.extend({tmpl:function(t,i,r){return n.tmpl(this[0],t,i,r)},tmplItem:function(){return n.tmplItem(this[0])},template:function(t){return n.template(t,this[0])},domManip:function(r,u,e){if(r[0]&&r[0].nodeType){for(var o=n.makeArray(arguments),s=r.length,h=0,c;h<s&&!(c=n.data(r[h++],"tmplItem")););s>1&&(o[0]=[n.makeArray(r)]);c&&i&&(o[2]=function(t){n.tmpl.afterManip(this,t,e)});a.apply(this,o)}else a.apply(this,arguments);return i=0,f||n.tmpl.complete(t),this}});n.extend({tmpl:function(i,r,f,e){var h,c=!e;if(c)e=y,i=n.template[i]||n.template(null,i),u={};else if(!i)return i=e.tmpl,t[e.key]=e,e.nodes=[],e.wrapped&&w(e,e.wrapped),n(s(e,null,e.tmpl(n,e)));return i?(typeof r=="function"&&(r=r.call(e||{})),f&&f.wrapped&&w(f,f.wrapped),h=n.isArray(r)?n.map(r,function(n){return n?o(f,e,i,n):null}):[o(f,e,i,r)],c?n(s(e,null,h)):h):[]},tmplItem:function(t){var i;for(t instanceof n&&(t=t[0]);t&&t.nodeType===1&&!(i=n.data(t,"tmplItem"))&&(t=t.parentNode););return i||y},template:function(t,i){return i?(typeof i=="string"?i=p(i):i instanceof n&&(i=i[0]||{}),i.nodeType&&(i=n.data(i,"tmpl")||n.data(i,"tmpl",p(i.innerHTML))),typeof t=="string"?n.template[t]=i:i):t?typeof t!="string"?n.template(null,t):n.template[t]||n.template(null,v.test(t)?t:n(t)):null},encode:function(n){return(""+n).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});n.extend(n.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){_=_.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(_,$1,$2);_=[];",close:"call=$item.calls();_=call._.concat($item.wrap(call,_));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){_.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){_.push($.encode($1a));}"},"!":{open:""}},complete:function(){t={}},afterManip:function(t,r,u){var f=r.nodeType===11?n.makeArray(r.childNodes):r.nodeType===1?[r]:[];u.call(t,r);b(f);i++}})}(jQuery),window.log=function(){if(log.history=log.history||[],log.history.push(arguments),this.console){var n=arguments,t;n.callee=n.callee.caller;t=[].slice.call(n);typeof console.log=="object"?log.apply.call(console.log,console,t):console.log.apply(console,t)}},function(n){function i(){}for(var r="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),t;!!(t=r.pop());)n[t]=n[t]||i}(function(){try{return console.log(),window.console}catch(n){return window.console={}}}()),jQuery.validator.methods.number=function(n){return n==""||n==undefined||!0},jQuery.fn.outerHTML=function(n){return n?this.before(n).remove():jQuery("<div>").append(this.eq(0).clone()).html()},Date.prototype.addHours=function(n){return this.setHours(this.getHours()+n),this},String.prototype.toDate=function(){return new Date(Date.parse(this))},String.prototype.capitalizeFirstWord=function(){return this.charAt(0).toUpperCase()+this.slice(1)},String.prototype.toJSCulture=function(){var n=this.split(/[_-]/);return n.length>=2?n[0]+"-"+n[1].toUpperCase()+(n.length>=3?"-"+n[2].toUpperCase():""):this},String.prototype.toNETCulture=function(){var n=this.split(/[_-]/);return n.length>=2?n[0]+"_"+n[1].toUpperCase()+(n.length>=3?"_"+n[2].toUpperCase():""):this},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}),String.prototype.ltrim=function(){return this.replace(/^\s+/,"")},String.prototype.rtrim=function(){return this.replace(/\s+$/,"")},String.prototype.fulltrim=function(){return this.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,"").replace(/\s+/g," ")},isIE=document.all?!0:!1,Number.prototype.decOfNum=function(n){var t=this%100>4&&this%100<20?2:[2,0,1,1,1,2][Math.min(this%10,5)];return n[t]},String.prototype.decOfNum=function(n){var t=this,i,r;return(t=parseInt(t,10),isNaN(t))?"":(i=[2,0,1,1,1,2],r=t%100>4&&t%100<20?2:i[Math.min(t%10,5)],n[r])},function(n){n.fn.extend({onShow:function(t,i){return this.each(function(){var u=this,f=i==undefined?!0:i,r;n.isFunction(t)&&(n(this).is(":hidden")?(r=function(){n(u).is(":visible")&&(t.call(),f&&n("body").unbind("click keyup keydown",r))},n("body").bind("click keyup keydown",r)):t.call())})}})}(jQuery),!jQuery.support.cors&&window.XDomainRequest){var httpRegEx=/^https?:\/\//i,getOrPostRegEx=/^get|post$/i,sameSchemeRegEx=new RegExp("^"+location.protocol,"i"),jsonRegEx=/\/json/i,xmlRegEx=/\/xml/i;jQuery.ajaxTransport("text html xml json",function(n,t){if(n.crossDomain&&n.async&&getOrPostRegEx.test(n.type)&&httpRegEx.test(t.url)&&sameSchemeRegEx.test(t.url)){var i=null,r=(t.dataType||"").toLowerCase();return{send:function(u,f){i=new XDomainRequest;/^\d+$/.test(t.timeout)&&(i.timeout=t.timeout);i.ontimeout=function(){f(500,"timeout")};i.onload=function(){var e="Content-Length: "+i.responseText.length+"\r\nContent-Type: "+i.contentType,t={code:200,message:"success"},u={text:i.responseText},n;try{if(r==="json"||r!=="text"&&jsonRegEx.test(i.contentType))try{u.json=$.parseJSON(i.responseText)}catch(s){t.code=500;t.message="parseerror"}else if(r==="xml"||r!=="text"&&xmlRegEx.test(i.contentType)){n=new ActiveXObject("Microsoft.XMLDOM");n.async=!1;try{n.loadXML(i.responseText)}catch(s){n=undefined}if(!n||!n.documentElement||n.getElementsByTagName("parsererror").length){t.code=500;t.message="parseerror";throw"Invalid XML: "+i.responseText;}u.xml=n}}catch(o){throw o;}finally{f(t.code,t.message,u,e)}};i.onerror=function(){f(500,"error",{text:i.responseText})};var e=t.data&&$.param(t.data)||"";i.open(n.type,n.url);i.send(e)},abort:function(){i&&i.abort()}}}})}