// ColorBox v1.3.14 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2010 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

//	@rev     	30/03/2011
//	@author		Igino Fucci
//	@copyright	Copyright (c) 2011 (Keepthinking Ltd.)
//	@link		http://keepthinking.it

(function(b,ca){function d(a,f){a=a?' id="'+m+a+'"':"";return b("<div"+a+(f?' style="'+f+'"':"")+"/>")}function E(a,f){a=a?' id="'+m+a+'"':"";return b("<input"+a+(f?' style="'+f+'"':"")+' type="button" />')}function n(a,b){b=b==="x"?i.width():i.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function P(O){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(O)}function V(a){for(var c in a)b.isFunction(a[c])&&c.substring(0,2)!== "on"&&(a[c]=a[c].call(g));a.rel=a.rel||g.rel||"nofollow";a.rev=a.rev||b(g).attr("rev");a.href=a.href||b(g).attr("href");a.title=a.title||b(g).attr("data-title");return a}function w(a,c){c&&c.call(g);b.event.trigger(a)}function W(O){if(!I){g=O;a=V(b.extend({},b.data(g,r)));j=b(g);h=0;a.rel!=="nofollow"&&(j=b("."+F).filter(function(){return(b.data(this,r).rel||this.rel)===a.rel}),h=j.index(g),h===-1&&(j=j.add(g),h=j.length-1));if(!t){t=B=true;o.show();if(a.returnFocus)try{g.blur(),b(g).one(X,function(){try{this.focus()}catch(a){}})}catch(d){}l.css({opacity:+a.opacity, cursor:a.overlayClose?"pointer":"auto"}).show();a.w=n(a.initialWidth,"x");a.h=n(a.initialHeight,"y");c.position(0);Q&&i.bind("resize."+J+" scroll."+J,function(){l.css({width:i.width(),height:i.height(),top:i.scrollTop(),left:i.scrollLeft()})}).trigger("scroll."+J);w(da,a.onOpen);C.add(u).add(v).add(Y).add(D).hide();K.attr({value:a.close,tabindex:"4"}).show()}c.load(true)}}var Z={transition:"elastic",speed:300,width:false,initialWidth:"600",innerWidth:false,maxWidth:false,height:false,initialHeight:"450", innerHeight:false,maxHeight:false,scalePhotos:true,scrolling:true,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.6,preloading:true,current:"{current} of {total}",previous:"previous",next:"next",close:"close",open:false,returnFocus:true,loop:true,slideshow:false,slideshowAuto:true,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,overlayClose:true, escKey:true,arrowKey:true},r="colorbox",m="cbox",da=m+"_open",ea=m+"_load",fa=m+"_complete",aa=m+"_cleanup",X=m+"_closed",L=m+"_purge",ba=m+"_loaded",x=b.browser.msie&&!b.support.opacity,Q=x&&b.browser.version<7,J=m+"_IE6",l,o,y,k,R,S,T,U,j,i,M,p,G,H,D,N,C,Y,v,u,K,z,A,q,s,g,h,a,t,B,I=false,c,F=m+"Element";c=b.fn[r]=b[r]=function(a,c){var e=this,d;if(!e[0]&&e.selector)return e;a=a||{};if(c)a.onComplete=c;if(!e[0]||e.selector===void 0)e=b("<a/>"),a.open=true;e.each(function(){b.data(this,r,b.extend({}, b.data(this,r)||Z,a));b(this).addClass(F)});d=a.open;b.isFunction(d)&&(d=d.call(e));d&&W(e[0]);return e};c.init=function(){i=b(ca);o=d().attr({id:r,"class":x?m+"IE":""});l=d("Overlay",Q?"position:absolute":"").hide();y=d("Wrapper");M=d("LoadedData");D=d("Title");u=E("Previous");v=E("Next");C=d("Current");N=d("Header").append(D,u,v,C);k=d("Content").append(p=d("LoadedContent","width:0; height:0; overflow:hidden").append(M,N),H=d("LoadingOverlay").add(d("LoadingGraphic")),K=E("Close"));y.append(d().append(d("TopLeft"), R=d("TopCenter"),d("TopRight")),d(false,"clear:left").append(S=d("MiddleLeft"),k,T=d("MiddleRight")),d(false,"clear:left").append(d("BottomLeft"),U=d("BottomCenter"),d("BottomRight"))).children().children().css({"float":"left"});G=d(false,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(l,o.append(y,G));k.children().hover(function(){b(this).addClass("hover")},function(){b(this).removeClass("hover")}).addClass("hover");z=R.height()+U.height()+k.outerHeight(true)- k.height();A=S.width()+T.width()+k.outerWidth(true)-k.width();q=p.outerHeight(true);s=p.outerWidth(true);o.css({"padding-bottom":z,"padding-right":A}).hide();v.click(c.next);u.click(c.prev);K.click(c.close);k.children().removeClass("hover");b("."+F).live("click",function(a){a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),W(this))});l.click(function(){a.overlayClose&&c.close()});b(document).bind("keydown",function(b){t&&a.escKey&&b.keyCode===27&&(b.preventDefault(), c.close());if(t&&a.arrowKey&&!B&&j[1])if(b.keyCode===37&&(h||a.loop))b.preventDefault(),u.click();else if(b.keyCode===39&&(h<j.length-1||a.loop))b.preventDefault(),v.click()})};c.remove=function(){o.add(l).remove();b("."+F).die("click").removeData(r).removeClass(F)};c.position=function(b,c){function e(a){R[0].style.width=U[0].style.width=k[0].style.width=a.style.width;H[0].style.height=H[1].style.height=k[0].style.height=S[0].style.height=T[0].style.height=a.style.height}var d,h=Math.max(document.documentElement.clientHeight- a.h-q-z,0)/2+i.scrollTop(),j=Math.max(i.width()-a.w-s-A,0)/2+i.scrollLeft();d=o.width()===a.w+s&&o.height()===a.h+q?0:b;y[0].style.width=y[0].style.height="9999px";o.dequeue().animate({width:a.w+s,height:a.h+q,top:h,left:j},{duration:d,complete:function(){e(this);B=false;y[0].style.width=a.w+s+A+"px";y[0].style.height=a.h+q+z+"px";c&&c()},step:function(){e(this)}})};c.resize=function(b){if(t){b=b||{};if(b.width)a.w=n(b.width,"x")-s-A;if(b.innerWidth)a.w=n(b.innerWidth,"x");p.css({width:a.w});if(b.height)a.h= n(b.height,"y")-q-z;if(b.innerHeight)a.h=n(b.innerHeight,"y");if(!b.innerHeight&&!b.height)b=p.wrapInner("<div style='overflow:auto'></div>").children(),a.h=b.height(),b.replaceWith(b.children());p.css({height:a.h});c.position(a.transition==="none"?0:a.speed)}};c.prep=function(g){function f(d){var g,f,k,l,q=j.length,s=a.loop;c.position(d,function(){if(t){x&&e&&p.fadeIn(100);p.show();w(ba);D.show().html(a.title);if(q>1&&(typeof a.current==="string"&&C.html(a.current.replace(/\{current\}/,h+1).replace(/\{total\}/, q)).show(),v[s||h<q-1?"show":"hide"]().attr({value:a.next,tabindex:"2"}),u[s||h?"show":"hide"]().attr({value:a.previous,tabindex:"1"}),g=h?j[h-1]:j[q-1],k=h<q-1?j[h+1]:j[0],a.slideshow&&Y.show(),a.preloading)){l=b.data(k,r).href||k.href;f=b.data(g,r).href||g.href;l=b.isFunction(l)?l.call(k):l;f=b.isFunction(f)?f.call(g):f;if(P(l))b("<img/>")[0].src=l;if(P(f))b("<img/>")[0].src=f}H.hide();if(a.transition==="fade")o.fadeTo(n,1,function(){if(x)o[0].style.filter=false});else if(x)o[0].style.filter=false; i.bind("resize."+m,function(){c.position(0)});w(fa,a.onComplete)}})}if(t){var e,n=a.transition==="none"?0:a.speed;i.unbind("resize."+m);p.remove();M=d("LoadedData").html(g);D=d("Title");u=E("Previous");v=E("Next");C=d("Current");N=d("Header").append(D,u,v,C);p=d("LoadedContent").append(M,N);v.click(c.next);u.click(c.prev);K.click(c.close);p.hide().appendTo(G.show()).css({width:function(){a.w=a.w||p.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?"auto":"hidden"}).css({height:function(){a.h= a.h||p.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(k);G.hide();b("#"+m+"Photo").css({cssFloat:"none",marginLeft:"auto",marginRight:"auto"});if(Q)b("select").not(o.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(aa,function(){this.style.visibility="inherit"});a.transition==="fade"?o.fadeTo(n,0,function(){f(0)}):f(n)}};c.load=function(l){var f,e,k,i=c.prep;B=true;g=j[h];l||(a=V(b.extend({},b.data(g,r))));w(L);w(ea,a.onLoad); a.h=a.height?n(a.height,"y")-q-z:a.innerHeight&&n(a.innerHeight,"y");a.w=a.width?n(a.width,"x")-s-A:a.innerWidth&&n(a.innerWidth,"x");a.mw=a.w;a.mh=a.h;if(a.maxWidth)a.mw=n(a.maxWidth,"x")-s-A,a.mw=a.w&&a.w<a.mw?a.w:a.mw;if(a.maxHeight)a.mh=n(a.maxHeight,"y")-q-z,a.mh=a.h&&a.h<a.mh?a.h:a.mh;f=a.href;H.show();a.inline?(d().hide().insertBefore(b(f)[0]).one(L,function(){b(this).replaceWith(p.children())}),i(b(f))):a.iframe?(o.one(ba,function(){var c=b("<iframe name='"+(new Date).getTime()+"' frameborder=0"+ (a.scrolling?"":" scrolling='no'")+(x?" allowtransparency='true'":"")+" style='width:640px; height:360px; border:0; display:block;'/>");c[0].src=a.href;c.appendTo(p).one(L,function(){c[0].src="//about:blank"})}),c.resize({innerWidth:640,innerHeight:360}),i(" ")):a.html?i(a.html):P(f)?(e=new Image,e.onload=function(){var d;e.onload=null;e.id=m+"Photo";b(e).css({border:"none",display:"block",cssFloat:"left"});a.scalePhotos&&(k=function(){e.height-=e.height*d;e.width-=e.width*d},a.mw&&e.width>a.mw&& (d=(e.width-a.mw)/e.width,k()),a.mh&&e.height>a.mh&&(d=(e.height-a.mh)/e.height,k()));if(a.h)e.style.marginTop=Math.max(a.h-e.height,0)/2+"px";j[1]&&(h<j.length-1||a.loop)&&b(e).css({cursor:"pointer"}).click(c.next);if(x)e.style.msInterpolationMode="bicubic";setTimeout(function(){i(e)},1)},setTimeout(function(){e.src=f},1)):f&&G.load(f,function(a,c,d){i(c==="error"?"Request unsuccessful: "+d.statusText:b(this).children())})};c.next=function(){B||(h=h<j.length-1?h+1:0,c.load())};c.prev=function(){B|| (h=h?h-1:j.length-1,c.load())};c.close=function(){t&&!I&&(I=true,t=false,w(aa,a.onCleanup),i.unbind("."+m+" ."+J),l.fadeTo("fast",0),o.stop().fadeTo("fast",0,function(){w(L);p.remove();o.add(l).css({opacity:1,cursor:"auto"}).hide();setTimeout(function(){I=false;w(X,a.onClosed)},1)}))};c.element=function(){return b(g)};c.settings=Z;b(c.init)})(jQuery,this);$(".lightbox").colorbox({});
