function trackGoogleAnalytics(url) {
// Google Analytics
console.log("track google "+url);
//pageTracker._trackPageview(url);
_gaq.push(['_trackPageview', url]);
}

function Delodepote(_1){var _2=this;this.language=_1;this.renderer=new DelodepoteRenderer(this);this.ajax=new DelodepoteAjax(this.renderer);this.init=function(){this.renderer.init();this.ajax.init();};};function DelodepoteAjax(_3){var _4=this;this.renderer=_3;this.tid=null;this.historyCallbackFunction=null;this.pagesLoaded=0;this.isLoading=false;this.loadingTimout=5;this.timeoutTimer=null;this.fullscreenHideWait=3000;this.fullscreenHideSpeed=250;this.fullscreenPhotoHideSpeed=250;this.fullscreenHidden=false;this.initLoadFinished=true;if(window.location.hash.length){this.initLoadFinished=false;}this.timerLoading=null;this.timerLoadingTime=0.8;this.slideshowIsRunning=false;this.slideshowDuration=5000;this.slideshowTimer=null;this.slideshowStartUrl="";this.init=function(){$.ajaxSetup({type:"json",cache:false});$.history.init(this.historyCallback);this.initAjaxLinks();};this.initAjaxLinks=function(){$("a[tid]").each(function(){var e=$(this);if(!e.hasClass("tid-processed")){e.unbind("click");e.click(_4.ajaxClick);e.addClass("tid-processed");e.hover(function(){var _5=_4.renderer.getBlock($(this).attr("tid"));_5.opacityIn();},function(){var _6=_4.renderer.getBlock($(this).attr("tid"));_6.opacityOut();});}});};this.getUrl=function(_7){var _8=_7.split("/");var _9="/"+this.renderer.main.language+"/portfolio";var _a="";if(_7==""||_7=="/"){_a=_9;}else{if(_8.length==2||(_8.length==3&&_8[2].length==0)){_a="/"+_8[1]+"/portfolio";}else{_a=_7;}}return _a;};this.getUrlTid=function(_b){var _c=_b.split("/");var _d=null;if(_b==""||_b=="/"||_c.length==2||(_c.length>2&&_c[2].length==0)){console.log("empty url detected, setting TID to portfolio");_d="portfolio";}else{if(_c.length>2){_d=_c[2];}}return _d;};this.isInFullscreen=function(){return this.renderer.isInFullscreen();};this.isFullscreenUrl=function(_e){var _f=_e.split("/");if(_f.length>6&&_f[2]=="portfolio"&&_f[3]=="photo"){return true;}else{return false;}};this.historyCallback=function(_10,_11){console.log("_________________________history hash: "+_10);if($.isFunction(_11)){_4.historyCallbackFunction=_11;}if(_10==""&&_4.pagesLoaded>0){_10=_4.getUrl(window.location.pathname);_4.tid=_4.getUrlTid(window.location.pathname);}else{if(_4.pagesLoaded==0&&_10==""&&_4.isFullscreenUrl(window.location.pathname)){_10=window.location.pathname;_4.tid=_4.getUrlTid(window.location.pathname);}}if(_10.length){_10=_4.getUrl(_10);_4.tid=_4.getUrlTid(_10);}if(_10.length&&_4.tid){var _12=_4.renderer.getBlock(_4.tid);if(!_4.isLoading){_4.isLoading=true;if(_4.isFullscreenUrl(_10)){if(_4.isInFullscreen()){var _13=$("body > .fullscreen");_13.find(".img-center").stop().animate({opacity:0},_4.fullscreenPhotoHideSpeed);_13.find("> .invisible").load(_10,function(_14,_15,_16){

// Google Analytics
trackGoogleAnalytics(_10);

_4.pagesLoaded++;if(_15=="error"){_4.noticeError($(this),_14);}
_4.tid=null;_4.isLoading=false;_4.initFullscreen($("body > .fullscreen"));});}else{var _13=_4.renderer.toFullscreen();_13.find("> .invisible").load(_10,function(_17,_18,_19){

// Google Analytics
trackGoogleAnalytics(_10);

console.log("_________fullscreen response recived");console.log([this,_17,_18,_19]);_4.pagesLoaded++;if(_18=="error"){_4.noticeError($(this),_17);}_4.tid=null;_4.isLoading=false;_4.initNewFullscreen($("body > .fullscreen"));});}}else{if(_4.isInFullscreen()){_4.renderer.backFromFullscreen();}_4.timeoutTimer=setTimeout(function(){_4.isLoading=false;},_4.loadingTimout);_4.beforeRequestSend(_12);_12.e.load(_10,function(_1a,_1b,_1c){

// Google Analytics
trackGoogleAnalytics(_10);

_4.pagesLoaded++;if(_1b=="error"){_4.noticeError($(this),_1a);}clearTimeout(_4.timeoutTimer);_4.isLoading=false;_4.afterResponseRecived($(this),_1b,_1c);_4.tid=null;});}}else{_4.afterRequestSend(_12);}return false;}};this.initNewFullscreen=function(e){var _1d=e.find(".content-block");_1d.css({opacity:0});e.find(".loading").remove();_1d.remove();e.append(_1d);_1d.animate({opacity:1},500);this.initAjaxLinks();this.renderer.initElements(_1d);this.renderer.initArrows(_1d.find(".arrow"));e.find(".stop-slideshow").hide();var _1e=_1d.find(".header, .img-right, .img-nav");var _1f=_1d.find(".img-left");var _20=null;var _21=false;$(".fullscreen").mousemove(function(){_4.fullscreenHidden=false;var e=$(this).find(".header, .img-left, .img-right, .img-nav");clearTimeout(_20);if(!_21){_21=true;e.stop().animate({opacity:1},{duration:_4.fullscreenHideSpeed,complete:function(){_21=false;}});}_1f.css({marginTop:parseInt(_1f.attr("mtop"))});_20=setTimeout(function(){if(_4.slideshowIsRunning){_1f.css({opacity:1,marginTop:0});}else{_1f.animate({opacity:0},_4.fullscreenHideSpeed);}_1e.animate({opacity:0},_4.fullscreenHideSpeed);_4.fullscreenHidden=true;},_4.fullscreenHideWait);}).trigger("mousemove");var _22=_1d.find(".img-left").find(".start-slideshow a");var _23=_1d.find(".img-left").find(".stop-slideshow a");_22.click(function(e){_4.startSlideshow(_1d);e.preventDefault();return false;});_23.click(function(e){_4.stopSlideshow(_1d);e.preventDefault();return false;});$(window).trigger("resize");};this.startSlideshow=function(_24){var _25=_24.find(".img-left").find(".start-slideshow");var _26=_24.find(".img-left").find(".stop-slideshow");var _27=_24.find(".img-nav").find(".next-photo");var _28=_24.find(".header .photos li:first-child").next().find("a");if(!_27.length){_27=_28;}_25.hide(0);_26.show(0);this.slideshowTimer=setTimeout(function(){var _29=false;if(_27.length){if(_4.slideshowStartUrl==""){_4.slideshowStartUrl=_24.find(".header .photos li.selected").attr("link");}var _2a=_27.attr("href");if(_4.slideshowStartUrl!=_2a){_29=true;}_4.historyCallback(_2a);}if(!_29){_4.stopSlideshow($(".fullscreen .content-block"));}},this.slideshowDuration);_24.find(".img-left ul").css({width:"auto"}).animate({width:$(window).width()},this.slideshowDuration);this.slideshowIsRunning=true;};this.stopSlideshow=function(_2b){_2b.find(".img-left ul").stop().css({width:"auto"});var _2c=_2b.find(".img-left").find(".start-slideshow");var _2d=_2b.find(".img-left").find(".stop-slideshow");_2c.show(0);_2d.hide(0);clearTimeout(this.slideshowTimer);_4.slideshowIsRunning=false;_4.slideshowStartUrl="";};this.initFullscreen=function(e){var i=e.find("> .invisible");var _2e=i.find(".header");var h=e.find("> .content-block .header");h.html("");h.append(_2e.find("> *"));var c=e.find("> .content-block .content");c.find(".img-center").html("").prepend(i.find(".img-center img")).stop().animate({opacity:1},this.fullscreenPhotoHideSpeed);var _2f=c.find(".img-nav").html("");_2f.append(i.find(".img-nav > *"));var _30=c.find(".img-right").html("");_30.append(i.find(".img-right > *"));i.html("");this.initAjaxLinks();this.renderer.initElements(e.find("> .content-block"));this.renderer.initArrows(e.find(".arrow"));if(this.slideshowIsRunning){var _31=e.find("> .content-block");var _32=_31.find(".img-left");this.startSlideshow(_31);}$(window).trigger("resize");};this.noticeError=function(e,_33){e.find(".content").remove();$(_33).appendTo(e);};this.beforeRequestSend=function(_34){if(_34.isOpen()){this.startLoading(_34);}else{this.showLoading(_34);}this.renderer.showBlock(_34);_34.content.find("> *:not(.loading)").animate({opacity:0},500);};this.startLoading=function(_35){this.timerLoading=setTimeout(function(){_4.showLoading(_35);},this.timerLoadingTime*1000);};this.showLoading=function(_36){_36.content.find("> *").css({display:"none"});var _37=_36.e.height()-_36.getHeaderHeight();if(_37<100){_37=100;}var _38=$("<div>").addClass("loading").html("Loading...").css({height:_37,opacity:0});_36.content.find(".loading").remove();_38.appendTo(_36.content);_38.animate({opacity:1},this.renderer.blockParams.ajaxFadeinSpeed);return _38;};this.stopLoading=function(){if(this.timerLoading!=null){clearTimeout(this.timerLoading);}};this.afterRequestSend=function(_39){};this.afterResponseRecived=function(e,_3a,_3b){this.stopLoading();e.find(".content").addClass("open");var _3c=this.renderer.getBlock(e.attr("id"));this.initAjaxLinks();this.renderer.initElements(_3c.e);_3c.initAfterLoad();this.renderer.showBlock(_3c);if(this.tid=="recent"){var _3d=$("#recent .recent-description");var _3e=$("#recent .column-center .column-inner");var _3f=_3d.find(".description-item");_3f.bind("showDesc",function(){var _40=$(this).attr("id_gallery");console.log("showDesc "+_40);$(this).show(0);_3e.each(function(){var _41=parseInt($(this).attr("id_gallery"));if(_40==_41){$(this).show(0);}else{$(this).hide(0);}});$(window).trigger("resize");_3c.show();}).bind("hideDesc",function(){var _42=$(this).attr("id_gallery");console.log("hideDesc "+_42);$(this).hide(0);}).trigger("hideDesc");$("#recent .column-right a.arrow-right-recent").unbind("click").click(function(e){var _43=_3f.filter(":visible");_43.trigger("hideDesc");if(_43.next().length){_43.next().trigger("showDesc");}else{_3f.filter(":first-child").trigger("showDesc");}e.preventDefault();return false;}).find("> span").hide(0);_3d.find(".description-item:first-child").trigger("showDesc");}};this.ajaxClick=function(e){e.preventDefault();if(_4.slideshowIsRunning){_4.stopSlideshow($(".fullscreen > .content-block"));}if(!$(this).hasClass("disabled")){_4.tid=$(this).attr("tid");$.history.load($(this).attr("href"));}return false;};};function DelodepoteRenderer(_44){var _45=this;this.main=_44;this.window=$(window);this.footer=$("#footer");this.inFullscreen=false;this.background=$("body > div.background");this.speedBackgroundFadeout=500;this.speedBackgroundFadein=1500;this.speedBackgroundChange=15;this.timerBackgroundChange=null;this.blocks=new Array();this.blockParams={opacityMin:0.8,opacityMax:1,ajaxFadeoutSpeed:500,ajaxFadeinSpeed:500,opacityInSpeed:300,opacityOutSpeed:1500,opacityInEasing:"easeOutQuart",opacityOutEasing:"easeInQuart",contractSpeed:1500,expandSpeed:1500,heightEasing:"easeOutQuart"};this.init=function(){
	this.initBackground();
this.initMenu();this.initBlocks();this.window.resize(this.windowResize);};this.windowResize=function(){if(_45.isInFullscreen()){var e=$("body > .fullscreen");var img=e.find(".img-center img");if(!img.attr("o_height")){img.attr("o_height",img.attr("height"));img.attr("o_width",img.attr("width"));img.removeAttr("width");img.removeAttr("height");}var _46=parseInt(img.attr("o_width"));var _47=parseInt(img.attr("o_height"));var _48=_45.window.width();var _49=_45.window.height();if(_46/_47>=_48/_49){var _4a=(_47*_48/_46);img.css({width:(_46*_48/_46),height:_4a,marginTop:((_49-_4a)/2)});}else{img.css({width:(_46*_49/_47),height:(_47*_49/_47),marginTop:0});}e.find(".img-center").css({zIndex:80});e.find(".img-left, .img-right, .img-nav").css({zIndex:101});e.find(".img-left").css({display:"block"});var _4b=(e.find(".header").outerHeight()+30);var _4c=e.find(".img-left");if(_45.main.ajax.fullscreenHidden){_4c.css({top:0,marginTop:0});}else{_4c.css({top:0,marginTop:_4b});}_4c.attr("mTop",_4b);e.find(".img-right").css({top:(e.find(".header").outerHeight()+e.find(".img-left").outerHeight()+40)});var _4d=e.find(".img-right");e.find(".img-nav").css({top:parseInt(_4d.css("top"))+_4d.outerHeight()});}};this.initArrows=function(_4e){_4e.parent().hover(this.arrowOver,this.arrowOut);};this.arrowOver=function(e){var img=$("img.arrow",this);img.attr("src",img.attr("src_active"));};this.arrowOut=function(e){var img=$("img.arrow",this);img.attr("src",img.attr("src_inactive"));};this.initMenu=function(){var _4f=null;var _50=this.footer.find(".submenu");function _51(){_50.hide();};_50.hide().mouseover(function(){if(_4f!=null){clearTimeout(_4f);}}).mouseout(function(){_4f=setTimeout(_51,1000);});this.footer.find(".menu a[tid='portfolio']").mouseover(function(){if(_4f!=null){clearTimeout(_4f);}_50.show();}).mouseout(function(){_4f=setTimeout(_51,1000);});};this.initBlocks=function(){this.blocks=new Array();$(".block").each(function(){_45.blocks.push(new DelodepoteBlock($(this),_45));});for(i in _45.blocks){_45.blocks[i].init();}this.window.resize(function(){for(i in _45.blocks){_45.blocks[i].scroll.resize();}});};this.isInFullscreen=function(){return this.inFullscreen;};this.toFullscreen=function(){var _52=$("body > .fullscreen");if(!_52.length){_52=$("<div>").addClass("fullscreen");$("body").append(_52);}else{_52.html("");}_52.css({opacity:0}).animate({opacity:1},500);this.showLoading(_52);_52.append($("<div>").addClass("invisible"));this.inFullscreen=true;$("#main .h-center, #footer").animate({opacity:0},{duration:500,complete:function(){$(this).hide(0);}});$("body").css({overflow:"hidden"});return _52;};this.backFromFullscreen=function(){$(".fullscreen").animate({opacity:0},{duration:500,complete:function(){$(this).remove();}});$("#main .h-center, #footer").show(0).animate({opacity:1},500);$("body").css({overflow:"auto"});this.inFullscreen=false;};this.showLoading=function(_53){_53.append($("<div>").addClass("loading").html("Loading...").css({marginTop:300}));};this.getBlock=function(id){for(i in this.blocks){if(this.blocks[i].getId()==id){return this.blocks[i];}}return null;};this.showBlock=function(_54){for(i in this.blocks){if(this.blocks[i]!=_54){this.blocks[i].hide();}}_54.show();};
this.initBackground=function(){
	this.background.bind("adjustSize",function(){var img=$(this).find("img");var _55=_45.window.width();var _56=_45.window.height();$(this).css({overflow:"hidden",width:_55,height:_56});img.each(function(){var _57=$(this).attr("o_width");var _58=$(this).attr("o_height");if((_57/_58)<(_55/_56)){$(this).attr("width",_55);$(this).attr("height",(_55/_57)*_58);}else{$(this).attr("height",_56);$(this).attr("width",(_56/_58)*_57);}});});
	this.background.bind("nextImage",function(){var _59=$(this).find("img.visible");var _5a=_59.next();if(!_5a.length){_5a=$(this).find("img:first");}_59.animate({opacity:0},_45.speedBackgroundFadeout,function(){$(this).removeClass("visible");_5a.css({opacity:0}).addClass("visible");_5a.animate({opacity:1},_45.speedBackgroundFadein);});});
	this.window.resize(function(){_45.background.trigger("adjustSize");}).scroll(function(){_45.background.css({top:_45.window.scrollTop()});_45.footer.css({bottom:(-1*_45.window.scrollTop())});});
	this.background.trigger("adjustSize");
//this.startBackroundChange();
this.initElements($("body"));};this.initElements=function(_5b){_5b.find(".oa").removeClass(".oa").css({overflow:"hidden"});var pd=_5b.find(".photo-description");var _5c=0;if(pd.length){pd.css({position:"absolute"}).each(function(){var _5d=parseInt($(this).parent().find("img").attr("height"));if(_5d>_5c){_5c=_5d;}});pd.css({position:"absolute"}).each(function(){var e=$(this);e.bind("show",function(){$(this).stop().animate({opacity:0.7},200);});e.bind("hide",function(){$(this).stop().animate({opacity:0},200);});e.parent().hover(function(){$(this).find(".photo-description").trigger("show");},function(){$(this).find(".photo-description").trigger("hide");});var img=e.parent().find("img");var _5e=img.parent().parent();img.parent().css({position:"relative",top:-1*((_5c/2)-(img.height()/2))+"px"});e.css({top:img.position().top+img.height()-e.height(),backgroundColor:"#333",width:img.width()});e.trigger("hide");});}};this.startBackroundChange=function(){this.timerBackgroundChange=setInterval(function(){_45.nextBackground();},this.speedBackgroundChange*1000);};this.nextBackground=function(){this.background.trigger("nextImage");};this.stopBackgroundChange=function(){clearInterval(this.timerBackgroundChange);};};function DelodepoteBlock(e,_5f){var _60=this;this.renderer=_5f;this.e=e;this.header=$(".header",this.e);this.content=$(".content",this.e);this.scroll=null;this.init=function(){this.initHeader();if(this.isOpen()){this.opacityIn();this.show();}else{this.opacityOut();}this.initScroll();};this.getId=function(){return this.e.attr("id");};this.initScroll=function(){this.scroll=new DelodepoteScrollable(this,this.content.find(".scrollable"));this.scroll.init();};this.initAfterLoad=function(){this.header=this.e.find(".header");this.initHeader();this.content=this.e.find(".content");this.initScroll();};this.getHeaderHeight=function(){return this.header.height()+4;};this.isOpen=function(){return this.content.hasClass("open");};this.initArrows=function(_61){this.renderer.initArrows(_61);};this.initHeader=function(){this.header.click(function(e){if(_60.content.find("> *").length==0){$(this).find("h1 a:first-child").trigger("click");}else{if(_60.isOpen()){_60.hide();}else{_60.renderer.showBlock(_60);}}}).hover(function(){_60.opacityIn();},function(){if(!_60.isOpen()){_60.opacityOut();}});};this.show=function(){var _62=this.content.find("> *");this.content.find(".loading").height(100);this.e.stop(true,true).css({overflow:"hidden"});this.e.css({height:this.e.height()});_62.css({opacity:0});this.content.css({height:"auto"}).addClass("open");var _63=this.content.outerHeight()+this.getHeaderHeight();if(this.content.outerHeight()<(this.e.height()-this.getHeaderHeight())){this.content.height(this.e.height()-this.getHeaderHeight()-20);}this.e.animate({height:_63},{duration:this.renderer.blockParams.contractSpeed,easing:this.renderer.blockParams.heightEasing,complete:function(){_60.content.css("height","auto");$(window).trigger("resize");}});_62.css({opacity:1});this.opacityIn();};this.hide=function(){this.content.find("> *").animate({opacity:0},500);this.e.css({overflow:"hidden"}).stop().animate({height:this.getHeaderHeight()},{duration:500,complete:function(){_60.content.removeClass("open");_60.opacityOut();}});};this.opacityIn=function(){this.header.stop().animate({opacity:_60.renderer.blockParams.opacityMax},{duration:_60.renderer.blockParams.opacityInSpeed,easing:_60.renderer.blockParams.opacityInEasing});};this.opacityOut=function(){if(!this.isOpen()){this.header.stop().animate({opacity:_60.renderer.blockParams.opacityMin},{duration:_60.renderer.blockParams.opacityOutSpeed,easing:_60.renderer.blockParams.opacityOutEasing});}};};function DelodepoteScrollable(_64,_65){var _66=this;this.block=_64;this.e=_65;this.content=_65.find(".scroll");this.items=this.content.find(".column-inner");this.firstVisibleItem=null;this.leftArrow=null;this.rightArrow=null;this.scrolling=false;this.scrollSpeed=250;this.init=function(){this.leftArrow=this.block.e.find(".column-left .arrow-left");this.rightArrow=this.block.e.find(".column-right .arrow-right");this.leftArrow.click(function(e){_66.leftArrowClick(e);e.preventDefault();return false;});this.rightArrow.click(function(e){_66.rightArrowClick(e);e.preventDefault();return false;});this.block.initArrows(this.block.e.find(".arrow"));this.resize();};this.scrollLeft=function(){this.firstVisibleItem=this.getFirstVisibleItem();this.lastVisibleItem=this.getLastVisibleItem();if(!this.scrolling){this.scrolling=true;if(!this.isVisible(this.lastVisibleItem)){this.lastVisibleItem=this.lastVisibleItem.prev();}this.lastVisibleItem.stop().animate({opacity:0},_66.scrollSpeed);var _67=this.firstVisibleItem;_67.animate({opacity:1},500).prev().css({opacity:0});var _68=this.firstVisibleItem.position().left;if(this.firstVisibleItem.prev().length){_68=this.firstVisibleItem.prev().position().left;}this.e.scrollTo((_68)+"px",this.scrollSpeed,{easing:"easeInQuint",onAfter:function(e){_66.resize();_66.scrolling=false;}});}};this.scrollRight=function(){this.firstVisibleItem=this.getFirstVisibleItem();this.lastVisibleItem=this.getLastVisibleItem();if(!this.scrolling){this.scrolling=true;this.firstVisibleItem.stop().animate({opacity:0},_66.scrollSpeed);this.lastVisibleItem.stop().animate({opacity:1},500).next().css({opacity:0});this.e.stop().scrollTo((this.firstVisibleItem.next().position().left)+"px",this.scrollSpeed,{easing:"easeInQuint",onAfter:function(e){_66.resize();_66.scrolling=false;}});}};this.isOnScreen=function(e){var _69=e.position().left;var _6a=e.outerWidth();var _6b=this.e.scrollLeft();var _6c=this.e.width();if((_69+_6a>=_6b&&_69+_6a<=_6b+_6c)||(_69>=_6b&&_69<=_6b+_6c)||(_69<=_6b&&_69+_6a>=_6b+_6c)){return true;}return false;};this.isVisible=function(e){var _6d=e.position().left;var _6e=e.outerWidth();var _6f=this.e.scrollLeft();var _70=this.e.width();if(this.isOnScreen(e)){if(_6d>=_6f&&(_6d+_6e)<=(_6f+_70)||(_6d<=_6f&&_6d+_6e>=_6f+_70)){return true;}}return false;};this.leftArrowClick=function(){this.scrollLeft();};this.rightArrowClick=function(){this.scrollRight();};this.resize=function(){_66.leftArrow.hide();_66.rightArrow.hide();if(_66.e.width()<_66.content.width()){var _71=this.e.scrollLeft();if(_71>0){this.leftArrow.show();if((this.content.width()-_71)!=this.e.width()){this.rightArrow.show();}}else{this.rightArrow.show();}}var _72=null;var _73=false;this.items.each(function(){if(_66.isOnScreen($(this))){if(_72==null){_72=$(this);}if(_66.isVisible($(this))){_73=true;$(this).stop().animate({opacity:1},500).find("a").removeClass("disabled");}else{$(this).stop().animate({opacity:0},_66.scrollSpeed).find("a").addClass("disabled");}}});if(!_73&&_72!=null){_72.stop().animate({opacity:1},500).find("a").removeClass("disabled");}};this.getFirstVisibleItem=function(){var _74=null;this.items.each(function(){if(_74==null){var _75=$(this);if(_75.position().left+_75.outerWidth()>_66.e.scrollLeft()){_74=_75;}}});return _74;};this.getLastVisibleItem=function(){var _76=null;this.items.each(function(){var _77=$(this);if(((_77.position().left+_77.outerWidth())>_66.e.scrollLeft())&&(_77.position().left<=(_66.e.scrollLeft()+_66.e.width()))){_76=_77;}});return _76;};};