From 0b86d74554c5ea8e2a4e86d929d08c535edd02a8 Mon Sep 17 00:00:00 2001 From: Claudio Gamboa Date: Fri, 12 Jul 2013 16:46:55 +0100 Subject: [PATCH] Added JS bundles to release 2.1.1 --- VERSION | 2 +- js/ink-all.js | 14 ++++++++------ js/ink-all.min.js | 2 +- js/ink-ui.js | 14 ++++++++------ js/ink-ui.min.js | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/VERSION b/VERSION index 7ec1d6db4..3e3c2f1e5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.0 +2.1.1 diff --git a/js/ink-all.js b/js/ink-all.js index c99b0bea9..d9a698618 100644 --- a/js/ink-all.js +++ b/js/ink-all.js @@ -14962,8 +14962,8 @@ Ink.createModule('Ink.UI.FormValidator', '1', ['Ink.Dom.Css_1','Ink.Util.Validat this.elements[this.element.id] = []; this.confirmElms[this.element.id] = []; - console.log(this.element); - console.log(this.element.elements); + //console.log(this.element); + //console.log(this.element.elements); var formElms = this.element.elements; var curElm = false; for(var i=0, totalElm = formElms.length; i < totalElm; i++) { @@ -15001,7 +15001,7 @@ Ink.createModule('Ink.UI.FormValidator', '1', ['Ink.Dom.Css_1','Ink.Util.Validat } } - debugger; + //debugger; }, /** @@ -15303,7 +15303,7 @@ Ink.createModule('Ink.UI.FormValidator', '1', ['Ink.Dom.Css_1','Ink.Util.Validat if( !(validFormat in InkValidator._dateParsers ) ){ var validValues = []; - for( val in InkValidator._dateParsers ){ + for( var val in InkValidator._dateParsers ){ validValues.push(val); } throw "The attribute data-valid-format must be one of the following values: " + validValues.join(','); @@ -15342,8 +15342,10 @@ Ink.createModule('Ink.UI.FormValidator', '1', ['Ink.Dom.Css_1','Ink.Util.Validat var newLabel = document.createElement('p'); //newLabel.setAttribute('for',curElm.id); - newLabel.className = this._errorClassName; - newLabel.className += ' ' . this._errorTypeErrorClassName; + //newLabel.className = this._errorClassName; + //newLabel.className += ' ' + this._errorTypeErrorClassName; + Css.addClassName(newLabel, this._errorClassName); + Css.addClassName(newLabel, this._errorTypeErrorClassName); if(aFail[i].errors[0] !== 'ink-fv-custom') { newLabel.innerHTML = this._flagMap[aFail[i].errors[0]].msg; } else { diff --git a/js/ink-all.min.js b/js/ink-all.min.js index eb098b980..4fde5b094 100644 --- a/js/ink-all.min.js +++ b/js/ink-all.min.js @@ -28,7 +28,7 @@ Ink.createModule("Ink.UI.Tabs","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Cs Ink.createModule("Ink.UI.ImageQuery","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,i,o,r){"use strict";var s=function(t,n){if(!e.isDOMElement(t)&&"string"!=typeof t)throw"[ImageQuery] :: Invalid selector";if("string"==typeof t){if(this._element=o.select(t),1>this._element.length)throw"[ImageQuery] :: Selector has returned no elements";if(this._element.length>1){var r;for(r=1;this._element.length>r;r+=1)new Ink.UI.ImageQuery(this._element[r],n)}this._element=this._element[0]}else this._element=t;this._options=Ink.extendObj({queries:[],onLoad:null},i.data(this._element)),this._options=Ink.extendObj(this._options,n||{});var s;if(-1!==(s=this._element.src.lastIndexOf("?"))){var a=this._element.src.substr(s);this._filename=this._element.src.replace(a,"").split("/").pop()+a}else this._filename=this._element.src.split("/").pop();this._init()};return s.prototype={_init:function(){this._options.queries=r.sortMulti(this._options.queries,"width").reverse(),this._handlers={resize:Ink.bindEvent(this._onResize,this),load:Ink.bindEvent(this._onLoad,this)},"function"==typeof this._options.onLoad&&t.observe(this._element,"onload",this._handlers.load),t.observe(window,"resize",this._handlers.resize),this._handlers.resize.call(this)},_onResize:function(){clearTimeout(e);var e=setTimeout(Ink.bind(function(){if(!this._options.queries||this._options.queries==={})return clearTimeout(e),void 0;var t,n,i;for("number"==typeof window.innerWidth?i=window.innerWidth:document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)?i=document.documentElement.clientWidth:document.body&&(document.body.clientWidth||document.body.clientHeight)&&(i=document.body.clientWidth),t=0;this._options.queries.length>t;t+=1)if(i>=this._options.queries[t].width){n=t;break}n===void 0&&(n=this._options.queries.length-1);var o=this._options.queries[n].src||this._options.src;if("devicePixelRatio"in window&&window.devicePixelRatio>1&&"retina"in this._options&&(o=this._options.queries[n].retina||this._options.retina),this._options.queries[n].file=this._filename,"function"==typeof o&&(o=o.apply(this,[this._element,this._options.queries[n]]),"string"!=typeof o))throw'[ImageQuery] :: "src" callback does not return a string';var r;for(r in this._options.queries[n])"src"!==r&&"retina"!==r&&(o=o.replace("{:"+r+"}",this._options.queries[n][r]));this._element.src=o,delete this._options.queries[n].file,e=void 0},this),300)},_onLoad:function(){this._options.onLoad.call(this)}},s}); Ink.createModule("Ink.UI.TreeView","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,i,o,r){"use strict";var s=function(t,n){if(!e.isDOMElement(t)&&"string"!=typeof t)throw"[Ink.UI.TreeView] :: Invalid selector";if("string"==typeof t){if(this._element=o.select(t),1>this._element.length)throw"[Ink.UI.TreeView] :: Selector has returned no elements";this._element=this._element[0]}else this._element=t;this._options=Ink.extendObj({node:"li",child:"ul"},i.data(this._element)),this._options=Ink.extendObj(this._options,n||{}),this._init()};return s.prototype={_init:function(){this._handlers={click:Ink.bindEvent(this._onClick,this)},t.observe(this._element,"click",this._handlers.click);var e,i=o.select(this._options.node,this._element);r.each(i,Ink.bind(function(t){n.hasClassName(t,"open")||(n.hasClassName(t,"closed")||n.addClassName(t,"closed"),e=o.select(this._options.child,t),r.each(e,Ink.bind(function(e){n.hasClassName(e,"hide-all")||n.addClassName(e,"hide-all")},this)))},this))},_onClick:function(e){var i=t.element(e);if("."===this._options.node[0]){if(!n.hasClassName(i,this._options.node.substr(1)))for(;!n.hasClassName(i,this._options.node.substr(1))&&"body"!==i.nodeName.toLowerCase();)i=i.parentNode}else if("#"===this._options.node[0]){if(i.id!==this._options.node.substr(1))for(;i.id!==this._options.node.substr(1)&&"body"!==i.nodeName.toLowerCase();)i=i.parentNode}else if(i.nodeName.toLowerCase()!==this._options.node)for(;i.nodeName.toLowerCase()!==this._options.node&&"body"!==i.nodeName.toLowerCase();)i=i.parentNode;if("body"!==i.nodeName.toLowerCase()){var r=o.select(this._options.child,i);r.length>0&&(t.stop(e),r=r[0],n.hasClassName(r,"hide-all")?(n.removeClassName(r,"hide-all"),n.addClassName(i,"open"),n.removeClassName(i,"closed")):(n.addClassName(r,"hide-all"),n.removeClassName(i,"open"),n.addClassName(i,"closed")))}}},s}); Ink.createModule("Ink.UI.Gallery","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1","Ink.Util.Swipe_1"],function(e,t,n,i,o,s,r){"use strict";var a=function(e,t,n){var i=t[0],o=t[1];if(n||i>e[0]||o>e[1]){var s=i/o,r=e[0]/e[1],a=s>r?e[0]/i:e[1]/o;return[parseInt(i*a+.5,10),parseInt(o*a+.5,10)]}return t},l=function(e,t){t=Ink.bind(t,e);var n=[e.img.offsetWidth,e.img.offsetHeight];n[0]&&n[1]&&t(n),e.img.onload=Ink.bindEvent(function(){t([this.img.offsetWidth,this.img.offsetHeight])},e)},h=function(t,n){if(this._element=e.elOrSelector(t,"1st argument"),this._options=Ink.extendObj({fullImageMaxWidth:600,fullImageMaxHeight:400,thumbnailMaxWidth:106,layout:0,circular:!1,fixImageSizes:!1},i.data(this._element)),this._options=Ink.extendObj(this._options,n||{}),this._handlers={navClick:Ink.bindEvent(this._onNavClick,this),paginationClick:Ink.bindEvent(this._onPaginationClick,this),thumbsClick:Ink.bindEvent(this._onThumbsClick,this),focusBlur:Ink.bindEvent(this._onFocusBlur,this),keyDown:Ink.bindEvent(this._onKeyDown,this)},this._isFocused=!1,this._model=[],this._options.model instanceof Array)this._model=this._options.model,this._createdFrom="JSON";else{if("ul"!==this._element.nodeName.toLowerCase())throw new TypeError("You must pass a selector expression/DOM element as 1st option or provide a model on 2nd argument!");this._createdFrom="DOM"}if(this._index=0,this._thumbIndex=0,!isNaN(this._options.layout))if(this._options.layout=parseInt(this._options.layout,10),0===this._options.layout)this._showThumbs=!1,this._showDescription=!1,this._paginationHasPrevNext=!1;else{if(1!==this._options.layout&&2!==this._options.layout&&3!==this._options.layout)throw new TypeError("supported layouts are 0-3!");this._showThumbs=!0,this._showDescription=!0,this._paginationHasPrevNext=!0}null!==this._element.getAttribute("data-fix-image-sizes")&&(this._options.fixImageSizes=!0),this._init()};return h.prototype={_init:function(){"DOM"===this._createdFrom&&this._extractModelFromDOM();var n=this._generateMarkup(),i=this._element.parentNode;this._notFirstInit||(e.storeIdAndClasses(this._element,this),this._notFirstInit=!0),i.insertBefore(n,this._element),i.removeChild(this._element),this._element=n,e.restoreIdAndClasses(this._element,this),t.observe(this._paginationEl,"click",this._handlers.paginationClick),t.observe(this._navEl,"click",this._handlers.navClick),this._showThumbs&&t.observe(this._thumbsUlEl,"click",this._handlers.thumbsClick),t.observe(this._element,"mouseover",this._handlers.focusBlur),t.observe(this._element,"mouseout",this._handlers.focusBlur),t.observe(document,"keydown",this._handlers.keyDown),e.registerInstance(this,this._element,"gallery")},_extractModelFromDOM:function(){var e,t=[],n=o.select("> li",this._element);s.each(n,function(n){try{var i={image_full:"",image_thumb:"",title_text:"",title_link:"",description:"",content_overlay:document.createDocumentFragment()},s=o.select("> a[rel=enclosure]",n)[0],r=o.select("> img",s)[0],a=o.select("> a[class=bookmark]",n)[0],l=o.select("span[class=entry-title]",n)[0],h=o.select("> span[class=entry-content]",n)[0],d=o.select("> .content-overlay",n)[0];e=s.getAttribute("data-dims"),null!==e&&(e=e.split(","),e[0]=parseInt(e[0],10),e[1]=parseInt(e[1],10)),!e||isNaN(e[0])||isNaN(e[1])||(i.dims=e),i.image_full=s.getAttribute("href"),i.image_thumb=r.getAttribute("src"),a&&(i.title_link=a.getAttribute("href")),i.title_text=l.innerHTML,h&&(i.description=h.innerHTML),d&&i.content_overlay.appendChild(d),t.push(i)}catch(c){throw console.error("problematic element:"),console.error(n),console.error(c),Error("Problem parsing gallery data from DOM!")}}),this._model=t},_generateMarkup:function(){var e=document.createElement("div");e.className="ink-gallery";var t=document.createElement("div");t.className="stage";var i=document.createElement("nav");i.innerHTML=['"].join(""),this._navEl=i;var o=document.createElement("div");o.className="slider";var h=document.createElement("ul");this._sliderUlEl=h;var d=this,c=this._options.fullImageMaxWidth,u=this._options.fullImageMaxHeight;s.each(this._model,function(e,t){var n=document.createElement("li"),i=document.createElement("img");if(i.setAttribute("name","image "+(t+1)),i.setAttribute("src",e.image_full),i.setAttribute("alt",e.title_text),n.appendChild(i),e.content_overlay)if(1===e.content_overlay.nodeType||11===e.content_overlay.nodeType)e.content_overlay=n.appendChild(e.content_overlay);else if("string"==typeof e.content_overlay){var o=document.createElement("div");o.className="content-overlay",o.innerHTML=e.content_overlay,e.content_overlay=n.appendChild(o)}if(h.appendChild(n),d._options.fixImageSizes){var s=function(e){var t=this.img,n=this.data;n.dims||(n.dims=e);var i=a([c,u],e),o=i[0],s=i[1],r=Math.floor((c-o)/2),l=Math.floor((u-s)/2);if(o!==c||s!==u){t.setAttribute("width",o),t.setAttribute("height",s);var h=t.style;r>0&&(h.paddingLeft=r+"px"),l>0&&(h.paddingBottom=l+"px")}};e.dims?s.call({img:i,data:e},e.dims):l({img:i,data:e},s)}}),o.appendChild(h),this._sliderEl=o;var m;if(this._showDescription){var p=this._model[this._index];m=document.createElement("div"),m.className=["article_text","example"+(3===this._options.layout?2:this._options.layout)].join(" "),m.innerHTML=p.title_link?['

',p.title_text,"

",p.description].join(""):["

",p.title_text,"

",p.description].join(""),this._articleTextDivEl=m}var f;this._showThumbs&&(f=document.createElement("div"),f.className="thumbs",h=document.createElement("ul"),h.className="unstyled",s.each(this._model,function(e,t){var n=document.createElement("li"),i=document.createElement("a");i.setAttribute("href","#");var o=document.createElement("img");o.setAttribute("name","thumb "+(t+1)),o.setAttribute("src",e.image_thumb),o.setAttribute("alt",t+1);var s=document.createElement("span");s.innerHTML=e.title_text,i.appendChild(o),i.appendChild(s),n.appendChild(i),h.appendChild(n)}),f.appendChild(h),this._thumbsDivEl=f,this._thumbsUlEl=h);var g=document.createElement("div");g.className="pagination";var _;return this._paginationHasPrevNext&&(_=document.createElement("a"),_.setAttribute("href","#"),_.className="previous",g.appendChild(_)),s.each(this._model,function(e,t){var n=document.createElement("a");n.setAttribute("href","#"),n.setAttribute("data-index",t),t===d._index&&(n.className="active"),g.appendChild(n)}),this._paginationHasPrevNext&&(_=document.createElement("a"),_.setAttribute("href","#"),_.className="next",g.appendChild(_)),this._paginationEl=g,0===this._options.layout?(t.appendChild(i),t.appendChild(o),t.appendChild(g),e.appendChild(t)):(1===this._options.layout||2===this._options.layout||3===this._options.layout)&&(t.appendChild(i),t.appendChild(o),t.appendChild(m),e.appendChild(t),3===this._options.layout?(this._thumbsUlEl.className="thumbs unstyled",n.addClassName(e,"rightNav"),e.appendChild(this._thumbsUlEl)):(f.appendChild(g),e.appendChild(f))),this._swipeDir="x",this._swipeThumbsDir=0===this._options.layout?"":3===this._options.layout?"y":"x",r._supported&&new r(e,{callback:Ink.bind(function(t,n){var i=this._isMeOrParent(n.target,this._thumbsUlEl),o=i?!1:this._isMeOrParent(n.target,e);!i&&!o||i&&!this._swipeThumbsDir||o&&n.axis!==this._swipeDir||i&&n.axis!==this._swipeThumbsDir||(0>n.dr[0]?i?this.thumbNext():this.next():i?this.thumbPrevious():this.previous())},this),maxDuration:.4,minDist:50}),e},_isMeOrParent:function(e,t){if(e){do{if(e===t)return!0;e=e.parentNode}while(e);return!1}},_onNavClick:function(e){var i,o=t.element(e);if(n.hasClassName(o,"previous"))i=-1;else{if(!n.hasClassName(o,"next"))return;i=1}t.stop(e),this.goTo(i,!0)},_onPaginationClick:function(e){var i=t.element(e),o=i.getAttribute("data-index"),s=!1;if(n.hasClassName(i,"previous"))o=-1,s=!0;else if(n.hasClassName(i,"next"))o=1,s=!0;else{if(null===o)return;o=parseInt(o,10)}t.stop(e),s?this.thumbGoTo(o,!0):this.goTo(o)},_onThumbsClick:function(e){var n=t.element(e);if("img"===n.nodeName.toLowerCase());else{if("span"!==n.nodeName.toLowerCase())return;n=o.select("> img",n.parentNode)[0]}t.stop(e);var i=parseInt(n.getAttribute("alt"),10)-1;this.goTo(i)},_onFocusBlur:function(e){this._isFocused="mouseover"===e.type},_onKeyDown:function(e){if(this._isFocused){var n=e.keyCode;if(37===n)this.previous();else{if(39!==n)return;this.next()}t.stop(e)}},_validateValue:function(t,n,i){if(!e.isInteger(t))throw new TypeError("1st parameter must be an integer number!");if(void 0!==n&&n!==!1&&n!==!0)throw new TypeError("2nd parameter must either be boolean or ommitted!");var o=i?this._thumbIndex:this._index;if(n&&(t+=o),this._options.circular)0>t?t=this._model.length-1:t>=this._model.length&&(t=0);else if(0>t||t>=this._model.length||t===o)return!1;return t},getIndex:function(){return this._index},getLength:function(){return this._model.length},goTo:function(e,t){if(e=this._validateValue(e,t,!1),e!==!1){this._index=e;var i=o.select("> a",this._paginationEl),r=this;if(s.each(i,function(e,t){n.setClassName(e,"active",t-(r._paginationHasPrevNext?1:0)===r._index)}),this._sliderUlEl.style.marginLeft=["-",this._options.fullImageMaxWidth*this._index,"px"].join(""),this._showDescription){var a=this._model[this._index];this._articleTextDivEl.innerHTML=a.title_link?['

',a.title_text,"

",a.description].join(""):["

",a.title_text,"

",a.description].join("")}}},thumbGoTo:function(e,t){if(e=this._validateValue(e,t,!0),e!==!1){this._thumbIndex=e;var n="margin"+("x"===this._swipeThumbsDir?"Left":"Top");this._thumbsUlEl.style[n]=["-",this._options.thumbnailMaxWidth*this._thumbIndex,"px"].join("")}},previous:function(){this.goTo(-1,!0)},next:function(){this.goTo(1,!0)},thumbPrevious:function(){this.thumbGoTo(-1,!0)},thumbNext:function(){this.thumbGoTo(1,!0)},destroy:e.destroyComponent},h}); -Ink.createModule("Ink.UI.FormValidator","1",["Ink.Dom.Css_1","Ink.Util.Validator_1"],function(e,t){"use strict";var n={version:"1",_flagMap:{"ink-fv-required":{msg:"Required field"},"ink-fv-email":{msg:"Invalid e-mail address"},"ink-fv-url":{msg:"Invalid URL"},"ink-fv-number":{msg:"Invalid number"},"ink-fv-phone_pt":{msg:"Invalid phone number"},"ink-fv-phone_cv":{msg:"Invalid phone number"},"ink-fv-phone_mz":{msg:"Invalid phone number"},"ink-fv-phone_ao":{msg:"Invalid phone number"},"ink-fv-date":{msg:"Invalid date"},"ink-fv-confirm":{msg:"Confirmation does not match"},"ink-fv-custom":{msg:""}},elements:{},confirmElms:{},hasConfirm:{},_errorClassName:"tip",_errorValidationClassName:"validaton",_errorTypeWarningClassName:"warning",_errorTypeErrorClassName:"error",validate:function(e,t){if(this._free(),t=Ink.extendObj({onSuccess:!1,onError:!1,customFlag:!1,confirmGroup:[]},t||{}),"string"==typeof e&&(e=document.getElementById(e)),null===e)return!1;this.element=e,(this.element.id===void 0||null===this.element.id||""===this.element.id)&&(this.element.id="ink-fv_randomid_"+Math.round(99999*Math.random())),this.custom=t.customFlag,this.confirmGroup=t.confirmGroup;var n=this._validateElements();return n.length>0?(t.onError?t.onError(n):this._showError(e,n),!1):(t.onError||this._clearError(e),this._clearCache(),t.onSuccess&&t.onSuccess(),!0)},reset:function(){this._clearError(),this._clearCache()},_free:function(){this.element=null,this.custom=!1,this.confirmGroup=!1},_clearCache:function(){this.element=null,this.elements=[],this.custom=!1,this.confirmGroup=!1},_getElements:function(){this.elements[this.element.id]=[],this.confirmElms[this.element.id]=[],console.log(this.element),console.log(this.element.elements);for(var t=this.element.elements,n=!1,i=0,o=t.length;o>i;i++)if(n=t[i],null!==n.getAttribute("type")&&"radio"===n.getAttribute("type").toLowerCase()){if(0===this.elements[this.element.id].length||n.getAttribute("type")!==this.elements[this.element.id][this.elements[this.element.id].length-1].getAttribute("type")&&n.getAttribute("name")!==this.elements[this.element.id][this.elements[this.element.id].length-1].getAttribute("name"))for(var r in this._flagMap)if(e.hasClassName(n,r)){this.elements[this.element.id].push(n);break}}else{for(var s in this._flagMap)if(e.hasClassName(n,s)&&"ink-fv-confirm"!==s){this.elements[this.element.id].push(n);break}e.hasClassName(n,"ink-fv-confirm")&&(this.confirmElms[this.element.id].push(n),this.hasConfirm[this.element.id]=!0)}},_validateElements:function(){var t;this._getElements(),this.hasConfirm[this.element.id]!==void 0&&this.hasConfirm[this.element.id]===!0&&(t=this._makeConfirmGroups());for(var n,i=[],o=!1,r=!1,s=0,a=this.elements[this.element.id].length;a>s;s++)if(n=!1,o=this.elements[this.element.id][s],!o.disabled)for(var l in this._flagMap)e.hasClassName(o,l)&&("ink-fv-custom"!==l&&"ink-fv-confirm"!==l?this._isValid(o,l)||(n?i[i.length-1].errors.push(l):(i.push({elm:o,errors:[l]}),n=!0)):"ink-fv-confirm"!==l&&(r=this._isCustomValid(o),r.length>0&&i.push({elm:o,errors:[l],custom:r})));return i=this._validateConfirmGroups(t,i)},_validateConfirmGroups:function(e,t){var n=!1;for(var i in e)n=e[i],2===n.length&&n[0].value!==n[1].value&&t.push({elm:n[1],errors:["ink-fv-confirm"]});return t},_makeConfirmGroups:function(){var t;if(this.confirmGroup&&this.confirmGroup.length>0){t={};for(var n=!1,i=!1,o=0,r=this.confirmElms[this.element.id].length;r>o;o++){n=this.confirmElms[this.element.id][o];for(var s=0,a=this.confirmGroup.length;a>s;s++)i=this.confirmGroup[s],e.hasClassName(n,i)&&(t[i]===void 0?t[i]=[n]:t[i].push(n))}return t}return 2===this.confirmElms[this.element.id].length&&(t={"ink-fv-confirm":[this.confirmElms[this.element.id][0],this.confirmElms[this.element.id][1]]}),t},_isCustomValid:function(t){for(var n=[],i=!1,o=0,r=this.custom.length;r>o;o++)i=this.custom[o],e.hasClassName(t,i.flag)&&(i.callback(t,i.msg)||n.push({flag:i.flag,msg:i.msg}));return n},_isValid:function(n,i){switch(i){case"ink-fv-required":if("select"===n.nodeName.toLowerCase())return n.selectedIndex>0?!0:!1;if("checkbox"!==n.getAttribute("type")&&"radio"!==n.getAttribute("type")){if(""!==this._trim(n.value))return!0}else if("checkbox"===n.getAttribute("type")){if(n.checked===!0)return!0}else if("radio"===n.getAttribute("type")){var o=n.form[n.name];o.length===void 0&&(o=[o]);for(var r=!1,s=0,a=o.length;a>s;s++)o[s].checked===!0&&(r=!0);return r}break;case"ink-fv-email":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.mail(n.value))return!0;break;case"ink-fv-url":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.url(n.value))return!0;break;case"ink-fv-number":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(!isNaN(Number(n.value)))return!0;break;case"ink-fv-phone_pt":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isPTPhone(n.value))return!0;break;case"ink-fv-phone_cv":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isCVPhone(n.value))return!0;break;case"ink-fv-phone_ao":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isAOPhone(n.value))return!0;break;case"ink-fv-phone_mz":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isMZPhone(n.value))return!0;break;case"ink-fv-date":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;var l=Ink.getModule("Ink.Dom.Element",1),h=l.data(n),d="yyyy-mm-dd";if(e.hasClassName(n,"ink-datepicker")&&"format"in h?d=h.format:"validFormat"in h&&(d=h.validFormat),!(d in t._dateParsers)){var c=[];for(val in t._dateParsers)c.push(val);throw"The attribute data-valid-format must be one of the following values: "+c.join(",")}return t.isDate(d,n.value);case"ink-fv-custom":}return!1},_showError:function(t,n){this._clearError(t);for(var i=!1,o=0,r=n.length;r>o;o++)if(i=n[o].elm,"radio"!==i.getAttribute("type")){var s=document.createElement("p");s.className=this._errorClassName,s.className+=" ".this._errorTypeErrorClassName,s.innerHTML="ink-fv-custom"!==n[o].errors[0]?this._flagMap[n[o].errors[0]].msg:n[o].custom[0].msg,"checkbox"!==i.getAttribute("type")&&(i.nextSibling.parentNode.insertBefore(s,i.nextSibling),e.hasClassName(i.parentNode,"control")&&(e.addClassName(i.parentNode.parentNode,"validation"),"ink-fv-required"===n[o].errors[0]?e.addClassName(i.parentNode.parentNode,"error"):e.addClassName(i.parentNode.parentNode,"warning")))}else e.hasClassName(i.parentNode.parentNode,"control-group")&&(e.addClassName(i.parentNode.parentNode,"validation"),e.addClassName(i.parentNode.parentNode,"error"))},_clearError:function(t){for(var n=t.getElementsByTagName("p"),i=!1,o=n.length-1;o>=0;o--)i=n[o],e.hasClassName(i,this._errorClassName)&&(e.hasClassName(i.parentNode,"control")&&(e.removeClassName(i.parentNode.parentNode,"validation"),e.removeClassName(i.parentNode.parentNode,"error"),e.removeClassName(i.parentNode.parentNode,"warning")),e.hasClassName(i,"tip")&&e.hasClassName(i,"error")&&i.parentNode.removeChild(i));var r=t.getElementsByTagName("ul");for(o=r.length-1;o>=0;o--)i=r[o],e.hasClassName(i,"control-group")&&(e.removeClassName(i,"validation"),e.removeClassName(i,"error"))},_trim:function(e){return"string"==typeof e?e.replace(/^\s+|\s+$|\n+$/g,""):void 0}};return n}); +Ink.createModule("Ink.UI.FormValidator","1",["Ink.Dom.Css_1","Ink.Util.Validator_1"],function(e,t){"use strict";var n={version:"1",_flagMap:{"ink-fv-required":{msg:"Required field"},"ink-fv-email":{msg:"Invalid e-mail address"},"ink-fv-url":{msg:"Invalid URL"},"ink-fv-number":{msg:"Invalid number"},"ink-fv-phone_pt":{msg:"Invalid phone number"},"ink-fv-phone_cv":{msg:"Invalid phone number"},"ink-fv-phone_mz":{msg:"Invalid phone number"},"ink-fv-phone_ao":{msg:"Invalid phone number"},"ink-fv-date":{msg:"Invalid date"},"ink-fv-confirm":{msg:"Confirmation does not match"},"ink-fv-custom":{msg:""}},elements:{},confirmElms:{},hasConfirm:{},_errorClassName:"tip",_errorValidationClassName:"validaton",_errorTypeWarningClassName:"warning",_errorTypeErrorClassName:"error",validate:function(e,t){if(this._free(),t=Ink.extendObj({onSuccess:!1,onError:!1,customFlag:!1,confirmGroup:[]},t||{}),"string"==typeof e&&(e=document.getElementById(e)),null===e)return!1;this.element=e,(this.element.id===void 0||null===this.element.id||""===this.element.id)&&(this.element.id="ink-fv_randomid_"+Math.round(99999*Math.random())),this.custom=t.customFlag,this.confirmGroup=t.confirmGroup;var n=this._validateElements();return n.length>0?(t.onError?t.onError(n):this._showError(e,n),!1):(t.onError||this._clearError(e),this._clearCache(),t.onSuccess&&t.onSuccess(),!0)},reset:function(){this._clearError(),this._clearCache()},_free:function(){this.element=null,this.custom=!1,this.confirmGroup=!1},_clearCache:function(){this.element=null,this.elements=[],this.custom=!1,this.confirmGroup=!1},_getElements:function(){this.elements[this.element.id]=[],this.confirmElms[this.element.id]=[];for(var t=this.element.elements,n=!1,i=0,o=t.length;o>i;i++)if(n=t[i],null!==n.getAttribute("type")&&"radio"===n.getAttribute("type").toLowerCase()){if(0===this.elements[this.element.id].length||n.getAttribute("type")!==this.elements[this.element.id][this.elements[this.element.id].length-1].getAttribute("type")&&n.getAttribute("name")!==this.elements[this.element.id][this.elements[this.element.id].length-1].getAttribute("name"))for(var r in this._flagMap)if(e.hasClassName(n,r)){this.elements[this.element.id].push(n);break}}else{for(var s in this._flagMap)if(e.hasClassName(n,s)&&"ink-fv-confirm"!==s){this.elements[this.element.id].push(n);break}e.hasClassName(n,"ink-fv-confirm")&&(this.confirmElms[this.element.id].push(n),this.hasConfirm[this.element.id]=!0)}},_validateElements:function(){var t;this._getElements(),this.hasConfirm[this.element.id]!==void 0&&this.hasConfirm[this.element.id]===!0&&(t=this._makeConfirmGroups());for(var n,i=[],o=!1,r=!1,s=0,a=this.elements[this.element.id].length;a>s;s++)if(n=!1,o=this.elements[this.element.id][s],!o.disabled)for(var l in this._flagMap)e.hasClassName(o,l)&&("ink-fv-custom"!==l&&"ink-fv-confirm"!==l?this._isValid(o,l)||(n?i[i.length-1].errors.push(l):(i.push({elm:o,errors:[l]}),n=!0)):"ink-fv-confirm"!==l&&(r=this._isCustomValid(o),r.length>0&&i.push({elm:o,errors:[l],custom:r})));return i=this._validateConfirmGroups(t,i)},_validateConfirmGroups:function(e,t){var n=!1;for(var i in e)n=e[i],2===n.length&&n[0].value!==n[1].value&&t.push({elm:n[1],errors:["ink-fv-confirm"]});return t},_makeConfirmGroups:function(){var t;if(this.confirmGroup&&this.confirmGroup.length>0){t={};for(var n=!1,i=!1,o=0,r=this.confirmElms[this.element.id].length;r>o;o++){n=this.confirmElms[this.element.id][o];for(var s=0,a=this.confirmGroup.length;a>s;s++)i=this.confirmGroup[s],e.hasClassName(n,i)&&(t[i]===void 0?t[i]=[n]:t[i].push(n))}return t}return 2===this.confirmElms[this.element.id].length&&(t={"ink-fv-confirm":[this.confirmElms[this.element.id][0],this.confirmElms[this.element.id][1]]}),t},_isCustomValid:function(t){for(var n=[],i=!1,o=0,r=this.custom.length;r>o;o++)i=this.custom[o],e.hasClassName(t,i.flag)&&(i.callback(t,i.msg)||n.push({flag:i.flag,msg:i.msg}));return n},_isValid:function(n,i){switch(i){case"ink-fv-required":if("select"===n.nodeName.toLowerCase())return n.selectedIndex>0?!0:!1;if("checkbox"!==n.getAttribute("type")&&"radio"!==n.getAttribute("type")){if(""!==this._trim(n.value))return!0}else if("checkbox"===n.getAttribute("type")){if(n.checked===!0)return!0}else if("radio"===n.getAttribute("type")){var o=n.form[n.name];o.length===void 0&&(o=[o]);for(var r=!1,s=0,a=o.length;a>s;s++)o[s].checked===!0&&(r=!0);return r}break;case"ink-fv-email":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.mail(n.value))return!0;break;case"ink-fv-url":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.url(n.value))return!0;break;case"ink-fv-number":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(!isNaN(Number(n.value)))return!0;break;case"ink-fv-phone_pt":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isPTPhone(n.value))return!0;break;case"ink-fv-phone_cv":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isCVPhone(n.value))return!0;break;case"ink-fv-phone_ao":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isAOPhone(n.value))return!0;break;case"ink-fv-phone_mz":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isMZPhone(n.value))return!0;break;case"ink-fv-date":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;var l=Ink.getModule("Ink.Dom.Element",1),h=l.data(n),d="yyyy-mm-dd";if(e.hasClassName(n,"ink-datepicker")&&"format"in h?d=h.format:"validFormat"in h&&(d=h.validFormat),!(d in t._dateParsers)){var c=[];for(var u in t._dateParsers)c.push(u);throw"The attribute data-valid-format must be one of the following values: "+c.join(",")}return t.isDate(d,n.value);case"ink-fv-custom":}return!1},_showError:function(t,n){this._clearError(t);for(var i=!1,o=0,r=n.length;r>o;o++)if(i=n[o].elm,"radio"!==i.getAttribute("type")){var s=document.createElement("p");e.addClassName(s,this._errorClassName),e.addClassName(s,this._errorTypeErrorClassName),s.innerHTML="ink-fv-custom"!==n[o].errors[0]?this._flagMap[n[o].errors[0]].msg:n[o].custom[0].msg,"checkbox"!==i.getAttribute("type")&&(i.nextSibling.parentNode.insertBefore(s,i.nextSibling),e.hasClassName(i.parentNode,"control")&&(e.addClassName(i.parentNode.parentNode,"validation"),"ink-fv-required"===n[o].errors[0]?e.addClassName(i.parentNode.parentNode,"error"):e.addClassName(i.parentNode.parentNode,"warning")))}else e.hasClassName(i.parentNode.parentNode,"control-group")&&(e.addClassName(i.parentNode.parentNode,"validation"),e.addClassName(i.parentNode.parentNode,"error"))},_clearError:function(t){for(var n=t.getElementsByTagName("p"),i=!1,o=n.length-1;o>=0;o--)i=n[o],e.hasClassName(i,this._errorClassName)&&(e.hasClassName(i.parentNode,"control")&&(e.removeClassName(i.parentNode.parentNode,"validation"),e.removeClassName(i.parentNode.parentNode,"error"),e.removeClassName(i.parentNode.parentNode,"warning")),e.hasClassName(i,"tip")&&e.hasClassName(i,"error")&&i.parentNode.removeChild(i));var r=t.getElementsByTagName("ul");for(o=r.length-1;o>=0;o--)i=r[o],e.hasClassName(i,"control-group")&&(e.removeClassName(i,"validation"),e.removeClassName(i,"error"))},_trim:function(e){return"string"==typeof e?e.replace(/^\s+|\s+$|\n+$/g,""):void 0}};return n}); Ink.createModule("Ink.UI.Droppable","1",["Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Css_1"],function(e,t,n){var i={debug:!1,_elements:{},add:function(e,t){var n=Ink.extendObj({hoverclass:!1,accept:!1,onHover:!1,onDrop:!1,onDropOut:!1},t||{});e=Ink.i(e),n.accept&&n.accept.constructor===Array&&(n.accept=n.accept.join()),this._elements[e.id]={options:n},this.update(e.id)},updateAll:function(){for(var e in this._elements)this._elements.hasOwnProperty(e)&&this.update(Ink.i(e))},update:function(t){t=Ink.i(t);var n=this._elements[t.id];n&&(n.left=e.offsetLeft(t),n.top=e.offsetTop(t),n.right=n.left+e.elementWidth(t),n.bottom=n.top+e.elementHeight(t))},remove:function(e){e=Ink.i(e),delete this._elements[e.id]},action:function(e,t,i,o){var r,s,a,l,h;for(var d in this._elements)if(this._elements.hasOwnProperty(d))if(l=this._elements[d],r=l.options,a=!1,h=Ink.i(d),e.x>=l.left&&e.x<=l.right&&e.y>=l.top&&e.y<=l.bottom){if(r.accept){s=o.className.split(" ");for(var c=0,u=s.length;u>c;c++)r.accept.search(s[c])>=0&&o!==h&&(a=!0)}else a=!0;a&&("drag"===t?(r.hoverclass&&n.addClassName(h,r.hoverclass),r.onHover&&r.onHover(o,h)):"drop"===t&&r.onDrop&&(r.hoverclass&&n.removeClassName(h,r.hoverclass),r.onDrop&&r.onDrop(o,h,i)))}else"drag"===t&&r.hoverclass&&n.removeClassName(h,r.hoverclass),"drop"===t&&r.onDropOut&&r.onDropOut(o,h,i)}};return i}); Ink.createModule("Ink.UI.Draggable","1",["Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Browser_1","Ink.UI.Droppable_1"],function(e,t,n,i,o){var s=function(e,t){this.init(e,t)};return s.prototype={init:function(n,o){var s=Ink.extendObj({constraint:!1,top:0,right:e.pageWidth(),bottom:e.pageHeight(),left:0,handler:!1,revert:!1,cursor:"move",zindex:9999,onStart:!1,onEnd:!1,onDrag:!1,onChange:!1,droppableProxy:!1,mouseAnchor:void 0,skipChildren:!0,debug:!1},o||{});this.options=s,this.element=Ink.i(n),this.handle=!1,this.elmStartPosition=!1,this.active=!1,this.dragged=!1,this.prevCoords=!1,this.placeholder=!1,this.position=!1,this.zindex=!1,this.firstDrag=!0,s.fps&&(this.deltaMs=1e3/s.fps,this.lastRanAt=0),this.handlers={},this.handlers.start=Ink.bindEvent(this._onStart,this),this.handlers.dragFacade=Ink.bindEvent(this._onDragFacade,this),this.handlers.drag=Ink.bindEvent(this._onDrag,this),this.handlers.end=Ink.bindEvent(this._onEnd,this),this.handlers.selectStart=function(e){return t.stop(e),!1},this.handle=this.options.handler?Ink.i(this.options.handler):this.element,this.handle.style.cursor=s.cursor,s.right!==!1&&(this.options.right=s.right-e.elementWidth(n)),s.bottom!==!1&&(this.options.bottom=s.bottom-e.elementHeight(n)),t.observe(this.handle,"touchstart",this.handlers.start),t.observe(this.handle,"mousedown",this.handlers.start),i.IE&&t.observe(this.element,"selectstart",this.handlers.selectStart)},destroy:function(){t.stopObserving(this.handle,"touchstart",this.handlers.start),t.stopObserving(this.handle,"mousedown",this.handlers.start),i.IE&&t.stopObserving(this.element,"selectstart",this.handlers.selectStart)},_getPageScroll:function(){return self.pageXOffset!==void 0?[self.pageXOffset,self.pageYOffset]:document.documentElement!==void 0&&document.documentElement.scrollLeft!==void 0?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[document.body.scrollLeft,document.body.scrollTop]},_getCoords:function(e){var t=this._getPageScroll();return{x:(e.touches?e.touches[0].clientX:e.clientX)+t[0],y:(e.touches?e.touches[0].clientY:e.clientY)+t[1]}},_cloneStyle:function(t,i){i.className=t.className,i.style.borderWidth="0",i.style.padding="0",i.style.position="absolute",i.style.width=e.elementWidth(t)+"px",i.style.height=e.elementHeight(t)+"px",i.style.left=e.elementLeft(t)+"px",i.style.top=e.elementTop(t)+"px",i.style.cssFloat=n.getStyle(t,"float"),i.style.display=n.getStyle(t,"display")},_onStart:function(i){if(!this.active&&t.isLeftClick(i)||i.button===void 0){var o=i.target||i.srcElement;if(this.options.skipChildren&&o!==this.element)return;t.stop(i),this.elmStartPosition=[e.elementLeft(this.element),e.elementTop(this.element)];var s=[parseInt(n.getStyle(this.element,"left"),10),parseInt(n.getStyle(this.element,"top"),10)],r=[e.elementWidth(this.element),e.elementHeight(this.element)];this.originalPosition=[s[0]?s[0]:null,s[1]?s[1]:null],this.delta=this._getCoords(i),this.active=!0,this.position=n.getStyle(this.element,"position"),this.zindex=n.getStyle(this.element,"zIndex");var a=document.createElement("div");if(a.style.position=this.position,a.style.width=r[0]+"px",a.style.height=r[1]+"px",a.style.marginTop=n.getStyle(this.element,"margin-top"),a.style.marginBottom=n.getStyle(this.element,"margin-bottom"),a.style.marginLeft=n.getStyle(this.element,"margin-left"),a.style.marginRight=n.getStyle(this.element,"margin-right"),a.style.borderWidth="0",a.style.padding="0",a.style.cssFloat=n.getStyle(this.element,"float"),a.style.display=n.getStyle(this.element,"display"),a.style.visibility="hidden",this.delta2=[this.delta.x-this.elmStartPosition[0],this.delta.y-this.elmStartPosition[1]],this.options.mouseAnchor){var l=this.options.mouseAnchor.split(" "),h=[r[0],r[1]];"left"===l[0]?h[0]=0:"center"===l[0]&&(h[0]=parseInt(h[0]/2,10)),"top"===l[1]?h[1]=0:"center"===l[1]&&(h[1]=parseInt(h[1]/2,10)),this.applyDelta=[this.delta2[0]-h[0],this.delta2[1]-h[1]]}if(this.placeholder=a,this.options.onStart&&this.options.onStart(this.element,i),this.options.droppableProxy){this.proxy=document.createElement("div"),r=[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight];var d=this.proxy.style;d.width=r[0]+"px",d.height=r[1]+"px",d.position="fixed",d.left="0",d.top="0",d.zIndex=this.options.zindex+1,d.backgroundColor="#FF0000",n.setOpacity(this.proxy,0);for(var c=document.body.firstChild;c&&1!==c.nodeType;)c=c.nextSibling;document.body.insertBefore(this.proxy,c),t.observe(this.proxy,"mousemove",this.handlers[this.options.fps?"dragFacade":"drag"]),t.observe(this.proxy,"touchmove",this.handlers[this.options.fps?"dragFacade":"drag"])}else t.observe(document,"mousemove",this.handlers[this.options.fps?"dragFacade":"drag"]);return this.element.style.position="absolute",this.element.style.zIndex=this.options.zindex,this.element.parentNode.insertBefore(this.placeholder,this.element),this._onDrag(i),t.observe(document,"mouseup",this.handlers.end),t.observe(document,"touchend",this.handlers.end),!1}},_onDragFacade:function(e){var t=(new Date).getTime();(!this.lastRanAt||t>this.lastRanAt+this.deltaMs)&&(this.lastRanAt=t,this._onDrag(e))},_onDrag:function(e){if(this.active){t.stop(e),this.dragged=!0;var n=this._getCoords(e),i=n.x,s=n.y,r=this.options,a=!1,l=!1;if(this.prevCoords||(this.prevCoords={x:0,y:0}),i!==this.prevCoords.x||s!==this.prevCoords.y){if(r.onDrag&&r.onDrag(this.element,e),this.prevCoords=n,a=this.elmStartPosition[0]+i-this.delta.x,l=this.elmStartPosition[1]+s-this.delta.y,("horizontal"===r.constraint||"both"===r.constraint)&&(r.right!==!1&&a>r.right&&(a=r.right),r.left!==!1&&r.left>a&&(a=r.left)),("vertical"===r.constraint||"both"===r.constraint)&&(r.bottom!==!1&&l>r.bottom&&(l=r.bottom),r.top!==!1&&r.top>l&&(l=r.top)),this.firstDrag&&(o&&o.updateAll(),this.firstDrag=!1),a&&(this.element.style.left=a+"px"),l&&(this.element.style.top=l+"px"),o){var h=this.options.mouseAnchor?{x:i-this.applyDelta[0],y:s-this.applyDelta[1]}:n;o.action(h,"drag",e,this.element)}r.onChange&&r.onChange(this)}}},_onEnd:function(e){t.stopObserving(document,"mousemove",this.handlers.drag),t.stopObserving(document,"touchmove",this.handlers.drag),this.options.fps&&this._onDrag(e),this.active&&this.dragged&&(this.options.droppableProxy&&document.body.removeChild(this.proxy),this.pt&&(this.pt.parentNode.removeChild(this.pt),this.pt=void 0),this.placeholder&&this.placeholder.parentNode.removeChild(this.placeholder),this.options.revert&&(this.element.style.position=this.position,this.element.style.zIndex=null!==this.zindex?this.zindex:"auto",this.element.style.left=this.originalPosition[0]?this.originalPosition[0]+"px":"",this.element.style.top=this.originalPosition[1]?this.originalPosition[1]+"px":""),this.options.onEnd&&this.options.onEnd(this.element,e),o&&o.action(this._getCoords(e),"drop",e,this.element),this.position=!1,this.zindex=!1,this.firstDrag=!0),this.active=!1,this.dragged=!1}},s}); Ink.createModule("Ink.UI.DatePicker","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1","Ink.Util.Date_1"],function(e,t,i,n,o,s,r){"use strict";var a=function(t,i){t&&(this._dataField=e.elOrSelector(t,"1st argument")),this._options=Ink.extendObj({instance:"scdp_"+Math.round(99999*Math.random()),format:"yyyy-mm-dd",cssClass:"sapo_component_datepicker",position:"right",onFocus:!0,onYearSelected:void 0,onMonthSelected:void 0,validDayFn:void 0,startDate:!1,onSetDate:!1,displayInSelect:!1,showClose:!0,showClean:!0,yearRange:!1,dateRange:!1,startWeekDay:1,closeText:"Close",cleanText:"Clear",prevLinkText:"«",nextLinkText:"»",ofText:" de ",month:{1:"January",2:"February",3:"March",4:"April",5:"May",6:"June",7:"July",8:"August",9:"September",10:"October",11:"November",12:"December"},wDay:{0:"Sunday",1:"Monday",2:"Tuesday",3:"Wednesday",4:"Thursday",5:"Friday",6:"Saturday"}},n.data(this._dataField)||{}),this._options=Ink.extendObj(this._options,i||{}),this._options.format=this._dateParsers[this._options.format]||this._options.format,this._hoverPicker=!1,this._picker=null,this._options.pickerField&&(this._picker=e.elOrSelector(this._options.pickerField,"pickerField")),this._today=new Date,this._day=this._today.getDate(),this._month=this._today.getMonth(),this._year=this._today.getFullYear(),this._setMinMax(this._options.dateRange||this._options.yearRange),this._data=new Date(Date.UTC.apply(this,this._checkDateRange(this._year,this._month,this._day))),this._options.startDate&&"string"==typeof this._options.startDate&&/\d\d\d\d\-\d\d\-\d\d/.test(this._options.startDate)&&this.setDate(this._options.startDate),this._init(),this._render(),this._options.startDate||this._dataField&&"string"==typeof this._dataField.value&&this._dataField.value&&this.setDate(this._dataField.value),e.registerInstance(this,this._containerObject,"datePicker")};return a.prototype={version:"0.1",_init:function(){Ink.extendObj(this._options,this._lang||{})},_render:function(){this._containerObject=document.createElement("div"),this._containerObject.id=this._options.instance,this._containerObject.className="sapo_component_datepicker";var i=document.getElementsByTagName("body")[0];if(this._options.showClose||this._options.showClean){if(this._superTopBar=document.createElement("div"),this._superTopBar.className="sapo_cal_top_options",this._options.showClean){var o=document.createElement("a");o.className="clean",o.innerHTML=this._options.cleanText,this._superTopBar.appendChild(o)}if(this._options.showClose){var s=document.createElement("a");s.className="close",s.innerHTML=this._options.closeText,this._superTopBar.appendChild(s)}this._containerObject.appendChild(this._superTopBar)}var r=document.createElement("div");r.className="sapo_cal_top",this._monthDescContainer=document.createElement("div"),this._monthDescContainer.className="sapo_cal_month_desc",this._monthPrev=document.createElement("div"),this._monthPrev.className="sapo_cal_prev",this._monthPrev.innerHTML=''+this._options.prevLinkText+"",this._monthNext=document.createElement("div"),this._monthNext.className="sapo_cal_next",this._monthNext.innerHTML=''+this._options.nextLinkText+"",r.appendChild(this._monthPrev),r.appendChild(this._monthDescContainer),r.appendChild(this._monthNext),this._monthContainer=document.createElement("div"),this._monthContainer.className="sapo_cal_month",this._containerObject.appendChild(r),this._containerObject.appendChild(this._monthContainer),this._monthSelector=document.createElement("ul"),this._monthSelector.className="sapo_cal_month_selector";for(var a,l,h=1;12>=h;h++)0===(h-1)%4&&(a=document.createElement("ul")),l=document.createElement("li"),l.innerHTML=''+this._options.month[h].substring(0,3)+"",a.appendChild(l),0===h%4&&this._monthSelector.appendChild(a);if(this._containerObject.appendChild(this._monthSelector),this._yearSelector=document.createElement("ul"),this._yearSelector.className="sapo_cal_year_selector",this._containerObject.appendChild(this._yearSelector),(!this._options.onFocus||this._options.displayInSelect)&&(this._options.pickerField?this._picker=e.elOrSelector(this._options.pickerField,"pickerField"):(this._picker=document.createElement("a"),this._picker.href="#open_cal",this._picker.innerHTML="open",this._picker.style.position="absolute",this._picker.style.top=n.elementTop(this._dataField),this._picker.style.left=n.elementLeft(this._dataField)+(n.elementWidth(this._dataField)||0)+5+"px",this._dataField.parentNode.appendChild(this._picker),this._picker.className="sapo_cal_date_picker")),this._options.displayInSelect){if(!(this._options.dayField&&this._options.monthField&&this._options.yearField||this._options.pickerField))throw"To use display in select you *MUST* to set dayField, monthField, yearField and pickerField!";this._options.dayField=e.elOrSelector(this._options.dayField,"dayField"),this._options.monthField=e.elOrSelector(this._options.monthField,"monthField"),this._options.yearField=e.elOrSelector(this._options.yearField,"yearField")}i.insertBefore(this._containerObject,i.childNodes[0]),this._picker?t.observe(this._picker,"click",Ink.bindEvent(function(e){t.stop(e),this._containerObject=n.clonePosition(this._containerObject,this._picker),this._updateDate(),this._showMonth(),this._containerObject.style.display="block"},this)):t.observe(this._dataField,"focus",Ink.bindEvent(function(){this._containerObject=n.clonePosition(this._containerObject,this._dataField),"bottom"===this._options.position?(this._containerObject.style.top=n.elementHeight(this._dataField)+n.offsetTop(this._dataField)+"px",this._containerObject.style.left=n.offset2(this._dataField)[0]+"px"):(this._containerObject.style.top=n.offset2(this._dataField)[1]+"px",this._containerObject.style.left=n.elementWidth(this._dataField)+n.offset2(this._dataField)[0]+"px"),this._updateDate(),this._showMonth(),this._containerObject.style.display="block"},this)),this._options.displayInSelect?(t.observe(this._options.dayField,"change",Ink.bindEvent(function(){var e=this._options.yearField[this._options.yearField.selectedIndex].value;""!==e&&0!==e&&(this._updateDate(),this._showDefaultView())},this)),t.observe(this._options.monthField,"change",Ink.bindEvent(function(){var e=this._options.yearField[this._options.yearField.selectedIndex].value;""!==e&&0!==e&&(this._updateDate(),this._showDefaultView())},this)),t.observe(this._options.yearField,"change",Ink.bindEvent(function(){this._updateDate(),this._showDefaultView()},this))):(t.observe(this._dataField,"change",Ink.bindEvent(function(){this._updateDate(),this._showDefaultView(),this.setDate(),this._hoverPicker||(this._containerObject.style.display="none")},this)),t.observe(this._dataField,"blur",Ink.bindEvent(function(){this._hoverPicker||(this._containerObject.style.display="none")},this))),t.observe(document,"click",Ink.bindEvent(function(e){void 0===e.target&&(e.target=e.srcElement),n.descendantOf(this._containerObject,e.target)||e.target===this._dataField||(this._picker?e.target===this._picker||this._options.displayInSelect&&(e.target===this._options.dayField||e.target===this._options.monthField||e.target===this._options.yearField)||this._options.dayField&&(n.descendantOf(this._options.dayField,e.target)||n.descendantOf(this._options.monthField,e.target)||n.descendantOf(this._options.yearField,e.target))||(this._containerObject.style.display="none"):this._containerObject.style.display="none")},this)),this._showMonth(),this._monthChanger=document.createElement("a"),this._monthChanger.href="#monthchanger",this._monthChanger.className="sapo_cal_link_month",this._monthChanger.innerHTML=this._options.month[this._month+1],this._deText=document.createElement("span"),this._deText.innerHTML=this._options._deText,this._yearChanger=document.createElement("a"),this._yearChanger.href="#yearchanger",this._yearChanger.className="sapo_cal_link_year",this._yearChanger.innerHTML=this._year,this._monthDescContainer.innerHTML="",this._monthDescContainer.appendChild(this._monthChanger),this._monthDescContainer.appendChild(this._deText),this._monthDescContainer.appendChild(this._yearChanger),t.observe(this._containerObject,"mouseover",Ink.bindEvent(function(e){t.stop(e),this._hoverPicker=!0},this)),t.observe(this._containerObject,"mouseout",Ink.bindEvent(function(e){t.stop(e),this._hoverPicker=!1},this)),t.observe(this._containerObject,"click",Ink.bindEvent(function(e){e.target===void 0&&(e.target=e.srcElement);var i=e.target.className,n=-1!==i.indexOf("sapo_cal_off");if(t.stop(e),0!==i.indexOf("sapo_cal_")||n)if(0!==i.indexOf("sapo_calmonth_")||n)if(0!==i.indexOf("sapo_calyear_")||n)0!==i.indexOf("change_month_")||n?0!==i.indexOf("change_year_")||n?"clean"===i?this._options.displayInSelect?(this._options.yearField.selectedIndex=0,this._options.monthField.selectedIndex=0,this._options.dayField.selectedIndex=0):this._dataField.value="":"close"===i&&(this._containerObject.style.display="none"):"change_year_next"===i?this._showYearSelector(1):"change_year_prev"===i&&this._showYearSelector(-1):"change_month_next"===i?this._updateCal(1):"change_month_prev"===i&&this._updateCal(-1);else{var o=i.substr(13,4);Number(o)&&(this._year=o,"function"==typeof this._options.onYearSelected&&this._options.onYearSelected(this,{year:this._year}),this._monthPrev.childNodes[0].className="action_inactive",this._monthNext.childNodes[0].className="action_inactive",this._yearSelector.style.display="none",this._setActiveMonth(),this._monthSelector.style.display="block")}else{var s=i.substr(14,2);Number(s)&&(this._month=s-1,this._monthSelector.style.display="none",this._monthPrev.childNodes[0].className="change_month_prev",this._monthNext.childNodes[0].className="change_month_next",this._yearthis._yearMax||this._year===this._yearMax&&this._month>=this._monthMax)&&(this._monthNext.childNodes[0].className="action_inactive"),this._updateCal(),this._monthContainer.style.display="block")}else{var r=i.substr(9,2);Number(r)?(this.setDate(this._year+"-"+(this._month+1)+"-"+r),this._containerObject.style.display="none"):"sapo_cal_link_month"===i?(this._monthContainer.style.display="none",this._yearSelector.style.display="none",this._monthPrev.childNodes[0].className="action_inactive",this._monthNext.childNodes[0].className="action_inactive",this._setActiveMonth(),this._monthSelector.style.display="block"):"sapo_cal_link_year"===i&&(this._monthPrev.childNodes[0].className="action_inactive",this._monthNext.childNodes[0].className="action_inactive",this._monthSelector.style.display="none",this._monthContainer.style.display="none",this._showYearSelector(),this._yearSelector.style.display="block")}this._updateDescription()},this))},_setMinMax:function(e){var t;if(e){var i=e.split(":"),n=/^(\d{4})((\-)(\d{1,2})((\-)(\d{1,2}))?)?$/;if(i[0]&&("NOW"===i[0]?(this._yearMin=this._today.getFullYear(),this._monthMin=this._today.getMonth()+1,this._dayMin=this._today.getDate()):n.test(i[0])?(t=i[0].split("-"),this._yearMin=Math.floor(t[0]),this._monthMin=Math.floor(t[1])||1,this._dayMin=Math.floor(t[2])||1,this._monthMin>1&&this._monthMin>12&&(this._monthMin=1,this._dayMin=1),this._dayMin>1&&this._dayMin>this._daysInMonth(this._yearMin,this._monthMin)&&(this._dayMin=1)):(this._yearMin=Number.MIN_VALUE,this._monthMin=1,this._dayMin=1)),i[1])if("NOW"===i[1])this._yearMax=this._today.getFullYear(),this._monthMax=this._today.getMonth()+1,this._dayMax=this._today.getDate();else if(n.test(i[1])){t=i[1].split("-"),this._yearMax=Math.floor(t[0]),this._monthMax=Math.floor(t[1])||12,this._dayMax=Math.floor(t[2])||this._daysInMonth(this._yearMax,this._monthMax),this._monthMax>1&&this._monthMax>12&&(this._monthMax=12,this._dayMax=31);var o=this._daysInMonth(this._yearMax,this._monthMax);this._dayMax>1&&this._dayMax>o&&(this._dayMax=o)}else this._yearMax=Number.MAX_VALUE,this._monthMax=12,this._dayMax=31;this._yearMax>=this._yearMin&&(this._monthMax>this._monthMin||this._monthMax===this._monthMin&&this._dayMax>=this._dayMin)||(this._yearMin=Number.MIN_VALUE,this._monthMin=1,this._dayMin=1,this._yearMax=Number.MAX_VALUE,this._monthMax=12,this._dayMaXx=31)}else this._yearMin=Number.MIN_VALUE,this._monthMin=1,this._dayMin=1,this._yearMax=Number.MAX_VALUE,this._monthMax=12,this._dayMax=31},_checkDateRange:function(e,t,i){return this._isValidDate(e,t+1,i)||(e=this._today.getFullYear(),t=this._today.getMonth(),i=this._today.getDate()),e>this._yearMax?(e=this._yearMax,t=this._monthMax-1,i=this._dayMax):this._yearMin>e&&(e=this._yearMin,t=this._monthMin-1,i=this._dayMin),e===this._yearMax&&t+1>this._monthMax?(t=this._monthMax-1,i=this._dayMax):e===this._yearMin&&this._monthMin>t+1&&(t=this._monthMin-1,i=this._dayMin),e===this._yearMax&&t+1===this._monthMax&&i>this._dayMax?i=this._dayMax:e===this._yearMin&&t+1===this._monthMin&&this._dayMin>i?i=this._dayMin:i>this._daysInMonth(e,t+1)&&(i=this._daysInMonth(e,t+1)),[e,t,i]},_showDefaultView:function(){this._yearSelector.style.display="none",this._monthSelector.style.display="none",this._monthPrev.childNodes[0].className="change_month_prev",this._monthNext.childNodes[0].className="change_month_next",this._yearthis._yearMax||this._year===this._yearMax&&this._month+1>=this._monthMax)&&(this._monthNext.childNodes[0].className="action_inactive"),this._monthContainer.style.display="block"},_updateDate:function(){var e;this._options.displayInSelect?(e=[],this._isValidDate(e[0]=this._options.yearField[this._options.yearField.selectedIndex].value,e[1]=this._options.monthField[this._options.monthField.selectedIndex].value,e[2]=this._options.dayField[this._options.dayField.selectedIndex].value)?(e=this._checkDateRange(e[0],e[1]-1,e[2]),this._year=e[0],this._month=e[1],this._day=e[2]):(e=this._checkDateRange(e[0],e[1]-1,1),this._isValidDate(e[0],e[1]+1,e[2])&&(this._year=e[0],this._month=e[1],this._day=this._daysInMonth(e[0],e[1]),this.setDate()))):""!==this._dataField.value&&(this._isDate(this._options.format,this._dataField.value)?(e=this._getDataArrayParsed(this._dataField.value),e=this._checkDateRange(e[0],e[1]-1,e[2]),this._year=e[0],this._month=e[1],this._day=e[2]):(this._dataField.value="",this._year=this._data.getFullYear(),this._month=this._data.getMonth(),this._day=this._data.getDate()),this._data.setFullYear(this._year,this._month,this._day),this._dataField.value=this._writeDateInFormat()),this._updateDescription(),this._showMonth()},_updateDescription:function(){this._monthChanger.innerHTML=this._options.month[this._month+1],this._deText.innerHTML=this._options.ofText,this._yearChanger.innerHTML=this._year},_showYearSelector:function(){if(arguments.length){var e=+this._year+10*arguments[0];if(e-=e%10,e>this._yearMax||this._yearMin>e+9)return;this._year=+this._year+10*arguments[0]}for(var t="
  • ",i=this._year-this._year%10,n=0;11>=n;n++)0===n%4&&(t+="");t+="
  • ",this._yearSelector.innerHTML=t},_getDataArrayParsed:function(e){var t=[],i=r.set(this._options.format,e);return i&&(t=[i.getFullYear(),i.getMonth()+1,i.getDate()]),t},_isValidDate:function(e,t,i){var n=/^\d{4}$/,o=/^\d{1,2}$/;return n.test(e)&&o.test(t)&&o.test(i)&&t>=1&&12>=t&&i>=1&&this._daysInMonth(e,t)>=i},_isDate:function(e,t){try{if(e===void 0)return!1;var i=r.set(e,t);if(i&&this._isValidDate(i.getFullYear(),i.getMonth()+1,i.getDate()))return!0}catch(n){}return!1},_writeDateInFormat:function(){return r.get(this._options.format,this._data)},setDate:function(e){if("string"==typeof e&&/\d{4}-\d{1,2}-\d{1,2}/.test(e)){var t=e.split("-");this._year=t[0],this._month=t[1]-1,this._day=t[2]}this._setDate()},_setDate:function(e){e!==void 0&&e.className&&0===e.className.indexOf("sapo_cal_")&&(this._day=e.className.substr(9,2)),this._data.setFullYear.apply(this._data,this._checkDateRange(this._year,this._month,this._day)),this._options.displayInSelect?(this._options.dayField.value=this._data.getDate(),this._options.monthField.value=this._data.getMonth()+1,this._options.yearField.value=this._data.getFullYear()):this._dataField.value=this._writeDateInFormat(),this._options.onSetDate&&this._options.onSetDate(this,{date:this._data})},_updateCal:function(e){"function"==typeof this._options.onMonthSelected&&this._options.onMonthSelected(this,{year:this._year,month:this._month}),this._updateMonth(e),this._showMonth()},_daysInMonth:function(e,t){var i=31;switch(t){case 2:i=0===e%400||0===e%4&&0!==e%100?29:28;break;case 4:case 6:case 9:case 11:i=30}return i},_updateMonth:function(e){e===void 0&&(e="0");var t=this._month+1,i=this._year;switch(e){case-1:if(1===t){if(i===this._yearMin)return;t=12,i--}else t--;this._year=i,this._month=t-1;break;case 1:if(12===t){if(i===this._yearMax)return;t=1,i++}else t++;this._year=i,this._month=t-1;break;default:}},_dateParsers:{"yyyy-mm-dd":"Y-m-d","yyyy/mm/dd":"Y/m/d","yy-mm-dd":"y-m-d","yy/mm/dd":"y/m/d","dd-mm-yyyy":"d-m-Y","dd/mm/yyyy":"d/m/Y","dd-mm-yy":"d-m-y","dd/mm/yy":"d/m/y","mm/dd/yyyy":"m/d/Y","mm-dd-yyyy":"m-d-Y"},_showMonth:function(){var e,t,i=this._month+1,n=this._year,o=this._daysInMonth(n,i),s=new Date(n,i-1,1).getDay(),r=this._options.startWeekDay||0;this._monthPrev.childNodes[0].className="change_month_prev",this._monthNext.childNodes[0].className="change_month_next",this._yearMin>n||n===this._yearMin&&this._monthMin>=i?this._monthPrev.childNodes[0].className="action_inactive":(n>this._yearMax||n===this._yearMax&&i>=this._monthMax)&&(this._monthNext.childNodes[0].className="action_inactive"),r&&Number(r)&&(r>s?s=7+r-s:s+=r);var a="";for(a+='
      ',e=0;7>e;e++)a+="
    • "+this._options.wDay[e+(r+e>6?r-7:r)].substring(0,1)+"
    • ";a+="
    ";var l=0;if(a+="
      ",s)for(t=r;s-r>t;t++)l||(a+="
        "),a+='
      •  
      • ',l++;for(e=1;o>=e;e++){7===l&&(l=0,a+="
          ");var h="sapo_cal_"+(2===(e+"").length?e:"0"+e);h+=n===this._yearMin&&i===this._monthMin&&this._dayMin>e||n===this._yearMax&&i===this._monthMax&&e>this._dayMax||n===this._yearMin&&this._monthMin>i||n===this._yearMax&&i>this._monthMax||this._yearMin>n||n>this._yearMax||this._options.validDayFn&&!this._options.validDayFn.call(this,new Date(n,i-1,e))?" sapo_cal_off":this._data.getFullYear()===n&&this._data.getMonth()===i-1&&e===this._day?" sapo_cal_on":"",a+='
        • '+e+"
        • ",l++,7===l&&(a+="
        ")}if(7!==l){for(e=l;7>e;e++)a+='
      •  
      • ';a+="
      "}a+="
    ",this._monthContainer.innerHTML=a},_setActiveMonth:function(e){e===void 0&&(e=this._monthSelector);var t=e.childNodes.length;if(e.className&&e.className.match(/sapo_calmonth_/)){var n=this._year,o=e.className.substr(14,2);n===this._data.getFullYear()&&o===this._data.getMonth()+1?(i.addClassName(e,"sapo_cal_on"),i.removeClassName(e,"sapo_cal_off")):(i.removeClassName(e,"sapo_cal_on"),n===this._yearMin&&this._monthMin>o||n===this._yearMax&&o>this._monthMax||this._yearMin>n||n>this._yearMax?i.addClassName(e,"sapo_cal_off"):i.removeClassName(e,"sapo_cal_off"))}else if(0!==t)for(var s=0;t>s;s++)this._setActiveMonth(e.childNodes[s])},lang:function(e){this._lang=e},showMonth:function(){this._showMonth()},isMonthRendered:function(){var e=o.select(".sapo_cal_header",this._containerObject)[0];return"none"!==i.getStyle(e.parentNode,"display")&&"none"!==i.getStyle(e.parentNode.parentNode,"display")}},a}); diff --git a/js/ink-ui.js b/js/ink-ui.js index 8661f90b3..fff794603 100644 --- a/js/ink-ui.js +++ b/js/ink-ui.js @@ -4684,8 +4684,8 @@ Ink.createModule('Ink.UI.FormValidator', '1', ['Ink.Dom.Css_1','Ink.Util.Validat this.elements[this.element.id] = []; this.confirmElms[this.element.id] = []; - console.log(this.element); - console.log(this.element.elements); + //console.log(this.element); + //console.log(this.element.elements); var formElms = this.element.elements; var curElm = false; for(var i=0, totalElm = formElms.length; i < totalElm; i++) { @@ -4723,7 +4723,7 @@ Ink.createModule('Ink.UI.FormValidator', '1', ['Ink.Dom.Css_1','Ink.Util.Validat } } - debugger; + //debugger; }, /** @@ -5025,7 +5025,7 @@ Ink.createModule('Ink.UI.FormValidator', '1', ['Ink.Dom.Css_1','Ink.Util.Validat if( !(validFormat in InkValidator._dateParsers ) ){ var validValues = []; - for( val in InkValidator._dateParsers ){ + for( var val in InkValidator._dateParsers ){ validValues.push(val); } throw "The attribute data-valid-format must be one of the following values: " + validValues.join(','); @@ -5064,8 +5064,10 @@ Ink.createModule('Ink.UI.FormValidator', '1', ['Ink.Dom.Css_1','Ink.Util.Validat var newLabel = document.createElement('p'); //newLabel.setAttribute('for',curElm.id); - newLabel.className = this._errorClassName; - newLabel.className += ' ' . this._errorTypeErrorClassName; + //newLabel.className = this._errorClassName; + //newLabel.className += ' ' + this._errorTypeErrorClassName; + Css.addClassName(newLabel, this._errorClassName); + Css.addClassName(newLabel, this._errorTypeErrorClassName); if(aFail[i].errors[0] !== 'ink-fv-custom') { newLabel.innerHTML = this._flagMap[aFail[i].errors[0]].msg; } else { diff --git a/js/ink-ui.min.js b/js/ink-ui.min.js index 3725aff1e..dff889ec3 100644 --- a/js/ink-ui.min.js +++ b/js/ink-ui.min.js @@ -11,7 +11,7 @@ Ink.createModule("Ink.UI.Tabs","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Cs Ink.createModule("Ink.UI.ImageQuery","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,i,o,r){"use strict";var s=function(t,n){if(!e.isDOMElement(t)&&"string"!=typeof t)throw"[ImageQuery] :: Invalid selector";if("string"==typeof t){if(this._element=o.select(t),1>this._element.length)throw"[ImageQuery] :: Selector has returned no elements";if(this._element.length>1){var r;for(r=1;this._element.length>r;r+=1)new Ink.UI.ImageQuery(this._element[r],n)}this._element=this._element[0]}else this._element=t;this._options=Ink.extendObj({queries:[],onLoad:null},i.data(this._element)),this._options=Ink.extendObj(this._options,n||{});var s;if(-1!==(s=this._element.src.lastIndexOf("?"))){var a=this._element.src.substr(s);this._filename=this._element.src.replace(a,"").split("/").pop()+a}else this._filename=this._element.src.split("/").pop();this._init()};return s.prototype={_init:function(){this._options.queries=r.sortMulti(this._options.queries,"width").reverse(),this._handlers={resize:Ink.bindEvent(this._onResize,this),load:Ink.bindEvent(this._onLoad,this)},"function"==typeof this._options.onLoad&&t.observe(this._element,"onload",this._handlers.load),t.observe(window,"resize",this._handlers.resize),this._handlers.resize.call(this)},_onResize:function(){clearTimeout(e);var e=setTimeout(Ink.bind(function(){if(!this._options.queries||this._options.queries==={})return clearTimeout(e),void 0;var t,n,i;for("number"==typeof window.innerWidth?i=window.innerWidth:document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)?i=document.documentElement.clientWidth:document.body&&(document.body.clientWidth||document.body.clientHeight)&&(i=document.body.clientWidth),t=0;this._options.queries.length>t;t+=1)if(i>=this._options.queries[t].width){n=t;break}n===void 0&&(n=this._options.queries.length-1);var o=this._options.queries[n].src||this._options.src;if("devicePixelRatio"in window&&window.devicePixelRatio>1&&"retina"in this._options&&(o=this._options.queries[n].retina||this._options.retina),this._options.queries[n].file=this._filename,"function"==typeof o&&(o=o.apply(this,[this._element,this._options.queries[n]]),"string"!=typeof o))throw'[ImageQuery] :: "src" callback does not return a string';var r;for(r in this._options.queries[n])"src"!==r&&"retina"!==r&&(o=o.replace("{:"+r+"}",this._options.queries[n][r]));this._element.src=o,delete this._options.queries[n].file,e=void 0},this),300)},_onLoad:function(){this._options.onLoad.call(this)}},s}); Ink.createModule("Ink.UI.TreeView","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,i,o,r){"use strict";var s=function(t,n){if(!e.isDOMElement(t)&&"string"!=typeof t)throw"[Ink.UI.TreeView] :: Invalid selector";if("string"==typeof t){if(this._element=o.select(t),1>this._element.length)throw"[Ink.UI.TreeView] :: Selector has returned no elements";this._element=this._element[0]}else this._element=t;this._options=Ink.extendObj({node:"li",child:"ul"},i.data(this._element)),this._options=Ink.extendObj(this._options,n||{}),this._init()};return s.prototype={_init:function(){this._handlers={click:Ink.bindEvent(this._onClick,this)},t.observe(this._element,"click",this._handlers.click);var e,i=o.select(this._options.node,this._element);r.each(i,Ink.bind(function(t){n.hasClassName(t,"open")||(n.hasClassName(t,"closed")||n.addClassName(t,"closed"),e=o.select(this._options.child,t),r.each(e,Ink.bind(function(e){n.hasClassName(e,"hide-all")||n.addClassName(e,"hide-all")},this)))},this))},_onClick:function(e){var i=t.element(e);if("."===this._options.node[0]){if(!n.hasClassName(i,this._options.node.substr(1)))for(;!n.hasClassName(i,this._options.node.substr(1))&&"body"!==i.nodeName.toLowerCase();)i=i.parentNode}else if("#"===this._options.node[0]){if(i.id!==this._options.node.substr(1))for(;i.id!==this._options.node.substr(1)&&"body"!==i.nodeName.toLowerCase();)i=i.parentNode}else if(i.nodeName.toLowerCase()!==this._options.node)for(;i.nodeName.toLowerCase()!==this._options.node&&"body"!==i.nodeName.toLowerCase();)i=i.parentNode;if("body"!==i.nodeName.toLowerCase()){var r=o.select(this._options.child,i);r.length>0&&(t.stop(e),r=r[0],n.hasClassName(r,"hide-all")?(n.removeClassName(r,"hide-all"),n.addClassName(i,"open"),n.removeClassName(i,"closed")):(n.addClassName(r,"hide-all"),n.removeClassName(i,"open"),n.addClassName(i,"closed")))}}},s}); Ink.createModule("Ink.UI.Gallery","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1","Ink.Util.Swipe_1"],function(e,t,n,i,o,s,r){"use strict";var a=function(e,t,n){var i=t[0],o=t[1];if(n||i>e[0]||o>e[1]){var s=i/o,r=e[0]/e[1],a=s>r?e[0]/i:e[1]/o;return[parseInt(i*a+.5,10),parseInt(o*a+.5,10)]}return t},l=function(e,t){t=Ink.bind(t,e);var n=[e.img.offsetWidth,e.img.offsetHeight];n[0]&&n[1]&&t(n),e.img.onload=Ink.bindEvent(function(){t([this.img.offsetWidth,this.img.offsetHeight])},e)},h=function(t,n){if(this._element=e.elOrSelector(t,"1st argument"),this._options=Ink.extendObj({fullImageMaxWidth:600,fullImageMaxHeight:400,thumbnailMaxWidth:106,layout:0,circular:!1,fixImageSizes:!1},i.data(this._element)),this._options=Ink.extendObj(this._options,n||{}),this._handlers={navClick:Ink.bindEvent(this._onNavClick,this),paginationClick:Ink.bindEvent(this._onPaginationClick,this),thumbsClick:Ink.bindEvent(this._onThumbsClick,this),focusBlur:Ink.bindEvent(this._onFocusBlur,this),keyDown:Ink.bindEvent(this._onKeyDown,this)},this._isFocused=!1,this._model=[],this._options.model instanceof Array)this._model=this._options.model,this._createdFrom="JSON";else{if("ul"!==this._element.nodeName.toLowerCase())throw new TypeError("You must pass a selector expression/DOM element as 1st option or provide a model on 2nd argument!");this._createdFrom="DOM"}if(this._index=0,this._thumbIndex=0,!isNaN(this._options.layout))if(this._options.layout=parseInt(this._options.layout,10),0===this._options.layout)this._showThumbs=!1,this._showDescription=!1,this._paginationHasPrevNext=!1;else{if(1!==this._options.layout&&2!==this._options.layout&&3!==this._options.layout)throw new TypeError("supported layouts are 0-3!");this._showThumbs=!0,this._showDescription=!0,this._paginationHasPrevNext=!0}null!==this._element.getAttribute("data-fix-image-sizes")&&(this._options.fixImageSizes=!0),this._init()};return h.prototype={_init:function(){"DOM"===this._createdFrom&&this._extractModelFromDOM();var n=this._generateMarkup(),i=this._element.parentNode;this._notFirstInit||(e.storeIdAndClasses(this._element,this),this._notFirstInit=!0),i.insertBefore(n,this._element),i.removeChild(this._element),this._element=n,e.restoreIdAndClasses(this._element,this),t.observe(this._paginationEl,"click",this._handlers.paginationClick),t.observe(this._navEl,"click",this._handlers.navClick),this._showThumbs&&t.observe(this._thumbsUlEl,"click",this._handlers.thumbsClick),t.observe(this._element,"mouseover",this._handlers.focusBlur),t.observe(this._element,"mouseout",this._handlers.focusBlur),t.observe(document,"keydown",this._handlers.keyDown),e.registerInstance(this,this._element,"gallery")},_extractModelFromDOM:function(){var e,t=[],n=o.select("> li",this._element);s.each(n,function(n){try{var i={image_full:"",image_thumb:"",title_text:"",title_link:"",description:"",content_overlay:document.createDocumentFragment()},s=o.select("> a[rel=enclosure]",n)[0],r=o.select("> img",s)[0],a=o.select("> a[class=bookmark]",n)[0],l=o.select("span[class=entry-title]",n)[0],h=o.select("> span[class=entry-content]",n)[0],d=o.select("> .content-overlay",n)[0];e=s.getAttribute("data-dims"),null!==e&&(e=e.split(","),e[0]=parseInt(e[0],10),e[1]=parseInt(e[1],10)),!e||isNaN(e[0])||isNaN(e[1])||(i.dims=e),i.image_full=s.getAttribute("href"),i.image_thumb=r.getAttribute("src"),a&&(i.title_link=a.getAttribute("href")),i.title_text=l.innerHTML,h&&(i.description=h.innerHTML),d&&i.content_overlay.appendChild(d),t.push(i)}catch(c){throw console.error("problematic element:"),console.error(n),console.error(c),Error("Problem parsing gallery data from DOM!")}}),this._model=t},_generateMarkup:function(){var e=document.createElement("div");e.className="ink-gallery";var t=document.createElement("div");t.className="stage";var i=document.createElement("nav");i.innerHTML=['
      ','
    • ','
    • ',"
    "].join(""),this._navEl=i;var o=document.createElement("div");o.className="slider";var h=document.createElement("ul");this._sliderUlEl=h;var d=this,c=this._options.fullImageMaxWidth,u=this._options.fullImageMaxHeight;s.each(this._model,function(e,t){var n=document.createElement("li"),i=document.createElement("img");if(i.setAttribute("name","image "+(t+1)),i.setAttribute("src",e.image_full),i.setAttribute("alt",e.title_text),n.appendChild(i),e.content_overlay)if(1===e.content_overlay.nodeType||11===e.content_overlay.nodeType)e.content_overlay=n.appendChild(e.content_overlay);else if("string"==typeof e.content_overlay){var o=document.createElement("div");o.className="content-overlay",o.innerHTML=e.content_overlay,e.content_overlay=n.appendChild(o)}if(h.appendChild(n),d._options.fixImageSizes){var s=function(e){var t=this.img,n=this.data;n.dims||(n.dims=e);var i=a([c,u],e),o=i[0],s=i[1],r=Math.floor((c-o)/2),l=Math.floor((u-s)/2);if(o!==c||s!==u){t.setAttribute("width",o),t.setAttribute("height",s);var h=t.style;r>0&&(h.paddingLeft=r+"px"),l>0&&(h.paddingBottom=l+"px")}};e.dims?s.call({img:i,data:e},e.dims):l({img:i,data:e},s)}}),o.appendChild(h),this._sliderEl=o;var m;if(this._showDescription){var p=this._model[this._index];m=document.createElement("div"),m.className=["article_text","example"+(3===this._options.layout?2:this._options.layout)].join(" "),m.innerHTML=p.title_link?['

    ',p.title_text,"

    ",p.description].join(""):["

    ",p.title_text,"

    ",p.description].join(""),this._articleTextDivEl=m}var f;this._showThumbs&&(f=document.createElement("div"),f.className="thumbs",h=document.createElement("ul"),h.className="unstyled",s.each(this._model,function(e,t){var n=document.createElement("li"),i=document.createElement("a");i.setAttribute("href","#");var o=document.createElement("img");o.setAttribute("name","thumb "+(t+1)),o.setAttribute("src",e.image_thumb),o.setAttribute("alt",t+1);var s=document.createElement("span");s.innerHTML=e.title_text,i.appendChild(o),i.appendChild(s),n.appendChild(i),h.appendChild(n)}),f.appendChild(h),this._thumbsDivEl=f,this._thumbsUlEl=h);var g=document.createElement("div");g.className="pagination";var _;return this._paginationHasPrevNext&&(_=document.createElement("a"),_.setAttribute("href","#"),_.className="previous",g.appendChild(_)),s.each(this._model,function(e,t){var n=document.createElement("a");n.setAttribute("href","#"),n.setAttribute("data-index",t),t===d._index&&(n.className="active"),g.appendChild(n)}),this._paginationHasPrevNext&&(_=document.createElement("a"),_.setAttribute("href","#"),_.className="next",g.appendChild(_)),this._paginationEl=g,0===this._options.layout?(t.appendChild(i),t.appendChild(o),t.appendChild(g),e.appendChild(t)):(1===this._options.layout||2===this._options.layout||3===this._options.layout)&&(t.appendChild(i),t.appendChild(o),t.appendChild(m),e.appendChild(t),3===this._options.layout?(this._thumbsUlEl.className="thumbs unstyled",n.addClassName(e,"rightNav"),e.appendChild(this._thumbsUlEl)):(f.appendChild(g),e.appendChild(f))),this._swipeDir="x",this._swipeThumbsDir=0===this._options.layout?"":3===this._options.layout?"y":"x",r._supported&&new r(e,{callback:Ink.bind(function(t,n){var i=this._isMeOrParent(n.target,this._thumbsUlEl),o=i?!1:this._isMeOrParent(n.target,e);!i&&!o||i&&!this._swipeThumbsDir||o&&n.axis!==this._swipeDir||i&&n.axis!==this._swipeThumbsDir||(0>n.dr[0]?i?this.thumbNext():this.next():i?this.thumbPrevious():this.previous())},this),maxDuration:.4,minDist:50}),e},_isMeOrParent:function(e,t){if(e){do{if(e===t)return!0;e=e.parentNode}while(e);return!1}},_onNavClick:function(e){var i,o=t.element(e);if(n.hasClassName(o,"previous"))i=-1;else{if(!n.hasClassName(o,"next"))return;i=1}t.stop(e),this.goTo(i,!0)},_onPaginationClick:function(e){var i=t.element(e),o=i.getAttribute("data-index"),s=!1;if(n.hasClassName(i,"previous"))o=-1,s=!0;else if(n.hasClassName(i,"next"))o=1,s=!0;else{if(null===o)return;o=parseInt(o,10)}t.stop(e),s?this.thumbGoTo(o,!0):this.goTo(o)},_onThumbsClick:function(e){var n=t.element(e);if("img"===n.nodeName.toLowerCase());else{if("span"!==n.nodeName.toLowerCase())return;n=o.select("> img",n.parentNode)[0]}t.stop(e);var i=parseInt(n.getAttribute("alt"),10)-1;this.goTo(i)},_onFocusBlur:function(e){this._isFocused="mouseover"===e.type},_onKeyDown:function(e){if(this._isFocused){var n=e.keyCode;if(37===n)this.previous();else{if(39!==n)return;this.next()}t.stop(e)}},_validateValue:function(t,n,i){if(!e.isInteger(t))throw new TypeError("1st parameter must be an integer number!");if(void 0!==n&&n!==!1&&n!==!0)throw new TypeError("2nd parameter must either be boolean or ommitted!");var o=i?this._thumbIndex:this._index;if(n&&(t+=o),this._options.circular)0>t?t=this._model.length-1:t>=this._model.length&&(t=0);else if(0>t||t>=this._model.length||t===o)return!1;return t},getIndex:function(){return this._index},getLength:function(){return this._model.length},goTo:function(e,t){if(e=this._validateValue(e,t,!1),e!==!1){this._index=e;var i=o.select("> a",this._paginationEl),r=this;if(s.each(i,function(e,t){n.setClassName(e,"active",t-(r._paginationHasPrevNext?1:0)===r._index)}),this._sliderUlEl.style.marginLeft=["-",this._options.fullImageMaxWidth*this._index,"px"].join(""),this._showDescription){var a=this._model[this._index];this._articleTextDivEl.innerHTML=a.title_link?['

    ',a.title_text,"

    ",a.description].join(""):["

    ",a.title_text,"

    ",a.description].join("")}}},thumbGoTo:function(e,t){if(e=this._validateValue(e,t,!0),e!==!1){this._thumbIndex=e;var n="margin"+("x"===this._swipeThumbsDir?"Left":"Top");this._thumbsUlEl.style[n]=["-",this._options.thumbnailMaxWidth*this._thumbIndex,"px"].join("")}},previous:function(){this.goTo(-1,!0)},next:function(){this.goTo(1,!0)},thumbPrevious:function(){this.thumbGoTo(-1,!0)},thumbNext:function(){this.thumbGoTo(1,!0)},destroy:e.destroyComponent},h}); -Ink.createModule("Ink.UI.FormValidator","1",["Ink.Dom.Css_1","Ink.Util.Validator_1"],function(e,t){"use strict";var n={version:"1",_flagMap:{"ink-fv-required":{msg:"Required field"},"ink-fv-email":{msg:"Invalid e-mail address"},"ink-fv-url":{msg:"Invalid URL"},"ink-fv-number":{msg:"Invalid number"},"ink-fv-phone_pt":{msg:"Invalid phone number"},"ink-fv-phone_cv":{msg:"Invalid phone number"},"ink-fv-phone_mz":{msg:"Invalid phone number"},"ink-fv-phone_ao":{msg:"Invalid phone number"},"ink-fv-date":{msg:"Invalid date"},"ink-fv-confirm":{msg:"Confirmation does not match"},"ink-fv-custom":{msg:""}},elements:{},confirmElms:{},hasConfirm:{},_errorClassName:"tip",_errorValidationClassName:"validaton",_errorTypeWarningClassName:"warning",_errorTypeErrorClassName:"error",validate:function(e,t){if(this._free(),t=Ink.extendObj({onSuccess:!1,onError:!1,customFlag:!1,confirmGroup:[]},t||{}),"string"==typeof e&&(e=document.getElementById(e)),null===e)return!1;this.element=e,(this.element.id===void 0||null===this.element.id||""===this.element.id)&&(this.element.id="ink-fv_randomid_"+Math.round(99999*Math.random())),this.custom=t.customFlag,this.confirmGroup=t.confirmGroup;var n=this._validateElements();return n.length>0?(t.onError?t.onError(n):this._showError(e,n),!1):(t.onError||this._clearError(e),this._clearCache(),t.onSuccess&&t.onSuccess(),!0)},reset:function(){this._clearError(),this._clearCache()},_free:function(){this.element=null,this.custom=!1,this.confirmGroup=!1},_clearCache:function(){this.element=null,this.elements=[],this.custom=!1,this.confirmGroup=!1},_getElements:function(){this.elements[this.element.id]=[],this.confirmElms[this.element.id]=[],console.log(this.element),console.log(this.element.elements);for(var t=this.element.elements,n=!1,i=0,o=t.length;o>i;i++)if(n=t[i],null!==n.getAttribute("type")&&"radio"===n.getAttribute("type").toLowerCase()){if(0===this.elements[this.element.id].length||n.getAttribute("type")!==this.elements[this.element.id][this.elements[this.element.id].length-1].getAttribute("type")&&n.getAttribute("name")!==this.elements[this.element.id][this.elements[this.element.id].length-1].getAttribute("name"))for(var r in this._flagMap)if(e.hasClassName(n,r)){this.elements[this.element.id].push(n);break}}else{for(var s in this._flagMap)if(e.hasClassName(n,s)&&"ink-fv-confirm"!==s){this.elements[this.element.id].push(n);break}e.hasClassName(n,"ink-fv-confirm")&&(this.confirmElms[this.element.id].push(n),this.hasConfirm[this.element.id]=!0)}},_validateElements:function(){var t;this._getElements(),this.hasConfirm[this.element.id]!==void 0&&this.hasConfirm[this.element.id]===!0&&(t=this._makeConfirmGroups());for(var n,i=[],o=!1,r=!1,s=0,a=this.elements[this.element.id].length;a>s;s++)if(n=!1,o=this.elements[this.element.id][s],!o.disabled)for(var l in this._flagMap)e.hasClassName(o,l)&&("ink-fv-custom"!==l&&"ink-fv-confirm"!==l?this._isValid(o,l)||(n?i[i.length-1].errors.push(l):(i.push({elm:o,errors:[l]}),n=!0)):"ink-fv-confirm"!==l&&(r=this._isCustomValid(o),r.length>0&&i.push({elm:o,errors:[l],custom:r})));return i=this._validateConfirmGroups(t,i)},_validateConfirmGroups:function(e,t){var n=!1;for(var i in e)n=e[i],2===n.length&&n[0].value!==n[1].value&&t.push({elm:n[1],errors:["ink-fv-confirm"]});return t},_makeConfirmGroups:function(){var t;if(this.confirmGroup&&this.confirmGroup.length>0){t={};for(var n=!1,i=!1,o=0,r=this.confirmElms[this.element.id].length;r>o;o++){n=this.confirmElms[this.element.id][o];for(var s=0,a=this.confirmGroup.length;a>s;s++)i=this.confirmGroup[s],e.hasClassName(n,i)&&(t[i]===void 0?t[i]=[n]:t[i].push(n))}return t}return 2===this.confirmElms[this.element.id].length&&(t={"ink-fv-confirm":[this.confirmElms[this.element.id][0],this.confirmElms[this.element.id][1]]}),t},_isCustomValid:function(t){for(var n=[],i=!1,o=0,r=this.custom.length;r>o;o++)i=this.custom[o],e.hasClassName(t,i.flag)&&(i.callback(t,i.msg)||n.push({flag:i.flag,msg:i.msg}));return n},_isValid:function(n,i){switch(i){case"ink-fv-required":if("select"===n.nodeName.toLowerCase())return n.selectedIndex>0?!0:!1;if("checkbox"!==n.getAttribute("type")&&"radio"!==n.getAttribute("type")){if(""!==this._trim(n.value))return!0}else if("checkbox"===n.getAttribute("type")){if(n.checked===!0)return!0}else if("radio"===n.getAttribute("type")){var o=n.form[n.name];o.length===void 0&&(o=[o]);for(var r=!1,s=0,a=o.length;a>s;s++)o[s].checked===!0&&(r=!0);return r}break;case"ink-fv-email":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.mail(n.value))return!0;break;case"ink-fv-url":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.url(n.value))return!0;break;case"ink-fv-number":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(!isNaN(Number(n.value)))return!0;break;case"ink-fv-phone_pt":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isPTPhone(n.value))return!0;break;case"ink-fv-phone_cv":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isCVPhone(n.value))return!0;break;case"ink-fv-phone_ao":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isAOPhone(n.value))return!0;break;case"ink-fv-phone_mz":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isMZPhone(n.value))return!0;break;case"ink-fv-date":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;var l=Ink.getModule("Ink.Dom.Element",1),h=l.data(n),d="yyyy-mm-dd";if(e.hasClassName(n,"ink-datepicker")&&"format"in h?d=h.format:"validFormat"in h&&(d=h.validFormat),!(d in t._dateParsers)){var c=[];for(val in t._dateParsers)c.push(val);throw"The attribute data-valid-format must be one of the following values: "+c.join(",")}return t.isDate(d,n.value);case"ink-fv-custom":}return!1},_showError:function(t,n){this._clearError(t);for(var i=!1,o=0,r=n.length;r>o;o++)if(i=n[o].elm,"radio"!==i.getAttribute("type")){var s=document.createElement("p");s.className=this._errorClassName,s.className+=" ".this._errorTypeErrorClassName,s.innerHTML="ink-fv-custom"!==n[o].errors[0]?this._flagMap[n[o].errors[0]].msg:n[o].custom[0].msg,"checkbox"!==i.getAttribute("type")&&(i.nextSibling.parentNode.insertBefore(s,i.nextSibling),e.hasClassName(i.parentNode,"control")&&(e.addClassName(i.parentNode.parentNode,"validation"),"ink-fv-required"===n[o].errors[0]?e.addClassName(i.parentNode.parentNode,"error"):e.addClassName(i.parentNode.parentNode,"warning")))}else e.hasClassName(i.parentNode.parentNode,"control-group")&&(e.addClassName(i.parentNode.parentNode,"validation"),e.addClassName(i.parentNode.parentNode,"error"))},_clearError:function(t){for(var n=t.getElementsByTagName("p"),i=!1,o=n.length-1;o>=0;o--)i=n[o],e.hasClassName(i,this._errorClassName)&&(e.hasClassName(i.parentNode,"control")&&(e.removeClassName(i.parentNode.parentNode,"validation"),e.removeClassName(i.parentNode.parentNode,"error"),e.removeClassName(i.parentNode.parentNode,"warning")),e.hasClassName(i,"tip")&&e.hasClassName(i,"error")&&i.parentNode.removeChild(i));var r=t.getElementsByTagName("ul");for(o=r.length-1;o>=0;o--)i=r[o],e.hasClassName(i,"control-group")&&(e.removeClassName(i,"validation"),e.removeClassName(i,"error"))},_trim:function(e){return"string"==typeof e?e.replace(/^\s+|\s+$|\n+$/g,""):void 0}};return n}); +Ink.createModule("Ink.UI.FormValidator","1",["Ink.Dom.Css_1","Ink.Util.Validator_1"],function(e,t){"use strict";var n={version:"1",_flagMap:{"ink-fv-required":{msg:"Required field"},"ink-fv-email":{msg:"Invalid e-mail address"},"ink-fv-url":{msg:"Invalid URL"},"ink-fv-number":{msg:"Invalid number"},"ink-fv-phone_pt":{msg:"Invalid phone number"},"ink-fv-phone_cv":{msg:"Invalid phone number"},"ink-fv-phone_mz":{msg:"Invalid phone number"},"ink-fv-phone_ao":{msg:"Invalid phone number"},"ink-fv-date":{msg:"Invalid date"},"ink-fv-confirm":{msg:"Confirmation does not match"},"ink-fv-custom":{msg:""}},elements:{},confirmElms:{},hasConfirm:{},_errorClassName:"tip",_errorValidationClassName:"validaton",_errorTypeWarningClassName:"warning",_errorTypeErrorClassName:"error",validate:function(e,t){if(this._free(),t=Ink.extendObj({onSuccess:!1,onError:!1,customFlag:!1,confirmGroup:[]},t||{}),"string"==typeof e&&(e=document.getElementById(e)),null===e)return!1;this.element=e,(this.element.id===void 0||null===this.element.id||""===this.element.id)&&(this.element.id="ink-fv_randomid_"+Math.round(99999*Math.random())),this.custom=t.customFlag,this.confirmGroup=t.confirmGroup;var n=this._validateElements();return n.length>0?(t.onError?t.onError(n):this._showError(e,n),!1):(t.onError||this._clearError(e),this._clearCache(),t.onSuccess&&t.onSuccess(),!0)},reset:function(){this._clearError(),this._clearCache()},_free:function(){this.element=null,this.custom=!1,this.confirmGroup=!1},_clearCache:function(){this.element=null,this.elements=[],this.custom=!1,this.confirmGroup=!1},_getElements:function(){this.elements[this.element.id]=[],this.confirmElms[this.element.id]=[];for(var t=this.element.elements,n=!1,i=0,o=t.length;o>i;i++)if(n=t[i],null!==n.getAttribute("type")&&"radio"===n.getAttribute("type").toLowerCase()){if(0===this.elements[this.element.id].length||n.getAttribute("type")!==this.elements[this.element.id][this.elements[this.element.id].length-1].getAttribute("type")&&n.getAttribute("name")!==this.elements[this.element.id][this.elements[this.element.id].length-1].getAttribute("name"))for(var r in this._flagMap)if(e.hasClassName(n,r)){this.elements[this.element.id].push(n);break}}else{for(var s in this._flagMap)if(e.hasClassName(n,s)&&"ink-fv-confirm"!==s){this.elements[this.element.id].push(n);break}e.hasClassName(n,"ink-fv-confirm")&&(this.confirmElms[this.element.id].push(n),this.hasConfirm[this.element.id]=!0)}},_validateElements:function(){var t;this._getElements(),this.hasConfirm[this.element.id]!==void 0&&this.hasConfirm[this.element.id]===!0&&(t=this._makeConfirmGroups());for(var n,i=[],o=!1,r=!1,s=0,a=this.elements[this.element.id].length;a>s;s++)if(n=!1,o=this.elements[this.element.id][s],!o.disabled)for(var l in this._flagMap)e.hasClassName(o,l)&&("ink-fv-custom"!==l&&"ink-fv-confirm"!==l?this._isValid(o,l)||(n?i[i.length-1].errors.push(l):(i.push({elm:o,errors:[l]}),n=!0)):"ink-fv-confirm"!==l&&(r=this._isCustomValid(o),r.length>0&&i.push({elm:o,errors:[l],custom:r})));return i=this._validateConfirmGroups(t,i)},_validateConfirmGroups:function(e,t){var n=!1;for(var i in e)n=e[i],2===n.length&&n[0].value!==n[1].value&&t.push({elm:n[1],errors:["ink-fv-confirm"]});return t},_makeConfirmGroups:function(){var t;if(this.confirmGroup&&this.confirmGroup.length>0){t={};for(var n=!1,i=!1,o=0,r=this.confirmElms[this.element.id].length;r>o;o++){n=this.confirmElms[this.element.id][o];for(var s=0,a=this.confirmGroup.length;a>s;s++)i=this.confirmGroup[s],e.hasClassName(n,i)&&(t[i]===void 0?t[i]=[n]:t[i].push(n))}return t}return 2===this.confirmElms[this.element.id].length&&(t={"ink-fv-confirm":[this.confirmElms[this.element.id][0],this.confirmElms[this.element.id][1]]}),t},_isCustomValid:function(t){for(var n=[],i=!1,o=0,r=this.custom.length;r>o;o++)i=this.custom[o],e.hasClassName(t,i.flag)&&(i.callback(t,i.msg)||n.push({flag:i.flag,msg:i.msg}));return n},_isValid:function(n,i){switch(i){case"ink-fv-required":if("select"===n.nodeName.toLowerCase())return n.selectedIndex>0?!0:!1;if("checkbox"!==n.getAttribute("type")&&"radio"!==n.getAttribute("type")){if(""!==this._trim(n.value))return!0}else if("checkbox"===n.getAttribute("type")){if(n.checked===!0)return!0}else if("radio"===n.getAttribute("type")){var o=n.form[n.name];o.length===void 0&&(o=[o]);for(var r=!1,s=0,a=o.length;a>s;s++)o[s].checked===!0&&(r=!0);return r}break;case"ink-fv-email":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.mail(n.value))return!0;break;case"ink-fv-url":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.url(n.value))return!0;break;case"ink-fv-number":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(!isNaN(Number(n.value)))return!0;break;case"ink-fv-phone_pt":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isPTPhone(n.value))return!0;break;case"ink-fv-phone_cv":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isCVPhone(n.value))return!0;break;case"ink-fv-phone_ao":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isAOPhone(n.value))return!0;break;case"ink-fv-phone_mz":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;if(t.isMZPhone(n.value))return!0;break;case"ink-fv-date":if(""===this._trim(n.value))return e.hasClassName(n,"ink-fv-required")?!1:!0;var l=Ink.getModule("Ink.Dom.Element",1),h=l.data(n),d="yyyy-mm-dd";if(e.hasClassName(n,"ink-datepicker")&&"format"in h?d=h.format:"validFormat"in h&&(d=h.validFormat),!(d in t._dateParsers)){var c=[];for(var u in t._dateParsers)c.push(u);throw"The attribute data-valid-format must be one of the following values: "+c.join(",")}return t.isDate(d,n.value);case"ink-fv-custom":}return!1},_showError:function(t,n){this._clearError(t);for(var i=!1,o=0,r=n.length;r>o;o++)if(i=n[o].elm,"radio"!==i.getAttribute("type")){var s=document.createElement("p");e.addClassName(s,this._errorClassName),e.addClassName(s,this._errorTypeErrorClassName),s.innerHTML="ink-fv-custom"!==n[o].errors[0]?this._flagMap[n[o].errors[0]].msg:n[o].custom[0].msg,"checkbox"!==i.getAttribute("type")&&(i.nextSibling.parentNode.insertBefore(s,i.nextSibling),e.hasClassName(i.parentNode,"control")&&(e.addClassName(i.parentNode.parentNode,"validation"),"ink-fv-required"===n[o].errors[0]?e.addClassName(i.parentNode.parentNode,"error"):e.addClassName(i.parentNode.parentNode,"warning")))}else e.hasClassName(i.parentNode.parentNode,"control-group")&&(e.addClassName(i.parentNode.parentNode,"validation"),e.addClassName(i.parentNode.parentNode,"error"))},_clearError:function(t){for(var n=t.getElementsByTagName("p"),i=!1,o=n.length-1;o>=0;o--)i=n[o],e.hasClassName(i,this._errorClassName)&&(e.hasClassName(i.parentNode,"control")&&(e.removeClassName(i.parentNode.parentNode,"validation"),e.removeClassName(i.parentNode.parentNode,"error"),e.removeClassName(i.parentNode.parentNode,"warning")),e.hasClassName(i,"tip")&&e.hasClassName(i,"error")&&i.parentNode.removeChild(i));var r=t.getElementsByTagName("ul");for(o=r.length-1;o>=0;o--)i=r[o],e.hasClassName(i,"control-group")&&(e.removeClassName(i,"validation"),e.removeClassName(i,"error"))},_trim:function(e){return"string"==typeof e?e.replace(/^\s+|\s+$|\n+$/g,""):void 0}};return n}); Ink.createModule("Ink.UI.Droppable","1",["Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Css_1"],function(e,t,n){var i={debug:!1,_elements:{},add:function(e,t){var n=Ink.extendObj({hoverclass:!1,accept:!1,onHover:!1,onDrop:!1,onDropOut:!1},t||{});e=Ink.i(e),n.accept&&n.accept.constructor===Array&&(n.accept=n.accept.join()),this._elements[e.id]={options:n},this.update(e.id)},updateAll:function(){for(var e in this._elements)this._elements.hasOwnProperty(e)&&this.update(Ink.i(e))},update:function(t){t=Ink.i(t);var n=this._elements[t.id];n&&(n.left=e.offsetLeft(t),n.top=e.offsetTop(t),n.right=n.left+e.elementWidth(t),n.bottom=n.top+e.elementHeight(t))},remove:function(e){e=Ink.i(e),delete this._elements[e.id]},action:function(e,t,i,o){var r,s,a,l,h;for(var d in this._elements)if(this._elements.hasOwnProperty(d))if(l=this._elements[d],r=l.options,a=!1,h=Ink.i(d),e.x>=l.left&&e.x<=l.right&&e.y>=l.top&&e.y<=l.bottom){if(r.accept){s=o.className.split(" ");for(var c=0,u=s.length;u>c;c++)r.accept.search(s[c])>=0&&o!==h&&(a=!0)}else a=!0;a&&("drag"===t?(r.hoverclass&&n.addClassName(h,r.hoverclass),r.onHover&&r.onHover(o,h)):"drop"===t&&r.onDrop&&(r.hoverclass&&n.removeClassName(h,r.hoverclass),r.onDrop&&r.onDrop(o,h,i)))}else"drag"===t&&r.hoverclass&&n.removeClassName(h,r.hoverclass),"drop"===t&&r.onDropOut&&r.onDropOut(o,h,i)}};return i}); Ink.createModule("Ink.UI.Draggable","1",["Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Browser_1","Ink.UI.Droppable_1"],function(e,t,n,i,o){var s=function(e,t){this.init(e,t)};return s.prototype={init:function(n,o){var s=Ink.extendObj({constraint:!1,top:0,right:e.pageWidth(),bottom:e.pageHeight(),left:0,handler:!1,revert:!1,cursor:"move",zindex:9999,onStart:!1,onEnd:!1,onDrag:!1,onChange:!1,droppableProxy:!1,mouseAnchor:void 0,skipChildren:!0,debug:!1},o||{});this.options=s,this.element=Ink.i(n),this.handle=!1,this.elmStartPosition=!1,this.active=!1,this.dragged=!1,this.prevCoords=!1,this.placeholder=!1,this.position=!1,this.zindex=!1,this.firstDrag=!0,s.fps&&(this.deltaMs=1e3/s.fps,this.lastRanAt=0),this.handlers={},this.handlers.start=Ink.bindEvent(this._onStart,this),this.handlers.dragFacade=Ink.bindEvent(this._onDragFacade,this),this.handlers.drag=Ink.bindEvent(this._onDrag,this),this.handlers.end=Ink.bindEvent(this._onEnd,this),this.handlers.selectStart=function(e){return t.stop(e),!1},this.handle=this.options.handler?Ink.i(this.options.handler):this.element,this.handle.style.cursor=s.cursor,s.right!==!1&&(this.options.right=s.right-e.elementWidth(n)),s.bottom!==!1&&(this.options.bottom=s.bottom-e.elementHeight(n)),t.observe(this.handle,"touchstart",this.handlers.start),t.observe(this.handle,"mousedown",this.handlers.start),i.IE&&t.observe(this.element,"selectstart",this.handlers.selectStart)},destroy:function(){t.stopObserving(this.handle,"touchstart",this.handlers.start),t.stopObserving(this.handle,"mousedown",this.handlers.start),i.IE&&t.stopObserving(this.element,"selectstart",this.handlers.selectStart)},_getPageScroll:function(){return self.pageXOffset!==void 0?[self.pageXOffset,self.pageYOffset]:document.documentElement!==void 0&&document.documentElement.scrollLeft!==void 0?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[document.body.scrollLeft,document.body.scrollTop]},_getCoords:function(e){var t=this._getPageScroll();return{x:(e.touches?e.touches[0].clientX:e.clientX)+t[0],y:(e.touches?e.touches[0].clientY:e.clientY)+t[1]}},_cloneStyle:function(t,i){i.className=t.className,i.style.borderWidth="0",i.style.padding="0",i.style.position="absolute",i.style.width=e.elementWidth(t)+"px",i.style.height=e.elementHeight(t)+"px",i.style.left=e.elementLeft(t)+"px",i.style.top=e.elementTop(t)+"px",i.style.cssFloat=n.getStyle(t,"float"),i.style.display=n.getStyle(t,"display")},_onStart:function(i){if(!this.active&&t.isLeftClick(i)||i.button===void 0){var o=i.target||i.srcElement;if(this.options.skipChildren&&o!==this.element)return;t.stop(i),this.elmStartPosition=[e.elementLeft(this.element),e.elementTop(this.element)];var s=[parseInt(n.getStyle(this.element,"left"),10),parseInt(n.getStyle(this.element,"top"),10)],r=[e.elementWidth(this.element),e.elementHeight(this.element)];this.originalPosition=[s[0]?s[0]:null,s[1]?s[1]:null],this.delta=this._getCoords(i),this.active=!0,this.position=n.getStyle(this.element,"position"),this.zindex=n.getStyle(this.element,"zIndex");var a=document.createElement("div");if(a.style.position=this.position,a.style.width=r[0]+"px",a.style.height=r[1]+"px",a.style.marginTop=n.getStyle(this.element,"margin-top"),a.style.marginBottom=n.getStyle(this.element,"margin-bottom"),a.style.marginLeft=n.getStyle(this.element,"margin-left"),a.style.marginRight=n.getStyle(this.element,"margin-right"),a.style.borderWidth="0",a.style.padding="0",a.style.cssFloat=n.getStyle(this.element,"float"),a.style.display=n.getStyle(this.element,"display"),a.style.visibility="hidden",this.delta2=[this.delta.x-this.elmStartPosition[0],this.delta.y-this.elmStartPosition[1]],this.options.mouseAnchor){var l=this.options.mouseAnchor.split(" "),h=[r[0],r[1]];"left"===l[0]?h[0]=0:"center"===l[0]&&(h[0]=parseInt(h[0]/2,10)),"top"===l[1]?h[1]=0:"center"===l[1]&&(h[1]=parseInt(h[1]/2,10)),this.applyDelta=[this.delta2[0]-h[0],this.delta2[1]-h[1]]}if(this.placeholder=a,this.options.onStart&&this.options.onStart(this.element,i),this.options.droppableProxy){this.proxy=document.createElement("div"),r=[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight];var d=this.proxy.style;d.width=r[0]+"px",d.height=r[1]+"px",d.position="fixed",d.left="0",d.top="0",d.zIndex=this.options.zindex+1,d.backgroundColor="#FF0000",n.setOpacity(this.proxy,0);for(var c=document.body.firstChild;c&&1!==c.nodeType;)c=c.nextSibling;document.body.insertBefore(this.proxy,c),t.observe(this.proxy,"mousemove",this.handlers[this.options.fps?"dragFacade":"drag"]),t.observe(this.proxy,"touchmove",this.handlers[this.options.fps?"dragFacade":"drag"])}else t.observe(document,"mousemove",this.handlers[this.options.fps?"dragFacade":"drag"]);return this.element.style.position="absolute",this.element.style.zIndex=this.options.zindex,this.element.parentNode.insertBefore(this.placeholder,this.element),this._onDrag(i),t.observe(document,"mouseup",this.handlers.end),t.observe(document,"touchend",this.handlers.end),!1}},_onDragFacade:function(e){var t=(new Date).getTime();(!this.lastRanAt||t>this.lastRanAt+this.deltaMs)&&(this.lastRanAt=t,this._onDrag(e))},_onDrag:function(e){if(this.active){t.stop(e),this.dragged=!0;var n=this._getCoords(e),i=n.x,s=n.y,r=this.options,a=!1,l=!1;if(this.prevCoords||(this.prevCoords={x:0,y:0}),i!==this.prevCoords.x||s!==this.prevCoords.y){if(r.onDrag&&r.onDrag(this.element,e),this.prevCoords=n,a=this.elmStartPosition[0]+i-this.delta.x,l=this.elmStartPosition[1]+s-this.delta.y,("horizontal"===r.constraint||"both"===r.constraint)&&(r.right!==!1&&a>r.right&&(a=r.right),r.left!==!1&&r.left>a&&(a=r.left)),("vertical"===r.constraint||"both"===r.constraint)&&(r.bottom!==!1&&l>r.bottom&&(l=r.bottom),r.top!==!1&&r.top>l&&(l=r.top)),this.firstDrag&&(o&&o.updateAll(),this.firstDrag=!1),a&&(this.element.style.left=a+"px"),l&&(this.element.style.top=l+"px"),o){var h=this.options.mouseAnchor?{x:i-this.applyDelta[0],y:s-this.applyDelta[1]}:n;o.action(h,"drag",e,this.element)}r.onChange&&r.onChange(this)}}},_onEnd:function(e){t.stopObserving(document,"mousemove",this.handlers.drag),t.stopObserving(document,"touchmove",this.handlers.drag),this.options.fps&&this._onDrag(e),this.active&&this.dragged&&(this.options.droppableProxy&&document.body.removeChild(this.proxy),this.pt&&(this.pt.parentNode.removeChild(this.pt),this.pt=void 0),this.placeholder&&this.placeholder.parentNode.removeChild(this.placeholder),this.options.revert&&(this.element.style.position=this.position,this.element.style.zIndex=null!==this.zindex?this.zindex:"auto",this.element.style.left=this.originalPosition[0]?this.originalPosition[0]+"px":"",this.element.style.top=this.originalPosition[1]?this.originalPosition[1]+"px":""),this.options.onEnd&&this.options.onEnd(this.element,e),o&&o.action(this._getCoords(e),"drop",e,this.element),this.position=!1,this.zindex=!1,this.firstDrag=!0),this.active=!1,this.dragged=!1}},s}); Ink.createModule("Ink.UI.DatePicker","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1","Ink.Util.Date_1"],function(e,t,i,n,o,s,r){"use strict";var a=function(t,i){t&&(this._dataField=e.elOrSelector(t,"1st argument")),this._options=Ink.extendObj({instance:"scdp_"+Math.round(99999*Math.random()),format:"yyyy-mm-dd",cssClass:"sapo_component_datepicker",position:"right",onFocus:!0,onYearSelected:void 0,onMonthSelected:void 0,validDayFn:void 0,startDate:!1,onSetDate:!1,displayInSelect:!1,showClose:!0,showClean:!0,yearRange:!1,dateRange:!1,startWeekDay:1,closeText:"Close",cleanText:"Clear",prevLinkText:"«",nextLinkText:"»",ofText:" de ",month:{1:"January",2:"February",3:"March",4:"April",5:"May",6:"June",7:"July",8:"August",9:"September",10:"October",11:"November",12:"December"},wDay:{0:"Sunday",1:"Monday",2:"Tuesday",3:"Wednesday",4:"Thursday",5:"Friday",6:"Saturday"}},n.data(this._dataField)||{}),this._options=Ink.extendObj(this._options,i||{}),this._options.format=this._dateParsers[this._options.format]||this._options.format,this._hoverPicker=!1,this._picker=null,this._options.pickerField&&(this._picker=e.elOrSelector(this._options.pickerField,"pickerField")),this._today=new Date,this._day=this._today.getDate(),this._month=this._today.getMonth(),this._year=this._today.getFullYear(),this._setMinMax(this._options.dateRange||this._options.yearRange),this._data=new Date(Date.UTC.apply(this,this._checkDateRange(this._year,this._month,this._day))),this._options.startDate&&"string"==typeof this._options.startDate&&/\d\d\d\d\-\d\d\-\d\d/.test(this._options.startDate)&&this.setDate(this._options.startDate),this._init(),this._render(),this._options.startDate||this._dataField&&"string"==typeof this._dataField.value&&this._dataField.value&&this.setDate(this._dataField.value),e.registerInstance(this,this._containerObject,"datePicker")};return a.prototype={version:"0.1",_init:function(){Ink.extendObj(this._options,this._lang||{})},_render:function(){this._containerObject=document.createElement("div"),this._containerObject.id=this._options.instance,this._containerObject.className="sapo_component_datepicker";var i=document.getElementsByTagName("body")[0];if(this._options.showClose||this._options.showClean){if(this._superTopBar=document.createElement("div"),this._superTopBar.className="sapo_cal_top_options",this._options.showClean){var o=document.createElement("a");o.className="clean",o.innerHTML=this._options.cleanText,this._superTopBar.appendChild(o)}if(this._options.showClose){var s=document.createElement("a");s.className="close",s.innerHTML=this._options.closeText,this._superTopBar.appendChild(s)}this._containerObject.appendChild(this._superTopBar)}var r=document.createElement("div");r.className="sapo_cal_top",this._monthDescContainer=document.createElement("div"),this._monthDescContainer.className="sapo_cal_month_desc",this._monthPrev=document.createElement("div"),this._monthPrev.className="sapo_cal_prev",this._monthPrev.innerHTML=''+this._options.prevLinkText+"",this._monthNext=document.createElement("div"),this._monthNext.className="sapo_cal_next",this._monthNext.innerHTML=''+this._options.nextLinkText+"",r.appendChild(this._monthPrev),r.appendChild(this._monthDescContainer),r.appendChild(this._monthNext),this._monthContainer=document.createElement("div"),this._monthContainer.className="sapo_cal_month",this._containerObject.appendChild(r),this._containerObject.appendChild(this._monthContainer),this._monthSelector=document.createElement("ul"),this._monthSelector.className="sapo_cal_month_selector";for(var a,l,h=1;12>=h;h++)0===(h-1)%4&&(a=document.createElement("ul")),l=document.createElement("li"),l.innerHTML=''+this._options.month[h].substring(0,3)+"",a.appendChild(l),0===h%4&&this._monthSelector.appendChild(a);if(this._containerObject.appendChild(this._monthSelector),this._yearSelector=document.createElement("ul"),this._yearSelector.className="sapo_cal_year_selector",this._containerObject.appendChild(this._yearSelector),(!this._options.onFocus||this._options.displayInSelect)&&(this._options.pickerField?this._picker=e.elOrSelector(this._options.pickerField,"pickerField"):(this._picker=document.createElement("a"),this._picker.href="#open_cal",this._picker.innerHTML="open",this._picker.style.position="absolute",this._picker.style.top=n.elementTop(this._dataField),this._picker.style.left=n.elementLeft(this._dataField)+(n.elementWidth(this._dataField)||0)+5+"px",this._dataField.parentNode.appendChild(this._picker),this._picker.className="sapo_cal_date_picker")),this._options.displayInSelect){if(!(this._options.dayField&&this._options.monthField&&this._options.yearField||this._options.pickerField))throw"To use display in select you *MUST* to set dayField, monthField, yearField and pickerField!";this._options.dayField=e.elOrSelector(this._options.dayField,"dayField"),this._options.monthField=e.elOrSelector(this._options.monthField,"monthField"),this._options.yearField=e.elOrSelector(this._options.yearField,"yearField")}i.insertBefore(this._containerObject,i.childNodes[0]),this._picker?t.observe(this._picker,"click",Ink.bindEvent(function(e){t.stop(e),this._containerObject=n.clonePosition(this._containerObject,this._picker),this._updateDate(),this._showMonth(),this._containerObject.style.display="block"},this)):t.observe(this._dataField,"focus",Ink.bindEvent(function(){this._containerObject=n.clonePosition(this._containerObject,this._dataField),"bottom"===this._options.position?(this._containerObject.style.top=n.elementHeight(this._dataField)+n.offsetTop(this._dataField)+"px",this._containerObject.style.left=n.offset2(this._dataField)[0]+"px"):(this._containerObject.style.top=n.offset2(this._dataField)[1]+"px",this._containerObject.style.left=n.elementWidth(this._dataField)+n.offset2(this._dataField)[0]+"px"),this._updateDate(),this._showMonth(),this._containerObject.style.display="block"},this)),this._options.displayInSelect?(t.observe(this._options.dayField,"change",Ink.bindEvent(function(){var e=this._options.yearField[this._options.yearField.selectedIndex].value;""!==e&&0!==e&&(this._updateDate(),this._showDefaultView())},this)),t.observe(this._options.monthField,"change",Ink.bindEvent(function(){var e=this._options.yearField[this._options.yearField.selectedIndex].value;""!==e&&0!==e&&(this._updateDate(),this._showDefaultView())},this)),t.observe(this._options.yearField,"change",Ink.bindEvent(function(){this._updateDate(),this._showDefaultView()},this))):(t.observe(this._dataField,"change",Ink.bindEvent(function(){this._updateDate(),this._showDefaultView(),this.setDate(),this._hoverPicker||(this._containerObject.style.display="none")},this)),t.observe(this._dataField,"blur",Ink.bindEvent(function(){this._hoverPicker||(this._containerObject.style.display="none")},this))),t.observe(document,"click",Ink.bindEvent(function(e){void 0===e.target&&(e.target=e.srcElement),n.descendantOf(this._containerObject,e.target)||e.target===this._dataField||(this._picker?e.target===this._picker||this._options.displayInSelect&&(e.target===this._options.dayField||e.target===this._options.monthField||e.target===this._options.yearField)||this._options.dayField&&(n.descendantOf(this._options.dayField,e.target)||n.descendantOf(this._options.monthField,e.target)||n.descendantOf(this._options.yearField,e.target))||(this._containerObject.style.display="none"):this._containerObject.style.display="none")},this)),this._showMonth(),this._monthChanger=document.createElement("a"),this._monthChanger.href="#monthchanger",this._monthChanger.className="sapo_cal_link_month",this._monthChanger.innerHTML=this._options.month[this._month+1],this._deText=document.createElement("span"),this._deText.innerHTML=this._options._deText,this._yearChanger=document.createElement("a"),this._yearChanger.href="#yearchanger",this._yearChanger.className="sapo_cal_link_year",this._yearChanger.innerHTML=this._year,this._monthDescContainer.innerHTML="",this._monthDescContainer.appendChild(this._monthChanger),this._monthDescContainer.appendChild(this._deText),this._monthDescContainer.appendChild(this._yearChanger),t.observe(this._containerObject,"mouseover",Ink.bindEvent(function(e){t.stop(e),this._hoverPicker=!0},this)),t.observe(this._containerObject,"mouseout",Ink.bindEvent(function(e){t.stop(e),this._hoverPicker=!1},this)),t.observe(this._containerObject,"click",Ink.bindEvent(function(e){e.target===void 0&&(e.target=e.srcElement);var i=e.target.className,n=-1!==i.indexOf("sapo_cal_off");if(t.stop(e),0!==i.indexOf("sapo_cal_")||n)if(0!==i.indexOf("sapo_calmonth_")||n)if(0!==i.indexOf("sapo_calyear_")||n)0!==i.indexOf("change_month_")||n?0!==i.indexOf("change_year_")||n?"clean"===i?this._options.displayInSelect?(this._options.yearField.selectedIndex=0,this._options.monthField.selectedIndex=0,this._options.dayField.selectedIndex=0):this._dataField.value="":"close"===i&&(this._containerObject.style.display="none"):"change_year_next"===i?this._showYearSelector(1):"change_year_prev"===i&&this._showYearSelector(-1):"change_month_next"===i?this._updateCal(1):"change_month_prev"===i&&this._updateCal(-1);else{var o=i.substr(13,4);Number(o)&&(this._year=o,"function"==typeof this._options.onYearSelected&&this._options.onYearSelected(this,{year:this._year}),this._monthPrev.childNodes[0].className="action_inactive",this._monthNext.childNodes[0].className="action_inactive",this._yearSelector.style.display="none",this._setActiveMonth(),this._monthSelector.style.display="block")}else{var s=i.substr(14,2);Number(s)&&(this._month=s-1,this._monthSelector.style.display="none",this._monthPrev.childNodes[0].className="change_month_prev",this._monthNext.childNodes[0].className="change_month_next",this._yearthis._yearMax||this._year===this._yearMax&&this._month>=this._monthMax)&&(this._monthNext.childNodes[0].className="action_inactive"),this._updateCal(),this._monthContainer.style.display="block")}else{var r=i.substr(9,2);Number(r)?(this.setDate(this._year+"-"+(this._month+1)+"-"+r),this._containerObject.style.display="none"):"sapo_cal_link_month"===i?(this._monthContainer.style.display="none",this._yearSelector.style.display="none",this._monthPrev.childNodes[0].className="action_inactive",this._monthNext.childNodes[0].className="action_inactive",this._setActiveMonth(),this._monthSelector.style.display="block"):"sapo_cal_link_year"===i&&(this._monthPrev.childNodes[0].className="action_inactive",this._monthNext.childNodes[0].className="action_inactive",this._monthSelector.style.display="none",this._monthContainer.style.display="none",this._showYearSelector(),this._yearSelector.style.display="block")}this._updateDescription()},this))},_setMinMax:function(e){var t;if(e){var i=e.split(":"),n=/^(\d{4})((\-)(\d{1,2})((\-)(\d{1,2}))?)?$/;if(i[0]&&("NOW"===i[0]?(this._yearMin=this._today.getFullYear(),this._monthMin=this._today.getMonth()+1,this._dayMin=this._today.getDate()):n.test(i[0])?(t=i[0].split("-"),this._yearMin=Math.floor(t[0]),this._monthMin=Math.floor(t[1])||1,this._dayMin=Math.floor(t[2])||1,this._monthMin>1&&this._monthMin>12&&(this._monthMin=1,this._dayMin=1),this._dayMin>1&&this._dayMin>this._daysInMonth(this._yearMin,this._monthMin)&&(this._dayMin=1)):(this._yearMin=Number.MIN_VALUE,this._monthMin=1,this._dayMin=1)),i[1])if("NOW"===i[1])this._yearMax=this._today.getFullYear(),this._monthMax=this._today.getMonth()+1,this._dayMax=this._today.getDate();else if(n.test(i[1])){t=i[1].split("-"),this._yearMax=Math.floor(t[0]),this._monthMax=Math.floor(t[1])||12,this._dayMax=Math.floor(t[2])||this._daysInMonth(this._yearMax,this._monthMax),this._monthMax>1&&this._monthMax>12&&(this._monthMax=12,this._dayMax=31);var o=this._daysInMonth(this._yearMax,this._monthMax);this._dayMax>1&&this._dayMax>o&&(this._dayMax=o)}else this._yearMax=Number.MAX_VALUE,this._monthMax=12,this._dayMax=31;this._yearMax>=this._yearMin&&(this._monthMax>this._monthMin||this._monthMax===this._monthMin&&this._dayMax>=this._dayMin)||(this._yearMin=Number.MIN_VALUE,this._monthMin=1,this._dayMin=1,this._yearMax=Number.MAX_VALUE,this._monthMax=12,this._dayMaXx=31)}else this._yearMin=Number.MIN_VALUE,this._monthMin=1,this._dayMin=1,this._yearMax=Number.MAX_VALUE,this._monthMax=12,this._dayMax=31},_checkDateRange:function(e,t,i){return this._isValidDate(e,t+1,i)||(e=this._today.getFullYear(),t=this._today.getMonth(),i=this._today.getDate()),e>this._yearMax?(e=this._yearMax,t=this._monthMax-1,i=this._dayMax):this._yearMin>e&&(e=this._yearMin,t=this._monthMin-1,i=this._dayMin),e===this._yearMax&&t+1>this._monthMax?(t=this._monthMax-1,i=this._dayMax):e===this._yearMin&&this._monthMin>t+1&&(t=this._monthMin-1,i=this._dayMin),e===this._yearMax&&t+1===this._monthMax&&i>this._dayMax?i=this._dayMax:e===this._yearMin&&t+1===this._monthMin&&this._dayMin>i?i=this._dayMin:i>this._daysInMonth(e,t+1)&&(i=this._daysInMonth(e,t+1)),[e,t,i]},_showDefaultView:function(){this._yearSelector.style.display="none",this._monthSelector.style.display="none",this._monthPrev.childNodes[0].className="change_month_prev",this._monthNext.childNodes[0].className="change_month_next",this._yearthis._yearMax||this._year===this._yearMax&&this._month+1>=this._monthMax)&&(this._monthNext.childNodes[0].className="action_inactive"),this._monthContainer.style.display="block"},_updateDate:function(){var e;this._options.displayInSelect?(e=[],this._isValidDate(e[0]=this._options.yearField[this._options.yearField.selectedIndex].value,e[1]=this._options.monthField[this._options.monthField.selectedIndex].value,e[2]=this._options.dayField[this._options.dayField.selectedIndex].value)?(e=this._checkDateRange(e[0],e[1]-1,e[2]),this._year=e[0],this._month=e[1],this._day=e[2]):(e=this._checkDateRange(e[0],e[1]-1,1),this._isValidDate(e[0],e[1]+1,e[2])&&(this._year=e[0],this._month=e[1],this._day=this._daysInMonth(e[0],e[1]),this.setDate()))):""!==this._dataField.value&&(this._isDate(this._options.format,this._dataField.value)?(e=this._getDataArrayParsed(this._dataField.value),e=this._checkDateRange(e[0],e[1]-1,e[2]),this._year=e[0],this._month=e[1],this._day=e[2]):(this._dataField.value="",this._year=this._data.getFullYear(),this._month=this._data.getMonth(),this._day=this._data.getDate()),this._data.setFullYear(this._year,this._month,this._day),this._dataField.value=this._writeDateInFormat()),this._updateDescription(),this._showMonth()},_updateDescription:function(){this._monthChanger.innerHTML=this._options.month[this._month+1],this._deText.innerHTML=this._options.ofText,this._yearChanger.innerHTML=this._year},_showYearSelector:function(){if(arguments.length){var e=+this._year+10*arguments[0];if(e-=e%10,e>this._yearMax||this._yearMin>e+9)return;this._year=+this._year+10*arguments[0]}for(var t="
  • ",i=this._year-this._year%10,n=0;11>=n;n++)0===n%4&&(t+="");t+="
  • ",this._yearSelector.innerHTML=t},_getDataArrayParsed:function(e){var t=[],i=r.set(this._options.format,e);return i&&(t=[i.getFullYear(),i.getMonth()+1,i.getDate()]),t},_isValidDate:function(e,t,i){var n=/^\d{4}$/,o=/^\d{1,2}$/;return n.test(e)&&o.test(t)&&o.test(i)&&t>=1&&12>=t&&i>=1&&this._daysInMonth(e,t)>=i},_isDate:function(e,t){try{if(e===void 0)return!1;var i=r.set(e,t);if(i&&this._isValidDate(i.getFullYear(),i.getMonth()+1,i.getDate()))return!0}catch(n){}return!1},_writeDateInFormat:function(){return r.get(this._options.format,this._data)},setDate:function(e){if("string"==typeof e&&/\d{4}-\d{1,2}-\d{1,2}/.test(e)){var t=e.split("-");this._year=t[0],this._month=t[1]-1,this._day=t[2]}this._setDate()},_setDate:function(e){e!==void 0&&e.className&&0===e.className.indexOf("sapo_cal_")&&(this._day=e.className.substr(9,2)),this._data.setFullYear.apply(this._data,this._checkDateRange(this._year,this._month,this._day)),this._options.displayInSelect?(this._options.dayField.value=this._data.getDate(),this._options.monthField.value=this._data.getMonth()+1,this._options.yearField.value=this._data.getFullYear()):this._dataField.value=this._writeDateInFormat(),this._options.onSetDate&&this._options.onSetDate(this,{date:this._data})},_updateCal:function(e){"function"==typeof this._options.onMonthSelected&&this._options.onMonthSelected(this,{year:this._year,month:this._month}),this._updateMonth(e),this._showMonth()},_daysInMonth:function(e,t){var i=31;switch(t){case 2:i=0===e%400||0===e%4&&0!==e%100?29:28;break;case 4:case 6:case 9:case 11:i=30}return i},_updateMonth:function(e){e===void 0&&(e="0");var t=this._month+1,i=this._year;switch(e){case-1:if(1===t){if(i===this._yearMin)return;t=12,i--}else t--;this._year=i,this._month=t-1;break;case 1:if(12===t){if(i===this._yearMax)return;t=1,i++}else t++;this._year=i,this._month=t-1;break;default:}},_dateParsers:{"yyyy-mm-dd":"Y-m-d","yyyy/mm/dd":"Y/m/d","yy-mm-dd":"y-m-d","yy/mm/dd":"y/m/d","dd-mm-yyyy":"d-m-Y","dd/mm/yyyy":"d/m/Y","dd-mm-yy":"d-m-y","dd/mm/yy":"d/m/y","mm/dd/yyyy":"m/d/Y","mm-dd-yyyy":"m-d-Y"},_showMonth:function(){var e,t,i=this._month+1,n=this._year,o=this._daysInMonth(n,i),s=new Date(n,i-1,1).getDay(),r=this._options.startWeekDay||0;this._monthPrev.childNodes[0].className="change_month_prev",this._monthNext.childNodes[0].className="change_month_next",this._yearMin>n||n===this._yearMin&&this._monthMin>=i?this._monthPrev.childNodes[0].className="action_inactive":(n>this._yearMax||n===this._yearMax&&i>=this._monthMax)&&(this._monthNext.childNodes[0].className="action_inactive"),r&&Number(r)&&(r>s?s=7+r-s:s+=r);var a="";for(a+='
      ',e=0;7>e;e++)a+="
    • "+this._options.wDay[e+(r+e>6?r-7:r)].substring(0,1)+"
    • ";a+="
    ";var l=0;if(a+="
      ",s)for(t=r;s-r>t;t++)l||(a+="
        "),a+='
      •  
      • ',l++;for(e=1;o>=e;e++){7===l&&(l=0,a+="
          ");var h="sapo_cal_"+(2===(e+"").length?e:"0"+e);h+=n===this._yearMin&&i===this._monthMin&&this._dayMin>e||n===this._yearMax&&i===this._monthMax&&e>this._dayMax||n===this._yearMin&&this._monthMin>i||n===this._yearMax&&i>this._monthMax||this._yearMin>n||n>this._yearMax||this._options.validDayFn&&!this._options.validDayFn.call(this,new Date(n,i-1,e))?" sapo_cal_off":this._data.getFullYear()===n&&this._data.getMonth()===i-1&&e===this._day?" sapo_cal_on":"",a+='
        • '+e+"
        • ",l++,7===l&&(a+="
        ")}if(7!==l){for(e=l;7>e;e++)a+='
      •  
      • ';a+="
      "}a+="
    ",this._monthContainer.innerHTML=a},_setActiveMonth:function(e){e===void 0&&(e=this._monthSelector);var t=e.childNodes.length;if(e.className&&e.className.match(/sapo_calmonth_/)){var n=this._year,o=e.className.substr(14,2);n===this._data.getFullYear()&&o===this._data.getMonth()+1?(i.addClassName(e,"sapo_cal_on"),i.removeClassName(e,"sapo_cal_off")):(i.removeClassName(e,"sapo_cal_on"),n===this._yearMin&&this._monthMin>o||n===this._yearMax&&o>this._monthMax||this._yearMin>n||n>this._yearMax?i.addClassName(e,"sapo_cal_off"):i.removeClassName(e,"sapo_cal_off"))}else if(0!==t)for(var s=0;t>s;s++)this._setActiveMonth(e.childNodes[s])},lang:function(e){this._lang=e},showMonth:function(){this._showMonth()},isMonthRendered:function(){var e=o.select(".sapo_cal_header",this._containerObject)[0];return"none"!==i.getStyle(e.parentNode,"display")&&"none"!==i.getStyle(e.parentNode.parentNode,"display")}},a});