(function(a){a.prettyPhoto={version:"2.5.6"};a.fn.prettyPhoto=function(u){u=jQuery.extend({animationSpeed:"normal",opacity:0.8,showTitle:true,allowresize:true,default_width:500,default_height:344,counter_separator_label:"/",theme:"light_rounded",hideflash:false,wmode:"opaque",autoplay:true,modal:false,changepicturecallback:function(){},callback:function(){},markup:'<div class="pp_pic_holder">       <div class="pp_top">        <div class="pp_left"></div>        <div class="pp_middle"></div>        <div class="pp_right"></div>       </div>       <div class="pp_content_container">        <div class="pp_left">        <div class="pp_right">         <div class="pp_content">          <div class="pp_loaderIcon"></div>          <div class="pp_fade">           <a href="#" class="pp_expand" title="Expand the image">Expand</a>           <div class="pp_hoverContainer">            <a class="pp_next" href="#">next</a>            <a class="pp_previous" href="#">previous</a>           </div>           <div id="pp_full_res"></div>           <div class="pp_details clearfix">            <a class="pp_close" href="#">Close</a>            <p class="pp_description"></p>            <div class="pp_nav">             <a href="#" class="pp_arrow_previous">Previous</a>             <p class="currentTextHolder">0/0</p>             <a href="#" class="pp_arrow_next">Next</a>            </div>           </div>          </div>         </div>        </div>        </div>       </div>       <div class="pp_bottom">        <div class="pp_left"></div>        <div class="pp_middle"></div>        <div class="pp_right"></div>       </div>      </div>      <div class="pp_overlay"></div>      <div class="ppt"></div>',image_markup:'<img id="fullResImage" src="" />',flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline clearfix">{content}</div>'},u);if(a.browser.msie&&parseInt(a.browser.version)==6){u.theme="light_square"}if(a(".pp_overlay").size()==0){v()}var e=true,i=false,t,o,z,c,m,n,s,w,g=a(window).height(),y=a(window).width(),d=0,r=f();a(window).scroll(function(){r=f();j();q()});a(window).resize(function(){j();q()});a(document).keydown(function(A){if(o.is(":visible")){switch(A.keyCode){case 37:a.prettyPhoto.changePage("previous");break;case 39:a.prettyPhoto.changePage("next");break;case 27:if(!u.modal){a.prettyPhoto.close()}break}}});a(this).each(function(){a(this).bind("click",function(){_self=this;theRel=a(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var A=new Array(),C=new Array(),B=new Array();if(theGallery){a("a[rel*="+theGallery+"]").each(function(D){if(a(this)[0]===a(_self)[0]){d=D}A.push(a(this).attr("href"));C.push(a(this).find("img").attr("alt"));B.push(a(this).attr("title"))})}else{A=a(this).attr("href");C=(a(this).find("img").attr("alt"))?a(this).find("img").attr("alt"):"";B=(a(this).attr("title"))?a(this).attr("title"):""}a.prettyPhoto.open(A,C,B);return false})});a.prettyPhoto.open=function(C,B,A){if(a.browser.msie&&a.browser.version==6){a("select").css("visibility","hidden")}if(u.hideflash){a("object,embed").css("visibility","hidden")}images=a.makeArray(C);titles=a.makeArray(B);descriptions=a.makeArray(A);image_set=(a(images).size()>0)?true:false;h(a(images).size());a(".pp_loaderIcon").show();c.show().fadeTo(u.animationSpeed,u.opacity);o.find(".currentTextHolder").text((d+1)+u.counter_separator_label+a(images).size());if(descriptions[d]){o.find(".pp_description").show().html(unescape(descriptions[d]))}else{o.find(".pp_description").hide().text("")}if(titles[d]&&u.showTitle){hasTitle=true;z.html(unescape(titles[d]))}else{hasTitle=false}movie_width=(parseFloat(b("width",images[d])))?b("width",images[d]):u.default_width.toString();movie_height=(parseFloat(b("height",images[d])))?b("height",images[d]):u.default_height.toString();if(movie_width.indexOf("%")!=-1||movie_height.indexOf("%")!=-1){movie_height=parseFloat((a(window).height()*parseFloat(movie_height)/100)-100);movie_width=parseFloat((a(window).width()*parseFloat(movie_width)/100)-100);i=true}o.fadeIn(function(){imgPreloader="";switch(x(images[d])){case"image":imgPreloader=new Image();nextImage=new Image();if(image_set&&d>a(images).size()){nextImage.src=images[d+1]}prevImage=new Image();if(image_set&&images[d-1]){prevImage.src=images[d-1]}o.find("#pp_full_res")[0].innerHTML=u.image_markup;o.find("#fullResImage").attr("src",images[d]);imgPreloader.onload=function(){t=k(imgPreloader.width,imgPreloader.height);_showContent()};imgPreloader.onerror=function(){alert("Image cannot be loaded. Make sure the path is correct and image exist.");a.prettyPhoto.close()};imgPreloader.src=images[d];break;case"youtube":t=k(movie_width,movie_height);movie="http://www.youtube.com/v/"+b("v",images[d]);if(u.autoplay){movie+="&autoplay=1"}toInject=u.flash_markup.replace(/{width}/g,t.width).replace(/{height}/g,t.height).replace(/{wmode}/g,u.wmode).replace(/{path}/g,movie);break;case"vimeo":t=k(movie_width,movie_height);movie_id=images[d];movie="http://vimeo.com/moogaloop.swf?clip_id="+movie_id.replace("http://vimeo.com/","");if(u.autoplay){movie+="&autoplay=1"}toInject=u.flash_markup.replace(/{width}/g,t.width).replace(/{height}/g,t.height).replace(/{wmode}/g,u.wmode).replace(/{path}/g,movie);break;case"quicktime":t=k(movie_width,movie_height);t.height+=15;t.contentHeight+=15;t.containerHeight+=15;toInject=u.quicktime_markup.replace(/{width}/g,t.width).replace(/{height}/g,t.height).replace(/{wmode}/g,u.wmode).replace(/{path}/g,images[d]).replace(/{autoplay}/g,u.autoplay);break;case"flash":t=k(movie_width,movie_height);flash_vars=images[d];flash_vars=flash_vars.substring(images[d].indexOf("flashvars")+10,images[d].length);filename=images[d];filename=filename.substring(0,filename.indexOf("?"));toInject=u.flash_markup.replace(/{width}/g,t.width).replace(/{height}/g,t.height).replace(/{wmode}/g,u.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case"iframe":t=k(movie_width,movie_height);frame_url=images[d];frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1);toInject=u.iframe_markup.replace(/{width}/g,t.width).replace(/{height}/g,t.height).replace(/{path}/g,frame_url);break;case"inline":myClone=a(images[d]).clone().css({width:u.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo(a("body"));t=k(a(myClone).width(),a(myClone).height());a(myClone).remove();toInject=u.inline_markup.replace(/{content}/g,a(images[d]).html());break}if(!imgPreloader){o.find("#pp_full_res")[0].innerHTML=toInject;_showContent()}})};a.prettyPhoto.changePage=function(A){if(A=="previous"){d--;if(d<0){d=0;return}}else{if(a(".pp_arrow_next").is(".disabled")){return}d++}if(!e){e=true}l(function(){a.prettyPhoto.open(images,titles,descriptions)});a("a.pp_expand,a.pp_contract").fadeOut(u.animationSpeed)};a.prettyPhoto.close=function(){o.find("object,embed").css("visibility","hidden");a("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(u.animationSpeed);c.fadeOut(u.animationSpeed,function(){a("#pp_full_res").html("");o.attr("style","").find("div:not(.pp_hoverContainer)").attr("style","");j();if(a.browser.msie&&a.browser.version==6){a("select").css("visibility","visible")}if(u.hideflash){a("object,embed").css("visibility","visible")}d=0;u.callback()});e=true};_showContent=function(){a(".pp_loaderIcon").hide();projectedTop=r.scrollTop+((g/2)-(t.containerHeight/2));if(projectedTop<0){projectedTop=0+z.height()}o.find(".pp_content").animate({height:t.contentHeight},u.animationSpeed);o.animate({top:projectedTop,left:(y/2)-(t.containerWidth/2),width:t.containerWidth},u.animationSpeed,function(){o.find(".pp_hoverContainer,#fullResImage").height(t.height).width(t.width);o.find(".pp_fade").fadeIn(u.animationSpeed);if(image_set&&x(images[d])=="image"){o.find(".pp_hoverContainer").show()}else{o.find(".pp_hoverContainer").hide()}if(u.showTitle&&hasTitle){z.css({top:o.offset().top-25,left:o.offset().left+20,display:"none"});z.fadeIn(u.animationSpeed)}if(t.resized){a("a.pp_expand,a.pp_contract").fadeIn(u.animationSpeed)}u.changepicturecallback()})};function l(A){o.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");o.find(".pp_fade").fadeOut(u.animationSpeed,function(){a(".pp_loaderIcon").show();if(A){A()}});z.fadeOut(u.animationSpeed)}function h(A){if(d==A-1){o.find("a.pp_next").css("visibility","hidden");o.find("a.pp_arrow_next").addClass("disabled").unbind("click")}else{o.find("a.pp_next").css("visibility","visible");o.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){a.prettyPhoto.changePage("next");return false})}if(d==0){o.find("a.pp_previous").css("visibility","hidden");o.find("a.pp_arrow_previous").addClass("disabled").unbind("click")}else{o.find("a.pp_previous").css("visibility","visible");o.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){a.prettyPhoto.changePage("previous");return false})}if(A>1){a(".pp_nav").show()}else{a(".pp_nav").hide()}}function k(B,A){hasBeenResized=false;p(B,A);imageWidth=B;imageHeight=A;if(((w>y)||(s>g))&&e&&u.allowresize&&!i){hasBeenResized=true;notFitting=true;while(notFitting){if((w>y)){imageWidth=(y-200);imageHeight=(A/B)*imageWidth}else{if((s>g)){imageHeight=(g-200);imageWidth=(B/A)*imageHeight}else{notFitting=false}}s=imageHeight;w=imageWidth}p(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(s),containerWidth:Math.floor(w)+40,contentHeight:Math.floor(m),contentWidth:Math.floor(n),resized:hasBeenResized}}function p(B,A){B=parseFloat(B);A=parseFloat(A);$pp_details=o.find(".pp_details");$pp_details.width(B);detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));$pp_details=$pp_details.clone().appendTo(a("body")).css({position:"absolute",top:-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if(a.browser.msie&&a.browser.version==7){detailsHeight+=8}$pp_details.remove();m=A+detailsHeight;n=B;s=m+z.height()+o.find(".pp_top").height()+o.find(".pp_bottom").height();w=B}function x(A){if(A.match(/youtube\.com\/watch/i)){return"youtube"}else{if(A.match(/vimeo\.com/i)){return"vimeo"}else{if(A.indexOf(".mov")!=-1){return"quicktime"}else{if(A.indexOf(".swf")!=-1){return"flash"}else{if(A.indexOf("iframe")!=-1){return"iframe"}else{if(A.substr(0,1)=="#"){return"inline"}else{return"image"}}}}}}}function j(){if(e){titleHeight=z.height();contentHeight=o.height();contentwidth=o.width();projectedTop=(g/2)+r.scrollTop-((contentHeight+titleHeight)/2);o.css({top:projectedTop,left:(y/2)+r.scrollLeft-(contentwidth/2)});z.css({top:projectedTop-titleHeight,left:(y/2)+r.scrollLeft-(contentwidth/2)+20})}}function f(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset}}else{if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft}}else{if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}}}}}function q(){g=a(window).height();y=a(window).width();c.css({height:a(document).height()})}function v(){a("body").append(u.markup);o=a(".pp_pic_holder");z=a(".ppt");c=a("div.pp_overlay");o.attr("class","pp_pic_holder "+u.theme);c.css({opacity:0,height:a(document).height()}).bind("click",function(){if(!u.modal){a.prettyPhoto.close()}});a("a.pp_close").bind("click",function(){a.prettyPhoto.close();return false});a("a.pp_expand").bind("click",function(){$this=a(this);if($this.hasClass("pp_expand")){$this.removeClass("pp_expand").addClass("pp_contract");e=false}else{$this.removeClass("pp_contract").addClass("pp_expand");e=true}l(function(){a.prettyPhoto.open(images,titles,descriptions)});o.find(".pp_fade").fadeOut(u.animationSpeed);return false});o.find(".pp_previous, .pp_arrow_previous").bind("click",function(){a.prettyPhoto.changePage("previous");return false});o.find(".pp_next, .pp_arrow_next").bind("click",function(){a.prettyPhoto.changePage("next");return false})}j()};function b(e,d){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var c="[\\?&]"+e+"=([^&#]*)";var g=new RegExp(c);var f=g.exec(d);if(f==null){return""}else{return f[1]}}})(jQuery);