(function(d){d.prettyPhoto={version:"2.5.6"};d.fn.prettyPhoto=function(D){D=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>'},D);if(d.browser.msie&&parseInt(d.browser.version)==6){D.theme="light_square"}if(d(".pp_overlay").size()==0){C()}var T=true,P=false,E,J,a,V,L,K,F,B,R=d(window).height(),b=d(window).width(),U=0,G=S();d(window).scroll(function(){G=S();O();H()});d(window).resize(function(){O();H()});d(document).keydown(function(e){if(J.is(":visible")){switch(e.keyCode){case 37:d.prettyPhoto.changePage("previous");break;case 39:d.prettyPhoto.changePage("next");break;case 27:if(!D.modal){d.prettyPhoto.close()}break}}});d(this).each(function(){d(this).bind("click",function(){_self=this;theRel=d(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var e=new Array(),f=new Array(),g=new Array();if(theGallery){d("a[rel*="+theGallery+"]").each(function(h){if(d(this)[0]===d(_self)[0]){U=h}e.push(d(this).attr("href"));f.push(d(this).find("img").attr("alt"));g.push(d(this).attr("title"))})}else{e=d(this).attr("href");f=(d(this).find("img").attr("alt"))?d(this).find("img").attr("alt"):"";g=(d(this).attr("title"))?d(this).attr("title"):""}d.prettyPhoto.open(e,f,g);return false})});d.prettyPhoto.open=function(f,g,e){if(d.browser.msie&&d.browser.version==6){d("select").css("visibility","hidden")}if(D.hideflash){d("object,embed").css("visibility","hidden")}images=d.makeArray(f);titles=d.makeArray(g);descriptions=d.makeArray(e);image_set=(d(images).size()>0)?true:false;Q(d(images).size());d(".pp_loaderIcon").show();V.show().fadeTo(D.animationSpeed,D.opacity);J.find(".currentTextHolder").text((U+1)+D.counter_separator_label+d(images).size());if(descriptions[U]){J.find(".pp_description").show().html(unescape(descriptions[U]))}else{J.find(".pp_description").hide().text("")}if(titles[U]&&D.showTitle){hasTitle=true;a.html(unescape(titles[U]))}else{hasTitle=false}movie_width=(parseFloat(c("width",images[U])))?c("width",images[U]):D.default_width.toString();movie_height=(parseFloat(c("height",images[U])))?c("height",images[U]):D.default_height.toString();if(movie_width.indexOf("%")!=-1||movie_height.indexOf("%")!=-1){movie_height=parseFloat((d(window).height()*parseFloat(movie_height)/100)-100);movie_width=parseFloat((d(window).width()*parseFloat(movie_width)/100)-100);P=true}J.fadeIn(function(){imgPreloader="";switch(A(images[U])){case"image":imgPreloader=new Image();nextImage=new Image();if(image_set&&U>d(images).size()){nextImage.src=images[U+1]}prevImage=new Image();if(image_set&&images[U-1]){prevImage.src=images[U-1]}J.find("#pp_full_res")[0].innerHTML=D.image_markup;J.find("#fullResImage").attr("src",images[U]);imgPreloader.onload=function(){E=N(imgPreloader.width,imgPreloader.height);_showContent()};imgPreloader.onerror=function(){alert("Image cannot be loaded. Make sure the path is correct and image exist.");d.prettyPhoto.close()};imgPreloader.src=images[U];break;case"youtube":E=N(movie_width,movie_height);movie="http://www.youtube.com/v/"+c("v",images[U]);if(D.autoplay){movie+="&autoplay=1"}toInject=D.flash_markup.replace(/{width}/g,E.width).replace(/{height}/g,E.height).replace(/{wmode}/g,D.wmode).replace(/{path}/g,movie);break;case"vimeo":E=N(movie_width,movie_height);movie_id=images[U];movie="http://vimeo.com/moogaloop.swf?clip_id="+movie_id.replace("http://vimeo.com/","");if(D.autoplay){movie+="&autoplay=1"}toInject=D.flash_markup.replace(/{width}/g,E.width).replace(/{height}/g,E.height).replace(/{wmode}/g,D.wmode).replace(/{path}/g,movie);break;case"quicktime":E=N(movie_width,movie_height);E.height+=15;E.contentHeight+=15;E.containerHeight+=15;toInject=D.quicktime_markup.replace(/{width}/g,E.width).replace(/{height}/g,E.height).replace(/{wmode}/g,D.wmode).replace(/{path}/g,images[U]).replace(/{autoplay}/g,D.autoplay);break;case"flash":E=N(movie_width,movie_height);flash_vars=images[U];flash_vars=flash_vars.substring(images[U].indexOf("flashvars")+10,images[U].length);filename=images[U];filename=filename.substring(0,filename.indexOf("?"));toInject=D.flash_markup.replace(/{width}/g,E.width).replace(/{height}/g,E.height).replace(/{wmode}/g,D.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case"iframe":E=N(movie_width,movie_height);frame_url=images[U];frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1);toInject=D.iframe_markup.replace(/{width}/g,E.width).replace(/{height}/g,E.height).replace(/{path}/g,frame_url);break;case"inline":myClone=d(images[U]).clone().css({width:D.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo(d("body"));E=N(d(myClone).width(),d(myClone).height());d(myClone).remove();toInject=D.inline_markup.replace(/{content}/g,d(images[U]).html());break}if(!imgPreloader){J.find("#pp_full_res")[0].innerHTML=toInject;_showContent()}})};d.prettyPhoto.changePage=function(e){if(e=="previous"){U--;if(U<0){U=0;return}}else{if(d(".pp_arrow_next").is(".disabled")){return}U++}if(!T){T=true}M(function(){d.prettyPhoto.open(images,titles,descriptions)});d("a.pp_expand,a.pp_contract").fadeOut(D.animationSpeed)};d.prettyPhoto.close=function(){J.find("object,embed").css("visibility","hidden");d("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(D.animationSpeed);V.fadeOut(D.animationSpeed,function(){d("#pp_full_res").html("");J.attr("style","").find("div:not(.pp_hoverContainer)").attr("style","");O();if(d.browser.msie&&d.browser.version==6){d("select").css("visibility","visible")}if(D.hideflash){d("object,embed").css("visibility","visible")}U=0;D.callback()});T=true};_showContent=function(){d(".pp_loaderIcon").hide();projectedTop=G.scrollTop+((R/2)-(E.containerHeight/2));if(projectedTop<0){projectedTop=0+a.height()}J.find(".pp_content").animate({height:E.contentHeight},D.animationSpeed);J.animate({top:projectedTop,left:(b/2)-(E.containerWidth/2),width:E.containerWidth},D.animationSpeed,function(){J.find(".pp_hoverContainer,#fullResImage").height(E.height).width(E.width);J.find(".pp_fade").fadeIn(D.animationSpeed);if(image_set&&A(images[U])=="image"){J.find(".pp_hoverContainer").show()}else{J.find(".pp_hoverContainer").hide()}if(D.showTitle&&hasTitle){a.css({top:J.offset().top-25,left:J.offset().left+20,display:"none"});a.fadeIn(D.animationSpeed)}if(E.resized){d("a.pp_expand,a.pp_contract").fadeIn(D.animationSpeed)}D.changepicturecallback()})};function M(e){J.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");J.find(".pp_fade").fadeOut(D.animationSpeed,function(){d(".pp_loaderIcon").show();if(e){e()}});a.fadeOut(D.animationSpeed)}function Q(e){if(U==e-1){J.find("a.pp_next").css("visibility","hidden");J.find("a.pp_arrow_next").addClass("disabled").unbind("click")}else{J.find("a.pp_next").css("visibility","visible");J.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){d.prettyPhoto.changePage("next");return false})}if(U==0){J.find("a.pp_previous").css("visibility","hidden");J.find("a.pp_arrow_previous").addClass("disabled").unbind("click")}else{J.find("a.pp_previous").css("visibility","visible");J.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){d.prettyPhoto.changePage("previous");return false})}if(e>1){d(".pp_nav").show()}else{d(".pp_nav").hide()}}function N(f,e){hasBeenResized=false;I(f,e);imageWidth=f;imageHeight=e;if(((B>b)||(F>R))&&T&&D.allowresize&&!P){hasBeenResized=true;notFitting=true;while(notFitting){if((B>b)){imageWidth=(b-200);imageHeight=(e/f)*imageWidth}else{if((F>R)){imageHeight=(R-200);imageWidth=(f/e)*imageHeight}else{notFitting=false}}F=imageHeight;B=imageWidth}I(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(F),containerWidth:Math.floor(B)+40,contentHeight:Math.floor(L),contentWidth:Math.floor(K),resized:hasBeenResized}}function I(f,e){f=parseFloat(f);e=parseFloat(e);$pp_details=J.find(".pp_details");$pp_details.width(f);detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));$pp_details=$pp_details.clone().appendTo(d("body")).css({position:"absolute",top:-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if(d.browser.msie&&d.browser.version==7){detailsHeight+=8}$pp_details.remove();L=e+detailsHeight;K=f;F=L+a.height()+J.find(".pp_top").height()+J.find(".pp_bottom").height();B=f}function A(e){if(e.match(/youtube\.com\/watch/i)){return"youtube"}else{if(e.match(/vimeo\.com/i)){return"vimeo"}else{if(e.indexOf(".mov")!=-1){return"quicktime"}else{if(e.indexOf(".swf")!=-1){return"flash"}else{if(e.indexOf("iframe")!=-1){return"iframe"}else{if(e.substr(0,1)=="#"){return"inline"}else{return"image"}}}}}}}function O(){if(T){titleHeight=a.height();contentHeight=J.height();contentwidth=J.width();projectedTop=(R/2)+G.scrollTop-((contentHeight+titleHeight)/2);J.css({top:projectedTop,left:(b/2)+G.scrollLeft-(contentwidth/2)});a.css({top:projectedTop-titleHeight,left:(b/2)+G.scrollLeft-(contentwidth/2)+20})}}function S(){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 H(){R=d(window).height();b=d(window).width();V.css({height:d(document).height()})}function C(){d("body").append(D.markup);J=d(".pp_pic_holder");a=d(".ppt");V=d("div.pp_overlay");J.attr("class","pp_pic_holder "+D.theme);V.css({opacity:0,height:d(document).height()}).bind("click",function(){if(!D.modal){d.prettyPhoto.close()}});d("a.pp_close").bind("click",function(){d.prettyPhoto.close();return false});d("a.pp_expand").bind("click",function(){$this=d(this);if($this.hasClass("pp_expand")){$this.removeClass("pp_expand").addClass("pp_contract");T=false}else{$this.removeClass("pp_contract").addClass("pp_expand");T=true}M(function(){d.prettyPhoto.open(images,titles,descriptions)});J.find(".pp_fade").fadeOut(D.animationSpeed);return false});J.find(".pp_previous, .pp_arrow_previous").bind("click",function(){d.prettyPhoto.changePage("previous");return false});J.find(".pp_next, .pp_arrow_next").bind("click",function(){d.prettyPhoto.changePage("next");return false})}O()};function c(h,i){h=h.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var j="[\\?&]"+h+"=([^&#]*)";var a=new RegExp(j);var b=a.exec(i);if(b==null){return""}else{return b[1]}}})(jQuery);