(function(h){var k,u,s,r,c,p,j,q,g,t,n,a,d,o,i,m,f;h(function(){h("body").append(h([modalOverlay=h('<div id="modalBackgroundOverlay" />')[0],r=h('<div id="colorbox" />')[0]]).hide());h(r).append(h([t=h('<div id="borderTopLeft" />')[0],n=h('<div id="borderTopCenter" />')[0],a=h('<div id="borderTopRight" />')[0],d=h('<div id="borderMiddleLeft" />')[0],o=h('<div id="borderMiddleRight" />')[0],i=h('<div id="borderBottomLeft" />')[0],m=h('<div id="borderBottomCenter" />')[0],f=h('<div id="borderBottomRight" />')[0],j=h('<div id="modalContent" />')[0]]));h(j).append(h([q=h('<div id="modalLoadedContent"><a id="contentPrevious" href="#"></a><a id="contentNext" href="#"></a><span id="contentCurrent"></span><br id="modalInfoBr"/><span id="contentTitle"></span><div id="preloadPrevious"></div><div id="preloadNext"></div><div id="preloadClose"></div></div>')[0],modalLoadingOverlay=h('<div id="modalLoadingOverlay" />')[0],g=h('<a id="modalClose" href="#"></a>')[0]]));h(g).click(function(){l();return false})});function b(){h([modalOverlay,r]).css({position:"absolute",width:h(window).width(),height:h(window).height(),top:h(window).scrollTop(),left:h(window).scrollLeft()})}function e(v){if(v.keyCode==27){l();return false}else{if(v.keyCode==37){h("a#contentPrevious").click();return false}else{if(v.keyCode==39){h("a#contentNext").click();return false}}}}function l(){h([modalOverlay,r]).fadeOut("fast",function(){h(q).empty()});if(s){h(s).remove()}h(document).unbind("keydown",e);h(window).unbind("resize scroll",b)}h.fn.colorbox=function(A){A=h.extend({},h.fn.colorbox.settings,A);function v(D,E,F,H){var G=h(window).height()/2-E/2+h(window).scrollTop();var C=h(window).width()/2-D/2+h(window).scrollLeft();if(G<h(t).height()){G=h(t).height()}if(C<h(t).width()){C=h(t).width()}h(d).animate({top:G,left:C-h(d).width(),height:E},F);h(o).animate({top:G,left:C+D,height:E},F);h(t).animate({top:G-h(t).height(),left:C-h(t).width()},F);h(n).animate({top:G-h(n).height(),left:C,width:D},F);h(a).animate({top:G-h(a).height(),left:C+D},F);h(i).animate({top:G+E,left:C-h(i).width()},F);h(m).animate({top:G+E,left:C,width:D},F);h(f).animate({top:G+E,left:C+D},F);h(j).animate({height:E,width:D,top:G,left:C},F,function(){if(H){H()}if(h.browser.msie&&h.browser.version<7){b()}})}var z=[];function w(){if(A.preloading==true&&u.length>1){var D,C;k>0?D=u[k-1].href:D=u[u.length-1].href;k<u.length-1?C=u[k+1].href:C=u[0].href;return[h(new Image()).attr("src",C),h(new Image()).attr("src",D)]}}function y(E,C){h(q).hide().html(E).append(C);if(A.contentWidth){h(q).css({width:A.contentWidth})}if(A.contentHeight){h(q).css({height:A.contentHeight})}if(A.transition=="elastic"){v(h(q).outerWidth(true),h(q).outerHeight(true),A.transitionSpeed,function(){h(q).show();h(modalLoadingOverlay).hide()})}else{h(r).fadeTo(A.transitionSpeed,0,function(){v(h(q).outerWidth(true),h(q).outerHeight(true),0);h(q).show();h(modalLoadingOverlay).hide();h(r).fadeTo(A.transitionSpeed,1,function(){})})}var D=w()}function x(){h(modalLoadingOverlay).show();if(h(this).attr("id")=="contentPrevious"){k>0?k--:k=u.length-1}else{k<u.length-1?k++:k=0}B(u[k]);return false}function B(D){var C="<br id='modalInfoBr'/><span id='contentTitle'>"+D.title+"</span>";if(u.length>1){C+="<span id='contentCurrent'> "+A.contentCurrent+"</span>";C=C.replace(/{current}/,k+1).replace(/{total}/,u.length);C+="<a id='contentPrevious' href='#'>"+A.contentPrevious+"</a> ";C+="<a id='contentNext' href='#'>"+A.contentNext+"</a> "}if(D.href.match(/.(gif|png|jpg|jpeg|bmp|tif)$/i)){s=h(new Image()).load(function(){y("<img src='"+D.href+"' alt=''/>",C)}).attr("src",D.href)}else{if(A.contentInline){y(h(A.contentInline).html(),C)}else{if(A.contentIframe){y("<iframe src ="+D.href+"></iframe>",C)}else{s=h("<div></div>").load(((A.contentAjax)?A.contentAjax:D.href),function(E,F){if(F=="success"){y(h(this).html(),C)}else{y("<p>Ajax request unsuccessful</p>")}})}}}}h(this).click(function(){h(q).empty().css({height:"auto",width:"auto"});h(g).html(A.modalClose);h(modalOverlay).css({opacity:A.bgOpacity});h([modalOverlay,r,modalLoadingOverlay]).show();h(j).css({width:A.initialWidth,height:A.initialHeight});v(h(j).width(),h(j).height(),0);if(this.rel){u=h("a[rel='"+this.rel+"']");k=h(u).index(this)}else{u=h(this);k=0}B(u[k]);h("a#contentPrevious, a#contentNext").die().live("click",x);h(document).bind("keydown",e);if(h.browser.msie&&h.browser.version<7){h(window).bind("resize scroll",b)}return false});return this.each(function(){})};h.fn.colorbox.settings={transition:"elastic",transitionSpeed:350,initialWidth:300,initialHeight:100,contentWidth:false,contentHeight:false,contentAjax:false,contentInline:false,contentIframe:false,bgOpacity:0.85,preloading:true,contentCurrent:"{current} of {total}",contentPrevious:"previous",contentNext:"next",modalClose:"close"}})(jQuery);