raumstatus/public/js/vendor/ink-ui.min.js

22 lines
107 KiB
JavaScript

Ink.createModule("Ink.UI.Aux","1",["Ink.Net.Ajax_1","Ink.Dom.Css_1","Ink.Dom.Selector_1","Ink.Util.Url_1"],function(e,t,n,r){"use strict";var i={},o=0,a={Layouts:{SMALL:"small",MEDIUM:"medium",LARGE:"large"},isDOMElement:function(e){return"object"==typeof e&&"nodeType"in e&&1===e.nodeType},isInteger:function(e){return"number"==typeof e&&0===e%1},elOrSelector:function(e,t){if(!this.isDOMElement(e)){var r=n.select(e);if(0===r.length)throw new TypeError(t+" must either be a DOM Element or a selector expression!\nThe script element must also be after the DOM Element itself.");return r[0]}return e},clone:function(e){try{if("object"!=typeof e)throw Error("Given argument is not an object!");return JSON.parse(JSON.stringify(e))}catch(t){throw Error("Given object cannot have loops!")}},childIndex:function(e){if(a.isDOMElement(e))for(var t=n.select("> *",e.parentNode),r=0,i=t.length;i>r;++r)if(t[r]===e)return r;throw"not found!"},ajaxJSON:function(t,n,r){new e(t,{evalJS:"force",method:"POST",parameters:n,onSuccess:function(e){try{if(e=e.responseJSON,"ok"!==e.status)throw"server error: "+e.message;r(null,e)}catch(t){r(t)}},onFailure:function(){r("communication failure")}})},currentLayout:function(){var e,r,i,o,a,s=n.select("#ink-layout-detector")[0];if(!s){s=document.createElement("div"),s.id="ink-layout-detector";for(i in this.Layouts)this.Layouts.hasOwnProperty(i)&&(o=this.Layouts[i],a=document.createElement("div"),a.className="show-"+o+" hide-all",a.setAttribute("data-ink-layout",o),s.appendChild(a));document.body.appendChild(s)}for(e=0,r=s.childNodes.length;r>e;++e)if(a=s.childNodes[e],"hidden"!==t.getStyle(a,"visibility"))return a.getAttribute("data-ink-layout")},hashSet:function(e){if("object"!=typeof e)throw new TypeError("o should be an object!");var t=r.getAnchorString();t=Ink.extendObj(t,e),window.location.hash=r.genQueryString("",t).substring(1)},cleanChildren:function(e){if(!a.isDOMElement(e))throw"Please provide a valid DOMElement";for(var t,n=e.lastChild;n;)t=n.previousSibling,e.removeChild(n),n=t},storeIdAndClasses:function(e,t){if(!a.isDOMElement(e))throw"Please provide a valid DOMElement as first parameter";var n=e.id;n&&(t._id=n);var r=e.className;r&&(t._classes=r)},restoreIdAndClasses:function(e,t){if(!a.isDOMElement(e))throw"Please provide a valid DOMElement as first parameter";t._id&&e.id!==t._id&&(e.id=t._id),t._classes&&-1===e.className.indexOf(t._classes)&&(e.className?e.className+=" "+t._classes:e.className=t._classes),t._instanceId&&!e.getAttribute("data-instance")&&e.setAttribute("data-instance",t._instanceId)},registerInstance:function(e,t,n){if(!e._instanceId){if("object"!=typeof e)throw new TypeError("1st argument must be a JavaScript object!");if(!e._options||!e._options.skipRegister){if(!this.isDOMElement(t))throw new TypeError("2nd argument must be a DOM element!");if(void 0!==n&&"string"!=typeof n)throw new TypeError("3rd argument must be a string!");var r=(n||"instance")+ ++o;i[r]=e,e._instanceId=r;var a=t.getAttribute("data-instance");a=null!==a?[a,r].join(" "):r,t.setAttribute("data-instance",a)}}},unregisterInstance:function(e){delete i[e]},getInstance:function(e){var t;if(this.isDOMElement(e)){if(t=e.getAttribute("data-instance"),null===t)throw Error("argument is not a DOM instance element!")}else t=e;t=t.split(" ");var n,r,o,a=t.length,s=[];for(o=0;a>o;++o){if(r=t[o],!r)throw Error("Element is not a JS instance!");if(n=i[r],!n)throw Error('Instance "'+r+'" not found!');s.push(n)}return 1===a?s[0]:s},getInstanceFromSelector:function(e){var t=n.select(e)[0];if(!t)throw Error("Element not found!");return this.getInstance(t)},getInstanceIds:function(){var e=[];for(var t in i)i.hasOwnProperty(t)&&e.push(t);return e},getInstances:function(){var e=[];for(var t in i)i.hasOwnProperty(t)&&e.push(i[t]);return e},destroyComponent:function(){Ink.Util.Aux.unregisterInstance(this._instanceId),this._element.parentNode.removeChild(this._element)}};return a});
Ink.createModule("Ink.UI.Pagination","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(e,t,n,r,i){"use strict";var o=function(e,t){var n=document.createElement("a");return n.setAttribute("href","#"),void 0!==t&&n.setAttribute("data-index",t),n.innerHTML=e,n},a=function(t,i){if(this._element=e.elOrSelector(t,"1st argument"),this._options=Ink.extendObj({size:void 0,start:1,firstLabel:"First",lastLabel:"Last",previousLabel:"Previous",nextLabel:"Next",onChange:void 0,setHash:!1,hashParameter:"page",numberFormatter:function(e){return e+1}},i||{},r.data(this._element)),this._options.previousPageLabel||(this._options.previousPageLabel="Previous "+this._options.maxSize),this._options.nextPageLabel||(this._options.nextPageLabel="Next "+this._options.maxSize),this._handlers={click:Ink.bindEvent(this._onClick,this)},!e.isInteger(this._options.size))throw new TypeError("size option is a required integer!");if(!e.isInteger(this._options.start)&&this._options.start>0&&this._options.start<=this._options.size)throw new TypeError("start option is a required integer between 1 and size!");if(this._options.maxSize&&!e.isInteger(this._options.maxSize)&&this._options.maxSize>0)throw new TypeError("maxSize option is a positive integer!");if(0>this._options.size)throw new RangeError("size option must be equal or more than 0!");if(void 0!==this._options.onChange&&"function"!=typeof this._options.onChange)throw new TypeError("onChange option must be a function!");n.hasClassName(Ink.s("ul",this._element),"dotted")&&(this._options.numberFormatter=function(){return'<i class="icon-circle"></i>'}),this._current=this._options.start-1,this._itemLiEls=[],this._init()};return a.prototype={_init:function(){this._generateMarkup(this._element),this._updateItems(),this._observe(),e.registerInstance(this,this._element,"pagination")},_observe:function(){t.observe(this._element,"click",this._handlers.click)},_updateItems:function(){var e,t,r,i=this._itemLiEls,a=this._options.size===i.length;if(a)for(e=0,t=this._options.size;t>e;++e)n.setClassName(i[e],"active",e===this._current);else{for(e=i.length-1;e>=0;--e)this._ulEl.removeChild(i[e]);for(i=[],e=0,t=this._options.size;t>e;++e)r=document.createElement("li"),r.appendChild(o(this._options.numberFormatter(e),e)),n.setClassName(r,"active",e===this._current),this._ulEl.insertBefore(r,this._nextEl),i.push(r);this._itemLiEls=i}if(this._options.maxSize){var s=Math.floor(this._current/this._options.maxSize),u=this._options.maxSize*s,l=u+this._options.maxSize-1;for(e=0,t=this._options.size;t>e;++e)r=i[e],n.setClassName(r,"hide-all",u>e||e>l);this._pageStart=u,this._pageEnd=l,this._page=s,n.setClassName(this._prevPageEl,"disabled",!this.hasPreviousPage()),n.setClassName(this._nextPageEl,"disabled",!this.hasNextPage()),n.setClassName(this._firstEl,"disabled",this.isFirst()),n.setClassName(this._lastEl,"disabled",this.isLast())}n.setClassName(this._prevEl,"disabled",!this.hasPrevious()),n.setClassName(this._nextEl,"disabled",!this.hasNext())},_generateMarkup:function(e){n.addClassName(e,"ink-navigation");var t,r,a=!1;1>(t=i.select("ul.pagination",e)).length?(t=document.createElement("ul"),n.addClassName(t,"pagination")):(a=!0,t=t[0]),this._options.maxSize&&(r=document.createElement("li"),r.appendChild(o(this._options.firstLabel)),this._firstEl=r,n.addClassName(r,"first"),t.appendChild(r),r=document.createElement("li"),r.appendChild(o(this._options.previousPageLabel)),this._prevPageEl=r,n.addClassName(r,"previousPage"),t.appendChild(r)),r=document.createElement("li"),r.appendChild(o(this._options.previousLabel)),this._prevEl=r,n.addClassName(r,"previous"),t.appendChild(r),r=document.createElement("li"),r.appendChild(o(this._options.nextLabel)),this._nextEl=r,n.addClassName(r,"next"),t.appendChild(r),this._options.maxSize&&(r=document.createElement("li"),r.appendChild(o(this._options.nextPageLabel)),this._nextPageEl=r,n.addClassName(r,"nextPage"),t.appendChild(r),r=document.createElement("li"),r.appendChild(o(this._options.lastLabel)),this._lastEl=r,n.addClassName(r,"last"),t.appendChild(r)),a||e.appendChild(t),this._ulEl=t},_onClick:function(e){t.stop(e);var r=t.element(e);if("a"!==r.nodeName.toLowerCase()){do r=r.parentNode;while("a"!==r.nodeName.toLowerCase()&&r!==this._element);if(r===this._element)return}var i=r.parentNode;if("li"===i.nodeName.toLowerCase()&&!n.hasClassName(i,"active")&&!n.hasClassName(i,"disabled")){var o=n.hasClassName(i,"previous"),a=n.hasClassName(i,"next"),s=n.hasClassName(i,"previousPage"),u=n.hasClassName(i,"nextPage"),l=n.hasClassName(i,"first"),c=n.hasClassName(i,"last");if(l)this.setCurrent(0);else if(c)this.setCurrent(this._options.size-1);else if(s||u)this.setCurrent((s?-1:1)*this._options.maxSize,!0);else if(o||a)this.setCurrent(o?-1:1,!0);else{var d=parseInt(r.getAttribute("data-index"),10);this.setCurrent(d)}}},setSize:function(t){if(!e.isInteger(t))throw new TypeError("1st argument must be an integer number!");this._options.size=t,this._updateItems(),this._current=0},setCurrent:function(t,n){if(!e.isInteger(t))throw new TypeError("1st argument must be an integer number!");n&&(t+=this._current),0>t?t=0:t>this._options.size-1&&(t=this._options.size-1),this._current=t,this._updateItems(),this._options.onChange&&this._options.onChange(this)},getSize:function(){return this._options.size},getCurrent:function(){return this._current},isFirst:function(){return 0===this._current},isLast:function(){return this._current===this._options.size-1},hasPrevious:function(){return this._current>0},hasNext:function(){return this._current<this._options.size-1},hasPreviousPage:function(){return this._options.maxSize&&this._current>this._options.maxSize-1},hasNextPage:function(){return this._options.maxSize&&this._options.size-this._current>=this._options.maxSize+1},destroy:e.destroyComponent},a});
Ink.createModule("Ink.UI.SortableList","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,r,i,o){"use strict";var s=function(t,n){if(this._element=e.elOrSelector(t,"1st argument"),!e.isDOMElement(t)&&"string"!=typeof t)throw"[Ink.UI.SortableList] :: Invalid selector";if("string"==typeof t){if(this._element=Ink.Dom.Selector.select(t),1>this._element.length)throw"[Ink.UI.SortableList] :: Selector has returned no elements";this._element=this._element[0]}else this._element=t;if(this._options=Ink.extendObj({dragObject:"li"},Ink.Dom.Element.data(this._element)),this._options=Ink.extendObj(this._options,n||{}),this._handlers={down:Ink.bindEvent(this._onDown,this),move:Ink.bindEvent(this._onMove,this),up:Ink.bindEvent(this._onUp,this)},this._model=[],this._index=void 0,this._isMoving=!1,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._dragTriggers=i.select(this._options.dragObject,this._element),!this._dragTriggers)throw"[Ink.UI.SortableList] :: Drag object not found";this._init()};return s.prototype={_init:function(){"DOM"===this._createdFrom&&(this._extractModelFromDOM(),this._createdFrom="JSON");var n="ontouchstart"in document.documentElement;this._down=n?"touchstart":"mousedown",this._move=n?"touchmove":"mousemove",this._up=n?"touchend":"mouseup";var r=document.body;t.observe(r,this._move,this._handlers.move),t.observe(r,this._up,this._handlers.up),this._observe(),e.registerInstance(this,this._element,"sortableList")},_observe:function(){t.observe(this._element,this._down,this._handlers.down)},_extractModelFromDOM:function(){this._model=[];var e=this,t=i.select("> li",this._element);o.each(t,function(t){var n=t.innerHTML;e._model.push(n)})},_generateMarkup:function(){var e=document.createElement("ul");e.className="unstyled ink-sortable-list";var t=this;return o.each(this._model,function(n,r){var i=document.createElement("li");r===t._index&&(i.className="drag"),i.innerHTML=[n].join(""),e.appendChild(i)}),e},_getY:function(e){return 0===e.type.indexOf("touch")?e.changedTouches[0].pageY:"number"==typeof e.pageY?e.pageY:e.clientY},_refresh:function(t){var n=this._generateMarkup();this._element.parentNode.replaceChild(n,this._element),this._element=n,e.restoreIdAndClasses(this._element,this),this._dragTriggers=i.select(this._options.dragObject,this._element),t||this._observe()},_onDown:function(n){if(!this._isMoving){var r=t.element(n);if(!o.inArray(r,this._dragTriggers)){for(;!o.inArray(r,this._dragTriggers)&&"body"!==r.nodeName.toLowerCase();)r=r.parentNode;if("body"===r.nodeName.toLowerCase())return}t.stop(n);var i;if("li"!==r.nodeName.toLowerCase())for(;"li"!==r.nodeName.toLowerCase()&&"body"!==r.nodeName.toLowerCase();)r=r.parentNode;return i=r,this._index=e.childIndex(i),this._height=i.offsetHeight,this._startY=this._getY(n),this._isMoving=!0,document.body.style.cursor="move",this._refresh(!1),!1}},_onMove:function(e){if(this._isMoving){t.stop(e);var n=this._getY(e),r=n-this._startY,i=r>0?1:-1,o=i*Math.floor(Math.abs(r)/this._height);if(0!==o&&(o/=Math.abs(o),!(-1===o&&0===this._index||1===o&&this._index===this._model.length-1))){var s=o>0?this._index:this._index+o,a=0>o?this._index:this._index+o;this._model.splice(s,2,this._model[a],this._model[s]),this._index+=o,this._startY=n,this._refresh(!1)}}},_onUp:function(e){this._isMoving&&(t.stop(e),this._index=void 0,this._isMoving=!1,document.body.style.cursor="",this._refresh())},getModel:function(){return this._model.slice()},destroy:e.destroyComponent},s});
Ink.createModule("Ink.UI.Spy","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,r,i,o){"use strict";var s=function(t,n){this._rootElement=e.elOrSelector(t,"1st argument"),this._options=Ink.extendObj({target:void 0},r.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._options.target=e.elOrSelector(this._options.target,"Target"),this._scrollTimeout=null,this._init()};return s.prototype={_elements:[],_init:function(){t.observe(document,"scroll",Ink.bindEvent(this._onScroll,this)),this._elements.push(this._rootElement)},_onScroll:function(){var e=r.scrollHeight();if(!(this._rootElement.offsetTop>e)){for(var t=0,s=this._elements.length;s>t;t++)if(e>=this._elements[t].offsetTop&&this._elements[t]!==this._rootElement&&this._elements[t].offsetTop>this._rootElement.offsetTop)return;o.each(i.select("a",this._options.target),Ink.bind(function(e){var t="name"in this._rootElement&&this._rootElement.name?"#"+this._rootElement.name:"#"+this._rootElement.id;e.href.substr(e.href.indexOf("#"))===t?n.addClassName(r.findUpwardsByTag(e,"li"),"active"):n.removeClassName(r.findUpwardsByTag(e,"li"),"active")},this))}}},s});
Ink.createModule("Ink.UI.Sticky","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(e,t,n,r,i){"use strict";var o=function(t,n){if("object"!=typeof t&&"string"!=typeof t)throw"[Sticky] :: Invalid selector defined";if("object"==typeof t)this._rootElement=t;else{if(this._rootElement=i.select(t),0>=this._rootElement.length)throw"[Sticky] :: Can't find any element with the specified selector";this._rootElement=this._rootElement[0]}this._options=Ink.extendObj({offsetBottom:0,offsetTop:0,topElement:void 0,bottomElement:void 0},r.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._options.topElement=this._options.topElement!==void 0?e.elOrSelector(this._options.topElement,"Top Element"):e.elOrSelector("body","Top Element"),this._options.bottomElement=this._options.bottomElement!==void 0?e.elOrSelector(this._options.bottomElement,"Bottom Element"):e.elOrSelector("body","Top Element"),this._computedStyle=window.getComputedStyle?window.getComputedStyle(this._rootElement,null):this._rootElement.currentStyle,this._dims={height:this._computedStyle.height,width:this._computedStyle.width},this._init()};return o.prototype={_init:function(){t.observe(document,"scroll",Ink.bindEvent(this._onScroll,this)),t.observe(window,"resize",Ink.bindEvent(this._onResize,this)),this._calculateOriginalSizes(),this._calculateOffsets()},_onScroll:function(){var e="CSS1Compat"===document.compatMode?document.documentElement:document.body;return 100*r.elementWidth(this._rootElement)/e.clientWidth>90||649>=e.clientWidth?(r.hasAttribute(this._rootElement,"style")&&this._rootElement.removeAttribute("style"),void 0):(this._scrollTimeout&&clearTimeout(this._scrollTimeout),this._scrollTimeout=setTimeout(Ink.bind(function(){var e=r.scrollHeight();if(r.hasAttribute(this._rootElement,"style"))this._options.originalTop-this._options.originalOffsetTop>=e?this._rootElement.removeAttribute("style"):document.body.scrollHeight-(e+parseInt(this._dims.height,10))<this._options.offsetBottom?(this._rootElement.style.position="fixed",this._rootElement.style.top="auto",this._rootElement.style.left=this._options.originalLeft+"px",this._rootElement.style.bottom=this._options.offsetBottom<parseInt(document.body.scrollHeight-(document.documentElement.clientHeight+e),10)?this._options.originalOffsetBottom+"px":this._options.offsetBottom-parseInt(document.body.scrollHeight-(document.documentElement.clientHeight+e),10)+"px",this._rootElement.style.width=this._options.originalWidth+"px"):document.body.scrollHeight-(e+parseInt(this._dims.height,10))>=this._options.offsetBottom&&(this._rootElement.style.left=this._options.originalLeft+"px",this._rootElement.style.position="fixed",this._rootElement.style.bottom="auto",this._rootElement.style.left=this._options.originalLeft+"px",this._rootElement.style.top=this._options.originalOffsetTop+"px",this._rootElement.style.width=this._options.originalWidth+"px");else{if(this._options.originalTop-this._options.originalOffsetTop>=e)return;this._rootElement.style.left=this._options.originalLeft+"px",this._rootElement.style.position="fixed",this._rootElement.style.bottom="auto",this._rootElement.style.left=this._options.originalLeft+"px",this._rootElement.style.top=this._options.originalOffsetTop+"px",this._rootElement.style.width=this._options.originalWidth+"px"}this._scrollTimeout=void 0},this),0),void 0)},_onResize:function(){this._resizeTimeout&&clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(Ink.bind(function(){this._rootElement.removeAttribute("style"),this._calculateOriginalSizes(),this._calculateOffsets()},this),0)},_calculateOffsets:function(){if(this._options.topElement!==void 0)if("body"!==this._options.topElement.nodeName.toLowerCase()){var e=r.elementHeight(this._options.topElement),t=r.elementTop(this._options.topElement);this._options.offsetTop=parseInt(e,10)+parseInt(t,10)+parseInt(this._options.originalOffsetTop,10)}else this._options.offsetTop=parseInt(this._options.originalOffsetTop,10);if(this._options.bottomElement!==void 0)if("body"!==this._options.bottomElement.nodeName.toLowerCase()){var n=r.elementHeight(this._options.bottomElement);this._options.offsetBottom=parseInt(n,10)+parseInt(this._options.originalOffsetBottom,10)}else this._options.offsetBottom=parseInt(this._options.originalOffsetBottom,10);this._onScroll()},_calculateOriginalSizes:function(){this._options.originalOffsetTop===void 0&&(this._options.originalOffsetTop=parseInt(this._options.offsetTop,10),this._options.originalOffsetBottom=parseInt(this._options.offsetBottom,10)),this._options.originalTop=parseInt(this._rootElement.offsetTop,10),this._options.originalLeft=parseInt(this._rootElement.offsetLeft,10),isNaN(this._options.originalWidth=parseInt(this._dims.width,10))&&(this._options.originalWidth=0),this._options.originalWidth=parseInt(this._computedStyle.width,10)}},o});
Ink.createModule("Ink.UI.Table","1",["Ink.Net.Ajax_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.String_1"],function(e,t,n,i,r,o,s,a){"use strict";var l=function(e,n){if(this._rootElement=t.elOrSelector(e,"1st argument"),"table"!==this._rootElement.nodeName.toLowerCase())throw"[Ink.UI.Table] :: The element is not a table";this._options=Ink.extendObj({pageSize:void 0,endpoint:void 0,loadMode:"full",allowResetSorting:!1,visibleFields:void 0},r.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._markupMode=this._options.endpoint===void 0,this._options.visibleFields&&(this._options.visibleFields=this._options.visibleFields.split(",")),this._handlers={click:Ink.bindEvent(this._onClick,this)},this._originalFields=[],this._sortableFields={},this._originalData=this._data=[],this._headers=[],this._pagination=null,this._totalRows=0,this._init()};return l.prototype={_init:function(){if(this._markupMode){if(this._setHeadersHandlers(),s.each(o.select("tbody tr",this._rootElement),Ink.bind(function(e){this._data.push(e)},this)),this._originalData=this._data.slice(0),this._totalRows=this._data.length,"pageSize"in this._options&&this._options.pageSize!==void 0){for(this._pagination=this._rootElement.nextSibling;1!==this._pagination.nodeType;)this._pagination=this._pagination.nextSibling;if("nav"!==this._pagination.nodeName.toLowerCase())throw"[Ink.UI.Table] :: Missing the pagination markup or is mis-positioned";var e=Ink.getModule("Ink.UI.Pagination",1);this._pagination=new e(this._pagination,{size:Math.ceil(this._totalRows/this._options.pageSize),onChange:Ink.bind(function(e){this._paginate(e._current+1)},this)}),this._paginate(1)}}else this._getData(this._options.endpoint,!0)},_onClick:function(e){var i,l,u=n.element(e),c=r.data(u),h="pageSize"in this._options&&this._options.pageSize!==void 0;if("th"===u.nodeName.toLowerCase()&&"sortable"in c&&"true"==""+c.sortable){if(n.stop(e),i=-1,s.inArray(u,this._headers))for(l=0;this._headers.length>l;l++)if(this._headers[l]===u){i=l;break}if(!this._markupMode&&h){for(var d in this._sortableFields)d!=="col_"+i&&(this._sortableFields[d]="none",this._headers[d.replace("col_","")].innerHTML=a.stripTags(this._headers[d.replace("col_","")].innerHTML));"asc"===this._sortableFields["col_"+i]?(this._sortableFields["col_"+i]="desc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+'<i class="icon-caret-down"></i>'):(this._sortableFields["col_"+i]="asc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+'<i class="icon-caret-up"></i>'),this._pagination.setCurrent(this._pagination._current)}else{if(-1===i)return;if("desc"===this._sortableFields["col_"+i]&&this._options.allowResetSorting&&"true"==""+this._options.allowResetSorting)this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML),this._sortableFields["col_"+i]="none",this._data=this._originalData.slice(0);else{for(var d in this._sortableFields)d!=="col_"+i&&(this._sortableFields[d]="none",this._headers[d.replace("col_","")].innerHTML=a.stripTags(this._headers[d.replace("col_","")].innerHTML));this._sort(i),"asc"===this._sortableFields["col_"+i]?(this._data.reverse(),this._sortableFields["col_"+i]="desc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+'<i class="icon-caret-down"></i>'):(this._sortableFields["col_"+i]="asc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+'<i class="icon-caret-up"></i>')}var p=o.select("tbody",this._rootElement)[0];t.cleanChildren(p),s.each(this._data,function(e){p.appendChild(e)}),this._pagination.setCurrent(0),this._paginate(1)}}},_paginate:function(e){s.each(this._data,Ink.bind(function(t,n){n>=(e-1)*parseInt(this._options.pageSize,10)&&(e-1)*parseInt(this._options.pageSize,10)+parseInt(this._options.pageSize,10)>n?i.removeClassName(t,"hide-all"):i.addClassName(t,"hide-all")},this))},_sort:function(e){this._data.sort(Ink.bind(function(t,n){var i=r.textContent(o.select("td",t)[e]),s=r.textContent(o.select("td",n)[e]),a=RegExp(/\d/g);return!isNaN(i)&&a.test(i)?i=parseInt(i,10):isNaN(i)||(i=parseFloat(i)),!isNaN(s)&&a.test(s)?s=parseInt(s,10):isNaN(s)||(s=parseFloat(s)),i===s?0:i>s?1:-1},this))},_setHeaders:function(e,t){var n,i,s,a,l;if(0===(s=o.select("thead",this._rootElement)).length){s=this._rootElement.createTHead(),a=s.insertRow(0);for(n in e)if(e.hasOwnProperty(n)){if(this._options.visibleFields&&-1===this._options.visibleFields.indexOf(n))continue;l=document.createElement("th"),i=e[n],"sortable"in i&&"true"==""+i.sortable&&l.setAttribute("data-sortable","true"),"label"in i&&r.setTextContent(l,i.label),this._originalFields.push(n),a.appendChild(l)}}else{var u=t[0];for(n in u)if(u.hasOwnProperty(n)){if(this._options.visibleFields&&-1===this._options.visibleFields.indexOf(n))continue;this._originalFields.push(n)}}},_setHeadersHandlers:function(){var e=o.select("thead",this._rootElement);e.length&&(n.observe(e[0],"click",this._handlers.click),this._headers=o.select("thead tr th",this._rootElement),s.each(this._headers,Ink.bind(function(e,t){var n=r.data(e);"sortable"in n&&"true"==""+n.sortable&&(this._sortableFields["col_"+t]="none")},this)))},_setData:function(e){var t,n,i,r,s,a;n=o.select("tbody",this._rootElement),0===n.length?(n=document.createElement("tbody"),this._rootElement.appendChild(n)):(n=n[0],n.innerHTML=""),this._data=[];for(s in e)if(e.hasOwnProperty(s)){i=document.createElement("tr"),n.appendChild(i),a=0;for(t in e[s])if(e[s].hasOwnProperty(t)){if(this._options.visibleFields&&-1===this._options.visibleFields.indexOf(t))continue;r=i.insertCell(a++),r.innerHTML=e[s][t]}this._data.push(i)}this._originalData=this._data.slice(0)},setEndpoint:function(e,t){this._markupMode||(this._options.endpoint=e,this._pagination.setCurrent(t?parseInt(t,10):0))},_setPagination:function(){if("pageSize"in this._options&&this._options.pageSize!==void 0,"pageSize"in this._options&&this._options.pageSize!==void 0&&!this._pagination){this._pagination=document.createElement("nav"),this._pagination.className="ink-navigation",this._rootElement.parentNode.insertBefore(this._pagination,this._rootElement.nextSibling),this._pagination.appendChild(document.createElement("ul")).className="pagination";var e=Ink.getModule("Ink.UI.Pagination",1);this._pagination=new e(this._pagination,{size:Math.ceil(this._totalRows/this._options.pageSize),onChange:Ink.bind(function(){this._getData(this._options.endpoint)},this)})}},_getData:function(e){Ink.requireModules(["Ink.Util.Url_1"],Ink.bind(function(t){var n=t.parseUrl(e),i="pageSize"in this._options&&this._options.pageSize!==void 0,r=this._pagination?this._pagination._current+1:1;if(n.query=n.query?n.query.split("&"):[],i){n.query.push("rows_per_page="+this._options.pageSize),n.query.push("page="+r);for(var o in this._sortableFields)if("none"!==this._sortableFields[o]){n.query.push("sortField="+this._originalFields[parseInt(o.replace("col_",""),10)]),n.query.push("sortOrder="+this._sortableFields[o]);break}this._getDataViaAjax(e+"?"+n.query.join("&"))}else this._getDataViaAjax(e)},this))},_getDataViaAjax:function(t){var n="pageSize"in this._options&&this._options.pageSize!==void 0;new e(t,{method:"GET",contentType:"application/json",sanitizeJSON:!0,onSuccess:Ink.bind(function(e){if(200===e.status){var t=JSON.parse(e.responseText);0===this._headers.length&&(this._setHeaders(t.headers,t.rows),this._setHeadersHandlers()),this._setData(t.rows),n?this._totalRows&&parseInt(t.totalRows,10)!==parseInt(this._totalRows,10)?(this._totalRows=t.totalRows,this._pagination.setSize(Math.ceil(this._totalRows/this._options.pageSize))):this._totalRows=t.totalRows:this._totalRows&&t.rows.length!==parseInt(this._totalRows,10)?(this._totalRows=t.rows.length,this._pagination.setSize(Math.ceil(this._totalRows/this._options.pageSize))):this._totalRows=t.rows.length,this._setPagination()}},this)})}},l});
Ink.createModule("Ink.UI.Tabs","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,r,o){"use strict";var s=function(t,n){if(e.isDOMElement(t))this._element=t;else{if(t=r.select(t),0===t.length)throw new TypeError("1st argument must either be a DOM Element or a selector expression!");this._element=t[0]}this._options=Ink.extendObj({preventUrlChange:!1,active:void 0,disabled:[],onBeforeChange:void 0,onChange:void 0},i.data(t)),this._options=Ink.extendObj(this._options,n||{}),this._handlers={tabClicked:Ink.bindEvent(this._onTabClicked,this),disabledTabClicked:Ink.bindEvent(this._onDisabledTabClicked,this),resize:Ink.bindEvent(this._onResize,this)},this._init()};return s.prototype={_init:function(){this._menu=r.select(".tabs-nav",this._element)[0],this._menuTabs=this._getChildElements(this._menu),this._contentTabs=r.select(".tabs-content",this._element),this._initializeDom(),this._observe(),this._setFirstActive(),this._changeTab(this._activeMenuLink),this._handlers.resize(),e.registerInstance(this,this._element,"tabs")},_initializeDom:function(){for(var e=0;this._contentTabs.length>e;e++)n.hide(this._contentTabs[e])},_observe:function(){o.each(this._menuTabs,Ink.bind(function(e){var t=r.select("a",e)[0];o.inArray(t.getAttribute("href"),this._options.disabled)?this.disable(t):this.enable(t)},this)),t.observe(window,"resize",this._handlers.resize)},_setFirstActive:function(){var e=window.location.hash;this._activeContentTab=r.select(e,this._element)[0]||r.select(this._hashify(this._options.active),this._element)[0]||r.select(".tabs-content",this._element)[0],this._activeMenuLink=this._findLinkByHref(this._activeContentTab.getAttribute("id")),this._activeMenuTab=this._activeMenuLink.parentNode},_changeTab:function(e,t){t&&this._options.onBeforeChange!==void 0&&this._options.onBeforeChange(this);var i=e.getAttribute("href");n.removeClassName(this._activeMenuTab,"active"),n.removeClassName(this._activeContentTab,"active"),n.addClassName(this._activeContentTab,"hide-all"),this._activeMenuLink=e,this._activeMenuTab=this._activeMenuLink.parentNode,this._activeContentTab=r.select(i.substr(i.indexOf("#")),this._element)[0],n.addClassName(this._activeMenuTab,"active"),n.addClassName(this._activeContentTab,"active"),n.removeClassName(this._activeContentTab,"hide-all"),n.show(this._activeContentTab),t&&this._options.onChange!==void 0&&this._options.onChange(this)},_onTabClicked:function(e){t.stop(e);var n=t.findElement(e,"A");"a"===n.nodeName.toLowerCase()&&("true"!=""+this._options.preventUrlChange&&(window.location.hash=n.getAttribute("href").substr(n.getAttribute("href").indexOf("#"))),n!==this._activeMenuLink&&this.changeTab(n))},_onDisabledTabClicked:function(e){t.stop(e)},_onResize:function(){var t=e.currentLayout();t!==this._lastLayout&&(t===e.Layouts.SMALL||t===e.Layouts.MEDIUM?(n.removeClassName(this._menu,"menu"),n.removeClassName(this._menu,"horizontal")):(n.addClassName(this._menu,"menu"),n.addClassName(this._menu,"horizontal")),this._lastLayout=t)},_hashify:function(e){return e?0===e.indexOf("#")?e:"#"+e:""},_findLinkByHref:function(e){e=this._hashify(e);var t;return o.each(this._menuTabs,Ink.bind(function(n){var i=r.select("a",n)[0];-1!==i.getAttribute("href").indexOf("#")&&i.getAttribute("href").substr(i.getAttribute("href").indexOf("#"))===e&&(t=i)},this)),t},_getChildElements:function(e){for(var t=[],n=e.children,i=0;n.length>i;i++)1===n[i].nodeType&&t.push(n[i]);return t},changeTab:function(e){var t=1===e.nodeType?e:this._findLinkByHref(this._hashify(e));t&&!n.hasClassName(t,"ink-disabled")&&this._changeTab(t,!0)},disable:function(e){var i=1===e.nodeType?e:this._findLinkByHref(this._hashify(e));i&&(t.stopObserving(i,"click",this._handlers.tabClicked),t.observe(i,"click",this._handlers.disabledTabClicked),n.addClassName(i,"ink-disabled"))},enable:function(e){var i=1===e.nodeType?e:this._findLinkByHref(this._hashify(e));i&&(t.stopObserving(i,"click",this._handlers.disabledTabClicked),t.observe(i,"click",this._handlers.tabClicked),n.removeClassName(i,"ink-disabled"))},activeTab:function(){return this._activeContentTab.getAttribute("id")},activeMenuTab:function(){return this._activeMenuTab},activeMenuLink:function(){return this._activeMenuLink},activeContentTab:function(){return this._activeContentTab},destroy:e.destroyComponent},s});
Ink.createModule("Ink.UI.Toggle","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,r,o){"use strict";var s=function(e,t){if("string"!=typeof e&&"object"!=typeof e)throw"[Ink.UI.Toggle] Invalid CSS selector to determine the root element";if("string"==typeof e){if(this._rootElement=r.select(e),0>=this._rootElement.length)throw"[Ink.UI.Toggle] Root element not found";this._rootElement=this._rootElement[0]}else this._rootElement=e;if(this._options=Ink.extendObj({target:void 0,triggerEvent:"click",closeOnClick:!0},i.data(this._rootElement)),this._options=Ink.extendObj(this._options,t||{}),this._targets=function(e){return"string"==typeof e?r.select(e):"object"==typeof e?e.constructor===Array?e:[e]:void 0}(this._options.target),!this._targets.length)throw"[Ink.UI.Toggle] Toggle target was not found! Supply a valid selector, array, or element through the `target` option.";this._init()};return s.prototype={_init:function(){this._accordion=n.hasClassName(this._rootElement.parentNode,"accordion")||n.hasClassName(this._targets[0].parentNode,"accordion"),t.observe(this._rootElement,this._options.triggerEvent,Ink.bindEvent(this._onTriggerEvent,this)),"true"==""+this._options.closeOnClick&&t.observe(document,"click",Ink.bindEvent(this._onClick,this))},_onTriggerEvent:function(){if(this._accordion){var e,t,o;for(o=n.hasClassName(this._targets[0].parentNode,"accordion")?this._targets[0].parentNode:this._targets[0].parentNode.parentNode,e=r.select(".toggle",o),t=0;e.length>t;t+=1){var s=i.data(e[t]),a=r.select(s.target,o);a.length>0&&a[0]!==this._targets[0]&&(a[0].style.display="none")}}for(var l,u,c=0,h=this._targets.length;h>c;c++)l="none"===n.getStyle(this._targets[c],"display")?"show-all":"hide-all",u="none"===n.getStyle(this._targets[c],"display")?"block":"none",n.removeClassName(this._targets[c],"show-all"),n.removeClassName(this._targets[c],"hide-all"),n.addClassName(this._targets[c],l),this._targets[c].style.display=u;"show-all"===l?n.addClassName(this._rootElement,"active"):n.removeClassName(this._rootElement,"active")},_onClick:function(e){var n,r=t.element(e),s=o.some(this._targets,function(e){return i.isAncestorOf(e,r)});if(this._rootElement!==r&&!i.isAncestorOf(this._rootElement,r)&&!s){if((n=Ink.ss(".ink-shade")).length)for(var a=n.length,l=0;a>l;l++)if(i.isAncestorOf(n[l],r)&&i.isAncestorOf(n[l],this._rootElement))return;i.findUpwardsByClass(r,"toggle")&&this._dismiss(this._rootElement)}},_dismiss:function(){if("none"!==n.getStyle(this._targets[0],"display")){for(var e=0,t=this._targets.length;t>e;e++)n.removeClassName(this._targets[e],"show-all"),n.addClassName(this._targets[e],"hide-all"),this._targets[e].style.display="none";n.removeClassName(this._rootElement,"active")}}},s});
Ink.createModule("Ink.UI.Tooltip","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1","Ink.Dom.Css_1","Ink.Dom.Browser_1"],function(e,t,n,i,o,r){"use strict";function s(e,t){this._init(e,t||{})}function a(e,t){this._init(e,t)}var l,u,c;(function(){for(var e=document.createElement("DIV"),t=["transition","oTransition","msTransition","mozTransition","webkitTransition"],n=0;t.length>n;n++)if(e.style[t[n]+"Duration"]!==void 0){l=t[n]+"Duration",u=t[n]+"Property",c=t[n]+"TimingFunction";break}})();var h=document.getElementsByTagName("body"),d=h&&h.length?h[0]:document.documentElement;return s.prototype={_init:function(e,t){var n;if(this.options=Ink.extendObj({where:"up",zIndex:1e4,left:10,top:10,spacing:8,forever:0,color:"",timeout:0,delay:0,template:null,templatefield:null,fade:.3,text:""},t||{}),"string"==typeof e)n=i.select(e);else{if("object"!=typeof e)throw"Element expected";n=[e]}this.tooltips=[];for(var o=0,r=n.length;r>o;o++)this.tooltips[o]=new a(this,n[o])},destroy:function(){o.each(this.tooltips,function(e){e._destroy()}),this.tooltips=null,this.options=null}},a.prototype={_oppositeDirections:{left:"right",right:"left",up:"down",down:"up"},_init:function(e,n){t.observe(n,"mouseover",Ink.bindEvent(this._onMouseOver,this)),t.observe(n,"mouseout",Ink.bindEvent(this._onMouseOut,this)),t.observe(n,"mousemove",Ink.bindEvent(this._onMouseMove,this)),this.root=e,this.element=n,this._delayTimeout=null,this.tooltip=null},_makeTooltip:function(e){if(!this._getOpt("text"))return!1;var n=this._createTooltipElement();this.tooltip&&this._removeTooltip(),this.tooltip=n,this._fadeInTooltipElement(n),this._placeTooltipElement(n,e),t.observe(n,"mouseover",Ink.bindEvent(this._onTooltipMouseOver,this));var i=this._getFloatOpt("timeout");i&&setTimeout(Ink.bind(function(){this.tooltip===n&&this._removeTooltip()},this),1e3*i)},_createTooltipElement:function(){var t,o,s=this._getOpt("template"),a=this._getOpt("templatefield");if(s){var l=document.createElement("DIV");if(l.innerHTML=e.elOrSelector(s,"options.template").outerHTML,t=l.firstChild,a){if(o=i.select(a,t),!o)throw"options.templatefield must be a valid selector within options.template";o=o[0]}else o=t}else t=document.createElement("DIV"),r.addClassName(t,"ink-tooltip"),r.addClassName(t,this._getOpt("color")),o=document.createElement("DIV"),r.addClassName(o,"content"),t.appendChild(o);return n.setTextContent(o,this._getOpt("text")),t.style.display="block",t.style.position="absolute",t.style.zIndex=this._getIntOpt("zIndex"),t},_fadeInTooltipElement:function(e){var t=this._getFloatOpt("fade");l&&t&&(e.style.opacity="0",e.style[l]=t+"s",e.style[u]="opacity",e.style[c]="ease-in-out",setTimeout(function(){e.style.opacity="1"},0))},_placeTooltipElement:function(e,t){var i=this._getOpt("where");if("mousemove"===i||"mousefix"===i){var o=t;this._setPos(o[0],o[1]),d.appendChild(e)}else if(i.match(/(up|down|left|right)/)){d.appendChild(e);var s=n.offset(this.element),a=s[0],l=s[1];a instanceof Array&&(l=a[1],a=a[0]);var u=n.elementWidth(this.element)/2-n.elementWidth(e)/2,c=n.elementHeight(this.element)/2-n.elementHeight(e)/2,h=this._getIntOpt("spacing"),p=n.elementDimensions(e),f=n.elementDimensions(this.element),m=n.scrollWidth()+n.viewportWidth(),g=n.scrollHeight()+n.viewportHeight();"left"===i&&0>a-p[0]?i="right":"right"===i&&a+p[0]>m?i="left":"up"===i&&0>l-p[1]?i="down":"down"===i&&l+p[1]>g&&(i="up"),"up"===i?(l-=p[1],l-=h,a+=u):"down"===i?(l+=f[1],l+=h,a+=u):"left"===i?(a-=p[0],a-=h,l+=c):"right"===i&&(a+=f[0],a+=h,l+=c);var v=null;i.match(/(up|down|left|right)/)&&(v=document.createElement("SPAN"),r.addClassName(v,"arrow"),r.addClassName(v,this._oppositeDirections[i]),e.appendChild(v));var _=this._getLocalScroll(),y=a-_[0],b=l-_[1],w=b+p[1]-g,E=y+p[0]-m,k=0-y,C=0-b;w>0?(v&&(v.style.top=p[1]/2+w+"px"),b-=w):C>0?(v&&(v.style.top=p[1]/2-C+"px"),b+=C):E>0?(v&&(v.style.left=p[0]/2+E+"px"),y-=E):k>0&&(v&&(v.style.left=p[0]/2-k+"px"),y+=k),e.style.left=y+"px",e.style.top=b+"px"}},_removeTooltip:function(){var e=this.tooltip;if(e){var t=Ink.bind(n.remove,{},e);"mousemove"!==this._getOpt("where")&&l?(e.style.opacity=0,setTimeout(t,1e3*this._getFloatOpt("fade"))):t(),this.tooltip=null}},_getOpt:function(e){var t=n.data(this.element)[n._camelCase("tip-"+e)];if(t)return t;var i=this.root.options[e];return i!==void 0?i:void 0},_getIntOpt:function(e){return parseInt(this._getOpt(e),10)},_getFloatOpt:function(e){return parseFloat(this._getOpt(e),10)},_destroy:function(){this.tooltip&&n.remove(this.tooltip),this.root=null,this.element=null,this.tooltip=null},_onMouseOver:function(e){var t=this._getMousePosition(e),n=this._getFloatOpt("delay");n?this._delayTimeout=setTimeout(Ink.bind(function(){this.tooltip||this._makeTooltip(t),this._delayTimeout=null},this),1e3*n):this._makeTooltip(t)},_onMouseMove:function(e){if("mousemove"===this._getOpt("where")&&this.tooltip){var t=this._getMousePosition(e);this._setPos(t[0],t[1])}},_onMouseOut:function(){this._getIntOpt("forever")||this._removeTooltip(),this._delayTimeout&&(clearTimeout(this._delayTimeout),this._delayTimeout=null)},_onTooltipMouseOver:function(){this.tooltip&&this._removeTooltip()},_setPos:function(e,t){e+=this._getIntOpt("left"),t+=this._getIntOpt("top");var i=this._getPageXY();if(this.tooltip){var o=[n.elementWidth(this.tooltip),n.elementHeight(this.tooltip)],r=this._getScroll();o[0]+e-r[0]>=i[0]-20&&(e=e-o[0]-this._getIntOpt("left")-10),o[1]+t-r[1]>=i[1]-20&&(t=t-o[1]-this._getIntOpt("top")-10),this.tooltip.style.left=e+"px",this.tooltip.style.top=t+"px"}},_getPageXY:function(){var e=0,t=0;return"number"==typeof window.innerWidth?(e=window.innerWidth,t=window.innerHeight):document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)?(e=document.documentElement.clientWidth,t=document.documentElement.clientHeight):document.body&&(document.body.clientWidth||document.body.clientHeight)&&(e=document.body.clientWidth,t=document.body.clientHeight),[parseInt(e,10),parseInt(t,10)]},_getScroll:function(){var e=document.documentElement,t=document.body;return e&&(e.scrollLeft||e.scrollTop)?[e.scrollLeft,e.scrollTop]:t?[t.scrollLeft,t.scrollTop]:[0,0]},_getLocalScroll:function(){for(var e,t,n=[0,0],i=this.element.parentNode;i&&i!==document.documentElement&&i!==document.body;)e=i.scrollLeft,t=i.scrollTop,e&&(n[0]+=e),t&&(n[1]+=t),i=i.parentNode;return n},_getMousePosition:function(e){return[parseInt(t.pointerX(e),10),parseInt(t.pointerY(e),10)]}},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.SmoothScroller","1",["Ink.Dom.Event_1","Ink.Dom.Selector_1","Ink.Dom.Loaded_1"],function(e,t,n){"use strict";var i={speed:10,gy:function(e){var t;if(t=e.offsetTop,e.offsetParent)for(;e=e.offsetParent;)t+=e.offsetTop;return t},scrollTop:function(){var e=document.body,t=document.documentElement;return e&&e.scrollTop?e.scrollTop:t&&t.scrollTop?t.scrollTop:window.pageYOffset?window.pageYOffset:0},add:function(t,n,i){e.observe(t,n,i)},end:function(t){return window.event?(window.event.cancelBubble=!0,window.event.returnValue=!1,void 0):(e.stop(t),void 0)},scroll:function(e){var t=Ink.UI.SmoothScroller.scrollTop();t+=e>t?Math.ceil((e-t)/Ink.UI.SmoothScroller.speed):(e-t)/Ink.UI.SmoothScroller.speed,window.scrollTo(0,t),(t===e||Ink.UI.SmoothScroller.offsetTop===t)&&clearInterval(Ink.UI.SmoothScroller.interval),Ink.UI.SmoothScroller.offsetTop=t},init:function(){n.run(Ink.UI.SmoothScroller.render)},render:function(){var n=t.select("a.scrollableLink");Ink.UI.SmoothScroller.end(this);for(var i=0;n.length>i;i++){var o=n[i];!o.href||-1===o.href.indexOf("#")||o.pathname!==location.pathname&&"/"+o.pathname!==location.pathname||(Ink.UI.SmoothScroller.add(o,"click",Ink.UI.SmoothScroller.end),e.observe(o,"click",Ink.bindEvent(Ink.UI.SmoothScroller.clickScroll,this,o)))}},clickScroll:function(e,n){if(Ink.UI.SmoothScroller.end(n),null!==n&&null!==n.getAttribute("href")){var i=n.href.indexOf("#");if(-1===i)return;var o=n.href.substr(i+1),r=t.select('a[name="'+o+'"],#'+o);if(r[0]!==void 0){if(-1===n.parentNode.className.indexOf("active")){var s=n.parentNode.parentNode,a=s.firstChild;do if(a.tagName!==void 0&&"LI"===a.tagName.toUpperCase()&&-1!==a.className.indexOf("active")){a.className=a.className.replace("active","");break}while(a=a.nextSibling);n.parentNode.className+=" active"}clearInterval(Ink.UI.SmoothScroller.interval),Ink.UI.SmoothScroller.interval=setInterval("Ink.UI.SmoothScroller.scroll("+Ink.UI.SmoothScroller.gy(r[0])+")",10)}}}};return i});
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])if(this._options.queries[n].hasOwnProperty(r)){if("src"===r||"retina"===r)continue;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.FormValidator","2",["Ink.UI.Aux_1","Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Selector_1","Ink.Dom.Css_1","Ink.Util.Array_1","Ink.Util.I18n_1","Ink.Util.Validator_1"],function(e,t,n,i,o,r,s,a){"use strict";var l={required:function(e){return e!==void 0&&!/^\s*$/.test(e)},min_length:function(e,t){return"string"==typeof e&&e.length>=parseInt(t,10)},max_length:function(e,t){return"string"==typeof e&&e.length<=parseInt(t,10)},exact_length:function(e,t){return"string"==typeof e&&e.length===parseInt(t,10)},email:function(e){return"string"==typeof e&&a.mail(e)},url:function(e,t){return t=t||!1,"string"==typeof e&&a.url(e,t)},ip:function(e,t){return"string"!=typeof e?!1:a.isIP(e,t)},phone:function(e,t){if("string"!=typeof e)return!1;var n=t?t.toUpperCase():"";return a["is"+n+"Phone"](e)},credit_card:function(e,t){return"string"!=typeof e?!1:a.isCreditCard(e,t||"default")},date:function(e,t){return"string"==typeof e&&a.isDate(t,e)},alpha:function(e,t){return a.ascii(e,{singleLineWhitespace:t})},text:function(e,t,n){return a.unicode(e,{singleLineWhitespace:t,unicodePunctuation:n})},latin:function(e,t,n){return"string"!=typeof e?!1:a.latin1(e,{latin1Punctuation:t,singleLineWhitespace:n})},alpha_numeric:function(e){return a.ascii(e,{numbers:!0})},alpha_dash:function(e){return a.ascii(e,{dash:!0,underscore:!0})},digit:function(e){return"string"==typeof e&&/^[0-9]{1}$/.test(e)},integer:function(e,t){return a.number(e,{negative:!t,decimalPlaces:0})},decimal:function(e,t,n,i){return a.number(e,{decimalSep:t||".",decimalPlaces:+n||null,maxDigits:+i})},numeric:function(e,t,n,i){return t=t||".",-1!==e.indexOf(t)?l.decimal(e,t,n,i):l.integer(e)},range:function(e,t,n,i){return e=+e,t=+t,n=+n,isNaN(e)||isNaN(t)||isNaN(n)?!1:t>e||e>n?!1:i?0===(e-t)%i:!0},color:function(e){return a.isColor(e)},matches:function(e,t){return e===this.getFormElements()[t][0].getValue()}},u=new s({en_US:{"formvalidator.required":"The {field} filling is mandatory","formvalidator.min_length":"The {field} must have a minimum size of {param1} characters","formvalidator.max_length":"The {field} must have a maximum size of {param1} characters","formvalidator.exact_length":"The {field} must have an exact size of {param1} characters","formvalidator.email":"The {field} must have a valid e-mail address","formvalidator.url":"The {field} must have a valid URL","formvalidator.ip":"The {field} does not contain a valid {param1} IP address","formvalidator.phone":"The {field} does not contain a valid {param1} phone number","formvalidator.credit_card":"The {field} does not contain a valid {param1} credit card","formvalidator.date":"The {field} should contain a date in the {param1} format","formvalidator.alpha":"The {field} should only contain letters","formvalidator.text":"The {field} should only contain alphabetic characters","formvalidator.latin":"The {field} should only contain alphabetic characters","formvalidator.alpha_numeric":"The {field} should only contain letters or numbers","formvalidator.alpha_dashes":"The {field} should only contain letters or dashes","formvalidator.digit":"The {field} should only contain a digit","formvalidator.integer":"The {field} should only contain an integer","formvalidator.decimal":"The {field} should contain a valid decimal number","formvalidator.numeric":"The {field} should contain a number","formvalidator.range":"The {field} should contain a number between {param1} and {param2}","formvalidator.color":"The {field} should contain a valid color","formvalidator.matches":"The {field} should match the field {param1}","formvalidator.validation_function_not_found":"The rule {rule} has not been defined"},pt_PT:{"formvalidator.required":"Preencher {field} é obrigatório","formvalidator.min_length":"{field} deve ter no mínimo {param1} caracteres","formvalidator.max_length":"{field} tem um tamanho máximo de {param1} caracteres","formvalidator.exact_length":"{field} devia ter exactamente {param1} caracteres","formvalidator.email":"{field} deve ser um e-mail válido","formvalidator.url":"O {field} deve ser um URL válido","formvalidator.ip":"{field} não tem um endereço IP {param1} válido","formvalidator.phone":"{field} deve ser preenchido com um número de telefone {param1} válido.","formvalidator.credit_card":"{field} não tem um cartão de crédito {param1} válido","formvalidator.date":"{field} deve conter uma data no formato {param1}","formvalidator.alpha":"O campo {field} deve conter apenas caracteres alfabéticos","formvalidator.text":"O campo {field} deve conter apenas caracteres alfabéticos","formvalidator.latin":"O campo {field} deve conter apenas caracteres alfabéticos","formvalidator.alpha_numeric":"{field} deve conter apenas letras e números","formvalidator.alpha_dashes":"{field} deve conter apenas letras e traços","formvalidator.digit":"{field} destina-se a ser preenchido com apenas um dígito","formvalidator.integer":"{field} deve conter um número inteiro","formvalidator.decimal":"{field} deve conter um número válido","formvalidator.numeric":"{field} deve conter um número válido","formvalidator.range":"{field} deve conter um número entre {param1} e {param2}","formvalidator.color":"{field} deve conter uma cor válida","formvalidator.matches":"{field} deve corresponder ao campo {param1}","formvalidator.validation_function_not_found":"[A regra {rule} não foi definida]"}},"en_US"),c=function(n,i){this._element=e.elOrSelector(n,"Invalid FormElement"),this._errors={},this._rules={},this._value=null,this._options=Ink.extendObj({label:this._getLabel()},t.data(this._element)),this._options=Ink.extendObj(this._options,i||{})};c.prototype={_getLabel:function(){var e=t.findUpwardsByClass(this._element,"control-group"),n=Ink.s("label",e);return n=n?t.textContent(n):this._element.name||this._element.id||""},_parseRules:function(e){this._rules={},e=e.split("|");var t,n,i,o,r=e.length;if(r>0)for(t=0;r>t;t++)if(n=e[t])if(-1!==(o=n.indexOf("["))){i=n.substr(o+1),i=i.split("]"),i=i[0],i=i.split(",");for(var s=0,a=i.length;a>s;s++)i[s]="true"===i[s]?!0:"false"===i[s]?!1:i[s];i.splice(0,0,this.getValue()),n=n.substr(0,o),this._rules[n]=i}else this._rules[n]=[this.getValue()]},_addError:function(e){for(var t=this._rules[e]||[],n={field:this._options.label,value:this.getValue()},i=1;t.length>i;i++)n["param"+i]=t[i];var o="formvalidator."+e;this._errors[e]=u.text(o,n),this._errors[e]===o&&(this._errors[e]="Validation message not found")},getValue:function(){switch(this._element.nodeName.toLowerCase()){case"select":return Ink.s("option:selected",this._element).value;case"textarea":return this._element.innerHTML;case"input":if(!("type"in this._element))return this._element.value;if("radio"===this._element.type&&"checkbox"===this._element.type){if(this._element.checked)return this._element.value}else if("file"!==this._element.type)return this._element.value;return;default:return this._element.innerHTML}},getErrors:function(){return this._errors},getElement:function(){return this._element},getFormElements:function(){return this._options.form._formElements},validate:function(){if(this._errors={},this._parseRules(this._options.rules),"required"in this._rules||""!==this.getValue())for(var e in this._rules)if(this._rules.hasOwnProperty(e)){if("function"!=typeof l[e])return this._addError(null),!1;if(l[e].apply(this,this._rules[e])===!1)return this._addError(e),!1}return!0}};var h=function(i,o){this._rootElement=e.elOrSelector(i),this._formElements={},this._errorMessages=[],this._markedErrorElements=[],this._options=Ink.extendObj({eventTrigger:"submit",searchFor:"input, select, textarea, .control-group",beforeValidation:void 0,onError:void 0,onSuccess:void 0},t.data(this._rootElement)),this._options=Ink.extendObj(this._options,o||{}),"string"==typeof this._options.eventTrigger&&n.observe(this._rootElement,this._options.eventTrigger,Ink.bindEvent(this.validate,this)),this._init()};return h.setRule=function(e,t,n){if(l[e]=n,u.getKey("formvalidator."+e)!==t){var i={};i["formvalidator."+e]=t;var o={};o[u.lang()]=i,u.append(o)}},h.getI18n=function(){return u},h.setI18n=function(e){u=e},h.appendI18n=function(){u.append.apply(u,[].slice.call(arguments))},h.setLanguage=function(e){u.lang(e)},h.getRules=function(){return l},h.prototype={_init:function(){},getElements:function(){this._formElements={};var e=i.select(this._options.searchFor,this._rootElement);if(e.length){var n,o;for(n=0;e.length>n;n+=1){o=e[n];var r=t.data(o);if("rules"in r){var s,a={form:this};"name"in o&&o.name?s=o.name:"id"in o&&o.id?s=o.id:(s="element_"+Math.floor(100*Math.random()),o.id=s),s in this._formElements?this._formElements[s].push(new c(o,a)):this._formElements[s]=[new c(o,a)]}}}return this._formElements},validate:function(e){n.stop(e),"function"==typeof this._options.beforeValidation&&this._options.beforeValidation(),this.getElements();var i=[];for(var s in this._formElements)if(this._formElements.hasOwnProperty(s))for(var a=0;this._formElements[s].length>a;a+=1)this._formElements[s][a].validate()||i.push(this._formElements[s][a]);return 0===i.length?("function"==typeof this._options.onSuccess&&this._options.onSuccess(),!0):("function"==typeof this._options.onError&&this._options.onError(i),r.each(this._markedErrorElements,Ink.bind(o.removeClassName,o,"validation")),r.each(this._markedErrorElements,Ink.bind(o.removeClassName,o,"error")),r.each(this._errorMessages,t.remove),this._errorMessages=[],this._markedErrorElements=[],r.each(i,Ink.bind(function(e){var n,i;o.hasClassName(e.getElement(),"control-group")?(n=e.getElement(),i=Ink.s(".control",e.getElement())):(n=t.findUpwardsByClass(e.getElement(),"control-group"),i=t.findUpwardsByClass(e.getElement(),"control")),i&&n||(i=n=e.getElement()),o.addClassName(n,"validation"),o.addClassName(n,"error"),this._markedErrorElements.push(n);var r=document.createElement("p");o.addClassName(r,"tip"),t.insertAfter(r,i);var s=e.getErrors(),a=[];for(var l in s)s.hasOwnProperty(l)&&a.push(s[l]);r.innerHTML=a.join("<br/>"),this._errorMessages.push(r)},this)),!1)}},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]=[];for(var t=this.element.elements,n=!1,i=0,r=t.length;r>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 o in this._flagMap)if(e.hasClassName(n,o)){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=[],r=!1,o=!1,s=0,a=this.elements[this.element.id].length;a>s;s++)if(n=!1,r=this.elements[this.element.id][s],!r.disabled)for(var l in this._flagMap)e.hasClassName(r,l)&&("ink-fv-custom"!==l&&"ink-fv-confirm"!==l?this._isValid(r,l)||(n?i[i.length-1].errors.push(l):(i.push({elm:r,errors:[l]}),n=!0)):"ink-fv-confirm"!==l&&(o=this._isCustomValid(r),o.length>0&&i.push({elm:r,errors:[l],custom:o})));return i=this._validateConfirmGroups(t,i)},_validateConfirmGroups:function(e,t){var n=!1;for(var i in e)e.hasOwnProperty(i)&&(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,r=0,o=this.confirmElms[this.element.id].length;o>r;r++){n=this.confirmElms[this.element.id][r];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,r=0,o=this.custom.length;o>r;r++)i=this.custom[r],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 r=n.form[n.name];r.length===void 0&&(r=[r]);for(var o=!1,s=0,a=r.length;a>s;s++)r[s].checked===!0&&(o=!0);return o}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),u=l.data(n),c="yyyy-mm-dd";if(e.hasClassName(n,"ink-datepicker")&&"format"in u?c=u.format:"validFormat"in u&&(c=u.validFormat),!(c in t._dateParsers)){var h=[];for(var d in t._dateParsers)t._dateParsers.hasOwnProperty(d)&&h.push(d);throw"The attribute data-valid-format must be one of the following values: "+h.join(",")}return t.isDate(c,n.value);case"ink-fv-custom":}return!1},_showError:function(t,n){this._clearError(t);for(var i=!1,r=0,o=n.length;o>r;r++)if(i=n[r].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[r].errors[0]?this._flagMap[n[r].errors[0]].msg:n[r].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[r].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,r=n.length-1;r>=0;r--)i=n[r],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 o=t.getElementsByTagName("ul");for(r=o.length-1;r>=0;r--)i=o[r],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","Ink.UI.Aux_1","Ink.Util.Array_1","Ink.Dom.Selector_1"],function(e,t,n,i,r,o){var s=function(e){return function(t){return n.addClassName(e,t)}},a=function(e){return function(t){return n.removeClassName(e,t)}},l={debug:!1,_droppables:[],_draggables:[],add:function(t,n){function r(e){e.style.position="inherit"}t=i.elOrSelector(t,"Droppable.add target element");var o=Ink.extendObj({hoverClass:n.hoverclass||!1,accept:!1,onHover:!1,onDrop:!1,onDropOut:!1},n||{},e.data(t));"string"==typeof o.hoverClass&&(o.hoverClass=o.hoverClass.split(/\s+/));var s,a=this,l={move:function(e,t){r(e),t.appendChild(e)},copy:function(e,t){r(e),t.appendChild(e.cloneNode)},revert:function(e){a._findDraggable(e).originalParent.appendChild(e),r(e)}};if("string"==typeof o.onHover&&(s=o.onHover,o.onHover=l[s],void 0===o.onHover))throw Error("Unknown hover event handler: "+s);if("string"==typeof o.onDrop&&(s=o.onDrop,o.onDrop=l[s],void 0===o.onDrop))throw Error("Unknown drop event handler: "+s);if("string"==typeof o.onDropOut&&(s=o.onDropOut,o.onDropOut=l[s],void 0===o.onDropOut))throw Error("Unknown dropOut event handler: "+s);var u={element:t,data:{},options:o};this._droppables.push(u),this._update(u)},_findData:function(e){for(var t=this._droppables,n=0,i=t.length;i>n;n++)if(t[n].element===e)return t[n]},_findDraggable:function(e){for(var t=this._draggables,n=0,i=t.length;i>n;n++)if(t[n].element===e)return t[n]},updateAll:function(){r.each(this._droppables,l._update)},update:function(e){this._update(this._findData(e))},_update:function(t){var n=t.data,i=t.element;n.left=e.offsetLeft(i),n.top=e.offsetTop(i),n.right=n.left+e.elementWidth(i),n.bottom=n.top+e.elementHeight(i)},remove:function(e){e=i.elOrSelector(e);for(var t=this._droppables.length,n=0;t>n;n++)if(this._droppables[n].element===e){this._droppables.splice(n,1);break}return t!==this._droppables.length},action:function(e,t,n,i){r.each(this._droppables,Ink.bind(function(l){var u=l.data,h=l.options,c=l.element;(!h.accept||o.matches(h.accept,[i]).length)&&("drag"!==t||this._findDraggable(i)||this._draggables.push({element:i,originalParent:i.parentNode}),e.x>=u.left&&e.x<=u.right&&e.y>=u.top&&e.y<=u.bottom?"drag"===t?(h.hoverClass&&r.each(h.hoverClass,s(c)),h.onHover&&h.onHover(i,c)):"drop"===t&&(h.hoverClass&&r.each(h.hoverClass,a(c)),h.onDrop&&h.onDrop(i,c,n)):"drag"===t&&h.hoverClass?r.each(h.hoverClass,a(c)):"drop"===t&&h.onDropOut&&h.onDropOut(i,c,n))},this))}};return l});
Ink.createModule("Ink.UI.Draggable","1",["Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Browser_1","Ink.Dom.Selector_1","Ink.UI.Aux_1"],function(e,t,n,i,o,r){function s(e,t,n){return e=Math.min(e,n),e=Math.max(e,t)}var a=0,l=1,h=function(e,t){this.init(e,t)};return h.prototype={init:function(n,o){var s=Ink.extendObj({constraint:!1,constraintElm:!1,top:!1,right:!1,bottom:!1,left:!1,handle:o.handler||!1,revert:!1,cursor:"move",zindex:o.zindex||9999,dragClass:"drag",onStart:!1,onEnd:!1,onDrag:!1,onChange:!1,droppableProxy:!1,mouseAnchor:void 0,skipChildren:!0,fps:100,debug:!1},o||{},e.data(n));this.options=s,this.element=r.elOrSelector(n),this.constraintElm=s.constraintElm&&r.elOrSelector(s.constraintElm),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.lastRunAt=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.handle?r.elOrSelector(this.options.handle):this.element,this.handle.style.cursor=s.cursor,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)},_getCoords:function(t){var n=[e.scrollWidth(),e.scrollHeight()];return{x:(t.touches?t.touches[0].clientX:t.clientX)+n[a],y:(t.touches?t.touches[0].clientY:t.clientY)+n[l]}},_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=t.element(i);if(this.options.skipChildren&&o!==this.handle)return;t.stop(i),n.addClassName(this.element,this.options.dragClass),this.elmStartPosition=[e.elementLeft(this.element),e.elementTop(this.element)];var r=[parseInt(n.getStyle(this.element,"left"),10),parseInt(n.getStyle(this.element,"top"),10)],s=e.elementDimensions(this.element);this.originalPosition=[r[a]?r[a]:null,r[l]?r[l]:null],this.delta=this._getCoords(i),this.active=!0,this.position=n.getStyle(this.element,"position"),this.zindex=n.getStyle(this.element,"zIndex");var h=document.createElement("div");if(h.style.position=this.position,h.style.width=s[a]+"px",h.style.height=s[l]+"px",h.style.marginTop=n.getStyle(this.element,"margin-top"),h.style.marginBottom=n.getStyle(this.element,"margin-bottom"),h.style.marginLeft=n.getStyle(this.element,"margin-left"),h.style.marginRight=n.getStyle(this.element,"margin-right"),h.style.borderWidth="0",h.style.padding="0",h.style.cssFloat=n.getStyle(this.element,"float"),h.style.display=n.getStyle(this.element,"display"),h.style.visibility="hidden",this.delta2=[this.delta.x-this.elmStartPosition[a],this.delta.y-this.elmStartPosition[l]],this.options.mouseAnchor){var u=this.options.mouseAnchor.split(" "),c=[s[a],s[l]];"left"===u[0]?c[a]=0:"center"===u[0]&&(c[a]=parseInt(c[a]/2,10)),"top"===u[1]?c[l]=0:"center"===u[1]&&(c[l]=parseInt(c[l]/2,10)),this.applyDelta=[this.delta2[a]-c[a],this.delta2[l]-c[l]]}var d=this.options.fps?"dragFacade":"drag";if(this.placeholder=h,this.options.onStart&&this.options.onStart(this.element,i),this.options.droppableProxy){this.proxy=document.createElement("div"),s=[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight];var f=this.proxy.style;f.width=s[a]+"px",f.height=s[l]+"px",f.position="fixed",f.left="0",f.top="0",f.zIndex=this.options.zindex+1,f.backgroundColor="#FF0000",n.setOpacity(this.proxy,0);for(var p=document.body.firstChild;p&&1!==p.nodeType;)p=p.nextSibling;document.body.insertBefore(this.proxy,p),t.observe(this.proxy,"mousemove",this.handlers[d]),t.observe(this.proxy,"touchmove",this.handlers[d])}else t.observe(document,"mousemove",this.handlers[d]);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;(!this.lastRunAt||t>this.lastRunAt+this.deltaMs)&&(this.lastRunAt=t,this._onDrag(e))},_onDrag:function(n){if(this.active){t.stop(n),this.dragged=!0;var i=this._getCoords(n),o=i.x,r=i.y,h=this.options,u=!1,c=!1;if(this.prevCoords&&o!==this.prevCoords.x||r!==this.prevCoords.y){h.onDrag&&h.onDrag(this.element,n),this.prevCoords=i,u=this.elmStartPosition[a]+o-this.delta.x,c=this.elmStartPosition[l]+r-this.delta.y;var d=e.elementDimensions(this.element);if(this.constraintElm){var f=e.offset(this.constraintElm),p=e.elementDimensions(this.constraintElm),m=f[l]+(h.top||0),g=f[l]+p[l]-(h.bottom||0),v=f[a]+(h.left||0),_=f[a]+p[a]-(h.right||0);c=s(c,m,g-d[l]),u=s(u,v,_-d[a])}else if(h.constraint){var y=h.right===!1?e.pageWidth()-d[a]:h.right,b=h.left===!1?0:h.left,k=h.top===!1?0:h.top,w=h.bottom===!1?e.pageHeight()-d[l]:h.bottom;("horizontal"===h.constraint||"both"===h.constraint)&&(u=s(u,b,y)),("vertical"===h.constraint||"both"===h.constraint)&&(c=s(c,k,w))}var I=Ink.getModule("Ink.UI.Droppable_1");if(this.firstDrag&&(I&&I.updateAll(),this.firstDrag=!1),u&&(this.element.style.left=u+"px"),c&&(this.element.style.top=c+"px"),I){var E=this.options.mouseAnchor?{x:o-this.applyDelta[a],y:r-this.applyDelta[l]}:i;I.action(E,"drag",n,this.element)}h.onChange&&h.onChange(this)}}},_onEnd:function(i){if(t.stopObserving(document,"mousemove",this.handlers.drag),t.stopObserving(document,"touchmove",this.handlers.drag),this.options.fps&&this._onDrag(i),n.removeClassName(this.element,this.options.dragClass),this.active&&this.dragged){this.options.droppableProxy&&document.body.removeChild(this.proxy),this.pt&&(e.remove(this.pt),this.pt=void 0),this.placeholder&&e.remove(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[a]?this.originalPosition[a]+"px":"",this.element.style.top=this.originalPosition[l]?this.originalPosition[l]+"px":""),this.options.onEnd&&this.options.onEnd(this.element,i);var o=Ink.getModule("Ink.UI.Droppable_1");o&&o.action(this._getCoords(i),"drop",i,this.element),this.position=!1,this.zindex=!1,this.firstDrag=!0}this.active=!1,this.dragged=!1}},h});
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","Ink.Dom.Browser_1"],function(e,t,n,i,o,r,s){"use strict";var a=function(t,n){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:"&nbsp;de&nbsp;",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"}},i.data(this._dataField)||{}),this._options=Ink.extendObj(this._options,n||{}),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 n=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 r=document.createElement("a");r.className="close",r.innerHTML=this._options.closeText,this._superTopBar.appendChild(r)}this._containerObject.appendChild(this._superTopBar)}var s=document.createElement("div");s.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='<a href="#prev" class="change_month_prev">'+this._options.prevLinkText+"</a>",this._monthNext=document.createElement("div"),this._monthNext.className="sapo_cal_next",this._monthNext.innerHTML='<a href="#next" class="change_month_next">'+this._options.nextLinkText+"</a>",s.appendChild(this._monthPrev),s.appendChild(this._monthDescContainer),s.appendChild(this._monthNext),this._monthContainer=document.createElement("div"),this._monthContainer.className="sapo_cal_month",this._containerObject.appendChild(s),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='<a href="#" class="sapo_calmonth_'+(2===(h+"").length?h:"0"+h)+'">'+this._options.month[h].substring(0,3)+"</a>",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=i.elementTop(this._dataField),this._picker.style.left=i.elementLeft(this._dataField)+(i.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")}n.insertBefore(this._containerObject,n.childNodes[0]),this._picker?t.observe(this._picker,"click",Ink.bindEvent(function(e){t.stop(e),this._containerObject=i.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=i.clonePosition(this._containerObject,this._dataField),"bottom"===this._options.position?(this._containerObject.style.top=i.elementHeight(this._dataField)+i.offsetTop(this._dataField)+"px",this._containerObject.style.left=i.offset(this._dataField)[0]+"px"):(this._containerObject.style.top=i.offset(this._dataField)[1]+"px",this._containerObject.style.left=i.elementWidth(this._dataField)+i.offset(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),i.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&&(i.descendantOf(this._options.dayField,e.target)||i.descendantOf(this._options.monthField,e.target)||i.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 n=e.target.className,i=-1!==n.indexOf("sapo_cal_off");if(t.stop(e),0!==n.indexOf("sapo_cal_")||i)if(0!==n.indexOf("sapo_calmonth_")||i)if(0!==n.indexOf("sapo_calyear_")||i)0!==n.indexOf("change_month_")||i?0!==n.indexOf("change_year_")||i?"clean"===n?this._options.displayInSelect?(this._options.yearField.selectedIndex=0,this._options.monthField.selectedIndex=0,this._options.dayField.selectedIndex=0):this._dataField.value="":"close"===n&&(this._containerObject.style.display="none"):"change_year_next"===n?this._showYearSelector(1):"change_year_prev"===n&&this._showYearSelector(-1):"change_month_next"===n?this._updateCal(1):"change_month_prev"===n&&this._updateCal(-1);else{var o=n.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 r=n.substr(14,2);Number(r)&&(this._month=r-1,this._monthSelector.style.display="none",this._monthPrev.childNodes[0].className="change_month_prev",this._monthNext.childNodes[0].className="change_month_next",this._year<this._yearMin||this._year===this._yearMin&&this._month<=this._monthMin?this._monthPrev.childNodes[0].className="action_inactive":(this._year>this._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 s=n.substr(9,2);Number(s)?(this.setDate(this._year+"-"+(this._month+1)+"-"+s),this._containerObject.style.display="none"):"sapo_cal_link_month"===n?(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"===n&&(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 n=e.split(":"),i=/^(\d{4})((\-)(\d{1,2})((\-)(\d{1,2}))?)?$/;if(n[0]&&("NOW"===n[0]?(this._yearMin=this._today.getFullYear(),this._monthMin=this._today.getMonth()+1,this._dayMin=this._today.getDate()):i.test(n[0])?(t=n[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)),n[1])if("NOW"===n[1])this._yearMax=this._today.getFullYear(),this._monthMax=this._today.getMonth()+1,this._dayMax=this._today.getDate();else if(i.test(n[1])){t=n[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,n){return this._isValidDate(e,t+1,n)||(e=this._today.getFullYear(),t=this._today.getMonth(),n=this._today.getDate()),e>this._yearMax?(e=this._yearMax,t=this._monthMax-1,n=this._dayMax):this._yearMin>e&&(e=this._yearMin,t=this._monthMin-1,n=this._dayMin),e===this._yearMax&&t+1>this._monthMax?(t=this._monthMax-1,n=this._dayMax):e===this._yearMin&&this._monthMin>t+1&&(t=this._monthMin-1,n=this._dayMin),e===this._yearMax&&t+1===this._monthMax&&n>this._dayMax?n=this._dayMax:e===this._yearMin&&t+1===this._monthMin&&this._dayMin>n?n=this._dayMin:n>this._daysInMonth(e,t+1)&&(n=this._daysInMonth(e,t+1)),[e,t,n]},_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._year<this._yearMin||this._year===this._yearMin&&this._month+1<=this._monthMin?this._monthPrev.childNodes[0].className="action_inactive":(this._year>this._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="<li>",n=this._year-this._year%10,i=0;11>=i;i++)0===i%4&&(t+="<ul>"),t+=i&&11!==i?this._yearMax>=n+i-1&&n+i-1>=this._yearMin?'<li><a href="#" class="sapo_calyear_'+(n+i-1)+(n+i-1===this._data.getFullYear()?" sapo_cal_on":"")+'">'+(n+i-1)+"</a></li>":'<li><a href="#" class="sapo_cal_off">'+(n+i-1)+"</a></li>":i&&this._yearMax>=n+i-1&&n+i-1>=this._yearMin?'<li><a href="#year_next" class="change_year_next">'+this._options.nextLinkText+"</a></li>":this._yearMax>=n+i-1&&n+i-1>=this._yearMin?'<li><a href="#year_prev" class="change_year_prev">'+this._options.prevLinkText+"</a></li>":"<li>&nbsp;</li>",0===(i+1)%4&&(t+="</ul>");t+="</li>",this._yearSelector.innerHTML=t},_getDataArrayParsed:function(e){var t=[],n=s.set(this._options.format,e);return n&&(t=[n.getFullYear(),n.getMonth()+1,n.getDate()]),t},_isValidDate:function(e,t,n){var i=/^\d{4}$/,o=/^\d{1,2}$/;return i.test(e)&&o.test(t)&&o.test(n)&&t>=1&&12>=t&&n>=1&&this._daysInMonth(e,t)>=n},_isDate:function(e,t){try{if(e===void 0)return!1;var n=s.set(e,t);if(n&&this._isValidDate(n.getFullYear(),n.getMonth()+1,n.getDate()))return!0}catch(i){}return!1},_writeDateInFormat:function(){return s.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 n=31;switch(t){case 2:n=0===e%400||0===e%4&&0!==e%100?29:28;break;case 4:case 6:case 9:case 11:n=30}return n},_updateMonth:function(e){e===void 0&&(e="0");var t=this._month+1,n=this._year;switch(e){case-1:if(1===t){if(n===this._yearMin)return;t=12,n--}else t--;this._year=n,this._month=t-1;break;case 1:if(12===t){if(n===this._yearMax)return;t=1,n++}else t++;this._year=n,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,n=this._month+1,i=this._year,o=this._daysInMonth(i,n),r=new Date(i,n-1,1).getDay(),s=this._options.startWeekDay||0;this._monthPrev.childNodes[0].className="change_month_prev",this._monthNext.childNodes[0].className="change_month_next",this._yearMin>i||i===this._yearMin&&this._monthMin>=n?this._monthPrev.childNodes[0].className="action_inactive":(i>this._yearMax||i===this._yearMax&&n>=this._monthMax)&&(this._monthNext.childNodes[0].className="action_inactive"),s&&Number(s)&&(s>r?r=7+s-r:r+=s);var a="";for(a+='<ul class="sapo_cal_header">',e=0;7>e;e++)a+="<li>"+this._options.wDay[e+(s+e>6?s-7:s)].substring(0,1)+"</li>";a+="</ul>";var l=0;if(a+="<ul>",r)for(t=s;r-s>t;t++)l||(a+="<ul>"),a+='<li class="sapo_cal_empty">&nbsp;</li>',l++;for(e=1;o>=e;e++){7===l&&(l=0,a+="<ul>");var h="sapo_cal_"+(2===(e+"").length?e:"0"+e);h+=i===this._yearMin&&n===this._monthMin&&this._dayMin>e||i===this._yearMax&&n===this._monthMax&&e>this._dayMax||i===this._yearMin&&this._monthMin>n||i===this._yearMax&&n>this._monthMax||this._yearMin>i||i>this._yearMax||this._options.validDayFn&&!this._options.validDayFn.call(this,new Date(i,n-1,e))?" sapo_cal_off":this._data.getFullYear()===i&&this._data.getMonth()===n-1&&e===this._day?" sapo_cal_on":"",a+='<li><a href="#" class="'+h+'">'+e+"</a></li>",l++,7===l&&(a+="</ul>")}if(7!==l){for(e=l;7>e;e++)a+='<li class="sapo_cal_empty">&nbsp;</li>';a+="</ul>"}a+="</ul>",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 i=this._year,o=e.className.substr(14,2);i===this._data.getFullYear()&&o===this._data.getMonth()+1?(n.addClassName(e,"sapo_cal_on"),n.removeClassName(e,"sapo_cal_off")):(n.removeClassName(e,"sapo_cal_on"),i===this._yearMin&&this._monthMin>o||i===this._yearMax&&o>this._monthMax||this._yearMin>i||i>this._yearMax?n.addClassName(e,"sapo_cal_off"):n.removeClassName(e,"sapo_cal_off"))}else if(0!==t)for(var r=0;t>r;r++)this._setActiveMonth(e.childNodes[r])},lang:function(e){this._lang=e},showMonth:function(){this._showMonth()},isMonthRendered:function(){var e=o.select(".sapo_cal_header",this._containerObject)[0];return"none"!==n.getStyle(e.parentNode,"display")&&"none"!==n.getStyle(e.parentNode.parentNode,"display")}},a});
Ink.createModule("Ink.UI.Close","1",["Ink.Dom.Event_1","Ink.Dom.Element_1"],function(e,t){"use strict";var n=function(){e.observe(document.body,"click",function(n){var i=e.element(n);if(i=t.findUpwardsByClass(i,"ink-close")||t.findUpwardsByClass(i,"ink-dismiss")){var o=i;o=t.findUpwardsByClass(i,"ink-alert")||t.findUpwardsByClass(i,"ink-alert-block"),o&&(e.stop(n),t.remove(o))}})};return n});
Ink.createModule("Ink.UI.Carousel","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.UI.Pagination_1","Ink.Dom.Browser_1","Ink.Dom.Selector_1"],function(e,t,n,i,o,s){"use strict";var r=function(n,s){this._handlers={paginationChange:Ink.bind(this._onPaginationChange,this),windowResize:Ink.bind(this.refit,this)},t.observe(window,"resize",this._handlers.windowResize),this._element=e.elOrSelector(n,"1st argument"),this._options=Ink.extendObj({axis:"x",hideLast:!1,center:!1,keyboardSupport:!1,pagination:null,onChange:null},s||{},i.data(this._element)),this._isY="y"===this._options.axis;var r=this._element,a=Ink.s("ul.stage",r);if(this._ulEl=a,i.removeTextNodeChildren(a),this._options.hideLast){var l=document.createElement("div");l.className="hider",this._element.appendChild(l),l.style.position="absolute",l.style[this._isY?"left":"top"]="0",l.style[this._isY?"right":"bottom"]="0",l.style[this._isY?"bottom":"right"]="0",this._hiderEl=l}this.refit(),this._isY&&(this._ulEl.style.whiteSpace="normal"),this._options.pagination&&(e.isDOMElement(this._options.pagination)||"string"==typeof this._options.pagination?this._pagination=new o(this._options.pagination,{size:this._numPages,onChange:this._handlers.paginationChange}):(this._pagination=this._options.pagination,this._pagination._options.onChange=this._handlers.paginationChange,this._pagination.setSize(this._numPages),this._pagination.setCurrent(0)))};return r.prototype={refit:function(){this._liEls=Ink.ss("li.slide",this._ulEl);var e=this._liEls.length;this._ctnLength=this._size(this._element),this._elLength=this._size(this._liEls[0]),this._itemsPerPage=Math.floor(this._ctnLength/this._elLength),this._numPages=Math.ceil(e/this._itemsPerPage),this._deltaLength=this._itemsPerPage*this._elLength,this._isY?(this._element.style.width=this._liEls[0].offsetWidth+"px",this._ulEl.style.width=this._liEls[0].offsetWidth+"px"):this._ulEl.style.height=this._liEls[0].offsetHeight+"px",this._center(),this._updateHider(),this._IE7(),this._pagination&&(this._pagination.setSize(this._numPages),this._pagination.setCurrent(0))},_size:function(e){var t=i.outerDimensions(e);return this._isY?t[1]:t[0]},_center:function(){if(this._options.center){var e,t=Math.floor((this._ctnLength-this._elLength*this._itemsPerPage)/2);e=this._isY?[t,"px 0"]:["0 ",t,"px"],this._ulEl.style.padding=e.join("")}},_updateHider:function(){if(this._hiderEl){var e=Math.floor(this._ctnLength-this._elLength*this._itemsPerPage);this._options.center&&(e/=2),this._hiderEl.style[this._isY?"height":"width"]=e+"px"}},_IE7:function(){if(s.IE&&"7"==""+s.version.split(".")[0]){this._numPages;for(var e=Ink.ss("li.slide",this._ulEl),t=function(t,i){e[n].style[t]=i},n=0,i=e.length;i>n;n++)t("position","absolute"),t(this._isY?"top":"left",n*this._elLength+"px")}},_onPaginationChange:function(e){var t=e.getCurrent();this._ulEl.style["y"===this._options.axis?"top":"left"]=["-",t*this._deltaLength,"px"].join(""),this._options.onChange&&this._options.onChange.call(this,t)}},r});
Ink.createModule("Ink.UI.Modal","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,s){"use strict";var r=function(e,r){if("string"!=typeof e&&"object"!=typeof e&&r.markup===void 0)throw"Invalid Modal selector";if("string"==typeof e){if(""!==e){if(this._element=o.select(e),0===this._element.length)throw"The Modal selector has not returned any elements";this._element=this._element[0]}}else e&&(this._element=e);if(this._options={width:void 0,height:void 0,shadeClass:void 0,modalClass:void 0,trigger:void 0,triggerEvent:"click",autoDisplay:!0,markup:void 0,onShow:void 0,onDismiss:void 0,closeOnClick:!1,responsive:!0,disableScroll:!0},this._handlers={click:Ink.bindEvent(this._onClick,this),keyDown:Ink.bindEvent(this._onKeyDown,this),resize:Ink.bindEvent(this._onResize,this)},this._wasDismissed=!1,this._markupMode=this._element?n.hasClassName(this._element,"ink-modal"):!1,this._markupMode){if(this._modalDiv=this._element,this._modalDivStyle=this._modalDiv.style,this._modalShadow=this._modalDiv.parentNode,this._modalShadowStyle=this._modalShadow.style,this._contentContainer=o.select(".modal-body",this._modalDiv),!this._contentContainer.length)throw'Missing div with class "modal-body"';this._contentContainer=this._contentContainer[0],this._options.markup=this._contentContainer.innerHTML,this._options=Ink.extendObj(this._options,i.data(this._element))}else this._modalShadow=document.createElement("div"),this._modalShadowStyle=this._modalShadow.style,this._modalDiv=document.createElement("div"),this._modalDivStyle=this._modalDiv.style,this._element&&(this._options.markup=this._element.innerHTML),n.addClassName(this._modalShadow,"ink-shade"),n.addClassName(this._modalDiv,"ink-modal"),n.addClassName(this._modalDiv,"ink-space"),this._modalShadow.appendChild(this._modalDiv),document.body.appendChild(this._modalShadow);if(this._options=Ink.extendObj(this._options,r||{}),this._markupMode||this.setContentMarkup(this._options.markup),"string"==typeof this._options.shadeClass&&s.each(this._options.shadeClass.split(" "),Ink.bind(function(e){n.addClassName(this._modalShadow,e.trim())},this)),"string"==typeof this._options.modalClass&&s.each(this._options.modalClass.split(" "),Ink.bind(function(e){n.addClassName(this._modalDiv,e.trim())},this)),"trigger"in this._options&&this._options.trigger!==void 0){var a,l;if("string"==typeof this._options.trigger&&(a=o.select(this._options.trigger),a.length>0))for(l=0;a.length>l;l++)t.observe(a[l],this._options.triggerEvent,Ink.bindEvent(this.open,this))}else this._options.autoDisplay&&this.open()};return r.prototype={_reposition:function(){this._modalDivStyle.top=this._modalDivStyle.left="50%",this._modalDivStyle.marginTop="-"+~~(i.elementHeight(this._modalDiv)/2)+"px",this._modalDivStyle.marginLeft="-"+~~(i.elementWidth(this._modalDiv)/2)+"px"},_onResize:function(e){"boolean"==typeof e?this._timeoutResizeFunction.call(this):this._resizeTimeout||"object"!=typeof e||(this._resizeTimeout=setTimeout(Ink.bind(this._timeoutResizeFunction,this),250))},_timeoutResizeFunction:function(){var e="CSS1Compat"===document.compatMode?document.documentElement:document.body,t=parseInt(e.clientHeight,10),n=parseInt(e.clientWidth,10);this._modalDivStyle.width=n>this.originalStatus.width?this._modalDivStyle.maxWidth:~~(.9*n)+"px",this._modalDivStyle.height=t>this.originalStatus.height&&parseInt(this._modalDivStyle.maxHeight,10)>=i.elementHeight(this._modalDiv)?this._modalDivStyle.maxHeight:~~(.9*t)+"px",this._resizeContainer(),this._reposition(),this._resizeTimeout=void 0},_onClick:function(e){var s=t.element(e);if(n.hasClassName(s,"ink-close")||n.hasClassName(s,"ink-dismiss")||i.findUpwardsByClass(s,"ink-close")||i.findUpwardsByClass(s,"ink-dismiss")||this._options.closeOnClick&&(!i.descendantOf(this._shadeElement,s)||s===this._shadeElement)){for(var r=o.select(".ink-alert",this._shadeElement),a=r.length,l=0;a>l;l++)if(i.descendantOf(r[l],s))return;t.stop(e),this.dismiss()}},_onKeyDown:function(e){27!==e.keyCode||this._wasDismissed||this.dismiss()},_resizeContainer:function(){this._contentElement.style.overflow=this._contentElement.style.overflowX=this._contentElement.style.overflowY="hidden";var e=i.elementHeight(this._modalDiv);this._modalHeader=o.select(".modal-header",this._modalDiv),this._modalHeader.length>0&&(this._modalHeader=this._modalHeader[0],e-=i.elementHeight(this._modalHeader)),this._modalFooter=o.select(".modal-footer",this._modalDiv),this._modalFooter.length>0&&(this._modalFooter=this._modalFooter[0],e-=i.elementHeight(this._modalFooter)),this._contentContainer.style.height=e+"px",e!==i.elementHeight(this._contentContainer)&&(this._contentContainer.style.height=~~(e-(i.elementHeight(this._contentContainer)-e))+"px"),this._markupMode||(this._contentContainer.style.overflow=this._contentContainer.style.overflowX="hidden",this._contentContainer.style.overflowY="auto",this._contentElement.style.overflow=this._contentElement.style.overflowX=this._contentElement.style.overflowY="visible")},_disableScroll:function(){this._oldScrollPos=i.scroll(),this._onScrollBinded=Ink.bindEvent(function(e){var n=t.element(e);i.descendantOf(this._modalShadow,n)||(t.stop(e),window.scrollTo(this._oldScrollPos[0],this._oldScrollPos[1]))},this),t.observe(window,"scroll",this._onScrollBinded),t.observe(document,"touchmove",this._onScrollBinded)},open:function(o){o&&t.stop(o);var s="CSS1Compat"===document.compatMode?document.documentElement:document.body;this._resizeTimeout=null,n.addClassName(this._modalShadow,"ink-shade"),this._modalShadowStyle.display=this._modalDivStyle.display="block",setTimeout(Ink.bind(function(){n.addClassName(this._modalShadow,"visible"),n.addClassName(this._modalDiv,"visible")},this),100),this._contentElement=this._modalDiv,this._shadeElement=this._modalShadow,this._markupMode||this.setContentMarkup(this._options.markup),this._options.width!==void 0?(this._modalDivStyle.width=this._options.width,-1===this._options.width.indexOf("%")&&(this._modalDivStyle.maxWidth=i.elementWidth(this._modalDiv)+"px")):this._modalDivStyle.maxWidth=this._modalDivStyle.width=i.elementWidth(this._modalDiv)+"px",parseInt(s.clientWidth,10)<=parseInt(this._modalDivStyle.width,10)&&(this._modalDivStyle.width=~~(.9*parseInt(s.clientWidth,10))+"px"),this._options.height!==void 0?(this._modalDivStyle.height=this._options.height,-1===this._options.height.indexOf("%")&&(this._modalDivStyle.maxHeight=i.elementHeight(this._modalDiv)+"px")):this._modalDivStyle.maxHeight=this._modalDivStyle.height=i.elementHeight(this._modalDiv)+"px",parseInt(s.clientHeight,10)<=parseInt(this._modalDivStyle.height,10)&&(this._modalDivStyle.height=~~(.9*parseInt(s.clientHeight,10))+"px"),this.originalStatus={viewportHeight:parseInt(s.clientHeight,10),viewportWidth:parseInt(s.clientWidth,10),width:parseInt(this._modalDivStyle.maxWidth,10),height:parseInt(this._modalDivStyle.maxHeight,10)},this._options.responsive?(this._onResize(!0),t.observe(window,"resize",this._handlers.resize)):(this._resizeContainer(),this._reposition()),this._options.onShow&&this._options.onShow(this),this._options.disableScroll&&this._disableScroll(),t.observe(this._shadeElement,"click",this._handlers.click),t.observe(document,"keydown",this._handlers.keyDown),e.registerInstance(this,this._shadeElement,"modal"),this._wasDismissed=!1},dismiss:function(){if(this._options.onDismiss){var e=this._options.onDismiss(this);if(e===!1)return}if(this._wasDismissed=!0,this._options.disableScroll&&(t.stopObserving(window,"scroll",this._onScrollBinded),t.stopObserving(document,"touchmove",this._onScrollBinded)),this._options.responsive&&t.stopObserving(window,"resize",this._handlers.resize),this._markupMode){n.removeClassName(this._modalDiv,"visible"),n.removeClassName(this._modalShadow,"visible");var i,o=Ink.bindEvent(function(){i&&(this._modalShadowStyle.display="none",t.stopObserving(document,"transitionend",o),t.stopObserving(document,"oTransitionEnd",o),t.stopObserving(document,"webkitTransitionEnd",o),clearInterval(i),i=void 0)},this);t.observe(document,"transitionend",o),t.observe(document,"oTransitionEnd",o),t.observe(document,"webkitTransitionEnd",o),i||(i=setInterval(Ink.bind(function(){this._modalShadowStyle.opacity>0||(this._modalShadowStyle.display="none",clearInterval(i),i=void 0)},this),500))}else this._modalShadow.parentNode.removeChild(this._modalShadow),this.destroy()},destroy:function(){e.unregisterInstance(this._instanceId)},getContentElement:function(){return this._contentContainer},setContentMarkup:function(e){if(this._markupMode)this._contentContainer.innerHTML=[e].join("");else{if(this._modalDiv.innerHTML=[e].join(""),this._contentContainer=o.select(".modal-body",this._modalDiv),!this._contentContainer.length){var t=o.select(".modal-header",this._modalDiv),i=o.select(".modal-footer",this._modalDiv);s.each(t,Ink.bind(function(e){e.parentNode.removeChild(e)},this)),s.each(i,Ink.bind(function(e){e.parentNode.removeChild(e)},this));var r=document.createElement("div");n.addClassName(r,"modal-body"),r.innerHTML=this._modalDiv.innerHTML,this._modalDiv.innerHTML="",s.each(t,Ink.bind(function(e){this._modalDiv.appendChild(e)},this)),this._modalDiv.appendChild(r),s.each(i,Ink.bind(function(e){this._modalDiv.appendChild(e)},this)),this._contentContainer=o.select(".modal-body",this._modalDiv)}this._contentContainer=this._contentContainer[0]}this._contentElement=this._modalDiv,this._resizeContainer()}},r});
Ink.createModule("Ink.UI.ProgressBar","1",["Ink.Dom.Selector_1","Ink.Dom.Element_1"],function(e,t){"use strict";var n=function(n,i){if("object"!=typeof n){if("string"!=typeof n)throw"[Ink.UI.ProgressBar] :: Invalid selector";if(this._element=e.select(n),1>this._element.length)throw"[Ink.UI.ProgressBar] :: Selector didn't find any elements";this._element=this._element[0]}else this._element=n;this._options=Ink.extendObj({startValue:0,onStart:function(){},onEnd:function(){}},t.data(this._element)),this._options=Ink.extendObj(this._options,i||{}),this._value=this._options.startValue,this._init()};return n.prototype={_init:function(){if(this._elementBar=e.select(".bar",this._element),1>this._elementBar.length)throw"[Ink.UI.ProgressBar] :: Bar element not found";this._elementBar=this._elementBar[0],this._options.onStart=Ink.bind(this._options.onStart,this),this._options.onEnd=Ink.bind(this._options.onEnd,this),this.setValue(this._options.startValue)},setValue:function(e){this._options.onStart(this._value),e=parseInt(e,10),isNaN(e)||0>e?e=0:e>100&&(e=100),this._value=e,this._elementBar.style.width=this._value+"%",this._options.onEnd(this._value)}},n});