(function(a){function m(b,s){b=b.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=RegExp("[\\?&]"+b+"=([^&#]*)").exec(s);return t==null?"":t[1]}a.prettyPhoto={version:"2.5.6"};a.fn.prettyPhoto=function(b){function s(e){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();e&&e()});h.fadeOut(b.animationSpeed)}function t(e){if(d==e-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(d==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})}e>1?a(".pp_nav").show():a(".pp_nav").hide()}
function i(e,g){hasBeenResized=false;w(e,g);imageWidth=e;imageHeight=g;if((n>j||o>l)&&k&&b.allowresize&&!x){for(notFitting=hasBeenResized=true;notFitting;){if(n>j){imageWidth=j-200;imageHeight=g/e*imageWidth}else if(o>l){imageHeight=l-200;imageWidth=e/g*imageHeight}else notFitting=false;o=imageHeight;n=imageWidth}w(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(o),containerWidth:Math.floor(n)+40,contentHeight:Math.floor(v),contentWidth:Math.floor(y),
resized:hasBeenResized}}function w(e,g){e=parseFloat(e);g=parseFloat(g);$pp_details=c.find(".pp_details");$pp_details.width(e);detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));$pp_details=$pp_details.clone().appendTo(a("body")).css({position:"absolute",top:-1E4});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=e;o=
v+h.height()+c.find(".pp_top").height()+c.find(".pp_bottom").height();n=e}function z(e){return e.match(/youtube\.com\/watch/i)?"youtube":e.match(/vimeo\.com/i)?"vimeo":e.indexOf(".mov")!=-1?"quicktime":e.indexOf(".swf")!=-1?"flash":e.indexOf("iframe")!=-1?"iframe":e.substr(0,1)=="#"?"inline":e.indexOf("ajax")!=-1?"ajax":"image"}function u(){if(k){titleHeight=h.height();contentHeight=c.height();contentwidth=c.width();projectedTop=l/2+p.scrollTop-(contentHeight+titleHeight)/2;c.css({top:projectedTop,
left:j/2+p.scrollLeft-contentwidth/2});h.css({top:projectedTop-titleHeight,left:j/2+p.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(){l=a(window).height();
j=a(window).width();q.css({height:a(document).height()})}function C(){a("body").append(b.markup);c=a(".pp_pic_holder");h=a(".ppt");q=a("div.pp_overlay");c.attr("class","pp_pic_holder "+b.theme);q.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");
k=false}else{$this.removeClass("pp_contract").addClass("pp_expand");k=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.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"> \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 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>'},b);if(a.browser.msie&&parseInt(a.browser.version)==6){b.theme="light_square";b.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>'}a(".pp_overlay").size()==
0&&C();var k=true,x=false,f,c,h,q,v,y,o,n,l=a(window).height(),j=a(window).width(),d=0,p=A();a(window).scroll(function(){p=A();u();B()});a(window).resize(function(){u();B()});a(document).keydown(function(e){if(c.is(":visible"))switch(e.keyCode){case 37:a.prettyPhoto.changePage("previous");break;case 39:a.prettyPhoto.changePage("next");break;case 27:b.modal||a.prettyPhoto.close()}});a(this).each(function(){a(this).bind("click",function(){_self=this;theRel=a(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;
theGallery=galleryRegExp.exec(theRel);var e=[],g=[],r=[];if(theGallery)a("a[rel*="+theGallery+"]").each(function(D){if(a(this)[0]===a(_self)[0])d=D;e.push(a(this).attr("href"));g.push(a(this).find("img").attr("alt"));r.push(a(this).attr("title"))});else{e=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(e,g,r);return false})});a.prettyPhoto.open=function(e,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(e);titles=a.makeArray(g);descriptions=a.makeArray(r);image_set=a(images).size()>0?true:false;t(a(images).size());a(".pp_loaderIcon").show();q.show().fadeTo(b.animationSpeed,b.opacity);c.find(".currentTextHolder").text(d+1+b.counter_separator_label+a(images).size());descriptions[d]?c.find(".pp_description").show().html(unescape(descriptions[d])):c.find(".pp_description").hide().text("");
if(titles[d]&&b.showTitle){hasTitle=true;h.html(unescape(titles[d]))}else hasTitle=false;movie_width=parseFloat(m("width",images[d]))?m("width",images[d]):b.default_width.toString();movie_height=parseFloat(m("height",images[d]))?m("height",images[d]):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[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];c.find("#pp_full_res")[0].innerHTML=b.image_markup;c.find("#fullResImage").attr("src",images[d]);imgPreloader.onload=function(){f=i(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":f=i(movie_width,movie_height);movie="http://www.youtube.com/v/"+m("v",images[d]);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=i(movie_width,movie_height);movie_id=images[d];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=i(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[d]).replace(/{autoplay}/g,b.autoplay);break;case "flash":f=i(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=b.flash_markup.replace(/{width}/g,f.width).replace(/{height}/g,f.height).replace(/{wmode}/g,b.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case "iframe":f=i(movie_width,movie_height);frame_url=images[d];frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1);toInject=b.iframe_markup.replace(/{width}/g,f.width).replace(/{height}/g,
f.height).replace(/{path}/g,frame_url);break;case "inline":myClone=a(images[d]).clone().css({width:b.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo(a("body"));f=i(a(myClone).width(),a(myClone).height());a(myClone).remove();toInject=b.inline_markup.replace(/{content}/g,a(images[d]).html());break;case "ajax":f=i(movie_width,movie_height);ajax_url=images[d];ajax_url=ajax_url.substr(0,ajax_url.indexOf("ajax")-1);toInject=a.ajax({async:false,type:"GET",
url:ajax_url}).responseText}if(!imgPreloader){c.find("#pp_full_res")[0].innerHTML=toInject;_showContent()}})};a.prettyPhoto.changePage=function(e){if(e=="previous"){d--;if(d<0){d=0;return}}else{if(a(".pp_arrow_next").is(".disabled"))return;d++}k||(k=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);
q.fadeOut(b.animationSpeed,function(){a("#pp_full_res").html("");c.attr("style","").find("div:not(.pp_hoverContainer)").attr("style","");u();a.browser.msie&&a.browser.version==6&&a("select").css("visibility","visible");b.hideflash&&a("object,embed").css("visibility","visible");d=0;b.callback()});k=true};_showContent=function(){projectedTop=p.scrollTop+(l/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:j/2-f.containerWidth/2,width:f.containerWidth},b.animationSpeed,function(){c.find(".pp_hoverContainer,#fullResImage").height(f.height).width(f.width);c.find(".pp_fade").fadeIn(b.animationSpeed);image_set&&z(images[d])=="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();
a(".pp_loaderIcon").hide()})};u()}})(jQuery);
