PageSourceSearch

https://lacanasta.es/wp-content/themes/thestory/js/main.js?ver=1.8.2

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

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.