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