PageSourceSearch

https://venetiansalon.com/wp-content/themes/thestory/js/main.js?ver=1.6.2

js venetiansalon.com collected 2026-10-08 23:39:09 UTC 129,684 bytes, 2,932 lines download raw bytes

1/**
2 * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!)
3 * Common usage: wipe images (left and right to show the previous or next image)
4 * 
5 * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
6 * @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems)
7 * @version 1.1 (1st September 2010) - support wipe up and wipe down
8 * @version 1.0 (15th July 2010)
9 */
10(function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery);
11
12/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
13 * Licensed under the MIT License (LICENSE.txt).
14 *
15 * Version: 3.1.9
16 *
17 * Requires: jQuery 1.2.2+
18 */
19(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{if(typeof exports==="object"){module.exports=factory}else{factory(jQuery)}}}(function($){var toFix=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],toBind=("onwheel" in document||document.documentMode>=9)?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],slice=Array.prototype.slice,nullLowestDeltaTimeout,lowestDelta;if($.event.fixHooks){for(var i=toFix.length;i;){$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}var special=$.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener){for(var i=toBind.length;i;){this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}$.data(this,"mousewheel-line-height",special.getLineHeight(this));$.data(this,"mousewheel-page-height",special.getPageHeight(this))},teardown:function(){if(this.removeEventListener){for(var i=toBind.length;i;){this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}},getLineHeight:function(elem){return parseInt($(elem)["offsetParent" in $.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(elem){return $(elem).height()},settings:{adjustOldDeltas:true}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}});function handler(event){var orgEvent=event||window.event,args=slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0;event=$.event.fix(orgEvent);event.type="mousewheel";if("detail" in orgEvent){deltaY=orgEvent.detail*-1}if("wheelDelta" in orgEvent){deltaY=orgEvent.wheelDelta}if("wheelDeltaY" in orgEvent){deltaY=orgEvent.wheelDeltaY}if("wheelDeltaX" in orgEvent){deltaX=orgEvent.wheelDeltaX*-1}if("axis" in orgEvent&&orgEvent.axis===orgEvent.HORIZONTAL_AXIS){deltaX=deltaY*-1;deltaY=0}delta=deltaY===0?deltaX:deltaY;if("deltaY" in orgEvent){deltaY=orgEvent.deltaY*-1;delta=deltaY}if("deltaX" in orgEvent){deltaX=orgEvent.deltaX;if(deltaY===0){delta=deltaX*-1}}if(deltaY===0&&deltaX===0){return}if(orgEvent.deltaMode===1){var lineHeight=$.data(this,"mousewheel-line-height");delta*=lineHeight;deltaY*=lineHeight;deltaX*=lineHeight}else{if(orgEvent.deltaMode===2){var pageHeight=$.data(this,"mousewheel-page-height");delta*=pageHeight;deltaY*=pageHeight;deltaX*=pageHeight}}absDelta=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDelta||absDelta<lowestDelta){lowestDelta=absDelta;if(shouldAdjustOldDeltas(orgEvent,absDelta)){lowestDelta/=40}}if(shouldAdjustOldDeltas(orgEvent,absDelta)){delta/=40;deltaX/=40;deltaY/=40}delta=Math[delta>=1?"floor":"ceil"](delta/lowestDelta);deltaX=Math[deltaX>=1?"floor":"ceil"](deltaX/lowestDelta);deltaY=Math[deltaY>=1?"floor":"ceil"](deltaY/lowestDelta);event.deltaX=deltaX;event.deltaY=deltaY;event.deltaFactor=lowestDelta;event.deltaMode=0;args.unshift(event,delta,deltaX,deltaY);
19if(nullLowestDeltaTimeout){clearTimeout(nullLowestDeltaTimeout)}nullLowestDeltaTimeout=setTimeout(nullLowestDelta,200);return($.event.dispatch||$.event.handle).apply(this,args)}function nullLowestDelta(){lowestDelta=null}function shouldAdjustOldDeltas(orgEvent,absDelta){return special.settings.adjustOldDeltas&&orgEvent.type==="mousewheel"&&absDelta%120===0}}));
20/*!
21 * jQuery imagesLoaded plugin v1.0.4
22 * http://github.com/desandro/imagesloaded
23 *
24 * MIT License. by Paul Irish et al.
25 */
26
27(function(a,b){a.fn.imagesLoaded=function(i){var g=this,e=g.find("img").add(g.filter("img")),c=e.length,h="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";function f(){i.call(g,e)}function d(j){if(--c<=0&&j.target.src!==h){setTimeout(f);e.unbind("load error",d)}}if(!c){f()}e.bind("load error",d).each(function(){if(this.complete||this.complete===b){var j=this.src;this.src=h;this.src=j}});return g}})(jQuery);
28
29
30/*
31 *  Sharrre.com - Make your sharing widget!
32 *  Version: beta 1.3.3 
33 *  Author: Julien Hany
34 *  License: MIT http://en.wikipedia.org/wiki/MIT_License or GPLv2 http://en.wikipedia.org/wiki/GNU_General_Public_License
35 */
36(function(g,i,j,b){var h="sharrre",f={className:"sharrre",share:{googlePlus:false,facebook:false,twitter:false,digg:false,delicious:false,stumbleupon:false,linkedin:false,pinterest:false},shareTotal:0,template:"",title:"",url:j.location.href,text:j.title,urlCurl:"sharrre.php",count:{},total:0,shorterTotal:true,enableHover:true,enableCounter:true,enableTracking:false,hover:function(){},hide:function(){},click:function(){},render:function(){},buttons:{googlePlus:{url:"",urlCount:false,size:"medium",lang:"en-US",annotation:""},facebook:{url:"",urlCount:false,action:"like",layout:"button_count",width:"",send:"false",faces:"false",colorscheme:"",font:"",lang:"en_US"},twitter:{url:"",urlCount:false,count:"horizontal",hashtags:"",via:"",related:"",lang:"en"},digg:{url:"",urlCount:false,type:"DiggCompact"},delicious:{url:"",urlCount:false,size:"medium"},stumbleupon:{url:"",urlCount:false,layout:"1"},linkedin:{url:"",urlCount:false,counter:""},pinterest:{url:"",media:"",description:"",layout:"horizontal"}}},c={googlePlus:"",facebook:"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",twitter:"http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",digg:"http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",delicious:"http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?",stumbleupon:"",linkedin:"http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",pinterest:""},l={googlePlus:function(m){var n=m.options.buttons.googlePlus;g(m.element).find(".buttons").append('<div class="button googleplus"><div class="g-plusone" data-size="'+n.size+'" data-href="'+(n.url!==""?n.url:m.options.url)+'" data-annotation="'+n.annotation+'"></div></div>');i.___gcfg={lang:m.options.buttons.googlePlus.lang};var o=0;if(typeof gapi==="undefined"&&o==0){o=1;(function(){var p=j.createElement("script");p.type="text/javascript";p.async=true;p.src="//apis.google.com/js/plusone.js";var q=j.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{gapi.plusone.go()}},facebook:function(m){var n=m.options.buttons.facebook;g(m.element).find(".buttons").append('<div class="button facebook"><div id="fb-root"></div><div class="fb-like" data-href="'+(n.url!==""?n.url:m.options.url)+'" data-send="'+n.send+'" data-layout="'+n.layout+'" data-width="'+n.width+'" data-show-faces="'+n.faces+'" data-action="'+n.action+'" data-colorscheme="'+n.colorscheme+'" data-font="'+n.font+'" data-via="'+n.via+'"></div></div>');var o=0;if(typeof FB==="undefined"&&o==0){o=1;(function(t,p,u){var r,q=t.getElementsByTagName(p)[0];if(t.getElementById(u)){return}r=t.createElement(p);r.id=u;r.src="//connect.facebook.net/"+n.lang+"/all.js#xfbml=1";q.parentNode.insertBefore(r,q)}(j,"script","facebook-jssdk"))}
36else{FB.XFBML.parse()}},twitter:function(m){var n=m.options.buttons.twitter;g(m.element).find(".buttons").append('<div class="button twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="'+(n.url!==""?n.url:m.options.url)+'" data-count="'+n.count+'" data-text="'+m.options.text+'" data-via="'+n.via+'" data-hashtags="'+n.hashtags+'" data-related="'+n.related+'" data-lang="'+n.lang+'">Tweet</a></div>');var o=0;if(typeof twttr==="undefined"&&o==0){o=1;(function(){var q=j.createElement("script");q.type="text/javascript";q.async=true;q.src="//platform.twitter.com/widgets.js";var p=j.getElementsByTagName("script")[0];p.parentNode.insertBefore(q,p)})()}else{g.ajax({url:"//platform.twitter.com/widgets.js",dataType:"script",cache:true})}},digg:function(m){var n=m.options.buttons.digg;g(m.element).find(".buttons").append('<div class="button digg"><a class="DiggThisButton '+n.type+'" rel="nofollow external" href="http://digg.com/submit?url='+encodeURIComponent((n.url!==""?n.url:m.options.url))+'"></a></div>');var o=0;if(typeof __DBW==="undefined"&&o==0){o=1;(function(){var q=j.createElement("SCRIPT"),p=j.getElementsByTagName("SCRIPT")[0];q.type="text/javascript";q.async=true;q.src="//widgets.digg.com/buttons.js";p.parentNode.insertBefore(q,p)})()}},delicious:function(o){if(o.options.buttons.delicious.size=="tall"){var p="width:50px;",n="height:35px;width:50px;font-size:15px;line-height:35px;",m="height:18px;line-height:18px;margin-top:3px;"}else{var p="width:93px;",n="float:right;padding:0 3px;height:20px;width:26px;line-height:20px;",m="float:left;height:20px;line-height:20px;"}var q=o.shorterTotal(o.options.count.delicious);if(typeof q==="undefined"){q=0}g(o.element).find(".buttons").append('<div class="button delicious">
36<div style="'+p+'font:12px Arial,Helvetica,sans-serif;cursor:pointer;color:#666666;display:inline-block;float:none;height:20px;line-height:normal;margin:0;padding:0;text-indent:0;vertical-align:baseline;"><div style="'+n+'background-color:#fff;margin-bottom:5px;overflow:hidden;text-align:center;border:1px solid #ccc;border-radius:3px;">'+q+'</div><div style="'+m+'display:block;padding:0;text-align:center;text-decoration:none;width:50px;background-color:#7EACEE;border:1px solid #40679C;border-radius:3px;color:#fff;"><img src="http://www.delicious.com/static/img/delicious.small.gif" height="10" width="10" alt="Delicious" /> Add</div></div></div>');g(o.element).find(".delicious").on("click",function(){o.openPopup("delicious")})},stumbleupon:function(m){var n=m.options.buttons.stumbleupon;g(m.element).find(".buttons").append('<div class="button stumbleupon"><su:badge layout="'+n.layout+'" location="'+(n.url!==""?n.url:m.options.url)+'"></su:badge></div>');var o=0;if(typeof STMBLPN==="undefined"&&o==0){o=1;(function(){var p=j.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.stumbleupon.com/1/widgets.js";var q=j.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})();s=i.setTimeout(function(){if(typeof STMBLPN!=="undefined"){STMBLPN.processWidgets();clearInterval(s)}},500)}else{STMBLPN.processWidgets()}},linkedin:function(m){var n=m.options.buttons.linkedin;g(m.element).find(".buttons").append('<div class="button linkedin"><script type="in/share" data-url="'+(n.url!==""?n.url:m.options.url)+'" data-counter="'+n.counter+'"><\/script></div>');var o=0;if(typeof i.IN==="undefined"&&o==0){o=1;(function(){var p=j.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.linkedin.com/in.js";var q=j.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{i.IN.init()}},pinterest:function(m){var n=m.options.buttons.pinterest;g(m.element).find(".buttons").append('<div class="button pinterest"><a href="http://pinterest.com/pin/create/button/?url='+(n.url!==""?n.url:m.options.url)+"&media="+n.media+"&description="+n.description+'" class="pin-it-button" count-layout="'+n.layout+'">Pin It</a></div>');(function(){var o=j.createElement("script");o.type="text/javascript";o.async=true;o.src="//assets.pinterest.com/js/pinit.js";var p=j.getElementsByTagName("script")[0];p.parentNode.insertBefore(o,p)})()}},d={googlePlus:function(){},facebook:function(){fb=i.setInterval(function(){if(typeof FB!=="undefined"){FB.Event.subscribe("edge.create",function(m){_gaq.push(["_trackSocial","facebook","like",m])});FB.Event.subscribe("edge.remove",function(m){_gaq.push(["_trackSocial","facebook","unlike",m])});FB.Event.subscribe("message.send",function(m){_gaq.push(["_trackSocial","facebook","send",m])});clearInterval(fb)}},1000)},twitter:function(){tw=i.setInterval(function(){if(typeof twttr!=="undefined"){twttr.events.bind("tweet",function(m){if(m){_gaq.push(["_trackSocial","twitter","tweet"])}});clearInterval(tw)}},1000)},digg:function(){},delicious:function(){},stumbleupon:function(){},linkedin:function(){function m(){_gaq.push(["_trackSocial","linkedin","share"])}},pinterest:function(){}},a={googlePlus:function(m){i.open("https://plus.google.com/share?hl="+m.buttons.googlePlus.lang+"&url="+encodeURIComponent((m.buttons.googlePlus.url!==""?m.buttons.googlePlus.url:m.url)),"","toolbar=0, status=0, width=900, height=500")},facebook:function(m){i.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((m.buttons.facebook.url!==""?m.buttons.facebook.url:m.url))+"&t="+m.text+"","","toolbar=0, status=0, width=900, height=500")},twitter:function(m){i.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(m.text)+"&url="+encodeURIComponent((m.buttons.twitter.url!==""?m.buttons.twitter.url:m.url))+(m.buttons.twitter.via!==""?"&via="+m.buttons.twitter.via:""),"","toolbar=0, status=0, width=650, height=360")},digg:function(m){i.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((m.buttons.digg.url!==""?m.buttons.digg.url:m.url))+"&title="+m.text+"&related=true&style=true","","toolbar=0, status=0, width=650, height=360")},delicious:function(m){i.open("http://www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&title="+m.text,"delicious","toolbar=no,width=550,height=550")},stumbleupon:function(m){i.open("http://www.stumbleupon.com/badge/?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url)),"stumbleupon","toolbar=no,width=550,height=550")},linkedin:function(m){i.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&token=&isFramed=true","linkedin","toolbar=no,width=550,height=550")},pinterest:function(m){i.open("http://pinterest.com/pin/create/button/?url="+encodeURIComponent((m.buttons.pinterest.url!==""?m.buttons.pinterest.url:m.url))+"&media="+encodeURIComponent(m.buttons.pinterest.media)+"&description="+m.buttons.pinterest.description,"pinterest","toolbar=no,width=700,height=300")}};function k(n,m){this.element=n;this.options=g.extend(true,{},f,m);this.options.share=m.share;this._defaults=f;this._name=h;this.init()}k.prototype.init=function(){var m=this;if(this.options.urlCurl!==""){c.googlePlus=this.options.urlCurl+"?url={url}&type=googlePlus";c.stumbleupon=this.options.urlCurl+"?url={url}&type=stumbleupon";c.pinterest=this.options.urlCurl+"?url={url}&type=pinterest"}g(this.element).addClass(this.options.className);if(typeof g(this.element).data("title")!=="undefined"){this.options.title=g(this.element).attr("data-title")}if(typeof g(this.element).data("url")!=="undefined"){this.options.url=g(this.element).data("url")}if(typeof g(this.element).data("text")!=="undefined"){this.options.text=g(this.element).data("text")}g.each(this.options.share,function(n,o){if(o===true){m.options.shareTotal++}});if(m.options.enableCounter===true){g.each(this.options.share,function(n,p){if(p===true){try{m.getSocialJson(n)}catch(o){}}})}else{if(m.options.template!==""){this.options.render(this,this.options)}else{this.loadButtons()}}g(this.element).hover(function(){if(g(this).find(".buttons").length===0&&m.options.enableHover===true){m.loadButtons()}m.options.hover(m,m.options)},function(){m.options.hide(m,m.options)});g(this.element).click(function(){m.options.click(m,m.options);return false})};k.prototype.loadButtons=function(){var m=this;g(this.element).append('<div class="buttons"></div>');g.each(m.options.share,function(n,o){if(o==true){l[n](m);if(m.options.enableTracking===true){d[n]()}}})};k.prototype.getSocialJson=function(o){var m=this,p=0,n=c[o].replace("{url}",encodeURIComponent(this.options.url));if(this.options.buttons[o].urlCount===true&&this.options.buttons[o].url!==""){n=c[o].replace("{url}",this.options.buttons[o].url)}if(n!=""&&m.options.urlCurl!==""){g.getJSON(n,function(r){if(typeof r.count!=="undefined"){var q=r.count+"";q=q.replace("\u00c2\u00a0","");p+=parseInt(q,10)}else{if(r.data&&r.data.length>0&&typeof r.data[0].total_count!=="undefined"){p+=parseInt(r.data[0].total_count,10)}else{if(typeof r.shares!=="undefined"){p+=parseInt(r.shares,10)}else{if(typeof r[0]!=="undefined"){p+=parseInt(r[0].total_posts,10)}else{if(typeof r[0]!=="undefined"){}}}}}m.options.count[o]=p;m.options.total+=p;m.renderer();m.rendererPerso()}).error(function(){m.options.count[o]=0;m.rendererPerso()})}else{m.renderer();m.options.count[o]=0;m.rendererPerso()}};k.prototype.rendererPerso=function(){var m=0;for(e in this.options.count){m++}if(m===this.options.shareTotal){this.options.render(this,this.options)}};k.prototype.renderer=function(){var n=this.options.total,m=this.options.template;if(this.options.shorterTotal===true){n=this.shorterTotal(n)}if(m!==""){m=m.replace("{total}",n);g(this.element).html(m)}else{g(this.element).html('<div class="box"><a class="count" href="#">'+n+"</a>"+(this.options.title!==""?'<a class="share" href="#">'+this.options.title+"</a>":"")+"</div>")}};k.prototype.shorterTotal=function(m){if(m>=1000000){m=(m/1000000).toFixed(2)+"M"}else{if(m>=1000){m=(m/1000).toFixed(1)+"k"}}return m};k.prototype.openPopup=function(m){a[m](this.options);if(this.options.enableTracking===true){var n={googlePlus:{site:"Google",action:"+1"},facebook:{site:"facebook",action:"like"},twitter:{site:"twitter",action:"tweet"},digg:{site:"digg",action:"add"},delicious:{site:"delicious",action:"add"},stumbleupon:{site:"stumbleupon",action:"add"},linkedin:{site:"linkedin",action:"share"},pinterest:{site:"pinterest",action:"pin"}};_gaq.push(["_trackSocial",n[m].site,n[m].action])}};k.prototype.simulateClick=function(){var m=g(this.element).html();g(this.element).html(m.replace(this.options.total,this.options.total+1))};k.prototype.update=function(m,n){if(m!==""){this.options.url=m}if(n!==""){this.options.text=n}};g.fn[h]=function(n){var m=arguments;if(n===b||typeof n==="object"){return this.each(function(){if(!g.data(this,"plugin_"+h)){g.data(this,"plugin_"+h,new k(this,n))}})}
36else{if(typeof n==="string"&&n[0]!=="_"&&n!=="init"){return this.each(function(){var o=g.data(this,"plugin_"+h);if(o instanceof k&&typeof o[n]==="function"){o[n].apply(o,Array.prototype.slice.call(m,1))}})}}}})(jQuery,window,document);
37
38
39/**
40 * Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
41 * Dual licensed under MIT and GPL.
42 * @author Ariel Flesler
43 * @version 1.4.3.1
44 */
45(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
46
47
48/*
49 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
50 *
51 * Uses the built in easing capabilities added In jQuery 1.1
52 * to offer multiple easing options
53 *
54 * TERMS OF USE - jQuery Easing
55 * 
56 * Open source under the BSD License. 
57 * 
58 * Copyright © 2008 George McGinley Smith
59 * All rights reserved.
60 * 
61 * Redistribution and use in source and binary forms, with or without modification, 
62 * are permitted provided that the following conditions are met:
63 * 
64 * Redistributions of source code must retain the above copyright notice, this list of 
65 * conditions and the following disclaimer.
66 * Redistributions in binary form must reproduce the above copyright notice, this list 
67 * of conditions and the following disclaimer in the documentation and/or other materials 
68 * provided with the distribution.
69 * 
70 * Neither the name of the author nor the names of contributors may be used to endorse 
71 * or promote products derived from this software without specific prior written permission.
72 * 
73 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
74 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
75 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
76 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
77 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
78 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
79 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
80 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
81 * OF THE POSSIBILITY OF SUCH DAMAGE. 
82 *
83*/
84
85// t: current time, b: begInnIng value, c: change In value, d: duration
86jQuery.easing['jswing'] = jQuery.easing['swing'];
87jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return -c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b}return -c/2*((--t)*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t+b}return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return -c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b}return -c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t*t+b}return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return -c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return -c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0){return b}if(t==d){return b+c}if((t/=d/2)<1){return c/2*Math.pow(2,10*(t-1))+b}return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return -c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1){return -c/2*(Math.sqrt(1-t*t)-1)+b}return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0){return b}if((t/=d)==1){return b+c}if(!p){p=d*0.3}if(a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}return -(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0){return b}if((t/=d)==1){return b+c}if(!p){p=d*0.3}if(a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0){return b}if((t/=d/2)==2){return b+c}if(!p){p=d*(0.3*1.5)}
vendor: 7,355 bytes, lines 87-129
87if(a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}if(t<1){return -0.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b}return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*0.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined){s=1.70158}return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined){s=1.70158}return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined){s=1.70158}if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b}return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else{if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+0.75)+b}else{if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+0.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+0.984375)+b}}}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2){return jQuery.easing.easeInBounce(x,t*2,0,c,d)*0.5+b}return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*0.5+c*0.5+b}});
88
89/*
90 *
91 * TERMS OF USE - EASING EQUATIONS
92 * 
93 * Open source under the BSD License. 
94 * 
95 * Copyright © 2001 Robert Penner
96 * All rights reserved.
97 * 
98 * Redistribution and use in source and binary forms, with or without modification, 
99 * are permitted provided that the following conditions are met:
100 * 
101 * Redistributions of source code must retain the above copyright notice, this list of 
102 * conditions and the following disclaimer.
103 * Redistributions in binary form must reproduce the above copyright notice, this list 
104 * of conditions and the following disclaimer in the documentation and/or other materials 
105 * provided with the distribution.
106 * 
107 * Neither the name of the author nor the names of contributors may be used to endorse 
108 * or promote products derived from this software without specific prior written permission.
109 * 
110 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
111 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
112 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
113 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
114 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
115 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
116 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
117 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
118 * OF THE POSSIBILITY OF SUCH DAMAGE. 
119 */
120
121
122
123/* ------------------------------------------------------------------------
124	Class: prettyPhoto
125	Use: Lightbox clone for jQuery
126	Author: Stephane Caron (http://www.no-margin-for-errors.com)
127	Version: 3.1.5
128------------------------------------------------------------------------- */
129(function($){$.prettyPhoto={version:"3.1.5"};$.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend({hook:"rel",animation_speed:"fast",ajaxcallback:function(){},slideshow:5000,autoplay_slideshow:false,opacity:0.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:'<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"> 											<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> 											<p class="pp_description"></p> 											<div class="pp_social">{pp_social}</div> 											<a class="pp_close" href="#">Close</a> 										</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>',gallery_markup:'<div class="pp_gallery"> 								<a href="#" class="pp_arrow_previous">Previous</a> 								<div> 									<ul> 										{gallery} 									</ul> 								</div> 								<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>',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">{content}</div>',custom_markup:"",social_tools:'<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"><\/script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>'},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()});
129if(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}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;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(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("&nbsp;");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();
129if(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(s?):\/\/(www\.)?vimeo.com\/(\d+)/;var match=movie_id.match(regExp);movie="http://player.vimeo.com/video/"+match[3]+"?title=0&amp;byline=0&amp;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('<br clear="all" />').css({width:settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').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}
129if(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(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;var isMobile=PEXETO.utils.checkIfMobile(),spacing=isMobile?40:200;_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-spacing);imageHeight=(height/width)*imageWidth}else{if((pp_containerHeight>windowHeight)){imageHeight=(windowHeight-spacing);imageWidth=(width/height)*imageHeight}else{fitting=true}}pp_containerHeight=imageHeight,pp_containerWidth=imageWidth}if(!isMobile){if((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight)){_fitToViewport(pp_containerWidth,pp_containerHeight)}}_getDimensions(imageWidth,imageHeight)}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();
129detailsHeight=(detailsHeight<=34)?36:detailsHeight;$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"){itemWidth=52+5;navWidth=(settings.theme=="facebook"||settings.theme=="pp_default")?50:30;itemsPerPage=Math.floor((pp_dimensions.containerWidth-100-navWidth)/itemWidth);itemsPerPage=(itemsPerPage<pp_images.length)?itemsPerPage:pp_images.length;totalPage=Math.ceil(pp_images.length/itemsPerPage)-1;if(totalPage==0){navWidth=0;$pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").hide()}else{$pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").show()}galleryWidth=itemsPerPage*itemWidth;fullGalleryWidth=pp_images.length*itemWidth;$pp_gallery.css("margin-left",-((galleryWidth/2)+(navWidth/2))).find("div:first").width(galleryWidth+5).find("ul").width(fullGalleryWidth).find("li.selected").removeClass("selected");goToPage=(Math.floor(set_position/itemsPerPage)<totalPage)?Math.floor(set_position/itemsPerPage):totalPage;$.prettyPhoto.changeGalleryPage(goToPage);$pp_gallery_li.filter(":eq("+set_position+")").addClass("selected")}else{$pp_pic_holder.find(".pp_content").unbind("mouseenter mouseleave")}}function _build_overlay(caller){if(settings.social_tools){facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href))}settings.markup=settings.markup.replace("{pp_social}","");$("body").append(settings.markup);$pp_pic_holder=$(".pp_pic_holder"),$ppt=$(".ppt"),$pp_overlay=$("div.pp_overlay");if(isSet&&settings.overlay_gallery){currentGalleryPage=0;toInject="";for(var i=0;i<pp_images.length;i++){if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){classname="default";img_src=""}else{classname="";img_src=pp_images[i]}toInject+="<li class='"+classname+"'><a href='#'><img src='"+img_src+"' width='50' alt='' /></a></li>"}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('<a href="#" class="pp_play">Play</a>');$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(){var 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;
130
131
132
133// Generated by CoffeeScript 1.4.0
134/*
135jQuery Waypoints - v2.0.2
136Copyright (c) 2011-2013 Caleb Troughton
137Dual licensed under the MIT license and GPL license.
138https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt
139*/
140(function(){var t=[].indexOf||function(t){for(var e=0,n=this.length;e<n;e++){if(e in this&&this[e]===t)return e}return-1},e=[].slice;(function(t,e){if(typeof define==="function"&&define.amd){return define("waypoints",["jquery"],function(n){return e(n,t)})}else{return e(t.jQuery,t)}})(this,function(n,r){var i,o,l,s,f,u,a,c,h,d,p,y,v,w,g,m;i=n(r);c=t.call(r,"ontouchstart")>=0;s={horizontal:{},vertical:{}};f=1;a={};u="waypoints-context-id";p="resize.waypoints";y="scroll.waypoints";v=1;
vendor: 6,759 bytes, line 140
140w="waypoints-waypoint-ids";g="waypoint";m="waypoints";o=function(){function t(t){var e=this;this.$element=t;this.element=t[0];this.didResize=false;this.didScroll=false;this.id="context"+f++;this.oldScroll={x:t.scrollLeft(),y:t.scrollTop()};this.waypoints={horizontal:{},vertical:{}};t.data(u,this.id);a[this.id]=this;t.bind(y,function(){var t;if(!(e.didScroll||c)){e.didScroll=true;t=function(){e.doScroll();return e.didScroll=false};return r.setTimeout(t,n[m].settings.scrollThrottle)}});t.bind(p,function(){var t;if(!e.didResize){e.didResize=true;t=function(){n[m]("refresh");return e.didResize=false};return r.setTimeout(t,n[m].settings.resizeThrottle)}})}t.prototype.doScroll=function(){var t,e=this;t={horizontal:{newScroll:this.$element.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.$element.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};if(c&&(!t.vertical.oldScroll||!t.vertical.newScroll)){n[m]("refresh")}n.each(t,function(t,r){var i,o,l;l=[];o=r.newScroll>r.oldScroll;i=o?r.forward:r.backward;n.each(e.waypoints[t],function(t,e){var n,i;if(r.oldScroll<(n=e.offset)&&n<=r.newScroll){return l.push(e)}else if(r.newScroll<(i=e.offset)&&i<=r.oldScroll){return l.push(e)}});l.sort(function(t,e){return t.offset-e.offset});if(!o){l.reverse()}return n.each(l,function(t,e){if(e.options.continuous||t===l.length-1){return e.trigger([i])}})});return this.oldScroll={x:t.horizontal.newScroll,y:t.vertical.newScroll}};t.prototype.refresh=function(){var t,e,r,i=this;r=n.isWindow(this.element);e=this.$element.offset();this.doScroll();t={horizontal:{contextOffset:r?0:e.left,contextScroll:r?0:this.oldScroll.x,contextDimension:this.$element.width(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:r?0:e.top,contextScroll:r?0:this.oldScroll.y,contextDimension:r?n[m]("viewportHeight"):this.$element.height(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};return n.each(t,function(t,e){return n.each(i.waypoints[t],function(t,r){var i,o,l,s,f;i=r.options.offset;l=r.offset;o=n.isWindow(r.element)?0:r.$element.offset()[e.offsetProp];if(n.isFunction(i)){i=i.apply(r.element)}else if(typeof i==="string"){i=parseFloat(i);if(r.options.offset.indexOf("%")>-1){i=Math.ceil(e.contextDimension*i/100)}}r.offset=o-e.contextOffset+e.contextScroll-i;if(r.options.onlyOnScroll&&l!=null||!r.enabled){return}if(l!==null&&l<(s=e.oldScroll)&&s<=r.offset){return r.trigger([e.backward])}else if(l!==null&&l>(f=e.oldScroll)&&f>=r.offset){return r.trigger([e.forward])}else if(l===null&&e.oldScroll>=r.offset){return r.trigger([e.forward])}})})};t.prototype.checkEmpty=function(){if(n.isEmptyObject(this.waypoints.horizontal)&&n.isEmptyObject(this.waypoints.vertical)){this.$element.unbind([p,y].join(" "));return delete a[this.id]}};return t}();l=function(){function t(t,e,r){var i,o;r=n.extend({},n.fn[g].defaults,r);if(r.offset==="bottom-in-view"){r.offset=function(){var t;t=n[m]("viewportHeight");if(!n.isWindow(e.element)){t=e.$element.height()}return t-n(this).outerHeight()}}this.$element=t;this.element=t[0];this.axis=r.horizontal?"horizontal":"vertical";this.callback=r.handler;this.context=e;this.enabled=r.enabled;this.id="waypoints"+v++;this.offset=null;this.options=r;e.waypoints[this.axis][this.id]=this;s[this.axis][this.id]=this;i=(o=t.data(w))!=null?o:[];i.push(this.id);t.data(w,i)}t.prototype.trigger=function(t){if(!this.enabled){return}if(this.callback!=null){this.callback.apply(this.element,t)}if(this.options.triggerOnce){return this.destroy()}};t.prototype.disable=function(){return this.enabled=false};t.prototype.enable=function(){this.context.refresh();return this.enabled=true};t.prototype.destroy=function(){delete s[this.axis][this.id];delete this.context.waypoints[this.axis][this.id];return this.context.checkEmpty()};t.getWaypointsByElement=function(t){var e,r;r=n(t).data(w);if(!r){return[]}e=n.extend({},s.horizontal,s.vertical);return n.map(r,function(t){return e[t]})};return t}();d={init:function(t,e){var r;if(e==null){e={}}if((r=e.handler)==null){e.handler=t}this.each(function(){var t,r,i,s;t=n(this);i=(s=e.context)!=null?s:n.fn[g].defaults.context;if(!n.isWindow(i)){i=t.closest(i)}i=n(i);r=a[i.data(u)];if(!r){r=new o(i)}return new l(t,r,e)});n[m]("refresh");return this},disable:function(){return d._invoke(this,"disable")},enable:function(){return d._invoke(this,"enable")},destroy:function(){return d._invoke(this,"destroy")},prev:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){if(e>0){return t.push(n[e-1])}})},next:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){if(e<n.length-1){return t.push(n[e+1])}})},_traverse:function(t,e,i){var o,l;if(t==null){t="vertical"}if(e==null){e=r}l=h.aggregate(e);o=[];this.each(function(){var e;e=n.inArray(this,l[t]);return i(o,e,l[t])});return this.pushStack(o)},_invoke:function(t,e){t.each(function(){var t;t=l.getWaypointsByElement(this);return n.each(t,function(t,n){n[e]();return true})});return this}};n.fn[g]=function(){var t,r;r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[];if(d[r]){return d[r].apply(this,t)}else if(n.isFunction(r)){return d.init.apply(this,arguments)}else if(n.isPlainObject(r)){return d.init.apply(this,[null,r])}else if(!r){return n.error("jQuery Waypoints needs a callback function or handler option.")}else{return n.error("The "+r+" method does not exist in jQuery Waypoints.")}};n.fn[g].defaults={context:r,continuous:true,enabled:true,horizontal:false,offset:0,triggerOnce:false};h={refresh:function(){return n.each(a,function(t,e){return e.refresh()})},viewportHeight:function(){var t;return(t=r.innerHeight)!=null?t:i.height()},aggregate:function(t){var e,r,i;e=s;if(t){e=(i=a[n(t).data(u)])!=null?i.waypoints:void 0}if(!e){return[]}r={horizontal:[],vertical:[]};n.each(r,function(t,i){n.each(e[t],function(t,e){return i.push(e)});i.sort(function(t,e){return t.offset-e.offset});r[t]=n.map(i,function(t){return t.element});return r[t]=n.unique(r[t])});return r},above:function(t){if(t==null){t=r}return h._filter(t,"vertical",function(t,e){return e.offset<=t.oldScroll.y})},below:function(t){if(t==null){t=r}return h._filter(t,"vertical",function(t,e){return e.offset>t.oldScroll.y})},left:function(t){if(t==null){t=r}return h._filter(t,"horizontal",function(t,e){return e.offset<=t.oldScroll.x})},right:function(t){if(t==null){t=r}return h._filter(t,"horizontal",function(t,e){return e.offset>t.oldScroll.x})},enable:function(){return h._invoke("enable")},disable:function(){return h._invoke("disable")},destroy:function(){return h._invoke("destroy")},extendFn:function(t,e){return d[t]=e},_invoke:function(t){var e;e=n.extend({},s.vertical,s.horizontal);
140return n.each(e,function(e,n){n[t]();return true})},_filter:function(t,e,r){var i,o;i=a[n(t).data(u)];if(!i){return[]}o=[];n.each(i.waypoints[e],function(t,e){if(r(i,e)){return o.push(e)}});o.sort(function(t,e){return t.offset-e.offset});return n.map(o,function(t){return t.element})}};n[m]=function(){var t,n;n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[];if(h[n]){return h[n].apply(null,t)}else{return h.aggregate.call(null,n)}};n[m].settings={resizeThrottle:100,scrollThrottle:30};return i.load(function(){return n[m]("refresh")})})}).call(this);
141
142
143
144/**
145 * Portfolio item slider (carousel) - displays a set of images, separated by pages.
146 * The pages can be changed by clicking on arrows with an animation.
147 * @author Pexeto
148 * http://pexetothemes.com
149 */
150(function($) {
151	"use strict";
152
153	var carouselId = 0;
154
155	$.fn.pexetoCarousel = function(options) {
156		carouselId++;
157
158			var defaults        = {
159				//set the default options (can be overwritten from the calling function)
160				minItemWidth        : 290,
161				namespace           : 'carousel' + carouselId,
162				itemMargin          : 12,
163				shadowWidth         : 0,
164				selfDisplay         : true, //if set to true, the carousel will get displayed 
165				//as soon as it is loaded. Otherwise, the calling code would be
166				//responsible to display the carousel (set its opacity to 1)
167				
168				//selectors and classes
169				holderSelector      : '.pc-holder',
170				pageWrapperSelector : '.pc-page-wrapper',
171				wrapperSel          : '.pc-wrapper',
172				itemSelector        : '.pc-item',
173				titleSelector       : '.portfolio-project-title',
174				hoverClass          : 'portfolio-hover',
175				headerSelector      : '.pc-header'
176			},
177			o            = $.extend(defaults, options),
178			//define some variables that will be used globally within the script
179			$container   = this,
180			$root        = $container.find(o.holderSelector).eq(0),
181			$items       = $root.find(o.itemSelector),
182			$wrapper     = $container.find(o.wrapperSel),
183			$header      = $container.find(o.headerSelector),
184			pageNumber   = 0,
185			itemsNumber  = $items.length,
186			currentPage  = 0,
187			inAnimation  = false,
188			pageWidth    = $root.find(o.pageWrapperSelector).eq(0).width(),
189			itemsPerPage = 0,
190			columns      = 0,
191			$prevArrow   = null,
192			$nextArrow   = null;
193
194
195		/**
196		 * Inits the main functionality.
197		 */
198
199		function init() {
200
201			var defWidth = parseInt($items.eq(0).data('defwidth'), 10);
202			if($container.hasClass('pc-no-spacing')){
203				o.itemMargin = 0;
204			}
205
206			if(defWidth && defWidth>100){
207				o.minItemWidth = defWidth - 70;
208			}
209
210			pageNumber = $root.find(o.pageWrapperSelector).length;
211
212			if(pageNumber > 1) {
213				//show the arrows and add the animation functionality if there are 
214				//more than one pages
215				buildNavigation();
216			}
217
218			setImageSize();
219
220			bindEventHandlers();
221
222			if(o.selfDisplay) {
223				$container.animate({
224					opacity: 1
225				});
226			}
227
228			itemsPerPage = $root.find(o.pageWrapperSelector + ':first' + ' ' + o.itemSelector).length;
229
230		}
231
232		/**
233		 * Sets the image size according to the current wrapper width.
234		 */
235		function setImageSize() {
236			var itemWidth, rootWidth;
237
238			columns = Math.floor(($container.width() - o.itemMargin) / (o.minItemWidth + o.itemMargin));
239
240			if(columns <= 1) {
241				columns = 2;
242			}
243			itemWidth = Math.floor(($container.width() + o.itemMargin - 2 * o.shadowWidth) / columns) - o.itemMargin;
244
245			$items.width(itemWidth+1);
246
247			pageWidth = $root.find(o.pageWrapperSelector).eq(0).width();
248
249			rootWidth = pageNumber * pageWidth + 1000;
250			$root.css({
251				width: rootWidth
252			});
253
254			setNavigationVisibility();
255
256		}
257
258		/**
259		 * Binds a change slide event handler to the root, so that it can be animated
260		 * when any of the navigation buttons has been clicked.
261		 */
262
263		function bindEventHandlers() {
264			if(pageNumber > 1) {
265
266				//mobile device finger slide events
267				$root.touchwipe({
268					wipeLeft: doOnNextSlide,
269					wipeRight: doOnPreviousSlide,
270					preventDefaultEvents: false
271				});
272
273				$(window).on('resize.' + o.namespace, doOnWindowResize);
274			}
275
276			$root.on('destroy' + o.namespace, doOnDestroy);
277		}
278
279		/**
280		 * Changes the current slide of items, to another one.
281		 * @param  {int} index the index of the new slide to show
282		 */
283		function changeSlide(index) {
284			if(!inAnimation) {
285				inAnimation = true;
286				var margin = getPageMarginPosition(index);
287				$root.animate({
288					marginLeft: [margin, 'easeOutExpo']
289				}, 800, function() {
290					inAnimation = false;
291					currentPage = index;
292				});
293			}
294		}
295
296		/**
297		 * Calculates the position offset (margin) of the current slide 
298		 * according to the current wrapper width.
299		 * @param  {int} index the inex of the current slide
300		 * @return {int}       the calculated margin
301		 */
302		function getPageMarginPosition(index) {
303			setSizes();
304			return -index * pageWidth - o.itemMargin / 2 + o.shadowWidth;
305		}
306
307		function setSizes(){
308			setImageSize();
309			pageWidth = $root.find(o.pageWrapperSelector).eq(0).width();
310		}
311
312		/**
313		 * On window resize event handler - resizes the wrapper and then the
314		 * inner images according to the current window size.
315		 */
316		function doOnWindowResize() {
317			setSizes();
318			$root.css({
319				marginLeft: getPageMarginPosition(currentPage)
320			});
321		}
322
323		/**
324		 * On next slide event handler - shows the next slide if there is one.
325		 */
326		function doOnNextSlide() {
327			if(!inAnimation){
328				if(!isLastPageVisible()) {
329					var index = currentPage < pageNumber - 1 ? currentPage + 1 : 0;
330					changeSlide(index);
331				} else {
332					animateLastPage(true);
333				}
334			}
335
336		}
337
338		/**
339		 * On previous slide event handler - shows the previous slide if there
340		 * is one.
341		 */
342		function doOnPreviousSlide() {
343			if(!inAnimation){
344				if(currentPage > 0) {
345					changeSlide(currentPage - 1);
346				} else {
347					animateLastPage(false);
348				}
349			}
350
351		}
352
353		/**
354		 * Animates the carousel when there are no more slides left and the
355		 * user still tries to open the previous/next slide - animates it in a
356		 * way to show that there are no more slides.
357		 * @param  {boolean} last setting whether this is the last slide (when
358		 * set to true) or the first slide (when set to false)
359		 */
360		function animateLastPage(last) {
361			var i = last ? -1 : 1;
362			$root.stop().animate({
363				left: i * 10
364			}, 100, function() {
365				$(this).stop().animate({
366					left: 0
367				}, 300);
368			});
369		}
370
371		/**
372		 * Checks if the last slide/page is visible on the carousel.
373		 * @return {boolean} true if it is visible and false if it is not
374		 */
375		function isLastPageVisible() {
376			if((itemsNumber - currentPage * itemsPerPage) <= columns) {
377				return true;
378			} 
379			
380			return false;
381		}
382
383		/**
384		 * Checks if all of the slides/pages are visible on the carousel.
385		 * @return {boolean} true if they are visible and false if they are not
386		 */
387		function areAllPagesVisible() {
388			return(itemsNumber <= columns && currentPage === 0) ? true : false;
389		}
390
391		/**
392		 * Builds the navigation (arrows) to change the slides.
393		 */
394		function buildNavigation() {
395
396			//next items arrow
397			$prevArrow = $('<div />', {
398				'class': 'pc-next hover'
399			}).on('click.' + o.namespace, doOnNextSlide).appendTo($wrapper);
400
401			//previous items arrow
402			$nextArrow = $('<div />', {
403				'class': 'pc-prev hover'
404			}).on('click.' + o.namespace, doOnPreviousSlide).appendTo($wrapper);
405		}
406
407		/**
408		 * Shows the navigation arrows when there are some slides that are not
409		 * visible and hides them when all of the slides are visible.
410		 */
411		function setNavigationVisibility() {
412			if(areAllPagesVisible()) {
413				if($prevArrow){
414					$prevArrow.hide();
415				}
416				if($nextArrow){
417					$nextArrow.hide();
418				}
419			} else {
420				if($prevArrow){
421					$prevArrow.show();
422				}
423				if($nextArrow){
424					$nextArrow.show();
425				}
426			}
427
428		}
429
430		/**
431		 * On destroy event handler- removes all the registered event listeners.
432		 */
433		function doOnDestroy() {
434			$(window).off('.' + o.namespace);
435			$root.off('.' + o.namespace);
436			$prevArrow.off('.' + o.namespace);
437			$nextArrow.off('.' + o.namespace);
438		}
439
440
441		if($root.length) {
442			init();
443		}
444
445	};
446}(jQuery));
447
448(function($) {
449	"use strict";
450
451	//CSS 3 transition support detection - code from: https://gist.github.com/jonraasch/373874
452	var thisBody = document.body || document.documentElement,
453	thisStyle = thisBody.style,
454	supportTransition = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined;
455
456	$.fn.pexetoTransit = function(){
457		var properties={},
458			callback = null,
459			namespace = 'pexetoTransit',
460			callbackCalled = false;
461
462		if(!arguments.length || typeof arguments[0]!=='object'){
463			return $(this);
464		}
465
466		if(supportTransition){
467			properties = arguments[0];
468
469			if(arguments[1]){
470				callback = arguments[1];
471				$(this).on('transitionend.'+namespace+' webkitTransitionEnd.'+namespace+' oTransitionEnd.'+namespace+' MSTransitionEnd.'+namespace, function(e){
472					if(!callbackCalled){
473						callback.call();
474						$(this).off(namespace);
475						callbackCalled = true;
476					}
477					
478				});
479			}
480			$(this).css(properties);
481		}else{
482			$.fn.animate.apply($(this), arguments);
483		}
484
485		return $(this);
486	};
487
488}(jQuery));
489
490
491/**
492 * Pexeto Contact Form - contains all the contact form functionality.
493 * @author Pexeto
494 * http://pexetothemes.com
495 */
496(function($) {
497	"use strict";
498
499	$.fn.pexetoContactForm = function(options) {
500		var defaults = {
501			//set the default options (CAN BE OVERWRITTEN BY THE INITIALIZATION CODE)
502			ajaxurl             : '',
503			invalidClass        : 'invalid',
504			afterValidClass     : 'after-validation',
505			captcha             : false,
506			
507			//selectors
508			submitSel           : '.send-button',
509			errorSel            : '.error-message',
510			statusSel           : '.contact-status',
511			sentSel             : '.sent-message',
512			loaderSel           : '.contact-loader',
513			checkSel            : '.check',
514			failSel             : '.fail-message',
515			inputWrapperSel     : '.contact-input-wrapper',
516			
517			//texts
518			wrongCaptchaText    : 'The text you have entered did not match the text on the image. Please try again.',
519			failText            : 'An error occurred. Message not sent',
520			validationErrorText : 'Please fill in all the fields correctly',
521			messageSentText     : 'Message sent'
522		};
523
524
525		var o = $.extend(defaults, options);
526		o.ajaxurl = $(this).attr('action');
527
528		//define some variables that will be used globally within the script
529		var $root           = $(this),
530			$requiredFields = $root.find('input.required, textarea.required, #recaptcha_response_field'),
531			$fields         = $root.find('input, textarea'),
532			$errorBox       = $root.find(o.errorSel),
533			$sentBox        = $root.find(o.sentSel),
534			$loader         = $root.find(o.loaderSel),
535			$check          = $root.find(o.checkSel);
536
537		/**
538		 * Inits the main functionality.
539		 */
540
541		function init() {
542			$fields.on('focus', doOnFieldsFocus);
543			$root.find(o.submitSel).eq(0).on('click', doOnSendClicked);
544		}
545
546		/**
547		 * On send button click event handler. Sends an AJAX request to send the message if the
548		 * entered input data is valid.
549		 * @param  {object} e the event object
550		 */
551
552		function doOnSendClicked(e) {
553			//set the send button click handler functionality
554			e.preventDefault();
555			var isValid = validateForm();
556
557			if(isValid) {
558				//the form is valid, send the email
559				$loader.css({
560					visibility: 'visible'
561				});
562				//hide all the message boxes
563				$errorBox.slideUp();
564
565				var data = $root.serialize() + '&action=pexeto_send_email';
566				//send the AJAX request
567				sendAjaxRequest(data);
568			}
569		}
570
571		/**
572		 * Sends the AJAX request to send the message.
573		 * @param  {object} data the data needed for the request
574		 */
575		function sendAjaxRequest(data) {
576			$.ajax({
577				url: PEXETO.ajaxurl,
578				data: data,
579				dataType: 'json',
580				type: 'post'
581			}).done(function(res) {
582				//reset the form
583				$loader.css({
584					visibility: 'hidden'
585				});
586				if(res.success) {
587					//the message was sent successfully
588					$root.get(0).reset();
589					hideAfterValidationErrors();
590					//show the confirmation check icon
591					$check.css({
592						visibility: 'visible'
593					}, 200);
594
595
596					$sentBox.html(o.messageSentText).slideDown();
597					$.scrollTo($root, {
598						duration:500,
599						offset:{top:-80}
600					});
601
602					setTimeout(function() {
603						//hide the confirmation boxes
604						$sentBox.slideUp();
605						$check.css({
606							visibility: 'hidden'
607						}, 200);
608					}, 3000);
609				} else {
610					//the message was not sent successfully, show an error
611					if(o.captcha && res.captcha_failed) {
612						//captcha did not validate
613						Recaptcha.reload();
614						showErrorMessage(o.wrongCaptchaText);
615					} else {
616						//another error occurred, show general error message
617						showErrorMessage(o.failText);
618					}
619				}
620			}).fail(function() {
621				//the message was not sent successfully, show an error
622				$loader.css({
623					visibility: 'hidden'
624				});
625				showErrorMessage(o.failText);
626			});
627		}
628
629
630		/**
631		 * Validates the form input.
632		 * @return {boolean} true if the form is valid.
633		 */
634
635		function validateForm() {
636			var isValid = true;
637
638			hideValidationErrors();
639			$requiredFields.each(function() {
640				var $elem = $(this);
641				if(!$.trim($elem.val()) || ($elem.hasClass('email') && !isValidEmail($elem.val()))) {
642					//this field value is not valid display an error
643					showError($elem);
644					isValid = false;
645				}
646			});
647
648			if(!isValid) {
649				//show an error box
650				showErrorMessage(o.validationErrorText);
651			}
652			return isValid;
653		}
654
655		/**
656		 * Hides all the validation errors from the required fields.
657		 */
658
659		function hideValidationErrors() {
660			$requiredFields.removeClass(o.invalidClass).removeClass(o.afterValidClass);
661		}
662
663		/**
664		 * Hides the after validation errors and styles from the required fields. After validation
665		 * means when there was a previous validation failure and the user after that clicks on a
666		 * failed field, which gets a new after validation style.
667		 */
668
669		function hideAfterValidationErrors() {
670			$requiredFields.each(function() {
671				var $wrapper = $(this).parents(o.inputWrapperSel).eq(0),
672					$errorElem = $wrapper.length ? $wrapper : $(this);
673				$errorElem.removeClass(o.afterValidClass);
674			});
675		}
676
677		/**
678		 * Adds an error message to an element.
679		 * @param  {object} $elem jQuery object element (input element) to which to add the message
680		 */
681
682		function showError($elem) {
683			var $wrapper = $elem.parents(o.inputWrapperSel).eq(0),
684				$errorElem = $wrapper.length ? $wrapper : $elem;
685			$errorElem.addClass(o.invalidClass);
686		}
687
688		/**
689		 * Displays a fail to send message error.
690		 */
691
692		function showErrorMessage(message) {
693			$errorBox.html(message).slideDown();
694			$.scrollTo($root, {
695				duration:500,
696				offset:{top:-80}
697			});
698		}
699
700		/**
701		 * On field focus in event handler. If the field is required and failed a validation,
702		 * another after validation class is added to it when it gains focus.
703		 */
704
705		function doOnFieldsFocus() {
706			var $wrapper = $(this).parents(o.inputWrapperSel).eq(0),
707				$errorElem = $wrapper.length ? $wrapper : $(this);
708			if($errorElem.hasClass(o.invalidClass)) {
709				$errorElem.addClass(o.afterValidClass);
710			}
711			$errorElem.removeClass(o.invalidClass);
712		}
713
714
715		/**
716		 * Checks if an email address is a valid one.
717		 *
718		 * @param {string} email the email address to validate
719		 * @return {boolean} true if the address is a valid one
720		 */
721
722		function isValidEmail(email) {
723			var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
724			return pattern.test(email);
725		}
726
727		if($root.length) {
728			init();
729		}
730
731	};
732}(jQuery));
733
734/**
735 * Define a placeholder check to jQuery.support
736 * code adapted from: http://diveintohtml5.org/detect.html#input-placeholder
737 */
738jQuery.support.placeholder = (function() {
739	var i = document.createElement('input');
740	return 'placeholder' in i;
741})();
742
743
744
745(function($) {
746	"use strict";
747
748	/**
749	 * Calls a callback function when all the images from a collection have been loaded.
750	 * A "callback" parameter should be added - the function to be called when all the
751	 * images are loaded.
752	 * @param  {object} options object literal containing the initialization options
753	 *
754	 * Dependencies: jQuery (http://jquery.com/)
755	 *
756	 * Example usage: $('.test img').pexetoOnImgLoaded({callback:showImages});
757	 *
758	 * @author Pexeto
759	 * http://pexetothemes.com
760	 */
761	$.fn.pexetoOnImgLoaded = function(options) {
762		var defaults     = {},
763			o            = $.extend(defaults, options),
764			$images      = $(this),
765			ie           = PEXETO.getBrowser().msie;
766
767
768		/**
769		 * Contains the main plugin functionality - once all the images are loaded, calls the
770		 * callback function.
771		 */
772
773		function init() {
774			var imagesNum = $images.length,
775				imgLoaded = 0;
776
777			if(!imagesNum) {
778				o.callback.call(this);
779				return;
780			}
781
782			$images.each(function() {
783
784				$(this).one('load', function(e) {
785					e.stopPropagation();
786					imgLoaded++;
787					if(imgLoaded === imagesNum) {
788						//all the images are loaded, call the callback function
789						o.callback.call(this);
790						$(this).off('load');
791					}
792				}).on('error', function(){
793					$(this).trigger('load');
794				});
795
796				if(this.complete || (ie && this.width)) {
797					$(this).trigger('load');
798				}
799			});
800		}
801
802		init();
803	};
804}(jQuery));
805
806
807(function($) {
808	"use strict";
809
810	/**
811	 * Pexeto Tabs Widget.
812	 * Dependencies : jQuery
813	 *
814	 * @author Pexeto
815 	 * http://pexetothemes.com
816	 */
817	$.fn.pexetoTabs = function(options) {
818		var defaults = {
819			//selectors and classes
820			tabSel       : '.tabs li',
821			paneSel      : '.panes>div',
822			currentClass : 'current'
823		},
824		o       = $.extend(defaults, options),
825		$root   = $(this),
826		$tabs   = $root.find(o.tabSel),
827		$panes  = $root.find(o.paneSel),
828		current = 0;
829
830
831		/**
832		 * Inits the tabs - sets a click event handler to the tabs.
833		 */
834		function init() {
835			showSelected(0);
836
837			$root.on('click', o.tabSel, function(e) {
838				e.preventDefault();
839
840				var index = $tabs.index($(this));
841
842				if(index !== current) {
843					hideTab(current);
844					showSelected(index);
845				}
846
847			});
848		}
849
850		/**
851		 * Displays the selected tab.
852		 * @param  {int} index the index of the selected tab
853		 */
854		function showSelected(index) {
855			$panes.eq(index).fadeIn();
856			$tabs.eq(index).addClass(o.currentClass);
857			current = index;
858		}
859
860		/**
861		 * Hides a tab when a new one has been selected.
862		 * @param  {index} index the index of the tab to hide
863		 */
864		function hideTab(index) {
865			$panes.eq(index).hide();
866			$tabs.eq(index).removeClass(o.currentClass);
867		}
868
869		init();
870	};
871}(jQuery));
872
873
874
875(function($) {
876	"use strict";
877
878	/**
879	 * Pexeto Accordion Widget.
880	 * Dependencies : jQuery
881	 *
882	 * @author Pexeto
883 	 * http://pexetothemes.com
884	 */
885	$.fn.pexetoAccordion = function(options) {
886		var defaults = {
887
888			//selectors and classes
889			tabSel       : '.accordion-title',
890			paneSel      : '.pane',
891			currentClass : 'current'
892		},
893		o       = $.extend(defaults, options),
894		$root   = $(this),
895		$tabs   = $root.find(o.tabSel),
896		$panes  = $root.find(o.paneSel),
897		allClosed = $root.hasClass('accordion-all-closed'),
898		current = allClosed ? -1 : 0;
899
900
901		/**
902		 * Inits the main functionality - registers a click event handler
903		 * to the accordion tabs.
904		 */
905		function init() {
906			$root.data('acc_init', 'true');
907			if(!allClosed){
908				//display the first pane
909				showSelected(0);
910			}
911
912			$root.on('click', o.tabSel, function(e) {
913				e.preventDefault();
914
915				var index = $tabs.index($(this));
916
917				if(index !== current) {
918					hideTab(current);
919					showSelected(index);
920				}else{
921					hideTab(current);
922					current = -1;
923				}
924			});
925		}
926
927		/**
928		 * Displays the selected accordion tab.
929		 * @param  {int} index the index of the selected tab
930		 */
931		function showSelected(index) {
932			$panes.eq(index).stop().animate({
933				height: 'show',
934				opacity: 1
935			});
936			$tabs.eq(index).addClass(o.currentClass);
937			current = index;
938		}
939
940		/**
941		 * Hides a tab when a new one has been selected.
942		 * @param  {index} index the index of the tab to hide
943		 */
944		function hideTab(index) {
945			var def = new $.Deferred();
946			$panes.eq(index).stop().animate({
947				height: 'hide',
948				opacity: 0
949			}, function() {
950				def.resolve();
951			});
952			$tabs.eq(index).removeClass(o.currentClass);
953			return def.promise();
954		}
955
956		if(!$root.data('acc_init')){
957			init();
958		}
959	};
960}(jQuery));
961
962
963
964/**
965 * PEXETO contains the functionality for initializing all the main scripts in the
966 * site and also some helper functions.
967 *
968 * @type {Object}
969 * @author Pexeto
970 */
971var PEXETO = PEXETO || {};
972
973(function($) {
974	"use strict";
975	
976	$.extend(PEXETO, {
977		ajaxurl       : '',
978		lightboxStyle : 'light_rounded',
979		masonryClass  : 'page-masonry'
980	});
981
982	/**
983	 * Retrieves the current browser info.
984	 * Code from jQuery Migrate: http://code.jquery.com/jquery-migrate-1.2.0.js
985	 * @return an object containing the browser info, for example for IE version 7
986	 * it would return:
987	 * {msie:true, version:7}
988	 */
989	PEXETO.getBrowser = function(){
990		var browser = {},
991			ua,
992			match,
993			matched;
994
995		if(PEXETO.browser){
996			return PEXETO.browser;
997		}
998
999		ua = navigator.userAgent.toLowerCase();
1000
1001		match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
1002			/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
1003			/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
1004			/(msie) ([\w.]+)/.exec( ua ) ||
1005			ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
1006			[];
1007
1008		matched = {
1009			browser: match[ 1 ] || "",
1010			version: match[ 2 ] || "0"
1011		};
1012
1013		if ( matched.browser ) {
1014			browser[ matched.browser ] = true;
1015			browser.version = matched.version;
1016		}
1017
1018		// Chrome is Webkit, but Webkit is also Safari.
1019		if ( browser.chrome ) {
1020			browser.webkit = true;
1021		} else if ( browser.webkit ) {
1022			browser.safari = true;
1023		}
1024
1025		PEXETO.browser = browser;
1026
1027		return browser;
1028	}
1029
1030
1031	PEXETO.supportsVideo = function() {
1032		if(typeof(PEXETO.videoSupport)=='undefined'){
1033			PEXETO.videoSupport = !!document.createElement('video').canPlayType;
1034		}
1035		return PEXETO.videoSupport;
1036	};
1037
1038	PEXETO.$win = $(window);
1039	PEXETO.$body = $('body');
1040
1041
1042	/**
1043	 * Contains the init functionality.
1044	 * @type {Object}
1045	 */
1046	PEXETO.init = {
1047
1048		/**
1049		 * Inits all the main functionality. Calls all the init functions.
1050		 */
1051		initSite: function() {
1052
1053			var init = this,
1054				clickMsg = '';
1055
1056			//initialize the lightbox
1057			init.lightbox(null, {});
1058
1059			init.lightbox($("a[data-rel^='pglightbox']:not(#portfolio-slider a, #portfolio-gallery a)"), {});
1060			init.carouselLightbox();
1061
1062			init.tabs();
1063			init.placeholder($('.placehoder'));
1064			init.loadableImg($('img.loadable, .blog-post-img img'));
1065			
1066			new PEXETO.menuNav($('#menu')).init();
1067
1068			init.quickGallery();
1069			init.carousel();
1070			init.headerSearch();
1071
1072			if(PEXETO.disableRightClick) {
1073				PEXETO.utils.disableRightClick();
1074			}
1075
1076			PEXETO.utils.checkIfMobile();
1077
1078
1079			//wrap the sidebar categories widget number of posts text node within a span
1080			var catSpans = $('li.cat-item, .widget_archive li').contents().filter(function() {
1081				return this.nodeType == 3;
1082			});
1083			if(catSpans.length) {
1084				catSpans.wrap($('<span />', {
1085					'class': 'cat-number'
1086				}));
1087			}
1088
1089			//init social sharing
1090			var $share = $('.social-share');
1091			$share.each(function() {
1092				PEXETO.init.share($(this));
1093			});
1094
1095			init.parallax();
1096
1097			init.bgCoverFallback();
1098
1099			if(!PEXETO.utils.checkIfMobile()){
1100				init.setScrollToTop();
1101			}
1102
1103			init.ieClass();
1104
1105			if(PEXETO.stickyHeader){
1106				new PEXETO.utils.stickyHeader($('#header'), {}).init();
1107				init.ieIframeFix();
1108			}
1109
1110			$('.testimonial-slider').each(function(){
1111				new PEXETO.utils.fadeSlider($(this), {
1112					itemSel : '.testimonial-container',
1113					leftArrowClass : 'ts-arrow ts-left-arrow',
1114					rightArrowClass : 'ts-arrow ts-right-arrow',
1115					autoplay : ($(this).data('autoplay') ? true : false)
1116				}).init();
1117			});
1118
1119			init.resizeEvents();
1120
1121		},
1122
1123
1124		resizeEvents : function(){
1125			var resizeId,
1126				doOnResize = function(){
1127					PEXETO.$win.trigger('pexetoresize');
1128				};
1129
1130			PEXETO.$win.on('resize', function(){
1131				clearTimeout(resizeId);
1132				resizeId = setTimeout(doOnResize, 500);
1133			});
1134		},
1135
1136		/**
1137		 * Sets the search button functionality in the header. On click
1138		 * displays a search field.
1139		 */
1140		headerSearch : function(){
1141			var $searchBtn = $('.header-search-btn'),
1142				$searchWrapper,
1143				$searchInput,
1144				inAnimation = false,
1145				visible = false,
1146				visibleClass = 'search-visible';
1147
1148			if($searchBtn.length){
1149				$searchWrapper = $('#header .search-wrapper:first');
1150				$searchInput = $searchWrapper.find('.search-input');
1151
1152				$searchBtn.on('click', function(e){
1153					e.preventDefault();
1154
1155					if(!inAnimation){
1156						inAnimation = true;
1157
1158						if(visible){
1159							$searchBtn.removeClass(visibleClass);
1160							$searchWrapper.animate({width:'hide', opacity:0}, function(){
1161								$searchInput.blur();
1162								$searchBtn.blur();
1163								visible = false;
1164								inAnimation = false;
1165							});
1166						}else{
1167							$searchBtn.addClass(visibleClass);
1168							
1169							$searchWrapper.animate({width:'show', opacity:1}, function(){
1170								$searchInput.focus();
1171								visible = true;
1172								inAnimation = false;
1173							});
1174						}
1175					}
1176				});
1177			}
1178		},
1179
1180
1181		/**
1182		 * Fixes the IE ignoring of z-index on iframes.
1183		 */
1184		ieIframeFix : function(){
1185			if(PEXETO.getBrowser().msie){
1186
1187				$('iframe').each(function() {
1188					var url = $(this).attr("src"),
1189						newUrl;
1190
1191					if(url){
1192						newUrl = PEXETO.url.addUrlParameter(url, 'wmode=transparent');
1193
1194						$(this).attr({
1195							"src" : newUrl,
1196							"wmode" : "Opaque"
1197						});
1198					}
1199					
1200				});
1201			}
1202		},
1203
1204		/**
1205		 * Adds an ie10 class to Internet Explorer
1206		 * @return {[type]} [description]
1207		 */
1208		ieClass : function(){
1209			var browser = PEXETO.getBrowser(),
1210				version = 0;
1211			if(browser.msie){
1212				version = parseInt(browser.version,10);
1213				$('body').addClass('ie ie'+version);
1214			}
1215		},
1216
1217		/**
1218		 * Inits the scroll to top button functionality.
1219		 */
1220		setScrollToTop : function(){
1221			var $scrollBtn = $('.scroll-to-top'),
1222				btnDisplayed = false;
1223
1224			if($scrollBtn.length){
1225				/**
1226				 * Shows or hides the scroll to top button depending on the current
1227				 * document scroll position.
1228				 */
1229				var setButtonVisibility = function(){
1230					var scrollPos = $(document).scrollTop(),
1231				   		winHeight = $(window).height();
1232
1233				   		if(!btnDisplayed && scrollPos > winHeight){
1234				   			//display scroll button
1235				   			$scrollBtn.pexetoTransit({opacity:1, marginBottom:0});
1236				   			btnDisplayed = true;
1237				   		}else if(btnDisplayed && scrollPos < winHeight){
1238				   			$scrollBtn.pexetoTransit({opacity:0, marginBottom:-30});
1239				   			btnDisplayed = false;
1240				   		}
1241				};
1242				$('body').on('mousewheel', setButtonVisibility);
1243				setButtonVisibility();
1244
1245				$scrollBtn.on('click', function(){
1246					$.scrollTo($('#main-container'), {
1247						duration: 1000,
1248						easing: 'easeOutSine',
1249						offset: {
1250							top: 0
1251						},
1252						onAfter:function(){
1253							setButtonVisibility();
1254							$(window).trigger('pexetoscroll');
1255						}
1256					});
1257				});
1258			}
1259			
1260		},
1261
1262		/**
1263		 * Inits the fallback functionality for the CSS background-size:cover
1264		 */
1265		bgCoverFallback : function(){
1266			if(PEXETO.getBrowser().msie && PEXETO.getBrowser().version<=8){
1267				$('.full-bg-image').each(function(){
1268					new PEXETO.utils.bgCoverFallback($(this)).init();
1269				});
1270			}
1271		},
1272
1273		/**
1274		 * Inits the parallax animation effect for some elements,
1275		 */
1276		parallax : function(){
1277			//init the full-width backfround image parallax
1278			if(!PEXETO.utils.checkIfMobile()){
1279				$('.parallax-scroll .full-bg-image').each(function(){
1280					new PEXETO.parallax(
1281						$(this),
1282						'background',
1283						{}
1284						).init();
1285				});
1286			}
1287
1288			//init the services boxes list parallax
1289			$('.services-default.pexeto-parallax,.services-icon.pexeto-parallax,.services-boxed-photo.pexeto-parallax').each(function(){
1290				new PEXETO.parallax(
1291					$(this),
1292					'list',
1293					{
1294						children:$(this).find('.services-box'),
1295						initProp : {opacity:0, top:50, position:'relative'},
1296						endProp: {opacity:1, top:0}
1297					}
1298					).init();
1299			});
1300
1301			$('.services-thumbnail.pexeto-parallax').each(function(){
1302				new PEXETO.parallax(
1303					$(this),
1304					'list',
1305					{
1306						children:$(this).find('.services-box'),
1307						animation: 'scale'
1308					}
1309					).init();
1310			});
1311
1312
1313			var $parallaxHeader = $('.parallax-header');
1314
1315			if($parallaxHeader.length){
1316				//init the parallax header effects
1317				
1318				$parallaxHeader.find('.page-title-wrapper').each(function(){
1319				new PEXETO.parallax(
1320					$(this),
1321					'hideOpacity',
1322					{
1323						disableMobile : true,
1324						$parent:$(this).parent('.header-wrapper')
1325					}
1326					).init();
1327				});
1328
1329				$parallaxHeader.find('.page-title .content-boxed').each(function(){
1330					new PEXETO.parallax(
1331						$(this),
1332						'stickToViewport',
1333						{
1334							disableMobile : true,
1335							$parent:$(this).parents('.header-wrapper:first')
1336						}
1337						).init();
1338				});
1339			}
1340
1341			
1342
1343		},
1344
1345		/**
1346		 * Inits the PrettyPhoto plugin lightbox.
1347		 * @param  {object} $el element or set of elements to which the lightbox will be loaded
1348		 */
1349		lightbox: function($el, add_options) {
1350			$el = $el || $("a[data-rel^='lightbox'],a[data-rel^='lightbox[group]']");
1351			var defaults = {
1352				animation_speed: 'normal',
1353				theme: PEXETO.lightboxStyle,
1354				overlay_gallery: false,
1355				slideshow: false,
1356				social_tools: '',
1357				hook:'data-rel'
1358			},
1359				options = $.extend(defaults, PEXETO.lightboxOptions);
1360
1361			if(!$.isEmptyObject(add_options)){
1362				options = $.extend(options, add_options);
1363			}
1364
1365			$el.prettyPhoto(options);
1366		},
1367
1368		carouselLightbox : function(){
1369			$("a[data-rel^=\'pclightbox\']").on("click", function(e){
1370				e.preventDefault();
1371				var images = $(this).data("images");
1372				var captions = $(this).data("captions");
1373				$.prettyPhoto.open(images, [], captions);
1374			});
1375		},
1376
1377		/**
1378		 * Inits a placeholder functionality for browsers that don't support placeholder.
1379		 * @param  {object} $el element or set of elements to which this functionality
1380		 * will be initialized.
1381		 */
1382		placeholder: function($el) {
1383			if(!$.support.placeholder) {
1384				$el.each(function() {
1385					$(this).attr('value', $(this).attr('placeholder'));
1386				}).on('focusin', function() {
1387					$(this).attr('value', $(this).attr('placeholder'));
1388				}).on('focusout', function() {
1389					$(this).attr('value', '');
1390				});
1391			}
1392		},
1393
1394		/**
1395		 * Inits the tabs and accordion functionality.
1396		 */
1397		tabs: function() {
1398			//set the tabs functionality
1399			$('.tabs-container').each(function(){
1400				$(this).pexetoTabs();
1401			});
1402
1403			//set the accordion functionality
1404			$('.accordion-container').each(function(){
1405				$(this).pexetoAccordion();
1406			});
1407		},
1408
1409		/**
1410		 * Inits the portfolio items carousel
1411		 */
1412		carousel: function() {
1413			var isSinglePortfolio = $('body').hasClass('single-portfolio');
1414
1415			if(!isSinglePortfolio
1416				|| (isSinglePortfolio && !$('#portfolio-slider').length)) {
1417				$('.portfolio-carousel').each(function() {
1418					$(this).pexetoCarousel();
1419				});
1420			}
1421
1422		},
1423
1424		/**
1425		 * Makes an image get displayed once it is loaded in a fade in animation.
1426		 * @param  {object} $el jQuery object or list of objects that contains 
1427		 * the loadable images. Each image must have a div parent from the 
1428		 * "img-loading" class which has a min-width and min-height set to it.
1429		 */
1430		loadableImg: function($el) {
1431			if($el.length) {
1432				$el.each(function() {
1433					$(this).pexetoOnImgLoaded({
1434						callback: function() {
1435							$(this).animate({
1436								opacity: 1
1437							}).parents('div.img-loading:first').css({
1438								minWidth: 0,
1439								minHeight: 0
1440							});
1441						}
1442					});
1443				});
1444			}
1445		},
1446
1447		/**
1448		 * Inits the quick gallery functionality. Loads the masonry script if
1449		 * the masonry option has been enabled.
1450		 */
1451		quickGallery: function() {
1452			$('.quick-gallery').each(function() {
1453				var $gallery = $(this),
1454					masonry = $gallery.hasClass(PEXETO.masonryClass);
1455
1456				if(!$gallery.hasClass('qg-full')){
1457					new PEXETO.utils.resizableImageGallery('.qg-img', 
1458						{
1459							masonry:masonry,
1460							parent:$gallery
1461						}).init();
1462				}
1463				
1464			});
1465		},
1466
1467		/**
1468		 * Loads the Nivo slider.
1469		 * @param  {object} $el     jQuery element which will contain the 
1470		 * slider images
1471		 * @param  {object} options object literal containing the slider 
1472		 * initialization options
1473		 */
1474		nivoSlider: function($el, options) {
1475			var $caption;
1476
1477			// loads the Nivo slider	
1478			var loadSlider = function() {
1479					$el.nivoSlider({
1480						effect: 'fade',
1481						animSpeed: options.speed,
1482						pauseTime: options.interval,
1483						startSlide: 0,
1484						// Set starting Slide (0 index)
1485						directionNav: options.arrows,
1486						// Next & Prev
1487						directionNavHide: false,
1488						// Only show on hover
1489						controlNav: options.buttons,
1490						// 1,2,3...
1491						controlNavThumbs: false,
1492						// Use thumbnails for
1493						// Control
1494						// Nav
1495						controlNavThumbsFromRel: false,
1496						// Use image rel for
1497						// thumbs
1498						keyboardNav: true,
1499						// Use left & right arrows
1500						pauseOnHover: options.pauseOnHover,
1501						// Stop animation while hovering
1502						manualAdvance: !options.autoplay,
1503						// Force manual transitions
1504						captionOpacity: 0.8,
1505						// Universal caption opacity
1506						beforeChange: function() {
1507							$caption.stop().css({opacity:0, bottom:-30});
1508						},
1509						afterChange: function() {
1510							$caption.animate({opacity:1, bottom:0});
1511						},
1512						slideshowEnd: function() {} // Triggers after all slides have been shown
1513					}).css({
1514						minHeight: 0
1515					});
1516
1517					$caption=$el.find('.nivo-caption');
1518
1519					// remove numbers from navigation
1520					$('.nivo-controlNav a').html('');
1521					$('.nivo-directionNav a').html('');
1522				};
1523
1524			if(!PEXETO.getBrowser().msie) {
1525				//load the slider once the images get loaded
1526				$el.find('img').pexetoOnImgLoaded({
1527					callback: loadSlider
1528				});
1529			} else {
1530				loadSlider();
1531			}
1532		},
1533
1534		/**
1535		 * Inits the sharing functionality. Uses the Sharrre script for the 
1536		 * sharing functionality.
1537		 * @param  {object} $wrapper a jQuery object wrapper that wraps the
1538		 * sharing buttons
1539		 */
1540		share: function($wrapper) {
1541
1542			if(!$wrapper.length) {
1543				return;
1544			}
1545
1546			$wrapper.find('.share-item').each(function() {
1547				var $el = $(this),
1548					type = $el.data('type'),
1549					title = $el.data('title'),
1550					url = $el.data('url'),
1551					args = {
1552						url: url,
1553						title: title,
1554						share: {},
1555						template: '<div></div>',
1556						enableHover: false,
1557						enableTracking: false,
1558						urlCurl: '',
1559						buttons: {},
1560						click: function(api, options) {
1561							api.simulateClick();
1562							api.openPopup(type);
1563						}
1564					};
1565
1566				args.share[type] = true;
1567
1568				if(type === 'googlePlus') {
1569					//set the language attribute for Google+
1570					args.buttons.googlePlus = {
1571						lang: $el.data('lang')
1572					};
1573				} else if(type === 'pinterest') {
1574					//set an image URL and a description to share on Pinterest
1575					args.buttons.pinterest = {
1576						media: $el.data('media'),
1577						description: title
1578					};
1579
1580				}
1581
1582				$el.sharrre(args);
1583			});
1584		},
1585
1586		blogMasonry : function(cols){
1587			var spacing = 30,
1588				$parent = $('.'+PEXETO.masonryClass),
1589				setColumnWidth = function(){
1590					var curCols = cols,
1591						containerWidth = $parent.width();
1592
1593					if(containerWidth <= 600){
1594						curCols = 1;
1595					}else if(containerWidth>600 && containerWidth<=800){
1596						curCols = 2;
1597					}
1598
1599					var width = Math.floor((containerWidth - (curCols-1)*spacing) / curCols) -1;
1600
1601					$parent.find('.post').width(width);
1602
1603					return width;
1604				};
1605
1606			setColumnWidth();
1607
1608			$parent.masonry({
1609				itemSelector:'.post',
1610				gutter: spacing,
1611				transitionDuration : 0
1612			});
1613
1614			$parent.find('img').each(function() {
1615				$(this).imagesLoaded(function() {
1616					$parent.masonry('layout');
1617				});
1618			});
1619
1620			$(window).on('resize', function(){
1621				setColumnWidth();
1622				$parent.masonry('layout');
1623			});
1624
1625		}
1626
1627	};
1628
1629
1630
1631	/***************************************************************************
1632	 * DROP-DOWN MENU
1633	 **************************************************************************/
1634
1635	/**
1636	 * Main navigation functionality. Includes the following functionality:
1637	 * - drop-down on hover for submenus
1638	 * - keeps the drop-down always visible in the window area
1639	 * - responsive navigation
1640	 * - toggle drop-down menu on click on smaller screens
1641	 * @param  {object} $el     The menu element - jQuery object
1642	 * @param  {object} options An object literal containing all the options
1643	 */
1644	PEXETO.menuNav = function($el, options){
1645		this.$menu = $el;
1646		var defaults = {
1647			mobMenuClass      : 'mob-nav-menu',
1648			mobPrecedingElSel : '.section-header',
1649			mobBtnSel         : '.mobile-nav',
1650			mobArrowClass     : 'mob-nav-arrow',
1651			mobSubOpenedClass : 'mob-sub-opened',
1652			megaMenuClass     : 'mega-menu-item',
1653			megaMenuMaxWidth  : 1000,
1654			megaMenuColumnWidth : 232
1655		};
1656		this.o = $.extend(defaults, options);
1657	};
1658
1659	var mn = PEXETO.menuNav.prototype;
1660
1661	/**
1662	 * Inits the navigation functionality.
1663	 */
1664	mn.init = function(){
1665		var self = this,
1666			browser = PEXETO.getBrowser();
1667
1668		self.$win = $(window);
1669		self.$body = $('body');
1670		self.$mainUl = self.$menu.find('ul:first');
1671		self.isIE9 = browser.msie && parseInt(browser.version, 10)==9;
1672
1673		if(self.$menu.is(':visible')){
1674			//init the main navigation functionality
1675			self.initMain();
1676		}else{
1677			$(window).on('resize.pexetodropdown', function(){
1678				if(self.$menu.is(':visible')){
1679					self.initMain();
1680					$(window).off('.pexetodropdown');
1681				}
1682			});
1683		}
1684
1685		//init the mobile navigation functionality
1686		self.initMobileMenu();
1687	};
1688
1689	/**
1690	 * Inits the main navigation functionality with the drop-down menus on 
1691	 * hover.
1692	 */
1693	mn.initMain = function(){
1694		var self = this,
1695			menuPosition = 'right';
1696
1697		if(this.$body.hasClass('header-layout-center')){
1698			menuPosition = 'center';
1699		}else if(this.$body.hasClass('header-layout-right')){
1700			menuPosition = 'left';
1701		}
1702		this.menuPosition = menuPosition;
1703
1704
1705		//bind the mouseover events
1706		self.$menu.find('ul li').has('ul').not('ul li.mega-menu-item li').each(function() {
1707
1708			$(this).on('mouseenter', function(){
1709				self.doOnMenuMouseover($(this));
1710			}).on('mouseleave', function(){
1711				self.doOnMenuMouseout($(this));
1712			}).find('a:first').append('<span class="drop-arrow"></span>');
1713		});
1714
1715		self.$menu.find('a[href="#"]').on('click', function(e){
1716			e.preventDefault();
1717		});
1718
1719		this.initMegaMenu();
1720	};
1721
1722	mn.initMegaMenu = function(){
1723		this.$megaUls = this.$menu.find('ul li.'+this.o.megaMenuClass).has('ul').children('ul');
1724
1725		if(this.$megaUls.length){
1726			this.$parentWrapper = this.$menu.parents('.section-boxed:first');
1727			
1728			this.$win.on('pexetoresize', $.proxy(this.setMegaMenuWidth, this));
1729			
1730			this.setMegaMenuWidth();
1731		}
1732		
1733	};
1734
1735	mn.setMegaMenuMaxWidth = function(){
1736		var maxWidth = 0;
1737
1738		switch(this.menuPosition){
1739			case 'right' :
1740				if(!this.lastMenuLi){
1741					this.lastMenuLi = this.$menu.find('ul:first>li:last');
1742				}
1743				if(this.isIE9){
1744					this.lastMenuLi.offset();
1745				}
1746				maxWidth = this.lastMenuLi.offset().left + this.lastMenuLi.width() - this.$parentWrapper.offset().left;
1747			break;
1748			case 'left' :
1749				maxWidth = this.$parentWrapper.width();
1750			break;
1751			case 'center' :
1752				maxWidth = this.$parentWrapper.width();
1753			break;
1754		}
1755
1756		this.megaMenuMaxWidth = Math.min(this.o.megaMenuMaxWidth, maxWidth);
1757	};
1758
1759	mn.setMegaMenuWidth = function(){
1760		var self = this;
1761
1762		this.setMegaMenuMaxWidth();
1763		this.mainUlWidth =  this.$mainUl.width();
1764
1765		this.$megaUls.each(function(){
1766			var $ul = $(this),
1767				liNum =$ul.children('li').length,
1768				width,
1769				colsToFit;
1770
1771			if(liNum>0){
1772				if(self.megaMenuMaxWidth<liNum*self.o.megaMenuColumnWidth){
1773					colsToFit = Math.floor(self.megaMenuMaxWidth/self.o.megaMenuColumnWidth) || 1;
1774					width = colsToFit*self.o.megaMenuColumnWidth;
1775				}else{
1776					width = liNum*self.o.megaMenuColumnWidth;
1777					colsToFit = liNum;
1778				}
1779
1780				if(this.lastMegaClass){
1781					$ul.removeClass(this.lastMegaClass);
1782				}
1783				this.lastMegaClass = 'mega-columns-'+colsToFit;
1784
1785				$ul.width(width)
1786					.addClass(this.lastMegaClass);
1787
1788				self.setMegaMenuPosition($ul, width);
1789
1790			}
1791		});
1792	}
1793
1794	mn.setMegaMenuPosition = function($ul, ulWidth){
1795		var left,
1796			$li,
1797			centerPosition,
1798			shortestEndDistance;
1799
1800		if(ulWidth >= this.mainUlWidth){
1801			//the mega drop-down is bigger than the parent menu
1802			switch(this.menuPosition){
1803				case 'right' :
1804					//align right
1805					$ul.css({left:'auto', right:0});
1806				break;
1807				case 'left' :
1808					//align left
1809					$ul.css({left:0});
1810				break;
1811				case 'center' :
1812					//center
1813					if(typeof this.iconsWidth === 'undefined'){
1814						var $icons = this.$parentWrapper.find('.header-buttons');
1815						this.iconsWidth = $icons.length ? $icons.width() : 0;
1816					}
1817					left = -(ulWidth - (this.mainUlWidth + this.iconsWidth) )/2;
1818					$ul.css({left:left});
1819				break;
1820			}
1821		}else{
1822			$li = $ul.parents('li:first');
1823			centerPosition = $li.position().left + $li.width()/2,
1824			shortestEndDistance = Math.min(centerPosition, this.mainUlWidth-centerPosition);
1825
1826			if(ulWidth/2<=shortestEndDistance){
1827				//center
1828				left = centerPosition - ulWidth/2;
1829				$ul.css({left:left});
1830			}else{
1831				if(centerPosition<=this.mainUlWidth-centerPosition){
1832					//align left
1833					$ul.css({left:0});
1834				}else{
1835					//align right
1836					$ul.css({left:'auto', right:0});
1837				}
1838			}
1839
1840		}
1841
1842	};
1843
1844
1845	/**
1846	 * Displays the drop-down menu on mouse over.
1847	 * @param  {object} $li the hovered element - jQuery object
1848	 */
1849	mn.doOnMenuMouseover = function($li) {
1850		var self = this,
1851			$ul = $li.find('ul:first'),
1852			parentUlNum = $ul.parents('ul').length,
1853			elWidth = $li.width(),
1854			ulWidth = $ul.width(),
1855			winWidth = self.$win.width(),
1856			elOffset = $li.offset().left;
1857
1858
1859		$li.addClass('hovered');
1860
1861		if(self.menuPosition=='right' && !$li.hasClass(self.o.megaMenuClass)){
1862			if(parentUlNum > 1 && (elWidth + ulWidth + elOffset > winWidth)) {
1863				//if the drop down ul goes beyound the screen, move it on the left side
1864				$ul.css({
1865					left: -elWidth
1866				});
1867			} else if(parentUlNum === 1) {
1868				if(ulWidth + elOffset > winWidth) {
1869					$ul.css({
1870						left: (winWidth - 3 - (ulWidth + elOffset))
1871					});
1872				} else {
1873					$ul.css({
1874						left: 0
1875					});
1876				}
1877			}
1878		}
1879
1880		// display the drop-down
1881		$ul.stop().fadeIn(300);
1882	};
1883
1884	/**
1885	 * Hides the drop-down on mouse out.
1886	 * @param  {object} $li the hovered li element - jQuery object
1887	 */
1888	mn.doOnMenuMouseout = function($li) {
1889		var $ul = $li.find('ul:first');
1890		$li.removeClass('hovered');
1891
1892		$ul.stop().fadeOut( 300);
1893	};
1894
1895	/**
1896	 * Inits the mobile navigation menu.
1897	 */
1898	mn.initMobileMenu = function(){
1899		var self = this,
1900			$menu = $('<div />', {
1901				'class': self.o.mobMenuClass,
1902				html: self.$menu.html()
1903			}).insertAfter($(self.o.mobPrecedingElSel));
1904
1905		self.mobile = {
1906			opened : false,
1907			inAnimation : false,
1908			$menuBtn : $(self.o.mobBtnSel),
1909			$menu : $menu
1910		};
1911
1912		//remove the already added element styles
1913		$menu.find('ul').css('width', '').css('left', '').css('right','');
1914
1915		//append a toggle arrow to the elements that contain submenus
1916		$menu.find('ul li').has('ul').each(function(){
1917			$(this).append('<div class="'+self.o.mobArrowClass+'"><span></span></div>');
1918		});
1919
1920		self.bindMobileEventHandlers();
1921	};
1922
1923
1924	/**
1925	 * Binds the event handlers to the menu navigation.
1926	 */
1927	mn.bindMobileEventHandlers = function(){
1928		var self = this,
1929			m = self.mobile;
1930
1931		//menu button click handler
1932		m.$menuBtn.on('click', function(){
1933			self.toggleMobileMenu();
1934		});
1935
1936		//hide the mobile menu 
1937		self.$win.on('resize', function(){
1938			if(!m.$menuBtn.is(':visible') && (m.$menu && m.opened)){
1939				m.$menu.hide();
1940				m.opened = false;
1941			}
1942		});
1943
1944		m.$menu.find('li:has(ul) a[href="#"],'+'.'+self.o.mobArrowClass).on('click', function(e){
1945			var $submenu = $(this).siblings('ul:first'),
1946				$arrow = e.target.nodeName.toLowerCase()=='span' ?
1947					$(this) : $(this).siblings('.'+self.o.mobArrowClass);
1948			self.toggleMobileSubMenu($submenu, $(this));	
1949		});
1950	};
1951
1952	/**
1953	 * Toggles the mobile menu.
1954	 */
1955	mn.toggleMobileMenu = function(){
1956		var self = this,
1957			m = self.mobile;
1958
1959		if(!m.inAnimation) {
1960			if(!m.opened) {
1961				//show the menu
1962				m.inAnimation = true;
1963				m.$menu.animate({
1964					height: 'show'
1965				}, function() {
1966					m.opened = true;
1967					m.inAnimation = false;
1968				});
1969			} else {
1970				//hide the menu
1971				m.inAnimation = true;
1972				m.$menu.animate({
1973					height: 'hide'
1974				}, function() {
1975					m.opened = false;
1976					m.inAnimation = false;
1977				});
1978			}
1979		}
1980	};
1981
1982	/**
1983	 * Toggles a mobile submenu.
1984	 * @param  {object} $ul    the ul element to display - a jQuery object
1985	 * @param  {object} $arrow the arrow object that has been clicked - a jQuery
1986	 * object
1987	 */
1988	mn.toggleMobileSubMenu = function($ul, $arrow){
1989		var self = this,
1990			m = self.mobile;
1991
1992		if(!$ul.length || m.inAnimation){
1993			return;
1994		}
1995
1996		m.inAnimation = true;
1997		$arrow.toggleClass(self.o.mobSubOpenedClass);
1998		if($ul.is(':visible')){
1999			//hide the menu
2000			$ul.animate({height:'hide'}, function(){
2001				m.inAnimation = false;
2002			});
2003		}else{
2004			//show the menu
2005			$ul.animate({height:'show'}, function(){
2006				m.inAnimation = false;
2007			});
2008		}
2009		
2010	};
2011
2012
2013
2014	PEXETO.woocommerce = {
2015
2016		init : function(enableLightbox){
2017			this.woocart();
2018			if(enableLightbox){
2019				PEXETO.init.lightbox($('a[data-rel^="prettyPhoto"],a.zoom,a[data-rel^="prettyPhoto[product-gallery]"]'), {hook: 'data-rel'});
2020			}
2021		},
2022
2023		woocart : function(){
2024			var self = this;
2025
2026			this.$wooBtn = $('.pex-woo-cart-btn');
2027			this.$wooCart = $('.pex-woo-cart');
2028			this.$wooNum = $('.pex-woo-cart-num');
2029
2030			if(this.$wooBtn.length && this.$wooCart.length){
2031				this.setBtnVisibility();
2032			}
2033
2034			$('body').on('added_to_cart', function(e, fragments, hash){
2035				if(fragments['div.widget_shopping_cart_content']){
2036					self.$wooCart.html(fragments['div.widget_shopping_cart_content']);
2037					self.setBtnVisibility();
2038					self.updateCartNum(fragments['pex_number'])
2039				}
2040			});
2041		},
2042
2043		setBtnVisibility : function(){
2044			if(this.$wooCart.find('li').not('.empty').length){
2045				this.$wooBtn.addClass('btn-visible');
2046			}else{
2047				this.$wooBtn.removeClass('btn-visible');
2048			}
2049		},
2050
2051		updateCartNum : function(num){
2052			var cartNum = num || 0;
2053
2054			this.$wooNum.text(cartNum)
2055				.data('num', cartNum);
2056		}
2057	};
2058
2059
2060
2061
2062	/***************************************************************************
2063	 * PARALLAX EFFECTS
2064	 **************************************************************************/
2065
2066	/**
2067	 * Parallax class - contains methods to apply various parallax animations
2068	 * to an element or set of elemements.
2069	 * @param  {object} $el     the element to apply the animation to
2070	 * @param  {string} type    the type of animation - available options:
2071	 * - background : animates a background image, changes its position on scroll
2072	 * - list : animates a list of items, one after another
2073	 * - single : animates a single item
2074	 * @param  {object} options options for the animation. Properties:
2075	 * - children : a list of elements to animate when the type of animation
2076	 * is set to list
2077	 * - initProp : object containing a set of CSS properties that are applied
2078	 * to each element before the animation starts
2079	 * - endProp : object containing a set of CSS properties that are applied
2080	 * to each element to be animated
2081	 */
2082	PEXETO.parallax = function($el, type, options){
2083		this.$el = $el;
2084		this.type = type;
2085		this.options = options;
2086	};
2087
2088	/**
2089	 * Inits the parallax functionality. Calls the corresponding animation
2090	 * method depending on the type of effect selected.
2091	 */
2092	PEXETO.parallax.prototype.init = function(){
2093		var self = this,
2094			funcToExec = {
2095			'background' : 'setBackground',
2096			'list' : 'setList',
2097			'single' : 'setSingleElement',
2098			'hideOpacity' : 'setHideOpacity',
2099			'stickToViewport' : 'setStickOnViewportUntilParentBottom'
2100		};
2101
2102		if(self.options.disableMobile && PEXETO.utils.checkIfMobile()){
2103			return;
2104		}
2105
2106		if(funcToExec.hasOwnProperty(self.type)){
2107			PEXETO.parallax.prototype[funcToExec[self.type]].call(this);
2108		}
2109	};
2110
2111	/**
2112	 * Sets a parallax background image functionality. Moves the image position
2113	 * on mouse scroll.
2114	 */
2115	PEXETO.parallax.prototype.setBackground = function(){
2116		var self = this,
2117			i,
2118			$el = self.$el,
2119			$parent = $el.parent(),
2120			waypoints = {},
2121			maxTop = 60,
2122			numSteps = 100,
2123			topStep = maxTop/numSteps,
2124			initWaypoint = 90,
2125			endWaypoint = 120,
2126			waypointStep = Math.floor((initWaypoint+endWaypoint) / numSteps);
2127
2128			//generate an array containing waypoints and the corresponding data
2129			for(i=0; i<numSteps; i++){
2130				waypoints[initWaypoint-i*waypointStep] = '-'+((i+1)*topStep)+'%';
2131			}
2132
2133			_.each(waypoints, function(top, waypoint){
2134
2135				$parent.waypoint(function(direction){
2136					$el.stop().pexetoTransit({top:top});
2137				}, {offset:waypoint+'%'});
2138			});
2139
2140	};
2141
2142	/**
2143	 * Registers a single element parallax animation. The "initProp" and
2144	 * "endProp" properties should be set to the constructor's options object.
2145	 */
2146	PEXETO.parallax.prototype.setSingleElement = function(){
2147		var self = this,
2148			$el = self.$el;
2149
2150		$el.css(self.options.initProp)
2151			.waypoint(function(){
2152				$el.addClass('animated-element')
2153					.pexetoTransit(self.options.endProp)
2154					.waypoint('destroy');
2155			}, {'offset':'90%'});
2156	};
2157
2158	PEXETO.parallax.prototype.setHideOpacity = function(){
2159		var self = this,
2160			$el = self.$el,
2161			$parent = self.options.$parent,
2162			parentHeight = $parent.height(),
2163			$win = $(window),
2164			setOpacity = function(){
2165				var opacity = 1,
2166					scrollTop = $win.scrollTop();
2167
2168				if(parentHeight<=0){
2169					return;
2170				}
2171
2172				if (scrollTop < parentHeight && scrollTop >= 0) {
2173					opacity = 1 - scrollTop/parentHeight;
2174					$el.css({opacity:opacity});
2175				}
2176			};
2177
2178			$win.scroll(setOpacity);
2179			setOpacity();
2180	};
2181
2182	PEXETO.parallax.prototype.setStickOnViewportUntilParentBottom = function(){
2183		var self = this,
2184			$el = self.$el,
2185			$parent = self.options.$parent,
2186			parentHeight = $parent.height(),
2187			$win = $(window),
2188			gapDistance = 100,
2189			setPosition = function(){
2190				var scrollTop = $win.scrollTop();
2191
2192				if(parentHeight<=0){
2193					return;
2194				}
2195
2196				if (scrollTop < parentHeight && scrollTop >= 0) {
2197					$el.css({top:scrollTop*gapDistance/parentHeight});
2198				}
2199				
2200			},
2201			calculateGap = function(){
2202				gapDistance =  ($parent.offset().top + $parent.outerHeight() ) - 
2203					($el.offset().top + $el.height())
2204			};
2205
2206			calculateGap();
2207			setPosition();
2208
2209			$win.scroll(setPosition);
2210			
2211	};
2212
2213	/**
2214	 * Registers a list of elements parallax animation. The "initProp" and
2215	 * "endProp" properties should be set to the constructor's options object
2216	 * to set the animation properties. Also a "children" property should be
2217	 * added to the options object containing the children elements to be loaded.
2218	 */
2219	PEXETO.parallax.prototype.setList = function(){
2220		var self = this,
2221			$el = self.$el,
2222			animation = self.options.animation && self.options.animation=='scale' ? 'scale' : 'custom',
2223			$children = self.options.children.addClass('parallax-element');
2224				
2225			if(animation==='custom'){
2226				$children.css(self.options.initProp);
2227			}
2228
2229			$el.waypoint(function(direction){
2230
2231				$children.each(function(i){
2232					var $element = $(this);
2233					setTimeout(function(){
2234						if(animation==='custom'){
2235							$element.pexetoTransit(self.options.endProp);
2236						}else{
2237							$element.addClass('parallax-scaled-original');
2238						}
2239					}, i * 400);
2240				});
2241
2242				$el.waypoint('destroy');
2243
2244			}, {'offset':'90%'});
2245	};
2246
2247
2248
2249
2250	/**
2251	 * Contains some general helper functions.
2252	 * @type {Object}
2253	 */
2254	PEXETO.utils = {
2255
2256		/**
2257		 * Disables right click which opens the context menu.
2258		 * @param  {string} message a message that will be displayed on right click. Use empty
2259		 * string if you don't need to display a message
2260		 */
2261		disableRightClick: function() {
2262			$(document).bind('contextmenu', function(e) {
2263				return false;
2264			});
2265		},
2266
2267		/**
2268		 * JavaScript templating function :
2269		 * http://mir.aculo.us/2011/03/09/little-helpers-a-tweet-sized-javascript-templating-engine/
2270		 * @param  {string} s the string template
2271		 * @param  {object} d object literal containing the values that will be replaced in the string
2272		 * @return {string}   the replaced string with the data set
2273		 */
2274		template: function(s, d) {
2275			var p;
2276			for(p in d)
2277			s = s.replace(new RegExp('{' + p + '}', 'g'), d[p]);
2278			return s;
2279		},
2280
2281		/**
2282		 * Checks if the current device is a mobile device. If it is a mobile device, and it is within
2283		 * the recognized devices, adds its specific class to the body.
2284		 * @return {boolean} setting if the device is a mobile device or not
2285		 */
2286		checkIfMobile: function() {
2287			if(PEXETO.isMobile !== undefined) {
2288				return PEXETO.isMobile;
2289			}
2290			var userAgent = navigator.userAgent.toLowerCase(),
2291				devices = [{
2292					'class': 'iphone',
2293					regex: /iphone/
2294				}, {
2295					'class': 'ipad',
2296					regex: /ipad/
2297				}, {
2298					'class': 'ipod',
2299					regex: /ipod/
2300				}, {
2301					'class': 'android',
2302					regex: /android/
2303				}, {
2304					'class': 'bb',
2305					regex: /blackberry|bb10/
2306				}, {
2307					'class': 'iemobile|nokia',
2308					regex: /iemobile/
2309				}],
2310				i, len;
2311				
2312			PEXETO.isMobile = false;
2313			for(i = 0, len = devices.length; i < len; i += 1) {
2314				if(devices[i].regex.test(userAgent)) {
2315					$('body').addClass(devices[i]['class'] + ' mobile');
2316					PEXETO.isMobile = true;
2317					PEXETO.mobileType = devices[i]['class'];
2318					return true;
2319				}
2320			}
2321
2322			return false;
2323		},
2324
2325		/**
2326		 * Fades an element in.
2327		 * @param {object} $elem the element to be faded
2328		 */
2329		elemFadeIn: function($elem) {
2330			$elem.stop().animate({
2331				opacity: 1
2332			}, function() {
2333				$elem.animate({
2334					opacity: 1
2335				}, 0);
2336			});
2337		},
2338
2339		/**
2340		 * Fades an elemen out to a selected opacity.
2341		 * @param {object} $elem the element to be faded
2342		 * @param {number} opacity the opacity to be faded to (number between 0 and 1)
2343		 */
2344		elemFadeOut: function($elem, opacity) {
2345			$elem.stop().animate({
2346				opacity: opacity
2347			}, function() {
2348				$elem.animate({
2349					opacity: opacity
2350				}, 0);
2351			});
2352		},
2353
2354		getNaturalImgSize: function($img){
2355			var img = $img.get(0);
2356			if(img.naturalWidth && img.naturalHeight){
2357				return {width:img.naturalWidth, height:img.naturalHeight};
2358			}
2359			return {width:$img.width(), height:$img.height()};
2360		}
2361	};
2362
2363
2364	/**
2365	 * Contains some URL helper functions.
2366	 * @type {Object}
2367	 */
2368	PEXETO.url = {
2369
2370		/**
2371		 * Retrieves the URL parameters/
2372		 * @return {object} containing the parameters and values in key-value pairs
2373		 */
2374		getUrlParameters: function() {
2375			var vars = {};
2376			var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
2377				vars[key] = value;
2378			});
2379			return vars;
2380		},
2381
2382		getCustomUrlParameters : function(url){
2383			var vars = {};
2384			var parts = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
2385				vars[key] = value;
2386			});
2387			return vars;
2388		},
2389
2390		/**
2391		 * Adds a parameter to the URL.
2392		 * @param {string} url   the URL to which to add the parameters to
2393		 * @param {string} param the parameter in a string format including its value, example:
2394		 * "param=value"
2395		 * @return {string} the URL with the added parameter
2396		 */
2397		addUrlParameter: function(url, param) {
2398			url += (url.split('?')[1] ? '&' : '?') + param;
2399			return url;
2400		}
2401
2402		
2403
2404	};
2405
2406
2407	/***************************************************************************
2408	 * STICKY HEADER
2409	 **************************************************************************/
2410
2411
2412	/**
2413	 * Sticky header functionality - displays the hader always on the top of the
2414	 * screen.
2415	 * @param  {object} $element jQuery element - the header element
2416	 * @param  {object} options  the options settings
2417	 */
2418	PEXETO.utils.stickyHeader = function($element, options){
2419		this.$el = $element;
2420		this.$body = $('body');
2421		this.$win = $(window);
2422
2423		var defaults = {
2424			scrollHeight : 64,
2425			scrollClass : 'fixed-header-scroll'
2426		};
2427
2428		this.o = $.extend(defaults, options);
2429	};
2430
2431
2432	/**
2433	 * Inits the sticky header functionality.
2434	 */
2435	PEXETO.utils.stickyHeader.prototype.init = function(){
2436		var self = this,
2437			setDefaultHeight = function(){
2438				if(!self.scrolled){
2439					self.defaultHeight = self.$el.outerHeight();
2440					self.setPositions();
2441				}
2442			};
2443
2444		self.setPadding = $('body').hasClass('slider-active') ? false : true;
2445
2446		self.$parent = this.$el.parent();
2447		self.isMobile = PEXETO.utils.checkIfMobile();
2448		self.setPositions();
2449
2450		$('#logo-container img').pexetoOnImgLoaded({callback:setDefaultHeight});
2451
2452		$(window).on('mousewheel pexetoscroll scroll', function(){
2453			if(!self.isMobile){
2454				self.setPositions();
2455			}
2456		}).on('resize', function(){
2457			if(!self.scrolled){
2458				self.defaultHeight = self.$el.outerHeight();
2459				if(self.setPadding){
2460					self.$parent.css({paddingTop:self.defaultHeight}); 
2461				}
2462			}
2463		});
2464	};
2465
2466	/**
2467	 * Checks whether the current window is scrolled.
2468	 * @return {boolean} true if it is scrolled and false if it is not scrolled
2469	 */
2470	PEXETO.utils.stickyHeader.prototype.isScrolled = function(){
2471		return $(document).scrollTop() > 5 ? true : false;
2472	};
2473
2474
2475	/**
2476	 * Positions the depending elements of the sticky header depending
2477	 * on the current header position.
2478	 */
2479	PEXETO.utils.stickyHeader.prototype.setPositions = function(){
2480		var self = this,
2481			currentScrolled = self.isScrolled();
2482			
2483		if(!self.defaultHeight){
2484			self.defaultHeight = self.$el.outerHeight();
2485		}
2486
2487		if(currentScrolled && !self.scrolled){
2488			self.scrolled = true;
2489			self.$body.addClass(self.o.scrollClass);
2490			if(self.setPadding){
2491				self.$parent.css({paddingTop:self.o.scrollHeight}); 
2492			}
2493			self.$win.trigger('pexetostickychange');
2494		}else if(!currentScrolled && (self.scrolled || self.scrolled===undefined)){
2495			self.scrolled = false;
2496			self.$body.removeClass(self.o.scrollClass);
2497			if(self.setPadding){
2498				self.$parent.css({paddingTop:self.defaultHeight}); 
2499			}
2500			self.$win.trigger('pexetostickychange');
2501		}
2502	};
2503
2504
2505	/***************************************************************************
2506	 * RESIZABLE IMAGE GALLERY
2507	 **************************************************************************/
2508
2509	/**
2510	 * Resizable gallery functionality. Resizes the images in a gallery so they
2511	 * so that they can always fill the full parent container without any gaps.
2512	 * Also provides a masonry functionality that uses the jQuery Masonry script.
2513	 * @param  {string} selector the items selector
2514	 * @param  {object} options  an options object, supported parameters:
2515	 * - parent : jQuery object, the parent container of the items
2516	 * - masonry : boolean setting whether to enable masonry or not
2517	 */
2518	PEXETO.utils.resizableImageGallery = function(selector, options){
2519		this.selector = selector;
2520		this.options = options;
2521		this.$parent = options.parent || $('.'+PEXETO.masonryClass);
2522		this.$items = this.$parent.find(selector);
2523		this.masonry = options.masonry;
2524	};
2525
2526	/**
2527	 * Inits the resizable functionality.
2528	 * @return {object} the resizableImageGallery object
2529	 */
2530	PEXETO.utils.resizableImageGallery.prototype.init = function(){
2531		var self = this;
2532
2533		self.setImageSize();
2534
2535		if(self.masonry){
2536			self.initMasonry();
2537		}
2538		
2539		self.loadImages();
2540
2541		$(window).on('resize', $.proxy(self.refresh, self));
2542
2543		return self;
2544	};
2545
2546	/**
2547	 * Inits the Masonry script.
2548	 */
2549	PEXETO.utils.resizableImageGallery.prototype.initMasonry = function(){
2550		var self = this;
2551		self.$parent.masonry({
2552			itemSelector : self.selector,
2553			transitionDuration: 0
2554		});
2555	};
2556
2557
2558	/**
2559	 * Adds an onload event handler to each of the images.
2560	 */
2561	PEXETO.utils.resizableImageGallery.prototype.loadImages = function(){
2562		var self = this;
2563
2564		self.$parent.find('img').each(function() {
2565			$(this).pexetoOnImgLoaded({callback:function() {
2566				if(self.masonry){
2567					//refresh masonry
2568					self.$parent.masonry('layout');
2569				}
2570				$(this).css({
2571					 opacity: 1
2572				})
2573				.trigger('imgmasonryloaded');
2574			}});
2575		});
2576	};
2577
2578	/**
2579	 * Calculates the image width depending on the default image width and
2580	 * the width of the parent container div.
2581	 * @return {int} the width of the image including the margins of the image
2582	 */
2583	PEXETO.utils.resizableImageGallery.prototype.setImageSize = function(){
2584		var self = this,
2585			$firstItem = self.$items.eq(0),
2586			space = parseInt($firstItem.css('marginRight'), 10) + parseInt($firstItem.css('marginLeft'), 10),
2587			defaultWidth = $firstItem.data('defwidth') || $firstItem.width(),
2588			numColumns = 0,
2589			spaceLeft = 0,
2590			containerWidth = self.$parent.width(),
2591			newImgW;
2592
2593			containerWidth = Math.floor(containerWidth-1);
2594
2595			numColumns = Math.floor(containerWidth / (defaultWidth + space));
2596			if(numColumns<=0){
2597				numColumns = 1;
2598			}
2599
2600			spaceLeft = containerWidth - numColumns * (defaultWidth + space);
2601
2602			if(spaceLeft > defaultWidth / 2) {
2603				numColumns += 1;
2604			}
2605
2606			newImgW = numColumns === 1 ? containerWidth - space 
2607				: Math.floor(containerWidth / numColumns) - space;
2608
2609			self.$items.css({
2610				width: newImgW,
2611				height: 'auto'
2612			});
2613
2614			return newImgW + space;
2615	};
2616
2617	/**
2618	 * Refreshes the gallery - recalculates the image dimensions and refreshes
2619	 * the masonry script if masonry is enabled.
2620	 */
2621	PEXETO.utils.resizableImageGallery.prototype.refresh = function(){
2622		var self = this;
2623
2624		if(!self.paused){
2625			self.setImageSize();
2626
2627			if(self.masonry){
2628				self.$parent.masonry('layout');
2629			}
2630		}
2631		
2632	};
2633
2634	/**
2635	 * Destroys the masonry script if it is enabled.
2636	 */
2637	PEXETO.utils.resizableImageGallery.prototype.destroy = function(){
2638		var self = this;
2639
2640		if(self.masonry){
2641			self.$parent.masonry('destroy');
2642		}
2643	};
2644
2645	PEXETO.utils.resizableImageGallery.prototype.pause = function(){
2646		this.paused = true;
2647	};
2648
2649	PEXETO.utils.resizableImageGallery.prototype.resume = function(){
2650		this.paused = false;
2651	};
2652
2653
2654
2655
2656	/***************************************************************************
2657	 * BACKGROUND IMAGE COVER FALLBACK
2658	 **************************************************************************/
2659
2660	/**
2661	 * CSS background-size:cover fallback. Main constructior.
2662	 */
2663	PEXETO.utils.bgCoverFallback = function($el){
2664		this.$el = $el;
2665	};
2666
2667
2668	/**
2669	 * Inits the fallback functionality - sets the background image as an image
2670	 * element that is positioned main div element.
2671	 */
2672	PEXETO.utils.bgCoverFallback.prototype.init = function(){
2673		var self = this,
2674			src='',
2675			img,
2676			$img;
2677
2678		src = self.$el.css('backgroundImage');
2679		self.$el.css({'backgroundImage':''});
2680		src = src.replace('url("','').replace('")','');
2681
2682		img = new Image();
2683		img.src = src;
2684
2685		$img = $(img).appendTo(self.$el);
2686		self.$img = $img;
2687
2688		new PEXETO.utils.fullBgImage($img).init();
2689	};
2690
2691
2692	PEXETO.utils.fullBgImage = function($img){
2693		this.$img = $img;
2694		this.$parent = $img.parent();
2695		var naturalSize = PEXETO.utils.getNaturalImgSize($img);
2696		this.imgWidth = naturalSize.width;
2697		this.imgHeight = naturalSize.height;
2698
2699	};
2700
2701	PEXETO.utils.fullBgImage.prototype.init = function(){
2702		var self = this;
2703		self.positionImage();
2704
2705		$(window).on('resize', function(){
2706			self.positionImage();
2707		});
2708	};
2709
2710	PEXETO.utils.fullBgImage.prototype.positionImage = function(){
2711		var self = this,
2712			parentWidth = self.$parent.width(),
2713			parentHeight = self.$parent.height(),
2714			naturalSize = PEXETO.utils.getNaturalImgSize(self.$img),
2715			imgWidth = self.imgWidth,
2716			imgHeight = self.imgHeight,
2717			displayHeight = Math.round(parentWidth * imgHeight / imgWidth),
2718			args = {};
2719
2720			if(parentWidth/parentHeight > imgWidth/imgHeight){
2721				args = {
2722					width:'100%',
2723					height:'auto',
2724					left:0
2725				};
2726
2727				self.$img.css(args);
2728
2729				var curImgHeight = self.$img.height(),
2730					top = curImgHeight > parentHeight ? - (curImgHeight - parentHeight) / 2 : 0;
2731				
2732				self.$img.css({top:top});
2733
2734			}else{
2735			
2736				args = {
2737					width:'auto',
2738					height:'100%',
2739					top:0
2740				};
2741
2742				self.$img.css(args);
2743
2744				var curImgWidth = self.$img.width(),
2745					left = curImgWidth > parentWidth ? - (curImgWidth - parentWidth) / 2 : 0;
2746
2747				self.$img.css({left:left});
2748			}
2749
2750		
2751	};
2752
2753	PEXETO.utils.supportsTransition = function(){
2754		if(PEXETO.supportsTransition !== undefined){
2755			return PEXETO.supportsTransition;
2756		}
2757
2758		var b = document.body || document.documentElement,
2759        s = b.style,
2760        support = s.transition !== undefined || s.WebkitTransition !== undefined || s.MozTransition !== undefined || s.MsTransition !== undefined || s.OTransition !== undefined;
2761   		PEXETO.supportsTransition = support;
2762   		return support;
2763	};
2764
2765
2766	/***************************************************************************
2767	 * FADE EFFECT SLIDER
2768	 **************************************************************************/
2769
2770
2771	PEXETO.utils.fadeSlider = function($el, options){
2772		this.$el = $el;
2773		var defaults = {
2774			itemSel : '.slider-container',
2775			loadingClass : 'loading',
2776			leftArrowClass : 'fs-left-arrow',
2777			rightArrowClass : 'fs-right-arrow',
2778			autoplay : true,
2779			showNavigation : true,
2780			animationInterval : 5000,
2781			pauseOnHover : true
2782		};
2783		this.o = $.extend(defaults, options);
2784	};
2785
2786	var fs = PEXETO.utils.fadeSlider.prototype;
2787
2788	fs.init = function(){
2789		var self = this;
2790
2791		self.$items = self.$el.find(self.o.itemSel);
2792		self.itemNum = self.$items.length;
2793		self.inAnimation = false;
2794
2795		if(self.itemNum){
2796			self.$el.addClass(self.o.loadingClass);
2797			if(self.o.showNavigation && self.itemNum > 1){
2798				self.addNavigation();
2799			}
2800			self.$el.find('img').pexetoOnImgLoaded({
2801				callback: function(){
2802					self.loadSlider();
2803				}
2804			});
2805		}
2806
2807		$(window).on('resize', function(){
2808			self.doOnWindowResize();
2809		});
2810		
2811	};
2812
2813	fs.loadSlider = function(){
2814		var self = this;
2815
2816		self.items = [];
2817		self.$items.each(function(){
2818			self.items.push({
2819				$el : $(this),
2820				height : $(this).height()
2821			});
2822		});
2823
2824		self.$el.removeClass(self.o.loadingClass);
2825		self.showSlide(0);
2826
2827		if(self.o.autoplay){
2828			self.setUpAutoplay();
2829		}
2830	};
2831
2832	fs.addNavigation = function(){
2833		var self = this;
2834
2835		self.$leftArrow = $('<div />', {'class':self.o.leftArrowClass})
2836			.appendTo(self.$el)
2837			.on('click', function(){
2838				self.doOnSlideChangeTrigger(false);
2839			});
2840
2841		self.$rightArrow = $('<div />', {'class':self.o.rightArrowClass})
2842			.appendTo(self.$el)
2843			.on('click', function(){
2844				self.doOnSlideChangeTrigger(true);
2845			});
2846	};
2847
2848	fs.doOnSlideChangeTrigger = function(next){
2849		var self = this,
2850			index = 0;
2851
2852		if(next){
2853			index = self.currentIndex < self.itemNum - 1 ? self.currentIndex + 1 : 0;
2854		}else{
2855			index = self.currentIndex > 0 ? self.currentIndex - 1 : self.itemNum - 1;
2856		}
2857
2858		self.showSlide(index);
2859	};
2860
2861	fs.doOnWindowResize = function(){
2862		var self = this,
2863			curItem = self.items[self.currentIndex];
2864
2865		//refresh the height value for all the items
2866		_.each(self.items, function(item){
2867			item.height = item.$el.height();
2868		});
2869		
2870		//resize the slider
2871		self.$el.css({height:curItem.height});
2872
2873	};
2874
2875	fs.showSlide = function(index){
2876		var self = this,
2877			showItem = self.items[index];
2878
2879		if(!self.inAnimation){
2880			self.inAnimation = true;
2881
2882			if(self.currentIndex !== undefined){
2883				//hide slide
2884				self.items[self.currentIndex].$el.css({zIndex:0}).animate({opacity:0}
2884);
2885			}
2886
2887			self.$el.animate({height:showItem.height});
2888
2889			showItem.$el.css({zIndex:10}).animate({opacity:1}, function(){
2890				self.currentIndex = index;
2891				self.inAnimation = false;
2892			});
2893		}
2894	};
2895
2896	fs.setUpAutoplay = function(){
2897		var self = this;
2898
2899		if(!self.o.autoplay){
2900			return;
2901		}
2902
2903		//pause on hover events
2904		if(self.o.pauseOnHover){
2905			self.$el.on('mouseenter', function(){
2906				 self.pause();
2907			}).on('mouseleave', function(){
2908				self.startAnimation();
2909			});
2910		}
2911
2912		self.startAnimation();
2913	};
2914
2915	fs.startAnimation = function(){
2916		var self = this;
2917
2918		self.timer = window.setInterval( function(){
2919			self.doOnSlideChangeTrigger(true);
2920		}, self.o.animationInterval);
2921	};
2922
2923	fs.pause = function(){
2924		var self = this;
2925
2926		window.clearInterval(self.timer);
2927		self.timer=-1;
2928	};
2929
2930
2931}(jQuery));
2932

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.