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