Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

JQuery ready issue

By: mindfriction on Jul 5th, 2012  |  syntax: jQuery  |  size: 34.09 KB  |  views: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. /*
  3.  * Superfish v1.4.8 - jQuery menu widget
  4.  * Copyright (c) 2008 Joel Birch
  5.  *
  6.  * Dual licensed under the MIT and GPL licenses:
  7.  *      http://www.opensource.org/licenses/mit-license.php
  8.  *      http://www.gnu.org/licenses/gpl.html
  9.  *
  10.  * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
  11.  */
  12. (function(a){a.fn.superfish=function(d){var c=a.fn.superfish,b=c.c,j=a(['<span class="',b.arrowClass,'"> &#187;</span>'].join("")),g=function(){var c=a(this),b=h(c);clearTimeout(b.sfTimer);c.showSuperfishUl().siblings().hideSuperfishUl();},i=function(){var b=a(this),d=h(b),e=c.op;clearTimeout(d.sfTimer);d.sfTimer=setTimeout(function(){e.retainPath=-1<a.inArray(b[0],e.$path);b.hideSuperfishUl();e.$path.length&&1>b.parents(["li.",e.hoverClass].join("")).length&&g.call(e.$path);},e.delay);},h=function(a){a=
  13. a.parents(["ul.",b.menuClass,":first"].join(""))[0];c.op=c.o[a.serial];return a};return this.each(function(){var k=this.serial=c.o.length,f=a.extend({},c.defaults,d);f.$path=a("li."+f.pathClass,this).slice(0,f.pathLevels).each(function(){a(this).addClass([f.hoverClass,b.bcClass].join(" ")).filter("li:has(ul)").removeClass(f.pathClass)});c.o[k]=c.op=f;a("li:has(ul)",this)[a.fn.hoverIntent&&!f.disableHI?"hoverIntent":"hover"](g,i).each(function(){f.autoArrows&&a(">a:first-child",this).addClass(b.anchorClass).append(j.clone())}).not("."+
  14. b.bcClass).hideSuperfishUl();var e=a("a",this);e.each(function(a){var b=e.eq(a).parents("li");e.eq(a).focus(function(){g.call(b)}).blur(function(){i.call(b)})});f.onInit.call(this)}).each(function(){var d=[b.menuClass];c.op.dropShadows&&!(a.browser.msie&&7>a.browser.version)&&d.push(b.shadowClass);a(this).addClass(d.join(" "))})};var b=a.fn.superfish;b.o=[];b.op={};b.IE7fix=function(){var d=b.op;a.browser.msie&&(6<a.browser.version&&d.dropShadows&&void 0!=d.animation.opacity)&&this.toggleClass(b.c.shadowClass+
  15. "-off")};b.c={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",arrowClass:"sf-sub-indicator",shadowClass:"sf-shadow"};b.defaults={hoverClass:"sfHover",pathClass:"overideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},speed:"normal",autoArrows:!0,dropShadows:!0,disableHI:!1,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};a.fn.extend({hideSuperfishUl:function(){var d=b.op,c=!0===d.retainPath?d.$path:"";d.retainPath=!1;c=a(["li.",
  16. d.hoverClass].join(""),this).add(this).not(c).removeClass(d.hoverClass).find(">ul").hide().css("visibility","hidden");d.onHide.call(c);return this},showSuperfishUl:function(){var a=b.op,c=this.addClass(a.hoverClass).find(">ul:hidden").css("visibility","visible");b.IE7fix.call(c);a.onBeforeShow.call(c);c.animate(a.animation,a.speed,function(){b.IE7fix.call(c);a.onShow.call(c)});return this}})})(jQuery);
  17.  
  18.  
  19. /* ------------------------------------------------------------------------
  20.         Class: prettyPhoto
  21.         Use: Lightbox clone for jQuery
  22.         Author: Stephane Caron (http://www.no-margin-for-errors.com)
  23.         Version: 3.0.3
  24. ------------------------------------------------------------------------- */
  25. (function(a){function g(a,g){var a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),i=RegExp("[\\?&]"+a+"=([^&#]*)").exec(g);return null==i?"":i[1]}a.prettyPhoto={version:"3.0.2"};a.fn.prettyPhoto=function(h){function s(){a(".pp_loaderIcon").hide();$ppt.fadeTo(settings.animation_speed,1);projectedTop=scroll_pos.scrollTop+(e/2-b.containerHeight/2);0>projectedTop&&(projectedTop=0);$pp_pic_holder.find(".pp_content").animate({height:b.contentHeight,width:b.contentWidth},settings.animation_speed);$pp_pic_holder.animate({top:projectedTop,
  26. left:d/2-b.containerWidth/2,width:b.containerWidth},settings.animation_speed,function(){$pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(b.height).width(b.width);$pp_pic_holder.find(".pp_fade").fadeIn(settings.animation_speed);isSet&&"image"==m(pp_images[set_position])?$pp_pic_holder.find(".pp_hoverContainer").show():$pp_pic_holder.find(".pp_hoverContainer").hide();b.resized?a("a.pp_expand,a.pp_contract").show():a("a.pp_expand,a.pp_contract").hide();settings.autoplay_slideshow&&(!j&&
  27. !n)&&a.prettyPhoto.startSlideshow();settings.changepicturecallback();n=!0});isSet&&settings.overlay_gallery&&"image"==m(pp_images[set_position])?(itemWidth=57,navWidth="facebook"==settings.theme?58:38,itemsPerPage=Math.floor((b.containerWidth-100-navWidth)/itemWidth),itemsPerPage=itemsPerPage<pp_images.length?itemsPerPage:pp_images.length,totalPage=Math.ceil(pp_images.length/itemsPerPage)-1,0==totalPage?(navWidth=0,$pp_pic_holder.find(".pp_gallery .pp_arrow_next,.pp_gallery .pp_arrow_previous").hide()):
  28. $pp_pic_holder.find(".pp_gallery .pp_arrow_next,.pp_gallery .pp_arrow_previous").show(),galleryWidth=itemsPerPage*itemWidth+navWidth,$pp_pic_holder.find(".pp_gallery").width(galleryWidth).css("margin-left",-(galleryWidth/2)),$pp_pic_holder.find(".pp_gallery ul").width(itemsPerPage*itemWidth).find("li.selected").removeClass("selected"),goToPage=Math.ceil((set_position+1)/itemsPerPage)<totalPage?Math.ceil((set_position+1)/itemsPerPage):totalPage,a.prettyPhoto.changeGalleryPage(goToPage),$pp_pic_holder.find(".pp_gallery ul li:eq("+
  29. set_position+")").addClass("selected")):($pp_pic_holder.find(".pp_content").unbind("mouseenter mouseleave"),$pp_pic_holder.find(".pp_gallery").hide())}function i(c){$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(){a(".pp_loaderIcon").show();c()})}function x(c){1<c?a(".pp_nav").show():a(".pp_nav").hide()}function f(a,b){resized=!1;t(a,b);imageWidth=a;imageHeight=b;if((k>d||l>e)&&doresize&&
  30. settings.allow_resize&&!o){resized=!0;for(fitting=!1;!fitting;)k>d?(imageWidth=d-200,imageHeight=b/a*imageWidth):l>e?(imageHeight=e-200,imageWidth=a/b*imageHeight):fitting=!0,l=imageHeight,k=imageWidth;t(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(l),containerWidth:Math.floor(k)+40,contentHeight:Math.floor(p),contentWidth:Math.floor(u),resized:resized}}function t(c,b){c=parseFloat(c);b=parseFloat(b);$pp_details=$pp_pic_holder.find(".pp_details");
  31. $pp_details.width(c);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();$pp_title=$pp_pic_holder.find(".ppt");$pp_title.width(c);titleHeight=parseFloat($pp_title.css("marginTop"))+parseFloat($pp_title.css("marginBottom"));
  32. $pp_title=$pp_title.clone().appendTo(a("body")).css({position:"absolute",top:-1E4});titleHeight+=$pp_title.height();$pp_title.remove();p=b+detailsHeight;u=c;l=p+titleHeight+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height();k=c}function m(a){return a.match(/youtube\.com\/watch/i)?"youtube":a.match(/vimeo\.com/i)?"vimeo":a.match(/\b.mov\b/i)?"quicktime":a.match(/\b.swf\b/i)?"flash":a.match(/\biframe=true\b/i)?"iframe":a.match(/\bcustom=true\b/i)?"custom":"#"==a.substr(0,
  33. 1)?"inline":"image"}function q(){doresize&&"undefined"!=typeof $pp_pic_holder&&(scroll_pos=v(),contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width(),projectedTop=e/2+scroll_pos.scrollTop-contentHeight/2,0>projectedTop&&(projectedTop=0),$pp_pic_holder.css({top:projectedTop,left:d/2+scroll_pos.scrollLeft-contentwidth/2}))}function v(){if(self.pageYOffset)return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};if(document.documentElement&&document.documentElement.scrollTop)return{scrollTop:document.documentElement.scrollTop,
  34. scrollLeft:document.documentElement.scrollLeft};if(document.body)return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}}function w(){a("body").append(settings.markup);$pp_pic_holder=a(".pp_pic_holder");$ppt=a(".ppt");$pp_overlay=a("div.pp_overlay");if(isSet&&settings.overlay_gallery){currentGalleryPage=0;toInject="";for(var b=0;b<pp_images.length;b++)classname=pp_images[b].match(/\b(jpg|jpeg|png|gif)\b/gi)?"":"default",toInject+="<li class='"+classname+"'><a href='#'><img src='"+
  35. pp_images[b]+"' width='50' alt='' /></a></li>";toInject=settings.gallery_markup.replace(/{gallery}/g,toInject);$pp_pic_holder.find("#pp_full_res").after(toInject);$pp_pic_holder.find(".pp_gallery .pp_arrow_next").click(function(){a.prettyPhoto.changeGalleryPage("next");a.prettyPhoto.stopSlideshow();return!1});$pp_pic_holder.find(".pp_gallery .pp_arrow_previous").click(function(){a.prettyPhoto.changeGalleryPage("previous");a.prettyPhoto.stopSlideshow();return!1});$pp_pic_holder.find(".pp_content").hover(function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeIn()},
  36. function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeOut()});itemWidth=57;$pp_pic_holder.find(".pp_gallery ul li").each(function(b){a(this).css({position:"absolute",left:b*itemWidth});a(this).find("a").unbind("click").click(function(){a.prettyPhoto.changePage(b);a.prettyPhoto.stopSlideshow();return!1})})}settings.slideshow&&($pp_pic_holder.find(".pp_nav").prepend('<a href="#" class="pp_play">Play</a>'),$pp_pic_holder.find(".pp_nav .pp_play").click(function(){a.prettyPhoto.startSlideshow();
  37. return!1}));$pp_pic_holder.attr("class","pp_pic_holder "+settings.theme);$pp_overlay.css({opacity:0,height:a(document).height(),width:a(window).width()}).bind("click",function(){settings.modal||a.prettyPhoto.close()});a("a.pp_close").bind("click",function(){a.prettyPhoto.close();return false});a("a.pp_expand").bind("click",function(){if(a(this).hasClass("pp_expand")){a(this).removeClass("pp_expand").addClass("pp_contract");doresize=false}else{a(this).removeClass("pp_contract").addClass("pp_expand");
  38. doresize=true}i(function(){a.prettyPhoto.open()});return false});$pp_pic_holder.find(".pp_previous, .pp_nav .pp_arrow_previous").bind("click",function(){a.prettyPhoto.changePage("previous");a.prettyPhoto.stopSlideshow();return false});$pp_pic_holder.find(".pp_next, .pp_nav .pp_arrow_next").bind("click",function(){a.prettyPhoto.changePage("next");a.prettyPhoto.stopSlideshow();return false});q()}var h=jQuery.extend({animation_speed:"fast",slideshow:!1,autoplay_slideshow:!1,opacity:0.8,show_title:!0,
  39. allow_resize:!0,default_width:500,default_height:344,counter_separator_label:"/",theme:"facebook",hideflash:!1,wmode:"opaque",autoplay:!0,modal:!1,overlay_gallery:!0,keyboard_shortcuts:!0,changepicturecallback:function(){},callback:function(){},markup:'<div class="pp_pic_holder"> <div class="ppt">&nbsp;</div> <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"> <p class="pp_description"></p> <a class="pp_close" href="#">Close</a> <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>',
  40. gallery_markup:'<div class="pp_gallery"> <a href="#" class="pp_arrow_previous">Previous</a> <ul> {gallery} </ul> <a href="#" class="pp_arrow_next">Next</a> </div>',image_markup:'<img id="fullResImage" src="{path}" />',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>',
  41. 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>',
  42. inline_markup:'<div class="pp_inline clearfix">{content}</div>',custom_markup:""},h),r=this,o=!1,b,n,p,u,l,k,e=a(window).height(),d=a(window).width(),j;doresize=!0;scroll_pos=v();a(window).unbind("resize.prettyphoto").bind("resize.prettyphoto",function(){q();e=a(window).height();d=a(window).width();"undefined"!=typeof $pp_overlay&&$pp_overlay.height(a(document).height()).width(d)});h.keyboard_shortcuts&&a(document).unbind("keydown.prettyphoto").bind("keydown.prettyphoto",function(b){if("undefined"!=
  43. typeof $pp_pic_holder&&$pp_pic_holder.is(":visible"))switch(b.keyCode){case 37:a.prettyPhoto.changePage("previous");b.preventDefault();break;case 39:a.prettyPhoto.changePage("next");b.preventDefault();break;case 27:settings.modal||a.prettyPhoto.close(),b.preventDefault()}});a.prettyPhoto.initialize=function(){settings=h;a.browser.msie&&6==parseInt(a.browser.version)&&(settings.theme="light_square");theRel=a(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;pp_images=(isSet=galleryRegExp.exec(theRel)?!0:
  44. !1)?jQuery.map(r,function(b){if(a(b).attr("rel").indexOf(theRel)!=-1)return a(b).attr("href")}):a.makeArray(a(this).attr("href"));pp_titles=isSet?jQuery.map(r,function(b){if(a(b).attr("rel").indexOf(theRel)!=-1)return a(b).find("img").attr("alt")?a(b).find("img").attr("alt"):""}):a.makeArray(a(this).find("img").attr("alt"));pp_descriptions=isSet?jQuery.map(r,function(b){if(a(b).attr("rel").indexOf(theRel)!=-1)return a(b).attr("title")?a(b).attr("title"):""}):a.makeArray(a(this).attr("title"));w(this);
  45. settings.allow_resize&&a(window).bind("scroll.prettyphoto",function(){q()});set_position=jQuery.inArray(a(this).attr("href"),pp_images);a.prettyPhoto.open();return!1};a.prettyPhoto.open=function(c,d,e){"undefined"==typeof settings&&(settings=h,a.browser.msie&&6==a.browser.version&&(settings.theme="light_square"),pp_images=a.makeArray(c),pp_titles=d?a.makeArray(d):a.makeArray(""),pp_descriptions=e?a.makeArray(e):a.makeArray(""),isSet=1<pp_images.length?!0:!1,set_position=0,w(c.target));a.browser.msie&&
  46. 6==a.browser.version&&a("select").css("visibility","hidden");settings.hideflash&&a("object,embed").css("visibility","hidden");x(a(pp_images).size());a(".pp_loaderIcon").show();$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+a(pp_images).size());$pp_pic_holder.find(".pp_description").show().html(unescape(pp_descriptions[set_position]));
  47. settings.show_title&&""!=pp_titles[set_position]&&"undefined"!=typeof pp_titles[set_position]?$ppt.html(unescape(pp_titles[set_position])):$ppt.html("&nbsp;");movie_width=parseFloat(g("width",pp_images[set_position]))?g("width",pp_images[set_position]):settings.default_width.toString();movie_height=parseFloat(g("height",pp_images[set_position]))?g("height",pp_images[set_position]):settings.default_height.toString();-1!=movie_height.indexOf("%")&&(movie_height=parseFloat(a(window).height()*parseFloat(movie_height)/
  48. 100-150),o=!0);-1!=movie_width.indexOf("%")&&(movie_width=parseFloat(a(window).width()*parseFloat(movie_width)/100-150),o=!0);$pp_pic_holder.fadeIn(function(){imgPreloader="";switch(m(pp_images[set_position])){case "image":imgPreloader=new Image;nextImage=new Image;if(isSet&&set_position<a(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,
  49. pp_images[set_position]);imgPreloader.onload=function(){b=f(imgPreloader.width,imgPreloader.height);s()};imgPreloader.onerror=function(){alert("Image cannot be loaded. Make sure the path is correct and image exist.");a.prettyPhoto.close()};imgPreloader.src=pp_images[set_position];break;case "youtube":b=f(movie_width,movie_height);movie="http://www.youtube.com/v/"+g("v",pp_images[set_position]);settings.autoplay&&(movie=movie+"&autoplay=1");toInject=settings.flash_markup.replace(/{width}/g,b.width).replace(/{height}/g,
  50. b.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case "vimeo":b=f(movie_width,movie_height);movie_id=pp_images[set_position];movie="http://player.vimeo.com/video/"+movie_id.match(/http:\/\/(www\.)?vimeo.com\/(\d+)/)[2]+"?title=0&amp;byline=0&amp;portrait=0";settings.autoplay&&(movie=movie+"&autoplay=1;");vimeo_width=b.width+"/embed/?moog_width="+b.width;toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,b.height).replace(/{path}/g,movie);
  51. break;case "quicktime":b=f(movie_width,movie_height);b.height=b.height+15;b.contentHeight=b.contentHeight+15;b.containerHeight=b.containerHeight+15;toInject=settings.quicktime_markup.replace(/{width}/g,b.width).replace(/{height}/g,b.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case "flash":b=f(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexOf("flashvars")+
  52. 10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexOf("?"));toInject=settings.flash_markup.replace(/{width}/g,b.width).replace(/{height}/g,b.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case "iframe":b=f(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,b.width).replace(/{height}/g,
  53. b.height).replace(/{path}/g,frame_url);break;case "custom":b=f(movie_width,movie_height);toInject=settings.custom_markup;break;case "inline":myClone=a(pp_images[set_position]).clone().css({width:settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo(a("body")).show();doresize=false;b=f(a(myClone).width(),a(myClone).height());doresize=true;a(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,a(pp_images[set_position]).html())}if(!imgPreloader){$pp_pic_holder.find("#pp_full_res")[0].innerHTML=
  54. toInject;s()}});return!1};a.prettyPhoto.changePage=function(b){currentGalleryPage=0;if("previous"==b){if(set_position--,0>set_position){set_position=0;return}}else"next"==b?(set_position++,set_position>a(pp_images).size()-1&&(set_position=0)):set_position=b;doresize||(doresize=!0);a(".pp_contract").removeClass("pp_contract").addClass("pp_expand");i(function(){a.prettyPhoto.open()})};a.prettyPhoto.changeGalleryPage=function(b){"next"==b?(currentGalleryPage++,currentGalleryPage>totalPage&&(currentGalleryPage=
  55. 0)):"previous"==b?(currentGalleryPage--,0>currentGalleryPage&&(currentGalleryPage=totalPage)):currentGalleryPage=b;itemsToSlide=currentGalleryPage==totalPage?pp_images.length-totalPage*itemsPerPage:itemsPerPage;$pp_pic_holder.find(".pp_gallery li").each(function(b){a(this).animate({left:b*itemWidth-itemsToSlide*itemWidth*currentGalleryPage})})};a.prettyPhoto.startSlideshow=function(){"undefined"==typeof j?($pp_pic_holder.find(".pp_play").unbind("click").removeClass("pp_play").addClass("pp_pause").click(function(){a.prettyPhoto.stopSlideshow();
  56. return!1}),j=setInterval(a.prettyPhoto.startSlideshow,settings.slideshow)):a.prettyPhoto.changePage("next")};a.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find(".pp_pause").unbind("click").removeClass("pp_pause").addClass("pp_play").click(function(){a.prettyPhoto.startSlideshow();return!1});clearInterval(j);j=void 0};a.prettyPhoto.close=function(){$pp_overlay.is(":animated")||(a.prettyPhoto.stopSlideshow(),$pp_pic_holder.stop().find("object,embed").css("visibility","hidden"),a("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animation_speed,
  57. function(){a(this).remove()}),$pp_overlay.fadeOut(settings.animation_speed,function(){a.browser.msie&&6==a.browser.version&&a("select").css("visibility","visible");settings.hideflash&&a("object,embed").css("visibility","visible");a(this).remove();a(window).unbind("scroll");settings.callback();doresize=!0;n=!1;delete settings}))};return this.unbind("click.prettyphoto").bind("click.prettyphoto",a.prettyPhoto.initialize)}})(jQuery);
  58.  
  59.  
  60. /*
  61.  * jQuery Nivo Slider v3.0.1
  62.  * http://nivo.dev7studios.com
  63.  *
  64.  * Copyright 2012, Dev7studios
  65.  * Free to use and abuse under the MIT license.
  66.  * http://www.opensource.org/licenses/mit-license.php
  67.  */
  68. (function(a){var t=function(m,r){var e=a.extend({},a.fn.nivoSlider.defaults,r),b={currentSlide:0,currentImage:"",totalSlides:0,running:!1,paused:!1,stop:!1,controlNavEl:!1},j=a(m);j.data("nivo:vars",b).addClass("nivoSlider");var k=j.children();k.each(function(){var c=a(this),f="";c.is("img")||(c.is("a")&&(c.addClass("nivo-imageLink"),f=c),c=c.find("img:first"));var d=0===d?c.attr("width"):c.width(),e=0===e?c.attr("height"):c.height();""!==f&&f.css("display","none");c.css("display","none");b.totalSlides++});
  69. e.randomStart&&(e.startSlide=Math.floor(Math.random()*b.totalSlides));0<e.startSlide&&(e.startSlide>=b.totalSlides&&(e.startSlide=b.totalSlides-1),b.currentSlide=e.startSlide);b.currentImage=a(k[b.currentSlide]).is("img")?a(k[b.currentSlide]):a(k[b.currentSlide]).find("img:first");a(k[b.currentSlide]).is("a")&&a(k[b.currentSlide]).css("display","block");var n=a('<img class="nivo-main-image" src="#" />');n.attr("src",b.currentImage.attr("src")).show();j.append(n);a(window).resize(function(){j.children("img").width(j.width());
  70. n.attr("src",b.currentImage.attr("src"));n.stop().height("auto");a(".nivo-slice").remove();a(".nivo-box").remove()});j.append(a('<div class="nivo-caption"></div>'));var u=function(c){var f=a(".nivo-caption",j);if(b.currentImage.attr("title")!=""&&b.currentImage.attr("title")!=void 0){var d=b.currentImage.attr("title");d.substr(0,1)=="#"&&(d=a(d).html());if(f.css("display")=="block")setTimeout(function(){f.html(d)},c.animSpeed);else{f.html(d);f.stop().fadeIn(c.animSpeed)}}else f.stop().fadeOut(c.animSpeed)};
  71. u(e);var l=0;!e.manualAdvance&&1<k.length&&(l=setInterval(function(){o(j,k,e,false)},e.pauseTime));e.directionNav&&(j.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+e.prevText+'</a><a class="nivo-nextNav">'+e.nextText+"</a></div>"),e.directionNavHide&&(a(".nivo-directionNav",j).hide(),j.hover(function(){a(".nivo-directionNav",j).show()},function(){a(".nivo-directionNav",j).hide()})),a("a.nivo-prevNav",j).live("click",function(){if(b.running)return false;clearInterval(l);l="";b.currentSlide=
  72. b.currentSlide-2;o(j,k,e,"prev")}),a("a.nivo-nextNav",j).live("click",function(){if(b.running)return false;clearInterval(l);l="";o(j,k,e,"next")}));if(e.controlNav){b.controlNavEl=a('<div class="nivo-controlNav"></div>');j.after(b.controlNavEl);for(var p=0;p<k.length;p++)if(e.controlNavThumbs){b.controlNavEl.addClass("nivo-thumbs-enabled");var s=k.eq(p);s.is("img")||(s=s.find("img:first"));s.attr("data-thumb")&&b.controlNavEl.append('<a class="nivo-control" rel="'+p+'"><img src="'+s.attr("data-thumb")+
  73. '" alt="" /></a>')}else b.controlNavEl.append('<a class="nivo-control" rel="'+p+'">'+(p+1)+"</a>");a("a:eq("+b.currentSlide+")",b.controlNavEl).addClass("active");a("a",b.controlNavEl).bind("click",function(){if(b.running||a(this).hasClass("active"))return false;clearInterval(l);l="";n.attr("src",b.currentImage.attr("src"));b.currentSlide=a(this).attr("rel")-1;o(j,k,e,"control")})}e.pauseOnHover&&j.hover(function(){b.paused=true;clearInterval(l);l=""},function(){b.paused=false;l===""&&!e.manualAdvance&&
  74. (l=setInterval(function(){o(j,k,e,false)},e.pauseTime))});j.bind("nivo:animFinished",function(){n.attr("src",b.currentImage.attr("src"));b.running=false;a(k).each(function(){a(this).is("a")&&a(this).css("display","none")});a(k[b.currentSlide]).is("a")&&a(k[b.currentSlide]).css("display","block");l===""&&(!b.paused&&!e.manualAdvance)&&(l=setInterval(function(){o(j,k,e,false)},e.pauseTime));e.afterChange.call(this)});var q=function(c,f,d){a(d.currentImage).parent().is("a")&&a(d.currentImage).parent().css("display",
  75. "block");a('img[src="'+d.currentImage.attr("src")+'"]',c).not(".nivo-main-image,.nivo-control img").width(c.width()).css("visibility","hidden").show();for(var b=a('img[src="'+d.currentImage.attr("src")+'"]',c).not(".nivo-main-image,.nivo-control img").parent().is("a")?a('img[src="'+d.currentImage.attr("src")+'"]',c).not(".nivo-main-image,.nivo-control img").parent().height():a('img[src="'+d.currentImage.attr("src")+'"]',c).not(".nivo-main-image,.nivo-control img").height(),g=0;g<f.slices;g++){var h=
  76. Math.round(c.width()/f.slices);g===f.slices-1?c.append(a('<div class="nivo-slice" name="'+g+'"><img src="'+d.currentImage.attr("src")+'" style="position:absolute; width:'+c.width()+"px; height:auto; display:block !important; top:0; left:-"+(h+g*h-h)+'px;" /></div>').css({left:h*g+"px",width:c.width()-h*g+"px",height:b+"px",opacity:"0",overflow:"hidden"})):c.append(a('<div class="nivo-slice" name="'+g+'"><img src="'+d.currentImage.attr("src")+'" style="position:absolute; width:'+c.width()+"px; height:auto; display:block !important; top:0; left:-"+
  77. (h+g*h-h)+'px;" /></div>').css({left:h*g+"px",width:h+"px",height:b+"px",opacity:"0",overflow:"hidden"}))}a(".nivo-slice",c).height(b);n.stop().animate({height:a(d.currentImage).height()},f.animSpeed)},v=function(c,f,d){a(d.currentImage).parent().is("a")&&a(d.currentImage).parent().css("display","block");a('img[src="'+d.currentImage.attr("src")+'"]',c).not(".nivo-main-image,.nivo-control img").width(c.width()).css("visibility","hidden").show();for(var b=Math.round(c.width()/f.boxCols),g=Math.round(a('img[src="'+
  78. d.currentImage.attr("src")+'"]',c).not(".nivo-main-image,.nivo-control img").height()/f.boxRows),h=0;h<f.boxRows;h++)for(var i=0;i<f.boxCols;i++){i===f.boxCols-1?c.append(a('<div class="nivo-box" name="'+i+'" rel="'+h+'"><img src="'+d.currentImage.attr("src")+'" style="position:absolute; width:'+c.width()+"px; height:auto; display:block; top:-"+g*h+"px; left:-"+b*i+'px;" /></div>').css({opacity:0,left:b*i+"px",top:g*h+"px",width:c.width()-b*i+"px"})):c.append(a('<div class="nivo-box" name="'+i+'" rel="'+
  79. h+'"><img src="'+d.currentImage.attr("src")+'" style="position:absolute; width:'+c.width()+"px; height:auto; display:block; top:-"+g*h+"px; left:-"+b*i+'px;" /></div>').css({opacity:0,left:b*i+"px",top:g*h+"px",width:b+"px"}));a('.nivo-box[name="'+i+'"]',c).height(a('.nivo-box[name="'+i+'"] img',c).height()+"px")}n.stop().animate({height:a(d.currentImage).height()},f.animSpeed)},o=function(c,f,d,b){var g=c.data("nivo:vars");g&&g.currentSlide===g.totalSlides-1&&d.lastSlide.call(this);if((!g||g.stop)&&
  80. !b)return false;d.beforeChange.call(this);if(b){b==="prev"&&n.attr("src",g.currentImage.attr("src"));b==="next"&&n.attr("src",g.currentImage.attr("src"))}else n.attr("src",g.currentImage.attr("src"));g.currentSlide++;if(g.currentSlide===g.totalSlides){g.currentSlide=0;d.slideshowEnd.call(this)}if(g.currentSlide<0)g.currentSlide=g.totalSlides-1;g.currentImage=a(f[g.currentSlide]).is("img")?a(f[g.currentSlide]):a(f[g.currentSlide]).find("img:first");if(d.controlNav){a("a",g.controlNavEl).removeClass("active");
  81. a("a:eq("+g.currentSlide+")",g.controlNavEl).addClass("active")}u(d);a(".nivo-slice",c).remove();a(".nivo-box",c).remove();var h=d.effect,f="";if(d.effect==="random"){f=["sliceDownRight","sliceDownLeft","sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade","boxRandom","boxRain","boxRainReverse","boxRainGrow","boxRainGrowReverse"];h=f[Math.floor(Math.random()*(f.length+1))];h===void 0&&(h="fade")}if(d.effect.indexOf(",")!==-1){f=d.effect.split(",");h=f[Math.floor(Math.random()*
  82. f.length)];h===void 0&&(h="fade")}g.currentImage.attr("data-transition")&&(h=g.currentImage.attr("data-transition"));g.running=true;var i=0,e=0,j=f="",k="",f="";if(h==="sliceDown"||h==="sliceDownRight"||h==="sliceDownLeft"){q(c,d,g);e=i=0;f=a(".nivo-slice",c);h==="sliceDownLeft"&&(f=a(".nivo-slice",c)._reverse());f.each(function(){var b=a(this);b.css({top:"0px"});e===d.slices-1?setTimeout(function(){b.animate({opacity:"1.0"},d.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+i):setTimeout(function(){b.animate({opacity:"1.0"},
  83. d.animSpeed)},100+i);i=i+50;e++})}else if(h==="sliceUp"||h==="sliceUpRight"||h==="sliceUpLeft"){q(c,d,g);e=i=0;f=a(".nivo-slice",c);h==="sliceUpLeft"&&(f=a(".nivo-slice",c)._reverse());f.each(function(){var b=a(this);b.css({bottom:"0px"});e===d.slices-1?setTimeout(function(){b.animate({opacity:"1.0"},d.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+i):setTimeout(function(){b.animate({opacity:"1.0"},d.animSpeed)},100+i);i=i+50;e++})}else if(h==="sliceUpDown"||h==="sliceUpDownRight"||
  84. h==="sliceUpDownLeft"){q(c,d,g);var l=e=i=0,f=a(".nivo-slice",c);h==="sliceUpDownLeft"&&(f=a(".nivo-slice",c)._reverse());f.each(function(){var b=a(this);if(e===0){b.css("top","0px");e++}else{b.css("bottom","0px");e=0}l===d.slices-1?setTimeout(function(){b.animate({opacity:"1.0"},d.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+i):setTimeout(function(){b.animate({opacity:"1.0"},d.animSpeed)},100+i);i=i+50;l++})}else if(h==="fold"){q(c,d,g);e=i=0;a(".nivo-slice",c).each(function(){var b=
  85. a(this),f=b.width();b.css({top:"0px",width:"0px"});e===d.slices-1?setTimeout(function(){b.animate({width:f,opacity:"1.0"},d.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+i):setTimeout(function(){b.animate({width:f,opacity:"1.0"},d.animSpeed)},100+i);i=i+50;e++})}else if(h==="fade"){q(c,d,g);j=a(".nivo-slice:first",c);j.css({width:c.width()+"px"});j.animate({opacity:"1.0"},d.animSpeed*2,"",function(){c.trigger("nivo:animFinished")})}else if(h==="slideInRight"){q(c,d,g);j=a(".nivo-slice:first",
  86. c);j.css({width:"0px",opacity:"1"});j.animate({width:c.width()+"px"},d.animSpeed*2,"",function(){c.trigger("nivo:animFinished")})}else if(h==="slideInLeft"){q(c,d,g);j=a(".nivo-slice:first",c);j.css({width:"0px",opacity:"1",left:"",right:"0px"});j.animate({width:c.width()+"px"},d.animSpeed*2,"",function(){j.css({left:"0px",right:""});c.trigger("nivo:animFinished")})}else if(h==="boxRandom"){v(c,d,g);k=d.boxCols*d.boxRows;i=e=0;f=t(a(".nivo-box",c));f.each(function(){var b=a(this);e===k-1?setTimeout(function(){b.animate({opacity:"1"},
  87. d.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+i):setTimeout(function(){b.animate({opacity:"1"},d.animSpeed)},100+i);i=i+20;e++})}else if(h==="boxRain"||h==="boxRainReverse"||h==="boxRainGrow"||h==="boxRainGrowReverse"){v(c,d,g);var k=d.boxCols*d.boxRows,m=i=e=0,o=0,p=[];p[m]=[];f=a(".nivo-box",c);if(h==="boxRainReverse"||h==="boxRainGrowReverse")f=a(".nivo-box",c)._reverse();f.each(function(){p[m][o]=a(this);o++;if(o===d.boxCols){m++;o=0;p[m]=[]}});for(g=0;g<d.boxCols*2;g++){f=g;
  88. for(b=0;b<d.boxRows;b++){if(f>=0&&f<d.boxCols){(function(b,f,g,e,i){var j=a(p[b][f]),k=j.width(),l=j.height();(h==="boxRainGrow"||h==="boxRainGrowReverse")&&j.width(0).height(0);e===i-1?setTimeout(function(){j.animate({opacity:"1",width:k,height:l},d.animSpeed/1.3,"",function(){c.trigger("nivo:animFinished")})},100+g):setTimeout(function(){j.animate({opacity:"1",width:k,height:l},d.animSpeed/1.3)},100+g)})(b,f,i,e,k);e++}f--}i=i+100}}},t=function(c){for(var a,b,e=c.length;e;a=parseInt(Math.random()*
  89. e,10),b=c[--e],c[e]=c[a],c[a]=b);return c},w=function(a){this.console&&typeof console.log!=="undefined"&&console.log(a)};this.stop=function(){if(!a(m).data("nivo:vars").stop){a(m).data("nivo:vars").stop=true;w("Stop Slider")}};this.start=function(){if(a(m).data("nivo:vars").stop){a(m).data("nivo:vars").stop=false;w("Start Slider")}};e.afterLoad.call(this);return this};a.fn.nivoSlider=function(m){return this.each(function(){var r=a(this);if(r.data("nivoslider"))return r.data("nivoslider");var e=new t(this,
  90. m);r.data("nivoslider",e)})};a.fn.nivoSlider.defaults={effect:"random",slices:15,boxCols:8,boxRows:4,animSpeed:500,pauseTime:3E3,startSlide:0,directionNav:!0,directionNavHide:!0,controlNav:!0,controlNavThumbs:!1,pauseOnHover:!0,manualAdvance:!1,prevText:"Prev",nextText:"Next",randomStart:!1,beforeChange:function(){},afterChange:function(){},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){}};a.fn._reverse=[].reverse})(jQuery);
  91.  
  92.  
  93. jQuery(document).ready(function(){
  94.        
  95.         // Main menu
  96.         jQuery('ul.sf-menu').superfish({
  97.                         delay: 500, // 1/2 second delay on mouseout
  98.                         animation: { opacity: 'show',height: 'show' },// fade-in and slide-down animation
  99.                         speed: 'fast',// faster animation speed
  100.                         autoArrows: false,// generation of arrow mark-up (for submenu)
  101.                         dropShadows: false // done in CSS instead (RL)
  102.         });
  103.        
  104.        
  105.         // FAQ Toggle Web Content Template
  106.         jQuery('.faq-list dt').css('cursor', 'pointer');
  107.         jQuery('.faq-list').on('click', 'dt', function(e){
  108.                 jQuery(this).next('dd').slideToggle('fast');
  109.         });
  110.  
  111.  
  112. });
  113.  
  114.  
  115. jQuery(window).load(function(){
  116.        
  117.  
  118.    // Homepage Slideshow
  119.         jQuery('#slider').nivoSlider({
  120.                         effect: 'fold',
  121.                         animSpeed: 500,
  122.                         pauseTime: 5000,
  123.                         startSlide: 0,
  124.                         slices: 15,
  125.                         directionNav: true,
  126.                         directionNavHide: true,
  127.                         controlNav: true,
  128.                         controlNavThumbs: false,
  129.                         keyboardNav: true,
  130.                         pauseOnHover: true,
  131.                         captionOpacity: 0.5
  132.                
  133.         });
  134.        
  135.         // Gallery
  136.         // Opens images in lightbox
  137.         jQuery("#gallery .portfolio a[rel^='prettyPhoto']").prettyPhoto({
  138.                 animationSpeed: 'slow',
  139.                 theme: 'facebook',
  140.                 slideshow: false,
  141.                 autoplay_slideshow: false,
  142.                 show_title: true,
  143.                 overlay_gallery: false
  144.         });    
  145.        
  146.         jQuery('#gallery .portfolio li img').hide();
  147.         // Incrementally fade in gallery images...
  148.          var i = 1;
  149.          var imgs = jQuery('#gallery .portfolio li img').length;
  150.          var int = setInterval(function() {
  151.                  //console.log(i); check to make sure interval properly stops
  152.                  if(i >= imgs) clearInterval(int);
  153.                  jQuery('#gallery .portfolio li img:hidden').eq(0).fadeIn(300);
  154.                  i++;
  155.          }, 300);
  156. });