(function(a){function j(a,j){var a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),p=RegExp("[\\?&]"+a+"=([^&#]*)").exec(j);return null==p?"":p[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()});f.fadeOut(b.animationSpeed)}function p(b){d==b-1?(c.find("a.pp_next").css("visibility","hidden"),c.find("a.pp_arrow_next").addClass("disabled").unbind("click")):
(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!1}));0==d?(c.find("a.pp_previous").css("visibility","hidden"),c.find("a.pp_arrow_previous").addClass("disabled").unbind("click")):(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!1}));1<b?a(".pp_nav").show():
a(".pp_nav").hide()}function k(a,c){hasBeenResized=!1;t(a,c);imageWidth=a;imageHeight=c;if((l>g||m>i)&&h&&b.allowresize&&!u){for(notFitting=hasBeenResized=!0;notFitting;)l>g?(imageWidth=g-200,imageHeight=c/a*imageWidth):m>i?(imageHeight=i-200,imageWidth=a/c*imageHeight):notFitting=!1,m=imageHeight,l=imageWidth;t(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(m),containerWidth:Math.floor(l)+40,contentHeight:Math.floor(r),contentWidth:Math.floor(v),
resized:hasBeenResized}}function t(b,d){b=parseFloat(b);d=parseFloat(d);$pp_details=c.find(".pp_details");$pp_details.width(b);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=34>=detailsHeight?36:detailsHeight;a.browser.msie&&7==a.browser.version&&(detailsHeight+=8);$pp_details.remove();r=d+detailsHeight;v=b;m=
r+f.height()+c.find(".pp_top").height()+c.find(".pp_bottom").height();l=b}function w(a){return a.match(/youtube\.com\/watch/i)?"youtube":a.match(/vimeo\.com/i)?"vimeo":-1!=a.indexOf(".mov")?"quicktime":-1!=a.indexOf(".flv")?"flash":-1!=a.indexOf("iframe")?"iframe":"#"==a.substr(0,1)?"inline":"image"}function q(){h&&(titleHeight=f.height(),contentHeight=c.height(),contentwidth=c.width(),projectedTop=i/2+n.scrollTop-(contentHeight+titleHeight)/2,c.css({top:projectedTop,left:g/2+n.scrollLeft-contentwidth/
2}),f.css({top:projectedTop-titleHeight,left:g/2+n.scrollLeft-contentwidth/2+20}))}function x(){if(self.pageYOffset)return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};if(document.documentElement&&document.documentElement.scrollTop)return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};if(document.body)return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}}function y(){i=a(window).height();g=a(window).width();o.css({height:a(document).height()})}
function z(){a("body").append(b.markup);c=a(".pp_pic_holder");f=a(".ppt");o=a("div.pp_overlay");c.attr("class","pp_pic_holder "+b.theme);o.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!1});a("a.pp_expand").bind("click",function(){$this=a(this);$this.hasClass("pp_expand")?($this.removeClass("pp_expand").addClass("pp_contract"),h=!1):($this.removeClass("pp_contract").addClass("pp_expand"),
h=!0);s(function(){a.prettyPhoto.open(images,titles,descriptions)});c.find(".pp_fade").fadeOut(b.animationSpeed);return!1});c.find(".pp_previous, .pp_arrow_previous").bind("click",function(){a.prettyPhoto.changePage("previous");return!1});c.find(".pp_next, .pp_arrow_next").bind("click",function(){a.prettyPhoto.changePage("next");return!1})}b=jQuery.extend({animationSpeed:"normal",opacity:0.8,showTitle:!0,allowresize:!0,default_width:500,default_height:344,counter_separator_label:"/",theme:"light_rounded",
hideflash:!1,wmode:"opaque",autoplay:!0,modal:!1,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&&6==parseInt(a.browser.version))b.theme="light_square";0==a(".pp_overlay").size()&&z();var h=!0,u=!1,e,c,f,o,r,v,m,l,i=a(window).height(),g=a(window).width(),d=0,n=x();a(window).scroll(function(){n=x();q();y()});a(window).resize(function(){q();y()});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()}});a(this).each(function(){a(this).bind("click",function(){_self=this;theRel=a(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var b=[],c=[],e=[];theGallery?a("a[rel*="+theGallery+"]").each(function(f){a(this)[0]===a(_self)[0]&&(d=f);b.push(a(this).attr("href"));c.push(a(this).find("img").attr("alt"));e.push(a(this).attr("title"))}):(b=a(this).attr("href"),c=a(this).find("img").attr("alt")?a(this).find("img").attr("alt"):"",
e=a(this).attr("title")?a(this).attr("title"):"");a.prettyPhoto.open(b,c,e);return!1})});a.prettyPhoto.open=function(g,h,i){a.browser.msie&&6==a.browser.version&&a("select").css("visibility","hidden");b.hideflash&&a("object,embed").css("visibility","hidden");images=a.makeArray(g);titles=a.makeArray(h);descriptions=a.makeArray(i);image_set=0<a(images).size()?!0:!1;p(a(images).size());a(".pp_loaderIcon").show();o.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("");titles[d]&&b.showTitle?(hasTitle=!0,f.html(unescape(titles[d]))):hasTitle=!1;movie_width=parseFloat(j("width",images[d]))?j("width",images[d]):b.default_width.toString();movie_height=parseFloat(j("height",images[d]))?j("height",images[d]):b.default_height.toString();if(-1!=movie_width.indexOf("%")||-1!=movie_height.indexOf("%"))movie_height=parseFloat(a(window).height()*
parseFloat(movie_height)/100-100),movie_width=parseFloat(a(window).width()*parseFloat(movie_width)/100-100),u=!0;c.fadeIn(function(){imgPreloader="";switch(w(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(){e=k(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":e=k(movie_width,movie_height);movie="http://www.youtube.com/v/"+j("v",images[d]);b.autoplay&&(movie+="&autoplay=1");toInject=b.flash_markup.replace(/{width}/g,e.width).replace(/{height}/g,e.height).replace(/{wmode}/g,b.wmode).replace(/{path}/g,movie);break;case "vimeo":e=k(movie_width,
movie_height);movie_id=images[d];movie="http://vimeo.com/moogaloop.swf?clip_id="+movie_id.replace("http://vimeo.com/","");b.autoplay&&(movie+="&autoplay=1");toInject=b.flash_markup.replace(/{width}/g,e.width).replace(/{height}/g,e.height).replace(/{wmode}/g,b.wmode).replace(/{path}/g,movie);break;case "quicktime":e=k(movie_width,movie_height);e.height+=15;e.contentHeight+=15;e.containerHeight+=15;toInject=b.quicktime_markup.replace(/{width}/g,e.width).replace(/{height}/g,e.height).replace(/{wmode}/g,
b.wmode).replace(/{path}/g,images[d]).replace(/{autoplay}/g,b.autoplay);break;case "flash":e=k(movie_width,movie_height);flash_vars=images[d];flash_vars=flash_vars.substring(images[d].indexOf("flashvars")+0,images[d].length);filename=images[d];filename=filename.substring(0,filename.indexOf("?"));toInject='<embed id="port_vid" height="'+movie_height+'" width="'+movie_width+'" flashvars="'+flash_vars+'" type="application/x-shockwave-flash" src="'+rootFolder+'/includes/mediaplayer/player.swf" name="port_vid" allowfullscreen="true" allowscriptaccess="always" wmode="opaque"></embed>';
break;case "iframe":e=k(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,e.width).replace(/{height}/g,e.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")),e=k(a(myClone).width(),a(myClone).height()),a(myClone).remove(),toInject=b.inline_markup.replace(/{content}/g,
a(images[d]).html())}if(!imgPreloader)c.find("#pp_full_res")[0].innerHTML=toInject,_showContent()})};a.prettyPhoto.changePage=function(c){if("previous"==c){if(d--,0>d){d=0;return}}else{if(a(".pp_arrow_next").is(".disabled"))return;d++}h||(h=!0);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);
o.fadeOut(b.animationSpeed,function(){a("#pp_full_res").html("");c.attr("style","").find("div:not(.pp_hoverContainer)").attr("style","");q();a.browser.msie&&6==a.browser.version&&a("select").css("visibility","visible");b.hideflash&&a("object,embed").css("visibility","visible");d=0;b.callback()});h=!0};_showContent=function(){a(".pp_loaderIcon").hide();projectedTop=n.scrollTop+(i/2-e.containerHeight/2);0>projectedTop&&(projectedTop=0+f.height());c.find(".pp_content").animate({height:e.contentHeight},
b.animationSpeed);c.animate({top:projectedTop,left:g/2-e.containerWidth/2,width:e.containerWidth},b.animationSpeed,function(){c.find(".pp_hoverContainer,#fullResImage").height(e.height).width(e.width);c.find(".pp_fade").fadeIn(b.animationSpeed);image_set&&"image"==w(images[d])?c.find(".pp_hoverContainer").show():c.find(".pp_hoverContainer").hide();b.showTitle&&hasTitle&&(f.css({top:c.offset().top-25,left:c.offset().left+20,display:"none"}),f.fadeIn(b.animationSpeed));e.resized&&a("a.pp_expand,a.pp_contract").fadeIn(b.animationSpeed);
b.changepicturecallback()})};q()}})(jQuery);
