// ColorBox v1.3.18 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

(function(H,k,U){var I={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,fastIframe:true,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:true,current:"image {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,top:false,bottom:false,left:false,right:false,fixed:false,data:undefined},v="colorbox",Q="cbox",p=Q+"Element",T=Q+"_open",e=Q+"_load",S=Q+"_complete",s=Q+"_cleanup",Z=Q+"_closed",i=Q+"_purge",t=H.browser.msie&&!H.support.opacity,ad=t&&H.browser.version<7,aa=t&&H.browser.version>8,Y=Q+"_IE6",O,ae,af,d,F,o,b,N,c,X,L,j,h,n,r,V,q,P,x,z,ac,ag,l,g,a,u,G,m,B,W,K,y,J,ab="div";function E(ah,ak,aj){var ai=k.createElement(ah);if(ak){ai.id=Q+ak}if(aj){ai.style.cssText=aj}return H(ai)}function C(ai){var ah=c.length,aj=(G+ai)%ah;return(aj<0)?ah+aj:aj}function M(ah,ai){return Math.round((/%/.test(ah)?((ai==="x"?X.width():X.height())/100):1)*parseInt(ah,10))}function A(ah){return ac.photo||/\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?$/i.test(ah)}function R(){var ah;ac=H.extend({},H.data(u,v));for(ah in ac){if(H.isFunction(ac[ah])&&ah.slice(0,2)!=="on"){ac[ah]=ac[ah].call(u)}}ac.rel=ac.rel||u.rel||"nofollow";ac.href=ac.href||H(u).attr("href");ac.title=ac.title||u.title;if(typeof ac.href==="string"){ac.href=H.trim(ac.href)}}function D(ah,ai){H.event.trigger(ah);if(ai){ai.call(u)}}function w(){var ai,ak=Q+"Slideshow_",al="click."+Q,am,aj,ah;if(ac.slideshow&&c[1]){am=function(){V.text(ac.slideshowStop).unbind(al).bind(S,function(){if(G<c.length-1||ac.loop){ai=setTimeout(J.next,ac.slideshowSpeed)}}).bind(e,function(){clearTimeout(ai)}).one(al+" "+s,aj);ae.removeClass(ak+"off").addClass(ak+"on");ai=setTimeout(J.next,ac.slideshowSpeed)};aj=function(){clearTimeout(ai);V.text(ac.slideshowStart).unbind([S,e,s,al].join(" ")).one(al,function(){J.next();am()});ae.removeClass(ak+"on").addClass(ak+"off")};if(ac.slideshowAuto){am()}else{aj()}}else{ae.removeClass(ak+"off "+ak+"on")}}function f(ai){if(!K){u=ai;R();c=H(u);G=0;if(ac.rel!=="nofollow"){c=H("."+p).filter(function(){var aj=H.data(this,v).rel||this.rel;return(aj===ac.rel)});G=c.index(u);if(G===-1){c=c.add(u);G=c.length-1}}if(!B){B=W=true;ae.show();if(ac.returnFocus){try{u.blur();H(u).one(Z,function(){try{this.focus()}catch(aj){}})}catch(ah){}}O.css({opacity:+ac.opacity,cursor:ac.overlayClose?"pointer":"auto"}).show();ac.w=M(ac.initialWidth,"x");ac.h=M(ac.initialHeight,"y");J.position();if(t){X.bind("resize."+Y+" scroll."+Y,function(){O.css({width:X.width(),height:X.height(),top:X.scrollTop(),left:X.scrollLeft()})}).trigger("resize."+Y)}D(T,ac.onOpen);z.add(n).hide();x.html(ac.close).show()}J.load(true)}}J=H.fn[v]=H[v]=function(ah,aj){var ai=this;ah=ah||{};J.init();if(!ai[0]){if(ai.selector){return ai}ai=H("<a/>");ah.open=true}if(aj){ah.onComplete=aj}ai.each(function(){H.data(this,v,H.extend({},H.data(this,v)||I,ah));H(this).addClass(p)});if((H.isFunction(ah.open)&&ah.open.call(ai))||ah.open){f(ai[0])}return ai};J.init=function(){if(!ae){if(!H("body")[0]){H(J.init);return}X=H(U);ae=E(ab).attr({id:v,"class":t?Q+(t?"IE6":"IE"):""});O=E(ab,"Overlay",t?"position:absolute":"").hide();af=E(ab,"Wrapper");d=E(ab,"Content").append(L=E(ab,"LoadedContent","width:0; height:0; overflow:hidden"),h=E(ab,"LoadingOverlay").add(E(ab,"LoadingGraphic")),n=E(ab,"Title"),r=E(ab,"Current"),q=E(ab,"Next"),P=E(ab,"Previous"),V=E(ab,"Slideshow").bind(T,w),x=E(ab,"Close"));af.append(E(ab).append(E(ab,"TopLeft"),F=E(ab,"TopCenter"),E(ab,"TopRight")),E(ab,false,"clear:left").append(o=E(ab,"MiddleLeft"),d,b=E(ab,"MiddleRight")),E(ab,false,"clear:left").append(E(ab,"BottomLeft"),N=E(ab,"BottomCenter"),E(ab,"BottomRight"))).find("div div").css({"float":"left"});if(t){j=E(ab,false,"position:absolute; visibility:hidden; display:none")}else{j=E(ab,false,"position:absolute; width:9999px; visibility:hidden; display:none")}H("body").prepend(O,ae.append(af,j));ag=F.height()+N.height()+d.outerHeight(true)-d.height();l=o.width()+b.width()+d.outerWidth(true)-d.width();g=L.outerHeight(true);a=L.outerWidth(true);ae.css({"padding-bottom":ag,"padding-right":l}).hide();q.click(function(){J.next()});P.click(function(){J.prev()});x.click(function(){J.close()});z=q.add(P).add(r).add(V);O.click(function(){if(ac.overlayClose){J.close()}});H(k).bind("keydown."+Q,function(ai){var ah=ai.keyCode;if(B&&ac.escKey&&ah===27){ai.preventDefault();J.close()}if(B&&ac.arrowKey&&c[1]){if(ah===37){ai.preventDefault();P.click()}else{if(ah===39){ai.preventDefault();q.click()}}}})}};J.remove=function(){ae.add(O).remove();ae=null;H("."+p).removeData(v).removeClass(p)};J.position=function(ai,ah){var ak=0,aj=0,al=ae.offset();X.unbind("resize."+Q);ae.css({top:-99999,left:-99999});if(ac.fixed&&!t){ae.css({position:"fixed"})}else{ak=X.scrollTop();aj=X.scrollLeft();ae.css({position:"absolute"})}if(ac.right!==false){aj+=Math.max(X.width()-ac.w-a-l-M(ac.right,"x"),0)}else{if(ac.left!==false){aj+=M(ac.left,"x")}else{aj+=Math.round(Math.max(X.width()-ac.w-a-l,0)/2)}}if(ac.bottom!==false){ak+=Math.max(X.height()-ac.h-g-ag-M(ac.bottom,"y"),0)}else{if(ac.top!==false){ak+=M(ac.top,"y")}else{ak+=Math.round(Math.max(X.height()-ac.h-g-ag,0)/2)}}ae.css({top:al.top,left:al.left});ai=(ae.width()===ac.w+a&&ae.height()===ac.h+g)?0:ai||0;af[0].style.width=af[0].style.height="9999px";function am(an){F[0].style.width=N[0].style.width=d[0].style.width=an.style.width;h[0].style.height=h[1].style.height=d[0].style.height=o[0].style.height=b[0].style.height=an.style.height}ae.dequeue().animate({width:ac.w+a,height:ac.h+g,top:ak,left:aj},{duration:ai,complete:function(){am(this);W=false;af[0].style.width=(ac.w+a+l)+"px";af[0].style.height=(ac.h+g+ag)+"px";if(ah){ah()}setTimeout(function(){X.bind("resize."+Q,J.position)},1)},step:function(){am(this)}})};J.resize=function(ah){if(B){ah=ah||{};if(ah.width){ac.w=M(ah.width,"x")-a-l}if(ah.innerWidth){ac.w=M(ah.innerWidth,"x")}L.css({width:ac.w});if(ah.height){ac.h=M(ah.height,"y")-g-ag}if(ah.innerHeight){ac.h=M(ah.innerHeight,"y")}if(!ah.innerHeight&&!ah.height){L.css({height:"auto"});ac.h=L.height()}L.css({height:ac.h});J.position(ac.transition==="none"?0:ac.speed)}};J.prep=function(ai){if(!B){return}var al,aj=ac.transition==="none"?0:ac.speed;L.remove();L=E(ab,"LoadedContent").append(ai);function ah(){ac.w=ac.w||L.width();ac.w=ac.mw&&ac.mw<ac.w?ac.mw:ac.w;return ac.w}function ak(){ac.h=ac.h||L.height();ac.h=ac.mh&&ac.mh<ac.h?ac.mh:ac.h;return ac.h}L.hide().appendTo(j.show()).css({width:ah(),overflow:ac.scrolling?"auto":"hidden"}).css({height:ak()}).prependTo(d);j.hide();H(m).css({"float":"none"});if(t){H("select").not(ae.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(s,function(){this.style.visibility="inherit"})}al=function(){var aw,at,au=c.length,aq,av="frameBorder",ap="allowTransparency",an,am,ar;if(!B){return}function ao(){if(t){ae[0].style.removeAttribute("filter")}}an=function(){clearTimeout(y);h.hide();D(S,ac.onComplete)};if(t){if(m){L.fadeIn(100)}}n.html(ac.title).add(L).show();if(au>1){if(typeof ac.current==="string"){r.html(ac.current.replace("{current}",G+1).replace("{total}",au)).show()}q[(ac.loop||G<au-1)?"show":"hide"]().html(ac.next);P[(ac.loop||G)?"show":"hide"]().html(ac.previous);if(ac.slideshow){V.show()}if(ac.preloading){aw=[C(-1),C(1)];while((at=c[aw.pop()])){am=H.data(at,v).href||at.href;if(H.isFunction(am)){am=am.call(at)}if(A(am)){ar=new Image();ar.src=am}}}}else{z.hide()}if(ac.iframe){aq=E("iframe")[0];if(av in aq){aq[av]=0}if(ap in aq){aq[ap]="true"}aq.name=Q+(+new Date());if(ac.fastIframe){an()}else{H(aq).one("load",an)}aq.src=ac.href;if(!ac.scrolling){aq.scrolling="no"}H(aq).addClass(Q+"Iframe").appendTo(L).one(i,function(){aq.src="//about:blank"})}else{an()}if(ac.transition==="fade"){ae.fadeTo(aj,1,ao)}else{ao()}};if(ac.transition==="fade"){ae.fadeTo(aj,0,function(){J.position(0,al)})}else{J.position(aj,al)}};J.load=function(aj){var ai,ak,ah=J.prep;W=true;m=false;u=c[G];if(!aj){R()}D(i);D(e,ac.onLoad);ac.h=ac.height?M(ac.height,"y")-g-ag:ac.innerHeight&&M(ac.innerHeight,"y");ac.w=ac.width?M(ac.width,"x")-a-l:ac.innerWidth&&M(ac.innerWidth,"x");ac.mw=ac.w;ac.mh=ac.h;if(ac.maxWidth){ac.mw=M(ac.maxWidth,"x")-a-l;ac.mw=ac.w&&ac.w<ac.mw?ac.w:ac.mw}if(ac.maxHeight){ac.mh=M(ac.maxHeight,"y")-g-ag;ac.mh=ac.h&&ac.h<ac.mh?ac.h:ac.mh}ai=ac.href;y=setTimeout(function(){h.show()},100);if(ac.inline){E(ab).hide().insertBefore(H(ai)[0]).one(i,function(){H(this).replaceWith(L.children())});ah(H(ai))}else{if(ac.iframe){ah(" ")}else{if(ac.html){ah(ac.html)}else{if(A(ai)){H(m=new Image()).addClass(Q+"Photo").error(function(){ac.title=false;ah(E(ab,"Error").text("This image could not be loaded"))}).load(function(){var al;m.onload=null;if(ac.scalePhotos){ak=function(){m.height-=m.height*al;m.width-=m.width*al};if(ac.mw&&m.width>ac.mw){al=(m.width-ac.mw)/m.width;ak()}if(ac.mh&&m.height>ac.mh){al=(m.height-ac.mh)/m.height;ak()}}if(ac.h){m.style.marginTop=Math.max(ac.h-m.height,0)/2+"px"}if(c[1]&&(G<c.length-1||ac.loop)){m.style.cursor="pointer";m.onclick=function(){J.next()}}if(t){m.style.msInterpolationMode="bicubic"}setTimeout(function(){ah(m)},1)});setTimeout(function(){m.src=ai},1)}else{if(ai){j.load(ai,ac.data,function(am,al,an){ah(al==="error"?E(ab,"Error").text("Request unsuccessful: "+an.statusText):H(this).contents())})}}}}}};J.next=function(){if(!W&&c[1]&&(G<c.length-1||ac.loop)){G=C(1);J.load()}};J.prev=function(){if(!W&&c[1]&&(G||ac.loop)){G=C(-1);J.load()}};J.close=function(){if(B&&!K){K=true;B=false;D(s,ac.onCleanup);X.unbind("."+Q+" ."+Y);O.fadeTo(200,0);ae.stop().fadeTo(300,0,function(){ae.add(O).css({opacity:1,cursor:"auto"}).hide();D(i);L.remove();setTimeout(function(){K=false;D(Z,ac.onClosed)},1)})}};J.element=function(){return H(u)};J.settings=I;H("."+p,k).live("click",function(ah){if(!(ah.which>1||ah.shiftKey||ah.altKey||ah.metaKey)){ah.preventDefault();f(this)}});J.init()}(jQuery,document,this));

		$(document).ready(function(){
			//Examples of how to assign the ColorBox event to elements
			$(".pop").colorbox();
			
			//Example of preserving a JavaScript event for inline calls.
			$("#click").click(function(){ 
				$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
				return false;
			});
		});
