window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){arguments.callee=arguments.callee.caller;var a=[].slice.call(arguments);"object"===typeof console.log?log.apply.call(console.log,console,a):console.log.apply(console,a)}};
(function(a){function c(){}for(var b="assert,clear,count,debug,dir,dirxml,error,exception,firebug,group,groupCollapsed,groupEnd,info,log,memoryProfile,memoryProfileEnd,profile,profileEnd,table,time,timeEnd,timeStamp,trace,warn".split(","),d;d=b.pop();)a[d]=a[d]||c})(function(){try{return console.log(),window.console}catch(a){return window.console={}}}());
$(function(){$.web=$.web||{};$.extend($.web,{$document:$(document),cycle:function(){var a=$("#cycle");1<a.find("> div > a").length&&a.append('<div id="cycle-prev" /><div id="cycle-next" />').find(" > div").cycle({timeout:1E4,prev:"#cycle-prev",next:"#cycle-next"}).mouseover(function(){a.cycle("pause")}).mouseout(function(){a.cycle("resume")})},dialog:function(){var a=this,c=$("#gallery a");$("#gallery").on("click","a",function(b){b.preventDefault();var d=this;$.fancybox('<div id="gal-img" /><div id="gal-thumbs"></div>',
{padding:20,autoScale:!1,autoDimensions:!1,width:850,height:302,onComplete:function(){a.gallery.open(d,c)},onClosed:function(){a.gallery.close()}})});$("[data-dialog]").fancybox({padding:20});$("[data-dialog=job]").addClass("iframe").fancybox({padding:20,autoScale:!1,autoDimensions:!1,width:418,height:460})},gallery:{open:function(a,c){var b=this,d={39:"next",37:"prev",38:"top",40:"down"};b.$thumbs=$("#gal-thumbs");b.$wrapper=$("#gal-img");b.numImgs=c.size();b.openedIndex=$(a).index();$("#fancybox-content > div").css("overflow",
"hidden");b.$thumbs.before('<h3 id="gal-header">Galerie</h3>');c.clone().appendTo(b.$thumbs).hide();b.showThumbs(0);b.showImage(a);b.$thumbs.on("click","a",function(a){a.preventDefault();b.changeImage(this)});$.web.$document.on("keydown.gallery",function(a){if(d[a.which]){a.preventDefault();var c;switch(d[a.which]){case "next":c=b.openedIndex===b.numImgs-1?0:b.openedIndex+1;break;case "prev":c=0===b.openedIndex?b.numImgs-1:b.openedIndex-1;break;case "top":c=0>b.openedIndex-2?b.openedIndex-2+b.numImgs:
b.openedIndex-2;break;case "down":c=b.openedIndex+2<b.numImgs-1?b.openedIndex+2:b.openedIndex+2-b.numImgs}a=b.$thumbs.find("a").eq(c).get(0);b.changeImage(a)}})},close:function(){$.web.$document.off(".gallery")},showImage:function(a){var c=this,b=$(a);c.openedIndex=b.index();$.when(c.loadImg(b.attr("href"))).done(function(){c.$wrapper.append(c.$img.hide()).children("img").fadeIn(500);c.highlightThumb(b)})},changeImage:function(a){var c=this,b=$(a);c.openedIndex=b.index();$.when(c.loadImg(b.attr("href"))).done(function(){c.$wrapper.children("img").addClass("off").end().append(c.$img);
setTimeout(function(){c.$wrapper.children("img:first").remove()},500);c.highlightThumb(b)})},loadImg:function(a){var c=$.Deferred();this.$img=$("<img />");$.fancybox.showActivity();this.$img.load(function(){$.fancybox.hideActivity();c.resolve()}).error(c.reject).attr("src",a);return c.promise()},highlightThumb:function(a){"gal-thumbs"!==a.parent().attr("id")&&(a=this.$thumbs.find("a").eq(a.index()));this.$thumbs.find("img").removeClass("selected");a.children("img").addClass("selected")},showThumbs:function(a){var c=
this;setTimeout(function(){c.$thumbs.children("a:eq("+a+")").fadeIn(500);a++;a<c.numImgs&&c.showThumbs(a)},150)}},externalLinks:function(){$("a.external, a[href$=pdf]").on("click",function(){window.open(this.href);return!1})},careerForm:function(){var a=$("#job-form .attachement"),c=$("#add-attachement");c.show();a.addClass("hidden");c.on("click","a",function(b){b.preventDefault();a.filter(".hidden:first").removeClass("hidden");a.filter(".hidden").length||c.hide()})}});$.web.cycle();$.web.dialog();
$.web.externalLinks();$.web.careerForm()});
