/* ------------------------------------------------------------------------ class: prettyphoto use: lightbox clone for jquery author: stephane caron (http://www.no-margin-for-errors.com) version: 3.1.5 ------------------------------------------------------------------------- */ (function(e){function t(){var e=location.href;hashtag=e.indexof("#prettyphoto")!==-1?decodeuri(e.substring(e.indexof("#prettyphoto")+1,e.length)):false;return hashtag}function n(){if(typeof therel=="undefined")return;location.hash=therel+"/"+rel_index+"/"}function r(){if(location.href.indexof("#prettyphoto")!==-1)location.hash="prettyphoto"}function i(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n="[\\?&]"+e+"=([^&#]*)";var r=new regexp(n);var i=r.exec(t);return i==null?"":i[1]}e.prettyphoto={version:"3.1.5"};e.fn.prettyphoto=function(s){function g(){e(".pp_loadericon").hide();projectedtop=scroll_pos["scrolltop"]+(d/2-a["containerheight"]/2);if(projectedtop<0)projectedtop=0;$ppt.fadeto(settings.animation_speed,1);$pp_pic_holder.find(".pp_content").animate({height:a["contentheight"],width:a["contentwidth"]},settings.animation_speed);$pp_pic_holder.animate({top:projectedtop,left:v/2-a["containerwidth"]/2<0?0:v/2-a["containerwidth"]/2,width:a["containerwidth"]},settings.animation_speed,function(){$pp_pic_holder.find(".pp_hovercontainer,#fullresimage").height(a["height"]).width(a["width"]);$pp_pic_holder.find(".pp_fade").fadein(settings.animation_speed);if(isset&&s(pp_images[set_position])=="image"){$pp_pic_holder.find(".pp_hovercontainer").show()}else{$pp_pic_holder.find(".pp_hovercontainer").hide()}if(settings.allow_expand){if(a["resized"]){e("a.pp_expand,a.pp_contract").show()}else{e("a.pp_expand").hide()}}if(settings.autoplay_slideshow&&!m&&!f)e.prettyphoto.startslideshow();settings.changepicturecallback();f=true});c();s.ajaxcallback()}function y(t){$pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");$pp_pic_holder.find(".pp_fade").fadeout(settings.animation_speed,function(){e(".pp_loadericon").show();t()})}function b(t){t>1?e(".pp_nav").show():e(".pp_nav").hide()}function w(e,t){resized=false;e(e,t);imagewidth=e,imageheight=t;if((p>v||h>d)&&doresize&&settings.allow_resize&&!u){resized=true,fitting=false;while(!fitting){if(p>v){imagewidth=v-200;imageheight=t/e*imagewidth}else if(h>d){imageheight=d-200;imagewidth=e/t*imageheight}else{fitting=true}h=imageheight,p=imagewidth}if(p>v||h>d){w(p,h)}e(imagewidth,imageheight)}return{width:math.floor(imagewidth),height:math.floor(imageheight),containerheight:math.floor(h),containerwidth:math.floor(p)+settings.horizontal_padding*2,contentheight:math.floor(l),contentwidth:math.floor(c),resized:resized}}function e(t,n){t=parsefloat(t);n=parsefloat(n);$pp_details=$pp_pic_holder.find(".pp_details");$pp_details.width(t);detailsheight=parsefloat($pp_details.css("margintop"))+parsefloat($pp_details.css("marginbottom"));$pp_details=$pp_details.clone().addclass(settings.theme).width(t).appendto(e("body")).css({position:"absolute",top:-1e4});detailsheight+=$pp_details.height();detailsheight=detailsheight<=34?36:detailsheight;$pp_details.remove();$pp_title=$pp_pic_holder.find(".ppt");$pp_title.width(t);titleheight=parsefloat($pp_title.css("margintop"))+parsefloat($pp_title.css("marginbottom"));$pp_title=$pp_title.clone().appendto(e("body")).css({position:"absolute",top:-1e4});titleheight+=$pp_title.height();$pp_title.remove();l=n+detailsheight;c=t;h=l+titleheight+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height();p=t}function s(e){if(e.match(/youtube\.com\/watch/i)||e.match(/youtu\.be/i)){return"youtube"}else if(e.match(/vimeo\.com/i)){return"vimeo"}else if(e.match(/\b.mov\b/i)){return"quicktime"}else if(e.match(/\b.swf\b/i)){return"flash"}else if(e.match(/\biframe=true\b/i)){return"iframe"}else if(e.match(/\bajax=true\b/i)){return"ajax"}else if(e.match(/\bcustom=true\b/i)){return"custom"}else if(e.substr(0,1)=="#"){return"inline"}else{return"image"}}function x(){if(doresize&&typeof $pp_pic_holder!="undefined"){scroll_pos=t();contentheight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedtop=d/2+scroll_pos["scrolltop"]-contentheight/2;if(projectedtop<0)projectedtop=0;if(contentheight>d)return;$pp_pic_holder.css({top:projectedtop,left:v/2+scroll_pos["scrollleft"]-contentwidth/2})}}function t(){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=e(window).height(),v=e(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height(e(document).height()).width(v)}function c(){if(isset&&settings.overlay_gallery&&s(pp_images[set_position])=="image"){itemwidth=52+5;navwidth=settings.theme=="facebook"||settings.theme=="pp_default"?50:30;itemsperpage=math.floor((a["containerwidth"]-100-navwidth)/itemwidth);itemsperpage=itemsperpage"}toinject=settings.gallery_markup.replace(/{gallery}/g,toinject);$pp_pic_holder.find("#pp_full_res").after(toinject);$pp_gallery=e(".pp_pic_holder .pp_gallery"),$pp_gallery_li=$pp_gallery.find("li");$pp_gallery.find(".pp_arrow_next").click(function(){e.prettyphoto.changegallerypage("next");e.prettyphoto.stopslideshow();return false});$pp_gallery.find(".pp_arrow_previous").click(function(){e.prettyphoto.changegallerypage("previous");e.prettyphoto.stopslideshow();return false});$pp_pic_holder.find(".pp_content").hover(function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadein()},function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeout()});itemwidth=52+5;$pp_gallery_li.each(function(t){e(this).find("a").click(function(){e.prettyphoto.changepage(t);e.prettyphoto.stopslideshow();return false})})}if(settings.slideshow){$pp_pic_holder.find(".pp_nav").prepend('play');$pp_pic_holder.find(".pp_nav .pp_play").click(function(){e.prettyphoto.startslideshow();return false})}$pp_pic_holder.attr("class","pp_pic_holder "+settings.theme);$pp_overlay.css({opacity:0,height:e(document).height(),width:e(window).width()}).bind("click",function(){if(!settings.modal)e.prettyphoto.close()});e("a.pp_close").bind("click",function(){e.prettyphoto.close();return false});if(settings.allow_expand){e("a.pp_expand").bind("click",function(t){if(e(this).hasclass("pp_expand")){e(this).removeclass("pp_expand").addclass("pp_contract");doresize=false}else{e(this).removeclass("pp_contract").addclass("pp_expand");doresize=true}y(function(){e.prettyphoto.open()});return false})}$pp_pic_holder.find(".pp_previous, .pp_nav .pp_arrow_previous").bind("click",function(){e.prettyphoto.changepage("previous");e.prettyphoto.stopslideshow();return false});$pp_pic_holder.find(".pp_next, .pp_nav .pp_arrow_next").bind("click",function(){e.prettyphoto.changepage("next");e.prettyphoto.stopslideshow();return false});x()}s=jquery.extend({hook:"rel",animation_speed:"fast",ajaxcallback:function(){},slideshow:5e3,autoplay_slideshow:false,opacity:.8,show_title:true,allow_resize:true,allow_expand:true,default_width:500,default_height:344,counter_separator_label:"/",theme:"pp_default",horizontal_padding:20,hideflash:false,wmode:"opaque",autoplay:true,modal:false,deeplinking:true,overlay_gallery:true,overlay_gallery_max:30,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},ie6_fallback:true,markup:'
â 
',gallery_markup:'',image_markup:'',flash_markup:'',quicktime_markup:'',iframe_markup:'',inline_markup:'
{content}
',custom_markup:"",social_tools:'
'},s);var o=this,u=false,a,f,l,c,h,p,d=e(window).height(),v=e(window).width(),m;doresize=true,scroll_pos=t();e(window).unbind("resize.prettyphoto").bind("resize.prettyphoto",function(){x();n()});if(s.keyboard_shortcuts){e(document).unbind("keydown.prettyphoto").bind("keydown.prettyphoto",function(t){if(typeof $pp_pic_holder!="undefined"){if($pp_pic_holder.is(":visible")){switch(t.keycode){case 37:e.prettyphoto.changepage("previous");t.preventdefault();break;case 39:e.prettyphoto.changepage("next");t.preventdefault();break;case 27:if(!settings.modal)e.prettyphoto.close();t.preventdefault();break}}}})}e.prettyphoto.initialize=function(){settings=s;if(settings.theme=="pp_default")settings.horizontal_padding=16;therel=e(this).attr(settings.hook);galleryregexp=/\[(?:.*)\]/;isset=galleryregexp.exec(therel)?true:false;pp_images=isset?jquery.map(o,function(t,n){if(e(t).attr(settings.hook).indexof(therel)!=-1)return e(t).attr("href")}):e.makearray(e(this).attr("href"));pp_titles=isset?jquery.map(o,function(t,n){if(e(t).attr(settings.hook).indexof(therel)!=-1)return e(t).find("img").attr("alt")?e(t).find("img").attr("alt"):""}):e.makearray(e(this).find("img").attr("alt"));pp_descriptions=isset?jquery.map(o,function(t,n){if(e(t).attr(settings.hook).indexof(therel)!=-1)return e(t).attr("title")?e(t).attr("title"):""}):e.makearray(e(this).attr("title"));if(pp_images.length>settings.overlay_gallery_max)settings.overlay_gallery=false;set_position=jquery.inarray(e(this).attr("href"),pp_images);rel_index=isset?set_position:e("a["+settings.hook+"^='"+therel+"']").index(e(this));k(this);if(settings.allow_resize)e(window).bind("scroll.prettyphoto",function(){x()});e.prettyphoto.open();return false};e.prettyphoto.open=function(t){if(typeof settings=="undefined"){settings=s;pp_images=e.makearray(arguments[0]);pp_titles=arguments[1]?e.makearray(arguments[1]):e.makearray("");pp_descriptions=arguments[2]?e.makearray(arguments[2]):e.makearray("");isset=pp_images.length>1?true:false;set_position=arguments[3]?arguments[3]:0;k(t.target)}if(settings.hideflash)e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","hidden");b(e(pp_images).size());e(".pp_loadericon").show();if(settings.deeplinking)n();if(settings.social_tools){facebook_like_link=settings.social_tools.replace("{location_href}",encodeuricomponent(location.href));$pp_pic_holder.find(".pp_social").html(facebook_like_link)}if($ppt.is(":hidden"))$ppt.css("opacity",0).show();$pp_overlay.show().fadeto(settings.animation_speed,settings.opacity);$pp_pic_holder.find(".currenttextholder").text(set_position+1+settings.counter_separator_label+e(pp_images).size());if(typeof pp_descriptions[set_position]!="undefined"&&pp_descriptions[set_position]!=""){$pp_pic_holder.find(".pp_description").show().html(unescape(pp_descriptions[set_position]))}else{$pp_pic_holder.find(".pp_description").hide()}movie_width=parsefloat(i("width",pp_images[set_position]))?i("width",pp_images[set_position]):settings.default_width.tostring();movie_height=parsefloat(i("height",pp_images[set_position]))?i("height",pp_images[set_position]):settings.default_height.tostring();u=false;if(movie_height.indexof("%")!=-1){movie_height=parsefloat(e(window).height()*parsefloat(movie_height)/100-150);u=true}if(movie_width.indexof("%")!=-1){movie_width=parsefloat(e(window).width()*parsefloat(movie_width)/100-150);u=true}$pp_pic_holder.fadein(function(){settings.show_title&&pp_titles[set_position]!=""&&typeof pp_titles[set_position]!="undefined"?$ppt.html(unescape(pp_titles[set_position])):$ppt.html("â ");imgpreloader="";skipinjection=false;switch(s(pp_images[set_position])){case"image":imgpreloader=new image;nextimage=new image;if(isset&&set_position0)movie_id=movie_id.substr(0,movie_id.indexof("?"));if(movie_id.indexof("&")>0)movie_id=movie_id.substr(0,movie_id.indexof("&"))}movie="http://www.youtube.com/embed/"+movie_id;i("rel",pp_images[set_position])?movie+="?rel="+i("rel",pp_images[set_position]):movie+="?rel=1";if(settings.autoplay)movie+="&autoplay=1";toinject=settings.iframe_markup.replace(/{width}/g,a["width"]).replace(/{height}/g,a["height"]).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case"vimeo":a=w(movie_width,movie_height);movie_id=pp_images[set_position];var t=/http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;var n=movie_id.match(t);movie="http://player.vimeo.com/video/"+n[3]+"?title=0&byline=0&portrait=0";if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=a["width"]+"/embed/?moog_width="+a["width"];toinject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,a["height"]).replace(/{path}/g,movie);break;case"quicktime":a=w(movie_width,movie_height);a["height"]+=15;a["contentheight"]+=15;a["containerheight"]+=15;toinject=settings.quicktime_markup.replace(/{width}/g,a["width"]).replace(/{height}/g,a["height"]).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case"flash":a=w(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexof("flashvars")+10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexof("?"));toinject=settings.flash_markup.replace(/{width}/g,a["width"]).replace(/{height}/g,a["height"]).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case"iframe":a=w(movie_width,movie_height);frame_url=pp_images[set_position];frame_url=frame_url.substr(0,frame_url.indexof("iframe")-1);toinject=settings.iframe_markup.replace(/{width}/g,a["width"]).replace(/{height}/g,a["height"]).replace(/{path}/g,frame_url);break;case"ajax":doresize=false;a=w(movie_width,movie_height);doresize=true;skipinjection=true;e.get(pp_images[set_position],function(e){toinject=settings.inline_markup.replace(/{content}/g,e);$pp_pic_holder.find("#pp_full_res")[0].innerhtml=toinject;g()});break;case"custom":a=w(movie_width,movie_height);toinject=settings.custom_markup;break;case"inline":myclone=e(pp_images[set_position]).clone().append('
').css({width:settings.default_width}).wrapinner('
').appendto(e("body")).show();doresize=false;a=w(e(myclone).width(),e(myclone).height());doresize=true;e(myclone).remove();toinject=settings.inline_markup.replace(/{content}/g,e(pp_images[set_position]).html());break}if(!imgpreloader&&!skipinjection){$pp_pic_holder.find("#pp_full_res")[0].innerhtml=toinject;g()}});return false};e.prettyphoto.changepage=function(t){currentgallerypage=0;if(t=="previous"){set_position--;if(set_position<0)set_position=e(pp_images).size()-1}else if(t=="next"){set_position++;if(set_position>e(pp_images).size()-1)set_position=0}else{set_position=t}rel_index=set_position;if(!doresize)doresize=true;if(settings.allow_expand){e(".pp_contract").removeclass("pp_contract").addclass("pp_expand")}y(function(){e.prettyphoto.open()})};e.prettyphoto.changegallerypage=function(e){if(e=="next"){currentgallerypage++;if(currentgallerypage>totalpage)currentgallerypage=0}else if(e=="previous"){currentgallerypage--;if(currentgallerypage<0)currentgallerypage=totalpage}else{currentgallerypage=e}slide_speed=e=="next"||e=="previous"?settings.animation_speed:0;slide_to=currentgallerypage*itemsperpage*itemwidth;$pp_gallery.find("ul").animate({left:-slide_to},slide_speed)};e.prettyphoto.startslideshow=function(){if(typeof m=="undefined"){$pp_pic_holder.find(".pp_play").unbind("click").removeclass("pp_play").addclass("pp_pause").click(function(){e.prettyphoto.stopslideshow();return false});m=setinterval(e.prettyphoto.startslideshow,settings.slideshow)}else{e.prettyphoto.changepage("next")}};e.prettyphoto.stopslideshow=function(){$pp_pic_holder.find(".pp_pause").unbind("click").removeclass("pp_pause").addclass("pp_play").click(function(){e.prettyphoto.startslideshow();return false});clearinterval(m);m=undefined};e.prettyphoto.close=function(){if($pp_overlay.is(":animated"))return;e.prettyphoto.stopslideshow();$pp_pic_holder.stop().find("object,embed").css("visibility","hidden");e("div.pp_pic_holder,div.ppt,.pp_fade").fadeout(settings.animation_speed,function(){e(this).remove()});$pp_overlay.fadeout(settings.animation_speed,function(){if(settings.hideflash)e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","visible");e(this).remove();e(window).unbind("scroll.prettyphoto");r();settings.callback();doresize=true;f=false;delete settings})};if(!pp_alreadyinitialized&&t()){pp_alreadyinitialized=true;hashindex=t();hashrel=hashindex;hashindex=hashindex.substring(hashindex.indexof("/")+1,hashindex.length-1);hashrel=hashrel.substring(0,hashrel.indexof("/"));settimeout(function(){e("a["+s.hook+"^='"+hashrel+"']:eq("+hashindex+")").trigger("click")},50)}return this.unbind("click.prettyphoto").bind("click.prettyphoto",e.prettyphoto.initialize)};})(jquery);var pp_alreadyinitialized=false