/*
 *	
 * @projectDescription:core animation functions for lumen photo
 * @author: thomas appel, mal(at)dev.appel-photography.com
 * @version: 1.0 (minified by google closure compiler)
 * 
 * depends on:
 *
 * - jQuery 1.4.2
 * - jquery.plugins.js
 * - lumen.plugins.js
 *	 
 *
 *
 * */

var htmlTag=document.getElementsByTagName("html");$(htmlTag).addClass("init");var uA=navigator.userAgent.toLowerCase(),$MSIE=$.browser.msie,browserVers=parseFloat($.browser.version.toString()),$MSIElt6=$MSIE&&browserVers<6,$MSIE6=$MSIE&&browserVers===6,$MSIElt8=$MSIE&&browserVers<8,$MSIE7=$MSIE&&browserVers===7,$MSIElt7=$MSIE&&browserVers<7,$GEKO1x=$.browser.mozilla&&browserVers<1.9,$WEBKIT=uA.match(/(webkit)/g),$SAFARI=$.browser.safari,$PRESTO=uA.match(/(presto)/g),$OPERA=$.browser.opera||$PRESTO;
function array_unique(q){if(q.length&&typeof q!=="string")for(var H={},x=[],s=0,n=q.length;s<n;s++)if(!H[q[s]+typeof q[s]]){x.push(q[s]);H[q[s]+typeof q[s]]=true}return x||q}
function preloadcss(q){function H(W){var D=new Image,L=!$MSIElt8?x-1:x-2;D.src=W;$(D).load(function(){++y;y===L&&q.call(this)}).error(function(){++y;y===L&&q.call(this)})}var x="",s=document.styleSheets,n=[],P="";n=[];for(var M=/[^\"\(\)]+\.(gif|jpg|jpeg|png)/g,t=0;t<s.length;t++){var E=document.styleSheets[t].cssRules,z=s[t].href;if(!E)E=document.styleSheets[t].rules;if(z!=null){n=z.split(/[^\/]+\.(css)/)[0];z=location.host;n=$MSIElt8?n.split(z):n.split(location.host)[1];for(z=0;z<E.length;z++){var O=
E[z].cssText?E[z].cssText:E[z].style.cssText;P+=O.match(n)?O:O.replace(M,n+"$&")}n=P.match(M)}}n=array_unique(n);if(x=n.length){var y=0;for(t=0;t<x;++t)new H(n[t])}}$(htmlTag).removeClass("nojs");
$(document).ready(function(){function q(b,a,c){var e=$("#carousel"),g=e[0]?e.outerWidth()+5:0,i=$(b).attr("href");a.removeClass("current");c.animate({width:0},{duration:250,easing:"easeInOutExpo",step:function(j,o){if(e){e.css({left:-Math.floor(o.pos*g),opacity:1-o.pos});o.pos===1&&e.removeAttr("class").empty().unbind("mouseenter")}},complete:function(){$(this).remove();$(b).parent("li").addClass("current");prlAttache(X,false,true,function(){f.css({opacity:0});H(i)})}})}function H(b){$.ajax({url:b.replace(/\.html/,
"/ajax.html"),type:"GET",ifModified:true,success:function(a){function c(){$("html").removeClass("noCar");d.html(r).animate({opacity:1},10,function(){$("#content").html(k).animate({opacity:0},10,function(){x(o,p)})})}function e(){$("html").addClass("noCar");$("#content").html(k).animate({opacity:0},10,function(){x(o,p)})}function g(){$("html").addClass("noCar");d.remove();$("#content").html(k).animate({opacity:0},10,function(){x(o,p)})}var i=$(a).filter("#title").html(),j=$(a).filter("#title")[0].className,
o=parseInt($(a).filter("#imgCount").html());document.title=i+W;i=i.replace(/\s+/g,"-");$(D).attr("id",i);j&&$(D).attr("class",j);!j&&$(D).removeAttr("class");var d=$("#carousel");j=$(a).filter("#carousel");var r=j.html(),k=$(a).filter("#content").html();a=j.length?true:false;i=$(k).filter("#imgWrap").length?true:false;var p=[a,i];a=window.location.hash?window.location.href.split(window.location.hash)[0]:window.location.href;if(r)r=$MSIElt8?r:r.replace(/#c_/g,a+"#c_");d.length&&j.length&&c(p);if(d.length==
0&&j.length){$("html").removeClass("noCar");d=$("<div/>").attr("id","carousel");$("#mMenu").after(d);d.css({left:-d.innerWidth()});d=d;c(d)}d.length==0&&j.length==0&&e(p);d.length&&j.length==0&&g(p);location.hash=b.replace(/\.html/,"")},error:function(){alert("error");$("#content").fadeIn("slow").html("an error occurred while requesting data from server");x()}})}function x(b,a){function c(l,m,A){l.bind("mouseover.laa",function(){$(this).animate({opacity:m},650,"easeInOutExpo")}).bind("mouseout.laa",
function(){$(this).animate({opacity:A},450,"easeInOutExpo")})}function e(){return'<div id="clicknav-1" class="prev"><span>prev</span></div><div id="clicknav-2" class="next"><span>next</span></div>'}function g(){u[0]&&(I=u.find("li:visible:first div.img_desc"));i(X,true,false,function(){function l(){return!$(this).hasClass("prev")&&!$(this).hasClass("next")}$("#prc").empty();a[0]?carSlipin(true,false,function(){$(document).removeData("locked")}):$(document).removeData("locked");a[1]&&t("li.act",u.find("li")[1]);
f.append(Q).find("#toolbar").fadeIn(250).children("#pan").append(ba).removeData("fxqueue");ca=$("#toolbar");Y=$("a.next");Z=$("a.prev");ca.delegate("a","click",function(m){m.preventDefault();if(m=$(this).filter(l)[0]){$(m).hasClass("pan")&&o(a);$(m).hasClass("minus")&&o(a);$(m).hasClass("info")&&j()}});a[1]&&(document.body.className==="gallery"||document.body.id==="contact")?function(){f.prepend(e);J=$([document.getElementById("clicknav-1"),document.getElementById("clicknav-2")]);J.css({opacity:0});
Y=$("a.next");Z=$("a.prev");J.hover(function(){J.fadeTo(250,0.8,function(){})},function(){J.fadeTo(250,0)});J.bind("click.clicknav",function(m){m.preventDefault();$(this).hasClass("prev")?$("a.prev").trigger("click"):$("a.next").trigger("click")})}():J.detach()})}function i(l,m,A,C){function F(){G.stop().animate({width:"100%"},{duration:500,easing:"easeInExpo",step:function(B,aa){f.css({opacity:1-aa.pos})},complete:function(){C.call(this)}})}function N(){G.stop().animate({width:0},{duration:650,easing:"easeInOutExpo",
step:function(B,aa){f.css({opacity:aa.pos})},complete:function(){C.call(this);$(this).detach()}})}var G=f.find(l).length?l:f.append(l);G=$(l);m?N():A&&F()}function j(){I=u.find("li:visible:first div.img_desc");parseInt(I.css("left"))<0?I.css({display:"block"}).children().css({opacity:"0.0"}).end().animate({left:0},500,"easeOutExpo",function(){$MSIE6||$MSIE7?$(this).children().fadeTo(500,1,function(){this.style.removeAttribute("filter")}):$(this).children().fadeTo(500,1)}):I.children().fadeTo(250,
0,function(){I.animate({left:-144},500,"easeOutExpo").addClass("hidden")});return false}function o(l){function m(){v.animate({left:-B[1]},240,"easeOutExpo",function(){$(this).data({hidden:true,visible:false}).dequeue();f.stop().animate({left:B[2]},{duration:500,step:function(){M(w)},easing:"easeOutExpo",complete:function(){f.removeData("fxqueue");$MSIE6&&$(this).css({width:"100%"});$("#pan").html(ea)}})})}function A(){f.stop().animate({left:B[0]},{duration:500,easing:"easeInOutExpo",step:function(){M(w);
f.removeData("fxqueue")},complete:function(){v.removeAttr("class").stop().animate({left:0},400,"easeOutExpo",function(){$(this).removeAttr("style");h.length&&carSlipin(true,false);$("#pan").html(ba);$(this).removeData("visible").removeData("hidden")})}})}var C=f.offset().left,F=h.length?Math.floor(h.offset().left):C,N=v.offset().left,G=h.length?h.innerWidth():0,B=[C,F,N,G];f.data("cOffset")?f.data("cOffset"):f.data({cOffset:B});B=f.data("cOffset");if(!v.data("hidden"))if(l[0])carSlipin(false,true,
function(){$(this).removeClass("visible").addClass("hidden");m()});else $(this).find("a.minus").length===0&&m();v.data("hidden")&&A();return false}w=b;L=$("#outerWrap");f=$("#content");f.css({opacity:0});prlAttache=i;i(X,false,false);L.innerWidth();L.innerHeight();D=$("body");u=$("#imgWrap");u.find("li.single").find(".main_img > img");R=u.find("ul");u[0]&&u.offset();S=u.find("li.single");h=$("#carousel");T=h.find("ul");h.find("a");h.find("img");v=$("#mMenu");$("span.cache").size();$(v).find("li.current");
a[0]&&h.carScroller({hoverItems:true,timerRate:25})&&function(){var l=T.hasClass("textnav")?"a":"img";h.find(l).first().addClass("current")}();a[1]&&D[0].id==="making-of"&&$(".img_grid").each(function(){$(this).flipBook({slideInEasing:"easeInOutExpo",slideInDuration:500})});var d=f.find("#laaHover"),r=d[0]?$(d[0].parentNode):null;d[0]&&$(r[0].parentNode);var k=f.find(".blackbox"),p=k.find("img");d[0]&&d.css({opacity:0})&&c(d,1,0);k[0]&&p.css({opacity:0.2})&&c(p,1,0.2);k[0]&&$(window).bind("resize.blackbox",
function(){k.css({width:p.innerWidth()})});d=0;if(a[1])if(w===0)w=S.length;for(;d<=w;){r=d;$($("li.single")[d]).data("item",++r);d>1&&$($("li.single")[d]).addClass("hidden");++d}U=$("li.single:first").find("img").length>1?3:1;if(a[1])V=$("li.single:first").find("img:first").offset().top-f.offset().top;P(w,U,V);$(v).find("li").not("[class=current]").removeAttr("class");u.innerWidth();f.removeAttr("style");K=location.href.split(location.hash)[0];$(".grid_img").shutter({gridDiv:"li"});$(R).find("li:first-child").addClass("rel act");
v.find("li.current > a").append('<span class="loader"/>');$(this).preloader({imgArr:$("li.single").find("img"),progressBar:"span.loader",callback:function(){$("DIV.hidden").css({display:"none"});$("span.loader").removeClass("loading");g()}});carSlipin=function(l,m,A){var C=$("li.act").prevAll("li").length+1;C=-(f.innerHeight()/2+36)+72*C;var F={fade:0.5,target:l?0:h.innerWidth(),speed:l?750:250,easing:l?"easeOutExpo":"easeInExpo"},N;m&&$OPERA&&h.css({left:0});h.find("img").not(":first").css({opacity:F.fade}).end().first().addClass("current").parents("li").addClass("active");
l&&h.scrollTop(C);l&&$MSIElt8&&h[0].style.removeAttribute("filter");h.removeClass("hidden").stop().animate({left:-F.target},{duration:F.speed,easing:F.easing,step:function(G,B){N=m?1-B.pos:B.pos;h.css({opacity:N})},complete:function(){h?(h.innerWidth(),v.innerWidth()):v.innerWidth();if(l){$(this).addClass("visible").delegate("li.active a","click",function(G){G.preventDefault()});$MSIElt8||$(this).removeAttr("style");A&&A()}else m&&A&&A()}})};d='<a href="'+K+"#c_"+w+'" class="prev">prev</a><a href="'+
K+'#c_2" class="next">next</a>';d=$MSIElt8?'<div class="links">'+d+"</div>":d;d='<div class="pnnav">'+d+"<span>click or use keyboard</span></div>";var Q='<div id="toolbar">'+($("DIV.img_desc").length?'<div class="iToggle"><a class="info" href="#" title="get image info"></a><span>info</span></div>':"")+(a[1]?d+da:da)+"</div>";pTitle=document.title.split("^|")[0];s(w,f,R);u.imgScale({grid:U,offset:V});n(S,f)}function s(b,a,c){b=$(c);a=$(a).innerWidth();b.innerWidth();c=a*4;$.browser.safari&&$("#preloader").css({width:a});
b.css({width:c})}function n(b,a){var c=$(a).innerWidth();b.css({width:c});b.find("> div.main_img").css({width:c-72})}function P(){$(window).bind("resize.lumenMain",function(){$("*:animated");M(w);t("li.act","li.nli")})}function M(){s(w,f,R);u.imgScale({grid:U,offset:V});n(S,f)}function t(b,a){$(a).find("> DIV").animate({left:-40},600,"easeOutQuad")}function E(b,a,c,e){var g=b[0].nodeName.toLowerCase(),i=b.next(g).length?b.next(g):false,j=a.next(g).length?a.next(g):false;g=b.data(e);e=a.data(e);var o=
e>g,d=e<g,r=e-g>1,k=e-g<-1,p=d&&!k?1:k?2:0;this.before=function(){a.removeClass("hidden");j&&j.removeClass("hidden");d&&c.scrollLeft(b.innerWidth()*p)};this.after=function(){if(o){b.addClass("hidden");r&&i.addClass("hidden")}else if(d){i&&i.addClass("hidden");k&&b.addClass("hidden")}c.scrollLeft(0)};++fa}function z(b,a){var c=b===1?T.find("img:first").addClass("current").parents("li").addClass("active"):T.find("img:nth("+(b-1)+")").addClass("current").parents("li").addClass("active");c.siblings().removeAttr("class").find("img").fadeTo("slow",
0.5,function(){$(this).removeAttr("Class")});var e=-(h.innerHeight()/2+36)+72*b;!v.hasClass("hidden")&&!a&&h.stop().animate({scrollTop:e},{duration:500,easing:"easeInOutQuad",step:function(g,i){var j=0.5+0.5*i.pos;c.find("img").css({opacity:j})},complete:function(){}});v.hasClass("hidden")&&c.find("img").css({opacity:1})}function O(b,a){this.obj=document.createElement(a);this.obj.id=b;this.obj.immerHTML="<p>\u2026loading\u2026</p>";return this.obj}if(navigator.appName.match("Microsoft Internet Explorer"))if(parseFloat(/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)[1])<
6){var y=document.getElementsByTagName("base")[0].href;window.location=y+"errormsie.html";return false}var W=" |"+document.title.split("|")[1];url=function(){function b(r){for(var k=0,p;k<a.length;){var Q=$(a[k]).find("a")[0].href.split(e)[1].split(".html")[0];if(r===Q){c.removeClass("current");$(a[k]).addClass("current");p=Q}++k}return p}var a=$("#mMenu").find("li"),c=$("#mMenu").find("li.current"),e=document.getElementsByTagName("base")[0].href,g=window.location.hash,i=g?g.split("#")[1].split("/"):
null,j=i?i.length:null,o;if(g)o=j>2?i[1]:$.grep(i,function(r,k){return j-1===k})[0];else var d=window.location.href.split(e)[1].split("#")[0].split(".html")[0];if(g=o?o:d?d:null)if(g=b(g))g=g+".html";else{c.removeClass("current");g=$(a[0]).addClass("current").find("a")[0].href.split(e)[1].split(".html")[0]+".html"}else g=$(a[0]).find("a")[0].href.split(e)[1].split(".html")[0]+".html";return g}();var D=$("body"),L,w,u,R;$("li.act");var S,h,T,v,f,I,Y,Z,ba='<a class="pan" title="hide menu" href="#"><span class="exp">hide menu</span></a>',
ea='<a class="minus" title="show menu" href="#"><span class="clp">show menu</span></a>',da='<div id="pan"/>';y=$('<div id="prc">1</div>');var X=$('<div id="preloader"></div>').html(y);$('<div id="preloader"/>');var K="",ca="",ga=$("#mMenu").find("li");$("#spin");var U="",V="";y=$("#mMenu");preloadcss(function(){$(htmlTag).fadeIn(1500,function(){$(this).removeData("fxqueue");$(htmlTag).removeClass("init").addClass("jscript");$("#content").css({opacity:0});ga.menuFade();H(url)})});y.live("click.menucklick",
function(b){b.preventDefault();b=$([b.target,b.target.parentNode]).filter($("a"))[0];var a=$(this).find("li.current"),c=$(this).find(".loading"),e=$(this).find(".loaded"),g=$(document).data("locked");if(b){c=b.parentNode===a[0]||c[0]||$(b).find(".loading")[0]||g?true:false;$(document).data("locked",true);c||q(b,a,e)}else return false});carSlipin=function(){};$(document).keydown(function(b){b=b.charCode?b.charCode:b.keyCode?b.keyCode:0;b===39&&$("a.next").trigger("click");b===37&&$("a.prev").trigger("click")});
var J=$(document.getElementById("clicknav-1"),document.getElementById("clicknav-2")),fa=0;y=!$MSIE?600:900;$.localScroll.defaults.axis="x";$.localScroll({target:"#imgWrap",lock:true,queue:false,lazy:true,duration:y,easing:"easeInOutExpo",hash:false,onBefore:function(b,a,c){$(a).find("div.img_desc");this.current=c.find("li.act");this.act_id=this.current.data("item");this.anc_id=$(a).data("item");this.nextLi=c.find("li:nth("+this.anc_id+")");if(this.act_id==this.anc_id)return false;this.bwd=this.act_id>
this.anc_id;c=new E(this.current,$(a),c,"item");c.before();this.sort=c;this.nextDiv=$(a).find("div:first");this.slipDiv=this.nextLi.find("div:first");this.nextDiv.css("zIndex");this.nextDivLeft=isNaN(parseInt(this.nextDiv[0].style.left))?0:Math.abs(parseInt(this.nextDiv[0].style.left));b=$([b.target,b.target.parentNode]).filter(function(){return $(this).hasClass("imgnav")})[0];z(this.anc_id,b);!$("body.gallery")[0]&&h&&h.find("a.current").removeClass("current")&&h.find("a:nth("+(this.anc_id-1)+")").addClass("current")},
inAnimation:function(b,a,c,e){b=e.nextDivLeft;e.nextDiv.css({left:-b+b/100*a.pos*100})},onAfter:function(b,a){I.removeAttr("style");$(a.target).find("li > div").css({left:0});a.sort.after();a.current.removeClass("act");$(b).addClass("act");a.current=$(b);a.act_id=a.anc_id;var c=++a.act_id,e=--a.act_id-1;c>w&&(c=1);e<=0&&(e=w);if($MSIE&&parseFloat($.browser.version)<8)$("DIV.links").html('<a href="'+K+"#c_"+e+'" class="prev">prev</a><a href="'+K+"#c_"+c+'" class="next">next</a>');else{$(Y).attr("href",
K+"#c_"+c);$(Z).attr("href",K+"#c_"+e)}t($(b),a.nextLi);$(a.target).removeData("fxqueue")}});f=$("#content");var ha=$("#preloader");$(window).ajaxStart(function(){var b=new O("spin","div");f.after(b);var a=$("#spin");a.css({left:f.innerWidth()/2+f.offset().left});setTimeout(function(){a.fadeIn("fast")},1500)});$(window).ajaxStop(function(){var b=$("#spin");b.fadeOut(250,function(){b.remove()});ha.removeClass("loading")})});
