/* ------------------------------------------------------------------------
	Class: prettyPhoto
	Use: Lightbox clone for jQuery
	Author: Stephane Caron (http://www.no-margin-for-errors.com)
	Version: 2.5.6
------------------------------------------------------------------------- */

(function($){$.prettyPhoto={version:"2.5.6"};$.fn.prettyPhoto=function(_1){_1=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>"},_1);if($.browser.msie&&parseInt($.browser.version)==6){_1.theme="light_square";}if($(".pp_overlay").size()==0){_2();}var _3=true,_4=false,_5,_6,_7,_8,_9,_a,_b,_c,_d=$(window).height(),_e=$(window).width(),_f=0,_10=_11();$(window).scroll(function(){_10=_11();_12();_13();});$(window).resize(function(){_12();_13();});$(document).keydown(function(e){if(_6.is(":visible")){switch(e.keyCode){case 37:$.prettyPhoto.changePage("previous");break;case 39:$.prettyPhoto.changePage("next");break;case 27:if(!_1.modal){$.prettyPhoto.close();}break;}}});$(this).each(function(){$(this).bind("click",function(){_self=this;theRel=$(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var _14=new Array(),_15=new Array(),_16=new Array();if(theGallery){$("a[rel*="+theGallery+"]").each(function(i){if($(this)[0]===$(_self)[0]){_f=i;}_14.push($(this).attr("href"));_15.push($(this).find("img").attr("alt"));_16.push($(this).attr("title"));});}else{_14=$(this).attr("href");_15=($(this).find("img").attr("alt"))?$(this).find("img").attr("alt"):"";_16=($(this).attr("title"))?$(this).attr("title"):"";}$.prettyPhoto.open(_14,_15,_16);return false;});});$.prettyPhoto.open=function(_17,_18,_19){if($.browser.msie&&$.browser.version==6){$("select").css("visibility","hidden");}if(_1.hideflash){$("object,embed").css("visibility","hidden");}images=$.makeArray(_17);titles=$.makeArray(_18);descriptions=$.makeArray(_19);image_set=($(images).size()>0)?true:false;_1a($(images).size());$(".pp_loaderIcon").show();_8.show().fadeTo(_1.animationSpeed,_1.opacity);_6.find(".currentTextHolder").text((_f+1)+_1.counter_separator_label+$(images).size());if(descriptions[_f]){_6.find(".pp_description").show().html(unescape(descriptions[_f]));}else{_6.find(".pp_description").hide().text("");}if(titles[_f]&&_1.showTitle){hasTitle=true;_7.html(unescape(titles[_f]));}else{hasTitle=false;}movie_width=(parseFloat(_27("width",images[_f])))?_27("width",images[_f]):_1.default_width.toString();movie_height=(parseFloat(_27("height",images[_f])))?_27("height",images[_f]):_1.default_height.toString();if(movie_width.indexOf("%")!=-1||movie_height.indexOf("%")!=-1){movie_height=parseFloat(($(window).height()*parseFloat(movie_height)/100)-100);movie_width=parseFloat(($(window).width()*parseFloat(movie_width)/100)-100);_4=true;}_6.fadeIn(function(){imgPreloader="";switch(_1e(images[_f])){case "image":imgPreloader=new Image();nextImage=new Image();if(image_set&&_f>$(images).size()){nextImage.src=images[_f+1];}prevImage=new Image();if(image_set&&images[_f-1]){prevImage.src=images[_f-1];}_6.find("#pp_full_res")[0].innerHTML=_1.image_markup;_6.find("#fullResImage").attr("src",images[_f]);imgPreloader.onload=function(){_5=_1b(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=images[_f];break;case "youtube":_5=_1b(movie_width,movie_height);movie="http://www.youtube.com/v/"+_27("v",images[_f]);if(_1.autoplay){movie+="&autoplay=1";}toInject=_1.flash_markup.replace(/{width}/g,_5["width"]).replace(/{height}/g,_5["height"]).replace(/{wmode}/g,_1.wmode).replace(/{path}/g,movie);break;case "vimeo":_5=_1b(movie_width,movie_height);movie_id=images[_f];movie="http://vimeo.com/moogaloop.swf?clip_id="+movie_id.replace("http://vimeo.com/","");if(_1.autoplay){movie+="&autoplay=1";}toInject=_1.flash_markup.replace(/{width}/g,_5["width"]).replace(/{height}/g,_5["height"]).replace(/{wmode}/g,_1.wmode).replace(/{path}/g,movie);break;case "quicktime":_5=_1b(movie_width,movie_height);_5["height"]+=15;_5["contentHeight"]+=15;_5["containerHeight"]+=15;toInject=_1.quicktime_markup.replace(/{width}/g,_5["width"]).replace(/{height}/g,_5["height"]).replace(/{wmode}/g,_1.wmode).replace(/{path}/g,images[_f]).replace(/{autoplay}/g,_1.autoplay);break;case "flash":_5=_1b(movie_width,movie_height);flash_vars=images[_f];flash_vars=flash_vars.substring(images[_f].indexOf("flashvars")+10,images[_f].length);filename=images[_f];filename=filename.substring(0,filename.indexOf("?"));toInject=_1.flash_markup.replace(/{width}/g,_5["width"]).replace(/{height}/g,_5["height"]).replace(/{wmode}/g,_1.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case "iframe":_5=_1b(movie_width,movie_height);frame_url=images[_f];frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1);toInject=_1.iframe_markup.replace(/{width}/g,_5["width"]).replace(/{height}/g,_5["height"]).replace(/{path}/g,frame_url);break;case "inline":myClone=$(images[_f]).clone().css({"width":_1.default_width}).wrapInner("<div id=\"pp_full_res\"><div class=\"pp_inline clearfix\"></div></div>").appendTo($("body"));_5=_1b($(myClone).width(),$(myClone).height());$(myClone).remove();toInject=_1.inline_markup.replace(/{content}/g,$(images[_f]).html());break;}if(!imgPreloader){_6.find("#pp_full_res")[0].innerHTML=toInject;_showContent();}});};$.prettyPhoto.changePage=function(_1c){if(_1c=="previous"){_f--;if(_f<0){_f=0;return;}}else{if($(".pp_arrow_next").is(".disabled")){return;}_f++;}if(!_3){_3=true;}_1d(function(){$.prettyPhoto.open(images,titles,descriptions);});$("a.pp_expand,a.pp_contract").fadeOut(_1.animationSpeed);};$.prettyPhoto.close=function(){_6.find("object,embed").css("visibility","hidden");$("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(_1.animationSpeed);_8.fadeOut(_1.animationSpeed,function(){$("#pp_full_res").html("");_6.attr("style","").find("div:not(.pp_hoverContainer)").attr("style","");_12();if($.browser.msie&&$.browser.version==6){$("select").css("visibility","visible");}if(_1.hideflash){$("object,embed").css("visibility","visible");}_f=0;_1.callback();});_3=true;};_showContent=function(){$(".pp_loaderIcon").hide();projectedTop=_10["scrollTop"]+((_d/2)-(_5["containerHeight"]/2));if(projectedTop<0){projectedTop=0+_7.height();}_6.find(".pp_content").animate({"height":_5["contentHeight"]},_1.animationSpeed);_6.animate({"top":projectedTop,"left":(_e/2)-(_5["containerWidth"]/2),"width":_5["containerWidth"]},_1.animationSpeed,function(){_6.find(".pp_hoverContainer,#fullResImage").height(_5["height"]).width(_5["width"]);_6.find(".pp_fade").fadeIn(_1.animationSpeed);if(image_set&&_1e(images[_f])=="image"){_6.find(".pp_hoverContainer").show();}else{_6.find(".pp_hoverContainer").hide();}if(_1.showTitle&&hasTitle){_7.css({"top":_6.offset().top-25,"left":_6.offset().left+20,"display":"none"});_7.fadeIn(_1.animationSpeed);}if(_5["resized"]){$("a.pp_expand,a.pp_contract").fadeIn(_1.animationSpeed);}_1.changepicturecallback();});};function _1d(_1f){_6.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");_6.find(".pp_fade").fadeOut(_1.animationSpeed,function(){$(".pp_loaderIcon").show();if(_1f){_1f();}});_7.fadeOut(_1.animationSpeed);};function _1a(_20){if(_f==_20-1){_6.find("a.pp_next").css("visibility","hidden");_6.find("a.pp_arrow_next").addClass("disabled").unbind("click");}else{_6.find("a.pp_next").css("visibility","visible");_6.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){$.prettyPhoto.changePage("next");return false;});}if(_f==0){_6.find("a.pp_previous").css("visibility","hidden");_6.find("a.pp_arrow_previous").addClass("disabled").unbind("click");}else{_6.find("a.pp_previous").css("visibility","visible");_6.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){$.prettyPhoto.changePage("previous");return false;});}if(_20>1){$(".pp_nav").show();}else{$(".pp_nav").hide();}};function _1b(_21,_22){hasBeenResized=false;_23(_21,_22);imageWidth=_21;imageHeight=_22;if(((_c>_e)||(_b>_d))&&_3&&_1.allowresize&&!_4){hasBeenResized=true;notFitting=true;while(notFitting){if((_c>_e)){imageWidth=(_e-200);imageHeight=(_22/_21)*imageWidth;}else{if((_b>_d)){imageHeight=(_d-200);imageWidth=(_21/_22)*imageHeight;}else{notFitting=false;}}_b=imageHeight;_c=imageWidth;}_23(imageWidth,imageHeight);}return {width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(_b),containerWidth:Math.floor(_c)+40,contentHeight:Math.floor(_9),contentWidth:Math.floor(_a),resized:hasBeenResized};};function _23(_24,_25){_24=parseFloat(_24);_25=parseFloat(_25);$pp_details=_6.find(".pp_details");$pp_details.width(_24);detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));$pp_details=$pp_details.clone().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();_9=_25+detailsHeight;_a=_24;_b=_9+_7.height()+_6.find(".pp_top").height()+_6.find(".pp_bottom").height();_c=_24;};function _1e(_26){if(_26.match(/youtube\.com\/watch/i)){return "youtube";}else{if(_26.match(/vimeo\.com/i)){return "vimeo";}else{if(_26.indexOf(".mov")!=-1){return "quicktime";}else{if(_26.indexOf(".swf")!=-1){return "flash";}else{if(_26.indexOf("iframe")!=-1){return "iframe";}else{if(_26.substr(0,1)=="#"){return "inline";}else{return "image";}}}}}}};function _12(){if(_3){titleHeight=_7.height();contentHeight=_6.height();contentwidth=_6.width();projectedTop=(_d/2)+_10["scrollTop"]-((contentHeight+titleHeight)/2);_6.css({"top":projectedTop,"left":(_e/2)+_10["scrollLeft"]-(contentwidth/2)});_7.css({"top":projectedTop-titleHeight,"left":(_e/2)+_10["scrollLeft"]-(contentwidth/2)+20});}};function _11(){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 _13(){_d=$(window).height();_e=$(window).width();_8.css({"height":$(document).height()});};function _2(){$("body").append(_1.markup);_6=$(".pp_pic_holder");_7=$(".ppt");_8=$("div.pp_overlay");_6.attr("class","pp_pic_holder "+_1.theme);_8.css({"opacity":0,"height":$(document).height()}).bind("click",function(){if(!_1.modal){$.prettyPhoto.close();}});$("a.pp_close").bind("click",function(){$.prettyPhoto.close();return false;});$("a.pp_expand").bind("click",function(){$this=$(this);if($this.hasClass("pp_expand")){$this.removeClass("pp_expand").addClass("pp_contract");_3=false;}else{$this.removeClass("pp_contract").addClass("pp_expand");_3=true;}_1d(function(){$.prettyPhoto.open(images,titles,descriptions);});_6.find(".pp_fade").fadeOut(_1.animationSpeed);return false;});_6.find(".pp_previous, .pp_arrow_previous").bind("click",function(){$.prettyPhoto.changePage("previous");return false;});_6.find(".pp_next, .pp_arrow_next").bind("click",function(){$.prettyPhoto.changePage("next");return false;});};_12();};function _27(_28,url){_28=_28.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var _29="[\\?&]"+_28+"=([^&#]*)";var _2a=new RegExp(_29);var _2b=_2a.exec(url);if(_2b==null){return "";}else{return _2b[1];}};})(jQuery);
