/* ------------------------------------------------------------------------ class: prettyphoto use: lightbox clone for jquery author: stephane caron (http://www.no-margin-for-errors.com) version: 3.1.4 ------------------------------------------------------------------------- */ (function($){$.prettyphoto={version:'3.1.4'};$.fn.prettyphoto=function(pp_settings){pp_settings=jquery.extend({hook:'rel',animation_speed:'fast',ajaxcallback:function(){},slideshow:5000,autoplay_slideshow:false,opacity:0.80,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:'
\
 
\ close \
\
\
\
\
\
\
\
\
\
\
\ expand \
\ next \ previous \
\
\
\
\ previous \

0/0

\ next \
\

\
{pp_social}
\
\
\
\
\
\
\
\
\
\
\
\
\
',gallery_markup:'',image_markup:'',flash_markup:'',quicktime_markup:'',iframe_markup:'',inline_markup:'
{content}
',custom_markup:'',social_tools:'
tweet
'},pp_settings);var matchedobjects=this,percentbased=false,pp_dimensions,pp_open,pp_contentheight,pp_contentwidth,pp_containerheight,pp_containerwidth,windowheight=$(window).height(),windowwidth=$(window).width(),pp_slideshow;doresize=true,scroll_pos=_get_scroll();$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){_center_overlay();_resize_overlay();});if(pp_settings.keyboard_shortcuts){$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){if(typeof $pp_pic_holder!='undefined'){if($pp_pic_holder.is(':visible')){switch(e.keycode){case 37:$.prettyphoto.changepage('previous');e.preventdefault();break;case 39:$.prettyphoto.changepage('next');e.preventdefault();break;case 27:if(!settings.modal) $.prettyphoto.close();e.preventdefault();break;};};};});};$.prettyphoto.initialize=function(){settings=pp_settings;if(settings.theme=='pp_default')settings.horizontal_padding=16;if(settings.ie6_fallback&&$.browser.msie&&parseint($.browser.version)==6)settings.theme="light_square";therel=$(this).attr(settings.hook);galleryregexp=/\[(?:.*)\]/;isset=(galleryregexp.exec(therel))?true:false;pp_images=(isset)?jquery.map(matchedobjects,function(n,i){if($(n).attr(settings.hook).indexof(therel)!=-1)return $(n).attr('href');}):$.makearray($(this).attr('href'));pp_titles=(isset)?jquery.map(matchedobjects,function(n,i){if($(n).attr(settings.hook).indexof(therel)!=-1)return($(n).find('img').attr('alt'))?$(n).find('img').attr('alt'):"";}):$.makearray($(this).find('img').attr('alt'));pp_descriptions=(isset)?jquery.map(matchedobjects,function(n,i){if($(n).attr(settings.hook).indexof(therel)!=-1)return($(n).attr('title'))?$(n).attr('title'):"";}):$.makearray($(this).attr('title'));if(pp_images.length>settings.overlay_gallery_max)settings.overlay_gallery=false;set_position=jquery.inarray($(this).attr('href'),pp_images);rel_index=(isset)?set_position:$("a["+settings.hook+"^='"+therel+"']").index($(this));_build_overlay(this);if(settings.allow_resize) $(window).bind('scroll.prettyphoto',function(){_center_overlay();});$.prettyphoto.open();return false;} $.prettyphoto.open=function(event){if(typeof settings=="undefined"){settings=pp_settings;if($.browser.msie&&$.browser.version==6)settings.theme="light_square";pp_images=$.makearray(arguments[0]);pp_titles=(arguments[1])?$.makearray(arguments[1]):$.makearray("");pp_descriptions=(arguments[2])?$.makearray(arguments[2]):$.makearray("");isset=(pp_images.length>1)?true:false;set_position=(arguments[3])?arguments[3]:0;_build_overlay(event.target);} if($.browser.msie&&$.browser.version==6)$('select').css('visibility','hidden');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden');_checkposition($(pp_images).size());$('.pp_loadericon').show();if(settings.deeplinking) sethashtag();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+$(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(getparam('width',pp_images[set_position])))?getparam('width',pp_images[set_position]):settings.default_width.tostring();movie_height=(parsefloat(getparam('height',pp_images[set_position])))?getparam('height',pp_images[set_position]):settings.default_height.tostring();percentbased=false;if(movie_height.indexof('%')!=-1){movie_height=parsefloat(($(window).height()*parsefloat(movie_height)/100)-150);percentbased=true;} if(movie_width.indexof('%')!=-1){movie_width=parsefloat(($(window).width()*parsefloat(movie_width)/100)-150);percentbased=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(_getfiletype(pp_images[set_position])){case'image':imgpreloader=new image();nextimage=new image();if(isset&&set_position<$(pp_images).size()-1)nextimage.src=pp_images[set_position+1];previmage=new image();if(isset&&pp_images[set_position-1])previmage.src=pp_images[set_position-1];$pp_pic_holder.find('#pp_full_res')[0].innerhtml=settings.image_markup.replace(/{path}/g,pp_images[set_position]);imgpreloader.onload=function(){pp_dimensions=_fittoviewport(imgpreloader.width,imgpreloader.height);_showcontent();};imgpreloader.onerror=function(){alert('image cannot be loaded. make sure the path is correct and image exist.');$.prettyphoto.close();};imgpreloader.src=pp_images[set_position];break;case'youtube':pp_dimensions=_fittoviewport(movie_width,movie_height);movie_id=getparam('v',pp_images[set_position]);if(movie_id==""){movie_id=pp_images[set_position].split('youtu.be/');movie_id=movie_id[1];if(movie_id.indexof('?')>0) 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;(getparam('rel',pp_images[set_position]))?movie+="?rel="+getparam('rel',pp_images[set_position]):movie+="?rel=1";if(settings.autoplay)movie+="&autoplay=1";toinject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case'vimeo':pp_dimensions=_fittoviewport(movie_width,movie_height);movie_id=pp_images[set_position];var regexp=/http:\/\/(www\.)?vimeo.com\/(\d+)/;var match=movie_id.match(regexp);movie='http://player.vimeo.com/video/'+match[2]+'?title=0&byline=0&portrait=0';if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=pp_dimensions['width']+'/embed/?moog_width='+pp_dimensions['width'];toinject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);break;case'quicktime':pp_dimensions=_fittoviewport(movie_width,movie_height);pp_dimensions['height']+=15;pp_dimensions['contentheight']+=15;pp_dimensions['containerheight']+=15;toinject=settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case'flash':pp_dimensions=_fittoviewport(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,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);break;case'iframe':pp_dimensions=_fittoviewport(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,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);break;case'ajax':doresize=false;pp_dimensions=_fittoviewport(movie_width,movie_height);doresize=true;skipinjection=true;$.get(pp_images[set_position],function(responsehtml){toinject=settings.inline_markup.replace(/{content}/g,responsehtml);$pp_pic_holder.find('#pp_full_res')[0].innerhtml=toinject;_showcontent();});break;case'custom':pp_dimensions=_fittoviewport(movie_width,movie_height);toinject=settings.custom_markup;break;case'inline':myclone=$(pp_images[set_position]).clone().append('
').css({'width':settings.default_width}).wrapinner('
').appendto($('body')).show();doresize=false;pp_dimensions=_fittoviewport($(myclone).width(),$(myclone).height());doresize=true;$(myclone).remove();toinject=settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());break;};if(!imgpreloader&&!skipinjection){$pp_pic_holder.find('#pp_full_res')[0].innerhtml=toinject;_showcontent();};});return false;};$.prettyphoto.changepage=function(direction){currentgallerypage=0;if(direction=='previous'){set_position--;if(set_position<0)set_position=$(pp_images).size()-1;}else if(direction=='next'){set_position++;if(set_position>$(pp_images).size()-1)set_position=0;}else{set_position=direction;};rel_index=set_position;if(!doresize)doresize=true;if(settings.allow_expand){$('.pp_contract').removeclass('pp_contract').addclass('pp_expand');} _hidecontent(function(){$.prettyphoto.open();});};$.prettyphoto.changegallerypage=function(direction){if(direction=='next'){currentgallerypage++;if(currentgallerypage>totalpage)currentgallerypage=0;}else if(direction=='previous'){currentgallerypage--;if(currentgallerypage<0)currentgallerypage=totalpage;}else{currentgallerypage=direction;};slide_speed=(direction=='next'||direction=='previous')?settings.animation_speed:0;slide_to=currentgallerypage*(itemsperpage*itemwidth);$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);};$.prettyphoto.startslideshow=function(){if(typeof pp_slideshow=='undefined'){$pp_pic_holder.find('.pp_play').unbind('click').removeclass('pp_play').addclass('pp_pause').click(function(){$.prettyphoto.stopslideshow();return false;});pp_slideshow=setinterval($.prettyphoto.startslideshow,settings.slideshow);}else{$.prettyphoto.changepage('next');};} $.prettyphoto.stopslideshow=function(){$pp_pic_holder.find('.pp_pause').unbind('click').removeclass('pp_pause').addclass('pp_play').click(function(){$.prettyphoto.startslideshow();return false;});clearinterval(pp_slideshow);pp_slideshow=undefined;} $.prettyphoto.close=function(){if($pp_overlay.is(":animated"))return;$.prettyphoto.stopslideshow();$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');$('div.pp_pic_holder,div.ppt,.pp_fade').fadeout(settings.animation_speed,function(){$(this).remove();});$pp_overlay.fadeout(settings.animation_speed,function(){if($.browser.msie&&$.browser.version==6)$('select').css('visibility','visible');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible');$(this).remove();$(window).unbind('scroll.prettyphoto');clearhashtag();settings.callback();doresize=true;pp_open=false;delete settings;});};function _showcontent(){$('.pp_loadericon').hide();projectedtop=scroll_pos['scrolltop']+((windowheight/2)-(pp_dimensions['containerheight']/2));if(projectedtop<0)projectedtop=0;$ppt.fadeto(settings.animation_speed,1);$pp_pic_holder.find('.pp_content').animate({height:pp_dimensions['contentheight'],width:pp_dimensions['contentwidth']},settings.animation_speed);$pp_pic_holder.animate({'top':projectedtop,'left':((windowwidth/2)-(pp_dimensions['containerwidth']/2)<0)?0:(windowwidth/2)-(pp_dimensions['containerwidth']/2),width:pp_dimensions['containerwidth']},settings.animation_speed,function(){$pp_pic_holder.find('.pp_hovercontainer,#fullresimage').height(pp_dimensions['height']).width(pp_dimensions['width']);$pp_pic_holder.find('.pp_fade').fadein(settings.animation_speed);if(isset&&_getfiletype(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(pp_dimensions['resized']){$('a.pp_expand,a.pp_contract').show();}else{$('a.pp_expand').hide();}} if(settings.autoplay_slideshow&&!pp_slideshow&&!pp_open)$.prettyphoto.startslideshow();settings.changepicturecallback();pp_open=true;});_insert_gallery();pp_settings.ajaxcallback();};function _hidecontent(callback){$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(){$('.pp_loadericon').show();callback();});};function _checkposition(setcount){(setcount>1)?$('.pp_nav').show():$('.pp_nav').hide();};function _fittoviewport(width,height){resized=false;_getdimensions(width,height);imagewidth=width,imageheight=height;if(((pp_containerwidth>windowwidth)||(pp_containerheight>windowheight))&&doresize&&settings.allow_resize&&!percentbased){resized=true,fitting=false;while(!fitting){if((pp_containerwidth>windowwidth)){imagewidth=(windowwidth-200);imageheight=(height/width)*imagewidth;}else if((pp_containerheight>windowheight)){imageheight=(windowheight-200);imagewidth=(width/height)*imageheight;}else{fitting=true;};pp_containerheight=imageheight,pp_containerwidth=imagewidth;};_getdimensions(imagewidth,imageheight);if((pp_containerwidth>windowwidth)||(pp_containerheight>windowheight)){_fittoviewport(pp_containerwidth,pp_containerheight)};};return{width:math.floor(imagewidth),height:math.floor(imageheight),containerheight:math.floor(pp_containerheight),containerwidth:math.floor(pp_containerwidth)+(settings.horizontal_padding*2),contentheight:math.floor(pp_contentheight),contentwidth:math.floor(pp_contentwidth),resized:resized};};function _getdimensions(width,height){width=parsefloat(width);height=parsefloat(height);$pp_details=$pp_pic_holder.find('.pp_details');$pp_details.width(width);detailsheight=parsefloat($pp_details.css('margintop'))+parsefloat($pp_details.css('marginbottom'));$pp_details=$pp_details.clone().addclass(settings.theme).width(width).appendto($('body')).css({'position':'absolute','top':-10000});detailsheight+=$pp_details.height();detailsheight=(detailsheight<=34)?36:detailsheight;if($.browser.msie&&$.browser.version==7)detailsheight+=8;$pp_details.remove();$pp_title=$pp_pic_holder.find('.ppt');$pp_title.width(width);titleheight=parsefloat($pp_title.css('margintop'))+parsefloat($pp_title.css('marginbottom'));$pp_title=$pp_title.clone().appendto($('body')).css({'position':'absolute','top':-10000});titleheight+=$pp_title.height();$pp_title.remove();pp_contentheight=height+detailsheight;pp_contentwidth=width;pp_containerheight=pp_contentheight+titleheight+$pp_pic_holder.find('.pp_top').height()+$pp_pic_holder.find('.pp_bottom').height();pp_containerwidth=width;} function _getfiletype(itemsrc){if(itemsrc.match(/youtube\.com\/watch/i)||itemsrc.match(/youtu\.be/i)){return'youtube';}else if(itemsrc.match(/vimeo\.com/i)){return'vimeo';}else if(itemsrc.match(/\b.mov\b/i)){return'quicktime';}else if(itemsrc.match(/\b.swf\b/i)){return'flash';}else if(itemsrc.match(/\biframe=true\b/i)){return'iframe';}else if(itemsrc.match(/\bajax=true\b/i)){return'ajax';}else if(itemsrc.match(/\bcustom=true\b/i)){return'custom';}else if(itemsrc.substr(0,1)=='#'){return'inline';}else{return'image';};};function _center_overlay(){if(doresize&&typeof $pp_pic_holder!='undefined'){scroll_pos=_get_scroll();contentheight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedtop=(windowheight/2)+scroll_pos['scrolltop']-(contentheight/2);if(projectedtop<0)projectedtop=0;if(contentheight>windowheight) return;$pp_pic_holder.css({'top':projectedtop,'left':(windowwidth/2)+scroll_pos['scrollleft']-(contentwidth/2)});};};function _get_scroll(){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 _resize_overlay(){windowheight=$(window).height(),windowwidth=$(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height($(document).height()).width(windowwidth);};function _insert_gallery(){if(isset&&settings.overlay_gallery&&_getfiletype(pp_images[set_position])=="image"&&(settings.ie6_fallback&&!($.browser.msie&&parseint($.browser.version)==6))){itemwidth=52+5;navwidth=(settings.theme=="facebook"||settings.theme=="pp_default")?50:30;itemsperpage=math.floor((pp_dimensions['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=$('.pp_pic_holder .pp_gallery'),$pp_gallery_li=$pp_gallery.find('li');$pp_gallery.find('.pp_arrow_next').click(function(){$.prettyphoto.changegallerypage('next');$.prettyphoto.stopslideshow();return false;});$pp_gallery.find('.pp_arrow_previous').click(function(){$.prettyphoto.changegallerypage('previous');$.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(i){$(this).find('a').click(function(){$.prettyphoto.changepage(i);$.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(){$.prettyphoto.startslideshow();return false;});} $pp_pic_holder.attr('class','pp_pic_holder '+settings.theme);$pp_overlay.css({'opacity':0,'height':$(document).height(),'width':$(window).width()}).bind('click',function(){if(!settings.modal)$.prettyphoto.close();});$('a.pp_close').bind('click',function(){$.prettyphoto.close();return false;});if(settings.allow_expand){$('a.pp_expand').bind('click',function(e){if($(this).hasclass('pp_expand')){$(this).removeclass('pp_expand').addclass('pp_contract');doresize=false;}else{$(this).removeclass('pp_contract').addclass('pp_expand');doresize=true;};_hidecontent(function(){$.prettyphoto.open();});return false;});} $pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){$.prettyphoto.changepage('previous');$.prettyphoto.stopslideshow();return false;});$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){$.prettyphoto.changepage('next');$.prettyphoto.stopslideshow();return false;});_center_overlay();};if(!pp_alreadyinitialized&&gethashtag()){pp_alreadyinitialized=true;hashindex=gethashtag();hashrel=hashindex;hashindex=hashindex.substring(hashindex.indexof('/')+1,hashindex.length-1);hashrel=hashrel.substring(0,hashrel.indexof('/'));settimeout(function(){$("a["+pp_settings.hook+"^='"+hashrel+"']:eq("+hashindex+")").trigger('click');},50);} return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyphoto.initialize);};function gethashtag(){url=location.href;hashtag=(url.indexof('#prettyphoto')!==-1)?decodeuri(url.substring(url.indexof('#prettyphoto')+1,url.length)):false;return hashtag;};function sethashtag(){if(typeof therel=='undefined')return;location.hash=therel+'/'+rel_index+'/';};function clearhashtag(){if(location.href.indexof('#prettyphoto')!==-1)location.hash="prettyphoto";} function getparam(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexs="[\\?&]"+name+"=([^&#]*)";var regex=new regexp(regexs);var results=regex.exec(url);return(results==null)?"":results[1];}})(jquery);var pp_alreadyinitialized=false;