Current File : /pages/54/47/d0016649/home/htdocs/cd24/wp-content/themes/en-vision/lib/js/app.js
jQuery.noConflict();

/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
 * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
 */
;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a){var e=a[d];if(!G(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function K(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)u[c[d]]=c[d]in k;return u.list&&(u.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),u}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e=k.type!=="text",e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!=="textfield"&&k.offsetHeight!==0,g.removeChild(k)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=k.checkValidity&&k.checkValidity()===!1:e=k.value!=l)),t[a[d]]=!!e;return t}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={svg:"http://www.w3.org/2000/svg"},s={},t={},u={},v=[],w=v.slice,x,y=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return J("flexWrap")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){return!!a.WebGLRenderingContext},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.hsla=function(){return D("background-color:hsla(120,40%,100%,.5)"),G(j.backgroundColor,"rgba")||G(j.backgroundColor,"hsla")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return J("backgroundSize")},s.borderimage=function(){return J("borderImage")},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.csscolumns=function(){return J("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return J("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var L in s)C(s,L)&&(x=L.toLowerCase(),e[x]=s[L](),v.push((e[x]?"":"no-")+x));return e.input||K(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},D(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};

/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);

/*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs  */
(function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B<y;B++){A=D[B],z=A.href,C=A.media,x=A.rel&&A.rel.toLowerCase()==="stylesheet";if(!!z&&x&&!o[z]){if(A.styleSheet&&A.styleSheet.rawCssText){m(A.styleSheet.rawCssText,z,C);o[z]=true}else{if((!/^([a-zA-Z:]*\/\/)/.test(z)&&!g)||z.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:z,media:C})}}}}u()},u=function(){if(d.length){var x=d.shift();n(x.href,function(y){m(y,x.href,x.media);o[x.href]=true;u()})}},m=function(I,x,z){var G=I.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),J=G&&G.length||0,x=x.substring(0,x.lastIndexOf("/")),y=function(K){return K.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+x+"$2$3")},A=!J&&z,D=0,C,E,F,B,H;if(x.length){x+="/"}if(A){J=1}for(;D<J;D++){C=0;if(A){E=z;k.push(y(I))}else{E=G[D].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;k.push(RegExp.$2&&y(RegExp.$2))}B=E.split(",");H=B.length;for(;C<H;C++){F=B[C];i.push({media:F.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:k.length-1,hasquery:F.indexOf("(")>-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l<h){clearTimeout(r);r=setTimeout(j,h);return}else{l=z}for(var E in i){var K=i[E],C=K.minw,J=K.maxw,A=C===null,L=J===null,y="em";if(!!C){C=parseFloat(C)*(C.indexOf(y)>-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this);


document.documentElement.className = document.documentElement.className.replace('no-js','js');
document.documentElement.className = document.documentElement.className.replace('html-loaded','html-loading');

(function(){
    "use strict";

    setTimeout(function(){
        document.documentElement.className = document.documentElement.className.replace('html-loading','html-loaded');
    }, 6000);

})();

jQuery(document).ready(function(){
    jQuery('html').removeClass('html-loading').addClass('html-loaded');
});


var CloudFw_jQueried = function( key, element ){
	"use strict";
	if ( typeof element === 'undefined' ) {
		return true;
	}

	if( element.parents('.dont-make-ui').length ) {
		return true;
	}

	if ( jQuery.data(element, key) === true ) {
		return true;
	}

	jQuery.data(element, key, true);
	return false;
};

/*
 * jQuery throttle / debounce - v1.1 - 3/7/2010
 * http://benalman.com/projects/jquery-throttle-debounce-plugin/
 *
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);

/**
 * Sticky Header
 *
 * @return void
 */
(function(){
	"use strict";

	var cloudfw_sticky_header = function(){

		if ( ! CloudFwOp.sticky_header ) {
			return false;
		}

		var header_container = jQuery('#header-container');

		if ( ! jQuery.isFunction( jQuery.fn.cloudfw_waypoint ) ) {
			return true;
		}

		if ( header_container.parent().hasClass('sticky-wrapper') ) {
			header_container.cloudfw_waypoint('unsticky');
		}
		header_container.cloudfw_waypoint('sticky', {
			wrapper: '<div class="sticky-wrapper" />',
			stuckClass: 'stuck',
			offset: parseInt(CloudFwOp.sticky_header_offset, 10) || 0
		});

	}

	jQuery(window).on( 'load', function(){
		cloudfw_sticky_header();
		jQuery(window).smartresize( cloudfw_sticky_header );
	});

})(jQuery);

/**
 * Debouncing function from John Hann
 *
 * http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
 */
(function($,sr){
  "use strict";

	var debounce = function (func, threshold, execAsap) {
	var timeout;

		return function debounced () {
			var obj = this, args = arguments;
			function delayed () {
				if (!execAsap) {
					func.apply(obj, args);
				}
				timeout = null;
			}

			if (timeout) {
				clearTimeout(timeout);
			} else if (execAsap) {
				func.apply(obj, args);
			}

			timeout = setTimeout(delayed, threshold || 100);
		};

	};

	// smartresize
	jQuery.fn[sr] = function(fn){  return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };

})(jQuery,'smartresize');


function cloudFwGetViewportWidth() {
	"use strict";
	var xWidth = null;
	if(window.screen !== null)
		xWidth = window.screen.availWidth;

	if(window.innerWidth !== null)
		xWidth = window.innerWidth;

	if(document.body !== null)
		xWidth = document.body.clientWidth;

	return xWidth;
}

var CloudFwParseAttribute = function( input ){
	"use strict";
	var data = {};

	if ( input ) {
		try {
			if ( typeof input !== 'object' )
				data = jQuery.parseJSON( input );

		} catch (e) {}

		return data;
	}
};


var CloudFwGetColumByClassname = function( elements ){
	"use strict";
	var columns_array = new Array( 1, 2, 3, 4, 6 ),
		classes_array = new Array('span12', 'span6','span4','span3','span2'),
		first_item = elements.first(),
		classes = first_item.attr('class');

	var span = classes.match(/span(\d+)/)[1];
	if ( span )
		span = 'span' + span;

	var position = jQuery.inArray( span, classes_array );

	if ( position !== -1 ) {
		return columns_array[ position ];
	} else {
		return 1;
	}
};


var cloudfw_load_css_file = function( id, filepath ) {
	"use strict";

	var head  = document.getElementsByTagName('head')[0];
	var link  = document.createElement('link');

	link.id   = id;
	link.rel  = 'stylesheet';
	link.type = 'text/css';
	link.href = filepath;
	link.media = 'all';
	head.appendChild(link);
};

/**
 * Add Window Loaded Classname to HTML
 *
 * @return void
 */
(function(){
	"use strict";

	jQuery(window).on( 'load', function(){
		jQuery('html').addClass('ui--win-loaded');
	});

})(jQuery);

/* ============================================================
 * retina-replace.js v1.0
 * http://github.com/leonsmith/retina-replace-js
 * ============================================================
 * Author: Leon Smith
 * Twitter: @nullUK
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============================================================ */
 (function($) {
        "use strict";

        var retinaReplace = function(element, options) {
                try {

                    this.options = options;
                    var $el = $(element);
                    var is_image = $el.is('img');
                    var normal_url = is_image ? $el.attr('src') : $el.backgroundImageUrl();
                    var retina_url = $el.attr('data-at2x') ? $el.attr('data-at2x') : '';;

                    if ( retina_url == '' ) {
                        if ( $el.attr('data-retina-auto') ) {
                            retina_url = this.options.generateUrl($el, normal_url);
                        } else {
                            return true;
                        }
                    }


                    $('<img/>').attr('src', retina_url).on( 'load', function() {

                        if (is_image) {

                            $el.css({ width: $el.width(), height: $el.height() });
                            $el.attr('data-orginal-src', $el.attr('src'));
                            $el.attr('src', $(this).attr('src'));

                        } else {

                            $el.backgroundImageUrl($(this).attr('src'));
                            $el.backgroundSize($(this)[0].width, $(this)[0].height);

                        }

                        $el.attr('data-retina', 'complete');

                    });

                } catch (e) {}


        }

        retinaReplace.prototype = {
                constructor: retinaReplace
        }

        $.fn.retinaReplace = function(option) {
                // Finish if we arn't a retina device
                return this.each(function() {
                    var $this = $(this);
                    var data = $this.data('retinaReplace');
                    var options = $.extend({}, $.fn.retinaReplace.defaults, $this.data(), typeof option == 'object' && option);
                    if (!data) { $this.data('retinaReplace', (data = new retinaReplace(this, options))); }
                    if (typeof option == 'string') { data[option](); }
                });
        }

        $.fn.retinaReplace.defaults = {
                suffix: '@2x',
                generateUrl: function(element, url) {
                    if ( typeof url == 'undefined' ) {
                        return '';
                    }
                    var dot_index = url.lastIndexOf('.');
                    var extension = url.substr(dot_index + 1);
                    var file = url.substr(0, dot_index);
                    return file + this.suffix + '.' + extension;
                }
        }

        $.fn.retinaReplace.Constructor = retinaReplace;

        $.fn.backgroundImageUrl = function(url) {
            return url ? this.each(function () {
                $(this).css("background-image", 'url("' + url + '")')
            }) : $(this).css("background-image").replace(/url\(|\)|"|'/g, "");
        }

        $.fn.backgroundSize = function(retinaWidth, retinaHeight) {
            var sizeValue = Math.floor(retinaWidth/2) + 'px ' + Math.floor(retinaHeight/2) + 'px';
            $(this).css("background-size", sizeValue);
            $(this).css("-webkit-background-size", sizeValue);
        }

        // Trigger replacement on elements that hav been marked up
        var init = function(){
            $(":not([data-at2x='']):visible").retinaReplace();
        }


        // Check is retina
        var isRetina = function(){
            var root = (typeof exports == 'undefined' ? window : exports);
            var mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\
                            (min--moz-device-pixel-ratio: 1.5),\
                            (-o-min-device-pixel-ratio: 3/2),\
                            (min-resolution: 1.5dppx)";

            if (root.devicePixelRatio > 1) {
                return true;
            }

            if (root.matchMedia && root.matchMedia(mediaQuery).matches) {
                return true;
            }

            //return true;
            return false;
        };


        if ( isRetina() ) {
            //$(init);
            $('html').removeClass('no-retina').addClass('retina');
            $(window).on('load', init );
            $(window).smartresize( init );
            $(window).bind( 'make@2x', init );
        }


})(window.jQuery);

/* ------------------------------------------------------------------------
	Class: prettyPhoto
	Use: Lightbox clone for jQuery
	Author: Stephane Caron (http://www.no-margin-for-errors.com)
	Version: 3.1.6
------------------------------------------------------------------------- */
(function($) {
	$.CloudFwPrettyPhoto = {version: '3.1.6'};

	$.fn.CloudFwPrettyPhoto = function(pp_settings) {
		if ( CloudFwOp.disable_prettyphoto_on_mobile && detectDeviceViaPageWidth() == 'phone' ) {
			return true;
		}

		pp_settings = jQuery.extend({
			hook: 'data-rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */
			animation_speed: 'fast', /* fast/slow/normal */
			ajaxcallback: function() {},
			slideshow: 5000, /* false OR interval time in ms */
			autoplay_slideshow: false, /* true/false */
			opacity: 0.80, /* Value between 0 and 1 */
			show_title: true, /* true/false */
			allow_resize: true, /* Resize the photos bigger than viewport. true/false */
			allow_expand: true, /* Allow the user to expand a resized image. true/false */
			default_width: 500,
			default_height: 344,
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
			horizontal_padding: 20, /* The padding on each side of the picture */
			hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
			wmode: 'opaque', /* Set the flash wmode attribute */
			autoplay: true, /* Automatically start videos: True/False */
			modal: false, /* If set to true, only the close button will close the window */
			deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
			overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
			overlay_gallery_max: 30, /* Maximum number of pictures in the overlay gallery */
			keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
			changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
			opened: function(){ jQuery('body').addClass('ui--lightbox-opened'); }, /* Called when prettyPhoto is opened */
			callback: function(){ jQuery('body').removeClass('ui--lightbox-opened'); }, /* Called when prettyPhoto is closed */
			ie6_fallback: true,
			markup: '<div class="pp_pic_holder"> \
						<div class="ppt">&nbsp;</div> \
						<div class="pp_top"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
						<div class="pp_content_container"> \
							<div class="pp_left"> \
							<div class="pp_right"> \
								<div class="pp_content"> \
									<div class="pp_loaderIcon"></div> \
									<div class="pp_fade"> \
										<div class="pp_nav pp_current_text"> \
											<p class="currentTextHolder btn btn-small btn-grey radius-3px">0/0</p> \
										</div> \
										<a class="pp_close btn btn-small btn-grey radius-3px" href="#"><i class="fontawesome-remove"></i> '+ CloudFwOp.text_close +'</a> \
										<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
										<div class="pp_hoverContainer"> \
											<a class="pp_next" href="#"><span><div class="arr arr-large arr-right"><span></span><i class="fontawesome-chevron-right"></i></div></span></a> \
											<a class="pp_previous" href="#"><span><div class="arr arr-large arr-left"><span></span><i class="fontawesome-chevron-left"></i></div></span></a> \
										</div> \
										<div id="pp_full_res"></div> \
										<div class="pp_details"> \
											<p class="pp_description ui--accent-gradient ui--accent-color"></p> \
										</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>',
			mp4_markup: '<video width="{width}" height="{height}" controls autoplay><source src="{path}" type="video/mp4">Your browser does not support the video tag.</video>',
			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>' /* html or false to disable */
		}, pp_settings);

		// Global variables accessible only by prettyPhoto
		var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,

		// prettyPhoto container specific
		pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,

		// Window size
		windowHeight = $(window).height(), windowWidth = $(window).width(),

		// Global elements
		pp_slideshow;

		doresize = true, scroll_pos = _get_scroll();

		// Window/Keyboard events
		$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });

		if(pp_settings.keyboard_shortcuts) {
			$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){
				if(typeof $pp_pic_holder != 'undefined'){
					if($pp_pic_holder.is(':visible')){
						switch(e.keyCode){
							case 37:
								$.CloudFwPrettyPhoto.changePage('previous');
								e.preventDefault();
								break;
							case 39:
								$.CloudFwPrettyPhoto.changePage('next');
								e.preventDefault();
								break;
							case 27:
								if(!settings.modal)
								$.CloudFwPrettyPhoto.close();
								e.preventDefault();
								break;
						};
						// return false;
					};
				};
			});
		};

		/**
		* Initialize prettyPhoto.
		*/
		$.CloudFwPrettyPhoto.initialize = function() {

			settings = pp_settings;

			if(settings.theme == 'pp_default') settings.horizontal_padding = 16;

			// Find out if the picture is part of a set
			theRel = $(this).attr(settings.hook);
			galleryRegExp = /\[(?:.*)\]/;
			isSet = (galleryRegExp.exec(theRel)) ? true : false;

			// Put the SRCs, TITLEs, ALTs into an array.
			pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href'));
			pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt'));
			pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('data-title')) ? $(n).attr('data-title') : ""; }) : $.makeArray($(this).attr('data-title'));

			if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;

			set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
			rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this));

			_build_overlay(this); // Build the overlay {this} being the caller

			if(settings.allow_resize)
				$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });

			$.CloudFwPrettyPhoto.open();

			return false;
		}


		/**
		* Opens the prettyPhoto modal box.
		* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
		* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
		* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
		*/
		$.CloudFwPrettyPhoto.open = function(event) {
			if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
				settings = pp_settings;
				pp_images = $.makeArray(arguments[0]);
				pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
				pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
				isSet = (pp_images.length > 1) ? true : false;
				set_position = (arguments[3])? arguments[3]: 0;
				_build_overlay(event.target); // Build the overlay {this} being the caller
			}

			if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden'); // Hide the flash

			_checkPosition($(pp_images).size()); // Hide the next/previous links if on first or last images.

			$('.pp_loaderIcon').show();

			if(settings.deeplinking)
				setHashtag();

			// Rebuild Facebook Like Button with updated href
			if(settings.social_tools){
				facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
				$pp_pic_holder.find('.pp_social').html(facebook_like_link);
			}

			// Fade the content in
			if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
			$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);

			// Display the current position
			$pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).size());

			// Set the description
			if(typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != ""){
				$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
			}else{
				$pp_pic_holder.find('.pp_description').hide();
			}

			// Get the dimensions
			movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString();
			movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString();

			// If the size is % based, calculate according to window dimensions
			percentBased=false;
			if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; }
			if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; }

			// Fade the holder
			$pp_pic_holder.fadeIn(function(){
				// Set the title
				(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html('&nbsp;');

				imgPreloader = "";
				skipInjection = false;

				// Inject the proper content
				switch(_getFileType(pp_images[set_position])){
					case 'image':
						imgPreloader = new Image();

						// Preload the neighbour images
						nextImage = new Image();
						if(isSet && set_position < $(pp_images).size() -1) nextImage.src = pp_images[set_position + 1];
						prevImage = new Image();
						if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];

						$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);

						imgPreloader.onload = function(){
							// Fit item to viewport
							pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);

							_showContent();
						};

						imgPreloader.onerror = function(){
							alert('Image cannot be loaded. Make sure the path is correct and image exist.');
							$.CloudFwPrettyPhoto.close();
						};

						imgPreloader.src = pp_images[set_position];
					break;

					case 'youtube':
						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport

						// Regular youtube link
						movie_id = getParam('v',pp_images[set_position]);

						// youtu.be link
						if(movie_id == ""){
							movie_id = pp_images[set_position].split('youtu.be/');
							movie_id = movie_id[1];
							if(movie_id.indexOf('?') > 0)
								movie_id = movie_id.substr(0,movie_id.indexOf('?')); // Strip anything after the ?

							if(movie_id.indexOf('&') > 0)
								movie_id = movie_id.substr(0,movie_id.indexOf('&')); // Strip anything after the &
						}

						movie = '//www.youtube.com/embed/'+movie_id;
						(getParam('rel',pp_images[set_position])) ? movie+="?rel="+getParam('rel',pp_images[set_position]) : movie+="?rel=1";

						if(settings.autoplay) movie += "&autoplay=1";

						toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
					break;

					case 'vimeo':
						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport

						movie_id = pp_images[set_position];
						var regExp = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;
						var match = movie_id.match(regExp);

						movie = 'http://player.vimeo.com/video/'+ match[3] +'?title=0&amp;byline=0&amp;portrait=0';
						if(settings.autoplay) movie += "&autoplay=1;";

						vimeo_width = pp_dimensions['width'] + '/embed/?moog_width='+ pp_dimensions['width'];

						toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);
					break;

					case 'quicktime':
						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
						pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar

						toInject = settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
					break;

					case 'mp4':
						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
						pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar

						toInject = settings.mp4_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
					break;

					case 'flash':
						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport

						flash_vars = pp_images[set_position];
						flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);

						filename = pp_images[set_position];
						filename = filename.substring(0,filename.indexOf('?'));

						toInject =  settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
					break;

					case 'iframe':
						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport

						frame_url = pp_images[set_position];
						frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);

						toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);
					break;

					case 'ajax':
						doresize = false; // Make sure the dimensions are not resized.
						pp_dimensions = _fitToViewport(movie_width,movie_height);
						doresize = true; // Reset the dimensions

						skipInjection = true;
						$.get(pp_images[set_position],function(responseHTML){
							toInject = settings.inline_markup.replace(/{content}/g,responseHTML);
							$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
							_showContent();
						});

					break;

					case 'custom':
						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport

						toInject = settings.custom_markup;
					break;

					case 'inline':
						// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
						myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
						doresize = false; // Make sure the dimensions are not resized.
						pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height());
						doresize = true; // Reset the dimensions
						$(myClone).remove();
						toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
					break;
				};

				if(!imgPreloader && !skipInjection){
					$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;

					// Show content
					_showContent();

				};
				settings.opened();

			});

			return false;
		};


		/**
		* Change page in the prettyPhoto modal box
		* @param direction {String} Direction of the paging, previous or next.
		*/
		$.CloudFwPrettyPhoto.changePage = function(direction){
			currentGalleryPage = 0;

			if(direction == 'previous') {
				set_position--;
				if (set_position < 0) set_position = $(pp_images).size()-1;
			}else if(direction == 'next'){
				set_position++;
				if(set_position > $(pp_images).size()-1) set_position = 0;
			}else{
				set_position=direction;
			};

			rel_index = set_position;

			if(!doresize) doresize = true; // Allow the resizing of the images
			if(settings.allow_expand) {
				$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
			}

			_hideContent(function(){ $.CloudFwPrettyPhoto.open(); });
		};


		/**
		* Change gallery page in the prettyPhoto modal box
		* @param direction {String} Direction of the paging, previous or next.
		*/
		$.CloudFwPrettyPhoto.changeGalleryPage = function(direction){
			if(direction=='next'){
				currentGalleryPage ++;

				if(currentGalleryPage > totalPage) currentGalleryPage = 0;
			}else if(direction=='previous'){
				currentGalleryPage --;

				if(currentGalleryPage < 0) currentGalleryPage = totalPage;
			}else{
				currentGalleryPage = direction;
			};

			slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0;

			slide_to = currentGalleryPage * (itemsPerPage * itemWidth);

			$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);
		};


		/**
		* Start the slideshow...
		*/
		$.CloudFwPrettyPhoto.startSlideshow = function(){
			if(typeof pp_slideshow == 'undefined'){
				$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
					$.CloudFwPrettyPhoto.stopSlideshow();
					return false;
				});
				pp_slideshow = setInterval($.CloudFwPrettyPhoto.startSlideshow,settings.slideshow);
			}else{
				$.CloudFwPrettyPhoto.changePage('next');
			};
		}


		/**
		* Stop the slideshow...
		*/
		$.CloudFwPrettyPhoto.stopSlideshow = function(){
			$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
				$.CloudFwPrettyPhoto.startSlideshow();
				return false;
			});
			clearInterval(pp_slideshow);
			pp_slideshow=undefined;
		}


		/**
		* Closes prettyPhoto.
		*/
		$.CloudFwPrettyPhoto.close = function(){
			if($pp_overlay.is(":animated")) return;

			$.CloudFwPrettyPhoto.stopSlideshow();

			$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');

			$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });

			$pp_overlay.fadeOut(settings.animation_speed, function(){

				if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible'); // Show the flash

				$(this).remove(); // No more need for the prettyPhoto markup

				$(window).unbind('scroll.prettyphoto');

				clearHashtag();

				settings.callback();

				doresize = true;

				pp_open = false;

				delete settings;
			});
		};

		/**
		* Set the proper sizes on the containers and animate the content in.
		*/
		function _showContent(){
			$('.pp_loaderIcon').hide();

			// Calculate the opened top position of the pic holder
			projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2));
			if(projectedTop < 0) projectedTop = 0;

			$ppt.fadeTo(settings.animation_speed,1);

			// Resize the content holder
			$pp_pic_holder.find('.pp_content')
				.animate({
					height:pp_dimensions['contentHeight'],
					width:pp_dimensions['contentWidth']
				},settings.animation_speed);

			// Resize picture the holder
			$pp_pic_holder.animate({
				'top': projectedTop,
				'left': ((windowWidth/2) - (pp_dimensions['containerWidth']/2) < 0) ? 0 : (windowWidth/2) - (pp_dimensions['containerWidth']/2),
				width:pp_dimensions['containerWidth']
			},settings.animation_speed,function(){
				$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);

				$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content

				// Show the nav
				if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }

				if(settings.allow_expand) {
					if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized
						$('a.pp_expand,a.pp_contract').show();
					}else{
						$('a.pp_expand').hide();
					}
				}

				if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.CloudFwPrettyPhoto.startSlideshow();

				settings.changepicturecallback(); // Callback!

				pp_open = true;
			});

			_insert_gallery();
			pp_settings.ajaxcallback();
		};

		/**
		* Hide the content...DUH!
		*/
		function _hideContent(callback){
			// Fade out the current picture
			$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
			$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
				$('.pp_loaderIcon').show();

				callback();
			});
		};

		/**
		* Check the item position in the gallery array, hide or show the navigation links
		* @param setCount {integer} The total number of items in the set
		*/
		function _checkPosition(setCount){
			(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
		};

		/**
		* Resize the item dimensions if it's bigger than the viewport
		* @param width {integer} Width of the item to be opened
		* @param height {integer} Height of the item to be opened
		* @return An array containin the "fitted" dimensions
		*/
		function _fitToViewport(width,height){
			resized = false;

			_getDimensions(width,height);

			// Define them in case there's no resize needed
			imageWidth = width, imageHeight = height;

			if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
				resized = true, fitting = false;

				while (!fitting){
					if((pp_containerWidth > windowWidth)){
						imageWidth = (windowWidth - 200);
						imageHeight = (height/width) * imageWidth;
					}else if((pp_containerHeight > windowHeight)){
						imageHeight = (windowHeight - 200);
						imageWidth = (width/height) * imageHeight;
					}else{
						fitting = true;
					};

					pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
				};



				if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){
					_fitToViewport(pp_containerWidth,pp_containerHeight)
				};

				_getDimensions(imageWidth,imageHeight);
			};

			return {
				width:Math.floor(imageWidth),
				height:Math.floor(imageHeight),
				containerHeight:Math.floor(pp_containerHeight),
				containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2),
				contentHeight:Math.floor(pp_contentHeight),
				contentWidth:Math.floor(pp_contentWidth),
				resized:resized
			};
		};

		/**
		* Get the containers dimensions according to the item size
		* @param width {integer} Width of the item to be opened
		* @param height {integer} Height of the item to be opened
		*/
		function _getDimensions(width,height){
			width = parseFloat(width);
			height = parseFloat(height);

			// Get the details height, to do so, I need to clone it since it's invisible
			$pp_details = $pp_pic_holder.find('.pp_details');
			$pp_details.width(width);
			detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));

			$pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
				'position':'absolute',
				'top':-10000
			});
			detailsHeight += $pp_details.height();
			detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
			$pp_details.remove();

			// Get the titles height, to do so, I need to clone it since it's invisible
			$pp_title = $pp_pic_holder.find('.ppt');
			$pp_title.width(width);
			titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
			$pp_title = $pp_title.clone().appendTo($('body')).css({
				'position':'absolute',
				'top':-10000
			});
			titleHeight += $pp_title.height();
			$pp_title.remove();

			// Get the container size, to resize the holder to the right dimensions
			pp_contentHeight = height + detailsHeight;
			pp_contentWidth = width;
			pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
			pp_containerWidth = width;
		}

		function _getFileType(itemSrc){
			if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
				return 'youtube';
			}else if (itemSrc.match(/vimeo\.com/i)) {
				return 'vimeo';
			}else if(itemSrc.match(/\b.mov\b/i)){
				return 'quicktime';
			}else if(itemSrc.match(/\b.mp4\b/i)){
				return 'mp4';
			}else if(itemSrc.match(/\b.swf\b/i)){
				return 'flash';
			}else if(itemSrc.match(/\biframe=true\b/i)){
				return 'iframe';
			}else if(itemSrc.match(/\bajax=true\b/i)){
				return 'ajax';
			}else if(itemSrc.match(/\bcustom=true\b/i)){
				return 'custom';
			}else if(itemSrc.substr(0,1) == '#'){
				return 'inline';
			}else{
				return 'image';
			};
		};

		function _center_overlay(){
			if(doresize && typeof $pp_pic_holder != 'undefined') {
				scroll_pos = _get_scroll();
				contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();

				projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
				if(projectedTop < 0) projectedTop = 0;

				if(contentHeight > windowHeight)
					return;

				$pp_pic_holder.css({
					'top': projectedTop,
					'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
				});
			};
		};

		function _get_scroll(){
			if (self.pageYOffset) {
				return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
			} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
				return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
			} else if (document.body) {// all other Explorers
				return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
			};
		};

		function _resize_overlay() {
			windowHeight = $(window).height(), windowWidth = $(window).width();

			if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth);
		};

		function _insert_gallery(){
			if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image") {
				itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
				navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; // Define the arrow width depending on the theme

				itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth);
				itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
				totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;

				// Hide the nav in the case there's no need for links
				if(totalPage == 0){
					navWidth = 0; // No nav means no width!
					$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
				}else{
					$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
				};

				galleryWidth = itemsPerPage * itemWidth;
				fullGalleryWidth = pp_images.length * itemWidth;

				// Set the proper width to the gallery items
				$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;

				$.CloudFwPrettyPhoto.changeGalleryPage(goToPage);

				$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
			}else{
				$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
				// $pp_gallery.hide();
			}
		}

		function _build_overlay(caller){
			// Inject Social Tool markup into General markup
			if(settings.social_tools)
				facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));

			settings.markup = settings.markup.replace('{pp_social}','');

			$('body').append(settings.markup); // Inject the markup

			$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors

			// Inject the inline gallery!
			if(isSet && settings.overlay_gallery) {
				currentGalleryPage = 0;
				toInject = "";
				for (var i=0; i < pp_images.length; i++) {
					if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){
						classname = 'default';
						img_src = '';
					}else{
						classname = '';
						img_src = pp_images[i];
					}
					toInject += "<li class='"+classname+"'><a href='#'><img src='" + img_src + "' width='50' alt='image' /></a></li>";
				};

				toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);

				$pp_pic_holder.find('#pp_full_res').after(toInject);

				$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors

				$pp_gallery.find('.pp_arrow_next').click(function(){
					$.CloudFwPrettyPhoto.changeGalleryPage('next');
					$.CloudFwPrettyPhoto.stopSlideshow();
					return false;
				});

				$pp_gallery.find('.pp_arrow_previous').click(function(){
					$.CloudFwPrettyPhoto.changeGalleryPage('previous');
					$.CloudFwPrettyPhoto.stopSlideshow();
					return false;
				});

				$pp_pic_holder.find('.pp_content').hover(
					function(){
						$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
					},
					function(){
						$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
					});

				itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
				$pp_gallery_li.each(function(i){
					$(this)
						.find('a')
						.click(function(){
							$.CloudFwPrettyPhoto.changePage(i);
							$.CloudFwPrettyPhoto.stopSlideshow();
							return false;
						});
				});
			};


			// Inject the play/pause if it's a slideshow
			if(settings.slideshow){
				$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
				$pp_pic_holder.find('.pp_nav .pp_play').click(function(){
					$.CloudFwPrettyPhoto.startSlideshow();
					return false;
				});
			}

			$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme

			$pp_overlay
				.css({
					'opacity':0,
					'height':$(document).height(),
					'width':$(window).width()
					})
				.bind('click',function(){
					if(!settings.modal) $.CloudFwPrettyPhoto.close();
				});

			$('a.pp_close').bind('click',function(){ $.CloudFwPrettyPhoto.close(); return false; });


			if(settings.allow_expand) {
				$('a.pp_expand').bind('click',function(e){
					// Expand the image
					if($(this).hasClass('pp_expand')){
						$(this).removeClass('pp_expand').addClass('pp_contract');
						doresize = false;
					}else{
						$(this).removeClass('pp_contract').addClass('pp_expand');
						doresize = true;
					};

					_hideContent(function(){ $.CloudFwPrettyPhoto.open(); });

					return false;
				});
			}

			$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
				$.CloudFwPrettyPhoto.changePage('previous');
				$.CloudFwPrettyPhoto.stopSlideshow();
				return false;
			});

			$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
				$.CloudFwPrettyPhoto.changePage('next');
				$.CloudFwPrettyPhoto.stopSlideshow();
				return false;
			});

			_center_overlay(); // Center it
		};

		if(!pp_alreadyInitialized && getHashtag()){
			pp_alreadyInitialized = true;

			// Grab the rel index to trigger the click on the correct element
			hashIndex = getHashtag();
			hashRel = hashIndex;
			hashIndex = hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);
			hashRel = hashRel.substring(0,hashRel.indexOf('/'));

			// Little timeout to make sure all the prettyPhoto initialize scripts has been run.
			// Useful in the event the page contain several init scripts.
			setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
		}

		return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.CloudFwPrettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
	};

	function getHashtag(){
		var url = location.href;
		hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false;
		if(hashtag){  hashtag = hashtag.replace(/<|>/g,''); }
		return hashtag;
	};

	function setHashtag(){
		if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
		location.hash = theRel + '/'+rel_index+'/';
	};

	function clearHashtag(){
		if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto";
	}

	function getParam(name,url){
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = "[\\?&]"+name+"=([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( url );
	  return ( results == null ) ? "" : results[1];
	}

})(jQuery);

var pp_alreadyInitialized = false; // Used for the deep linking to make sure not to call the same function several times.


(function($){$.belowthefold=function(element,settings){var fold=$(window).height()+$(window).scrollTop();return fold<=$(element).offset().top-settings.threshold;};$.abovethetop=function(element,settings){var top=$(window).scrollTop();return top>=$(element).offset().top+$(element).height()-settings.threshold;};$.rightofscreen=function(element,settings){var fold=$(window).width()+$(window).scrollLeft();return fold<=$(element).offset().left-settings.threshold;};$.leftofscreen=function(element,settings){var left=$(window).scrollLeft();return left>=$(element).offset().left+$(element).width()-settings.threshold;};$.inviewport=function(element,settings){return!$.rightofscreen(element,settings)&&!$.leftofscreen(element,settings)&&!$.belowthefold(element,settings)&&!$.abovethetop(element,settings);};$.extend($.expr[':'],{"below-the-fold":function(a,i,m){return $.belowthefold(a,{threshold:0});},"above-the-top":function(a,i,m){return $.abovethetop(a,{threshold:0});},"left-of-screen":function(a,i,m){return $.leftofscreen(a,{threshold:0});},"right-of-screen":function(a,i,m){return $.rightofscreen(a,{threshold:0});},"in-viewport":function(a,i,m){return $.inviewport(a,{threshold:0});}});})(jQuery);

// Generated by CoffeeScript 1.4.0
/*
jQuery waypoints - v2.0.2
Copyright (c) 2011-2013 Caleb Troughton
Dual licensed under the MIT license and GPL license.
https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt
*/
(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("cloudfw_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="cloudfw_waypoints-context-id";p="resize.cloudfw_waypoints";y="scroll.cloudfw_waypoints";v=1;w="cloudfw_waypoints-cloudfw_waypoint-ids";g="cloudfw_waypoint";m="cloudfw_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.cloudfw_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.cloudfw_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.cloudfw_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.cloudfw_waypoints.horizontal)&&n.isEmptyObject(this.cloudfw_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="cloudfw_waypoints"+v++;this.offset=null;this.options=r;e.cloudfw_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.cloudfw_waypoints[this.axis][this.id];return this.context.checkEmpty()};t.getcloudfw_waypointsByElement=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.getcloudfw_waypointsByElement(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 cloudfw_waypoints needs a callback function or handler option.")}else{return n.error("The "+r+" method does not exist in jQuery cloudfw_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.cloudfw_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);return 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.cloudfw_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.on('load',function(){return n[m]("refresh")})})}).call(this);

// Generated by CoffeeScript 1.6.2
/*
Sticky Elements Shortcut for jQuery cloudfw_waypoints - v2.0.3
Copyright (c) 2011-2013 Caleb Troughton
Dual licensed under the MIT license and GPL license.
https://github.com/imakewebthings/jquery-cloudfw_waypoints/blob/master/licenses.txt
*/


(function() {
  (function(root, factory) {
    if (typeof define === 'function' && define.amd) {
      return define(['jquery', 'cloudfw_waypoints'], factory);
    } else {
      return factory(root.jQuery);
    }
  })(this, function($) {
    var defaults, wrap;

    defaults = {
      wrapper: '<div class="sticky-wrapper" />',
      stuckClass: 'stuck',
      noStuckClass: 'no-stuck'
    };
    wrap = function($elements, options) {
      $elements.wrap(options.wrapper);
      return $elements.parent();
    };
    $.cloudfw_waypoints('extendFn', 'sticky', function(opt) {
      var $wrap, options, originalHandler;

      options = $.extend({}, $.fn.cloudfw_waypoint.defaults, defaults, opt);
      $wrap = wrap(this, options);
      originalHandler = options.handler;
      options.handler = function(direction) {
        var $sticky, shouldBeStuck;

        $sticky = $(this).children(':first');
        shouldBeStuck = direction === 'down' || direction === 'right';
        var height = shouldBeStuck ? $sticky.outerHeight() : '';  
        $sticky.toggleClass(options.stuckClass, shouldBeStuck);
        $sticky.toggleClass(options.noStuckClass, !shouldBeStuck);
        $wrap.height( height );
        if (originalHandler != null) {
          return originalHandler.call(this, direction);
        }
      };
      $wrap.cloudfw_waypoint(options);
      return this.data('stuckClass', options.stuckClass);
    });
    return $.cloudfw_waypoints('extendFn', 'unsticky', function() {
      this.parent().cloudfw_waypoint('destroy');
      this.unwrap();
      return this.removeClass(this.data('stuckClass'));
    });
  });

}).call(this);

jQuery(document).ready(function(){

	blogGalleryInit = function( parent ){

		jQuery( '.ui--blog-gallery' ).each(function(){
			var that = jQuery(this);
			var slider_data = that.data('flexslider');


			if ( !slider_data ) {

				var first_item = jQuery('.ui--blog-gallery-item-1 img', that);
				first_item.imagesLoaded(function(){

					that.css({height: first_item.height()});

					jQuery(window).on( 'load', function(){ blogGalleryInit( parent ); });

					var options = CloudFwParseAttribute(that.attr('data-options'));
						options.auto_rotate = (options.auto_rotate == '1') ? true : false;

					that.flexslider({
						namespace: "ui--blog-gallery-",
						selector: ".slides > div",
						animation: options.effect || "slide",
						slideshow: options.auto_rotate || false,
						slideshowSpeed: options.rotate_time || 7000,
						smoothHeight: true,
						controlNav: false,
						directionNav: false,
						keyboard: false
					});

					var slider_data = that.data('flexslider');

					var to_prev = function(){ that.flexslider("prev"); } 
					var to_next = function(){ that.flexslider("next"); } 

					that.find('.ui--blog-gallery-navigation').remove();
					that.append( jQuery('<div/>').addClass('ui--blog-gallery-navigation') );
					that.find('.ui--blog-gallery-navigation').html('<span class=\"arr arr-normal arr-left ui--carosuel-prev\"><span></span><i class=\"fontawesome-chevron-left px18\"></i></span> <span class=\"arr arr-normal ui--carosuel-next\"><span></span><i class=\"fontawesome-chevron-right px18\"></i></span>');
					that.find('.ui--blog-gallery-navigation > .ui--carosuel-prev').click( to_prev );
					that.find('.ui--blog-gallery-navigation > .ui--carosuel-next').click( to_next );
				
				});

			}

		});

	} 

	blogGalleryInit();
	jQuery(window).on( 'load', function(){ blogGalleryInit(); });

});

var BrowserDetect = 
{
    init: function () 
    {
        this.browser = this.searchString(this.dataBrowser) || "Other";
        this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown";
    },

    searchString: function (data) 
    {
        for (var i=0 ; i < data.length ; i++)   
        {
            var dataString = data[i].string;
            this.versionSearchString = data[i].subString;

            if (dataString.indexOf(data[i].subString) != -1)
            {
                return data[i].identity;
            }
        }
    },

    searchVersion: function (dataString) 
    {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
    },

    dataBrowser: 
    [
        { string: navigator.userAgent, subString: "Chrome",  identity: "Chrome" },
        { string: navigator.userAgent, subString: "MSIE",    identity: "IE" },
        { string: navigator.userAgent, subString: "Trident/", identity: "IE" },
        { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" },
        { string: navigator.userAgent, subString: "Safari",  identity: "Safari" },
        { string: navigator.userAgent, subString: "Opera",   identity: "Opera" },
    ]

};
BrowserDetect.init();

/*!
 * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
 * http://cherne.net/brian/resources/jquery.hoverIntent.html
 *
 * You may use hoverIntent under the terms of the MIT license. Basically that
 * means you are free to use hoverIntent as long as this header is left intact.
 * Copyright 2007, 2013 Brian Cherne
 */
 
/* hoverIntent is similar to jQuery's built-in "hover" method except that
 * instead of firing the handlerIn function immediately, hoverIntent checks
 * to see if the user's mouse has slowed down (beneath the sensitivity
 * threshold) before firing the event. The handlerOut function is only
 * called after a matching handlerIn.
 *
 * // basic usage ... just like .hover()
 * .hoverIntent( handlerIn, handlerOut )
 * .hoverIntent( handlerInOut )
 *
 * // basic usage ... with event delegation!
 * .hoverIntent( handlerIn, handlerOut, selector )
 * .hoverIntent( handlerInOut, selector )
 *
 * // using a basic configuration object
 * .hoverIntent( config )
 *
 * @param  handlerIn   function OR configuration object
 * @param  handlerOut  function OR selector for delegation OR undefined
 * @param  selector    selector OR undefined
 * @author Brian Cherne <brian(at)cherne(dot)net>
 */
(function($) {
    $.fn.hoverIntent = function(handlerIn,handlerOut,selector) {

        // default configuration values
        var cfg = {
            interval: 100,
            sensitivity: 7,
            timeout: 0
        };

        if ( typeof handlerIn === "object" ) {
            cfg = $.extend(cfg, handlerIn );
        } else if ($.isFunction(handlerOut)) {
            cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
        } else {
            cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
        }

        // instantiate variables
        // cX, cY = current X and Y position of mouse, updated by mousemove event
        // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
        var cX, cY, pX, pY;

        // A private function for getting mouse position
        var track = function(ev) {
            cX = ev.pageX;
            cY = ev.pageY;
        };

        // A private function for comparing current and previous mouse position
        var compare = function(ev,ob) {
            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
            // compare mouse positions to see if they've crossed the threshold
            if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
                $(ob).off("mousemove.hoverIntent",track);
                // set hoverIntent state to true (so mouseOut can be called)
                ob.hoverIntent_s = 1;
                return cfg.over.apply(ob,[ev]);
            } else {
                // set previous coordinates for next time
                pX = cX; pY = cY;
                // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
                ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
            }
        };

        // A private function for delaying the mouseOut function
        var delay = function(ev,ob) {
            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
            ob.hoverIntent_s = 0;
            return cfg.out.apply(ob,[ev]);
        };

        // A private function for handling mouse 'hovering'
        var handleHover = function(e) {
            // copy objects to be passed into t (required for event object to be passed in IE)
            var ev = jQuery.extend({},e);
            var ob = this;

            // cancel hoverIntent timer if it exists
            if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

            // if e.type == "mouseenter"
            if (e.type == "mouseenter") {
                // set "previous" X and Y position based on initial entry point
                pX = ev.pageX; pY = ev.pageY;
                // update "current" X and Y position based on mousemove
                $(ob).on("mousemove.hoverIntent",track);
                // start polling interval (self-calling timeout) to compare mouse coordinates over time
                if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

                // else e.type == "mouseleave"
            } else {
                // unbind expensive mousemove event
                $(ob).off("mousemove.hoverIntent",track);
                // if hoverIntent state is true, then call the mouseOut function after the specified delay
                if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
            }
        };

        // listen for mouseenter and mouseleave
        return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
    };
})(jQuery);

/*
 * jQuery Superfish Menu Plugin
 * Copyright (c) 2013 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 *	http://www.opensource.org/licenses/mit-license.php
 *	http://www.gnu.org/licenses/gpl.html
 */
(function ($) {
	"use strict";

	var methods = (function () {
		// private properties and methods go here
		var c = {
				bcClass: 'sf-breadcrumb',
				menuClass: 'sf-js-enabled',
				anchorClass: 'sf-with-ul',
				menuArrowClass: 'sf-arrows'
			},
			ios = (function () {
				var ios = /iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase());
				if (ios) {
					// iOS clicks only bubble as far as body children
					$(window).on('load',function () {
						$('body').children().on('click', $.noop);
					});
				}
				return ios;
			})(),
			wp7 = (function () {
				var style = document.documentElement.style;
				return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent));
			})(),
			toggleMenuClasses = function ($menu, o) {
				var classes = c.menuClass;
				if (o.cssArrows) {
					classes += ' ' + c.menuArrowClass;
				}
				$menu.toggleClass(classes);
			},
			setPathToCurrent = function ($menu, o) {
				return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
					.addClass(o.hoverClass + ' ' + c.bcClass)
						.filter(function () {
							return ($(this).children(o.popUpSelector).hide().show().length);
						}).removeClass(o.pathClass);
			},
			toggleAnchorClass = function ($li) {
				$li.children('a').toggleClass(c.anchorClass);
			},
			toggleTouchAction = function ($menu) {
				var touchAction = $menu.css('ms-touch-action');
				touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y';
				$menu.css('ms-touch-action', touchAction);
			},
			applyHandlers = function ($menu, o) {
				var targets = 'li:has(' + o.popUpSelector + ')';

				if ( o.fire_event == 'click' ) {
					$menu
						.on('click.superfish', targets, over)
						.on('mouseleave.superfish', targets, out);

				} else if ($.fn.hoverIntent && !o.disableHI) {
					$menu.hoverIntent(over, out, targets);
				}
				else {
					$menu
						.on('mouseenter.superfish', targets, over)
						.on('mouseleave.superfish', targets, out);
				}
				var touchevent = 'MSPointerDown.superfish';
				if (!ios) {
					touchevent += ' touchend.superfish';
				}
				if (wp7) {
					touchevent += ' mousedown.superfish';
				}
				$menu
					.on('focusin.superfish', 'li', over)
					.on('focusout.superfish', 'li', out)
					.on(touchevent, 'a', o, touchHandler);
			},
			touchHandler = function (e) {
				var $this = $(this),
					$ul = $this.siblings(e.data.popUpSelector);

				if ($ul.length > 0 && $ul.is(':hidden')) {
					$this.one('click.superfish', false);
					if (e.type === 'MSPointerDown') {
						$this.trigger('focus');
					} else {
						$.proxy(over, $this.parent('li'))();
					}
				}
			},
			over = function () {
				var $this = $(this),
					o = getOptions($this);
				clearTimeout(o.sfTimer);
				$this.siblings().superfish('hide').end().superfish('show');
			},
			out = function () {
				var $this = $(this),
					o = getOptions($this);
				if (ios) {
					$.proxy(close, $this, o)();
				}
				else {
					if ( o.sfTimer ) {
						clearTimeout(o.sfTimer);
					}
					o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay);
				}
			},
			close = function (o) {
				o.retainPath = ($.inArray(this[0], o.$path) > -1);
				this.superfish('hide');

				if (!this.parents('.' + o.hoverClass).length) {
					o.onIdle.call(getMenu(this));
					if (o.$path.length) {
						$.proxy(over, o.$path)();
					}
				}
			},
			getMenu = function ($el) {
				return $el.closest('.' + c.menuClass);
			},
			getOptions = function ($el) {
				return getMenu($el).data('sf-options');
			};

		return {
			// public methods
			hide: function (instant) {
				if (this.length) {
					var $this = this,
						o = getOptions($this);
					if (!o) {
						return this;
					}
					var not = (o.retainPath === true) ? o.$path : '',
						$ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector),
						speed = o.speedOut;

					if (instant) {
						$ul.show();
						speed = 0;
					}
					o.retainPath = false;
					o.onBeforeHide.call(this, $ul);
					$ul.stop(true, true).animate(o.animationOut, speed, function () {
						var $this = $(this);
						o.onHide.call($this);
					});
				}
				return this;
			},
			show: function () {
				var o = getOptions(this);
				if (!o) {
					return this;
				}
				var $this = this.addClass(o.hoverClass),
					$ul = $this.children(o.popUpSelector);

				o.onBeforeShow.call(this, $ul);
				$ul.stop(true, true).animate(o.animation, o.speed, function () {
					o.onShow.call(this, $ul);
				});
				return this;
			},
			destroy: function () {
				return this.each(function () {
					var $this = $(this),
						o = $this.data('sf-options'),
						$hasPopUp;
					if (!o) {
						return false;
					}
					$hasPopUp = $this.find(o.popUpSelector).parent('li');
					clearTimeout(o.sfTimer);
					toggleMenuClasses($this, o);
					toggleAnchorClass($hasPopUp);
					toggleTouchAction($this);
					// remove event handlers
					$this.off('.superfish').off('.hoverIntent');
					// clear animation's inline display style
					$hasPopUp.children(o.popUpSelector).attr('style', function (i, style) {
						return style.replace(/display[^;]+;?/g, '');
					});
					// reset 'current' path classes
					o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass);
					$this.find('.' + o.hoverClass).removeClass(o.hoverClass);
					o.onDestroy.call($this);
					$this.removeData('sf-options');
				});
			},
			init: function (op) {
				return this.each(function () {
					var $this = $(this);
					if ($this.data('sf-options')) {
						return false;
					}
					var o = $.extend({}, $.fn.superfish.defaults, op),
						$hasPopUp = $this.find(o.popUpSelector).parent('li');
					o.$path = setPathToCurrent($this, o);

					$this.data('sf-options', o);

					toggleMenuClasses($this, o);
					toggleAnchorClass($hasPopUp);
					toggleTouchAction($this);
					applyHandlers($this, o);

					$hasPopUp.not('.' + c.bcClass).superfish('hide', true);

					o.onInit.call(this);

					var iosnavfix_force = false;
					if ( o.fire_event == 'click' ) {
						iosnavfix_force = true;
					}

					$this.iosnavfix(iosnavfix_force);
				});
			}
		};
	})();

	$.fn.superfish = function (method, args) {
		if (methods[method]) {
			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
		}
		else if (typeof method === 'object' || ! method) {
			return methods.init.apply(this, arguments);
		}
		else {
			return $.error('Method ' +  method + ' does not exist on jQuery.fn.superfish');
		}
	};

	$.fn.superfish.defaults = {
	popUpSelector: 'ul, .sf-mega', // within menu context
		hoverClass: 'sfHover',
		pathClass: 'overrideThisToUse',
		fire_event: 'hover',
		pathLevels: 1,
		delay: 800,
		animation: {opacity: 'show'},
		animationOut: {opacity: 'hide'},
		speed: 'normal',
		speedOut: 'fast',
		cssArrows: true,
		disableHI: false,
		onInit: $.noop,
		onBeforeShow: $.noop,
		onShow: $.noop,
		onBeforeHide: $.noop,
		onHide: $.noop,
		onIdle: $.noop,
		onDestroy: $.noop
	};

	// soon to be deprecated
	$.fn.extend({
		hideSuperfishUl: methods.hide,
		showSuperfishUl: methods.show
	});

})(jQuery);

/*!
 * iOS Nav Fix - Dropdown menu fix for iOS devices
 *
 * Version:  1.0
 * Released: 19-02-2013
 * Source:   http://github.com/Vheissu/IOSNavFix
 * Plugin:   Iosnavfix
 * Author:   Dwayne Charrington (dwaynecharrington@gmail.com)
 * Modified: Orkun Gursel (help@wptation.com)
 * License:  MIT Licence
 *           http://www.opensource.org/licenses/mit-license.php
 *
 * Copyright (c) 2013 Dwayne Charrington.
 *
 */
;(function(w, $) {

	$.fn.iosnavfix = function( force ) {

		return this.each(function() {

			if ( isMobile() || force ) {
				var $this = $(this);
				var $list       = [];

				$("li", $this).each(function() {
					var $this       = $(this);
					var $parentLink = $("> a", $this);


					// If we have children
					if ($this.children('ul').length || $this.children('ol').length) {

						// Set default clicked state
						$parentLink.data('clicked', false);

						// When the link is clicked
						$parentLink.on("click", function(e) {

							jQuery.each($list, function(k,v){
								if ( v.jquery && v != $parentLink ) {
									v.data('clicked', false);
								}
							});

							// if we haven't already clicked, false
							if ($parentLink.data('clicked') == false) {
								// Inform everyone we've now clicked
								$parentLink.data('clicked', true);

								$list.push( $parentLink );

								// Prevent link being followed into next click
								return false;
							} else {
								// Reset link click state
								$parentLink.data('clicked', false);

								// Allow link to be followed now
								return true;
							}

						});
					}
				});
			}

		});

		/**
		 * If a user is pretending to be an iOS device, too bad for them.
		 * As if you would imitate an iPad or iPhone for non-testing purposes.
		 *
		 * Anyway, this function will detect iOS user agents, simple.
		 */
		function isMobile() {
			if ( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i) ) || (navigator.userAgent.match(/iPad/i) )|| (navigator.userAgent.toLowerCase().match(/android/i) ) ) { return true; } else { return false; }
		}

	}

})(window, jQuery);

/*!
 * imagesLoaded PACKAGED v3.0.4
 * JavaScript is all like "You images are done yet or what?"
 */

(function(){"use strict";function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}var n=e.prototype;n.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},n.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},n.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},n.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},n.on=n.addListener,n.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},n.once=n.addOnceListener,n.defineEvent=function(e){return this.getListeners(e),this},n.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},n.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},n.off=n.removeListener,n.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},n.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},n.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},n.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},n.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],o=n.listener.apply(this,t||[]),(o===this._getOnceReturnValue()||n.once===!0)&&this.removeListener(e,s[r][i].listener);return this},n.trigger=n.emitEvent,n.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},n.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},n._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},n._getEvents=function(){return this._events||(this._events={})},"function"==typeof define&&define.amd?define(function(){return e}):"undefined"!=typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){"use strict";var t=document.documentElement,n=function(){};t.addEventListener?n=function(e,t,n){e.addEventListener(t,n,!1)}:t.attachEvent&&(n=function(t,n,i){t[n+i]=i.handleEvent?function(){var t=e.event;t.target=t.target||t.srcElement,i.handleEvent.call(i,t)}:function(){var n=e.event;n.target=n.target||n.srcElement,i.call(t,n)},t.attachEvent("on"+n,t[n+i])});var i=function(){};t.removeEventListener?i=function(e,t,n){e.removeEventListener(t,n,!1)}:t.detachEvent&&(i=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var r={bind:n,unbind:i};"function"==typeof define&&define.amd?define(r):e.eventie=r}(this),function(e){"use strict";function t(e,t){for(var n in t)e[n]=t[n];return e}function n(e){return"[object Array]"===c.call(e)}function i(e){var t=[];if(n(e))t=e;else if("number"==typeof e.length)for(var i=0,r=e.length;r>i;i++)t.push(e[i]);else t.push(e);return t}function r(e,n){function r(e,n,s){if(!(this instanceof r))return new r(e,n);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=i(e),this.options=t({},this.options),"function"==typeof n?s=n:t(this.options,n),s&&this.on("always",s),this.getImages(),o&&(this.jqDeferred=new o.Deferred);var a=this;setTimeout(function(){a.check()})}function c(e){this.img=e}r.prototype=new e,r.prototype.options={},r.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);for(var i=n.querySelectorAll("img"),r=0,o=i.length;o>r;r++){var s=i[r];this.addImage(s)}}},r.prototype.addImage=function(e){var t=new c(e);this.images.push(t)},r.prototype.check=function(){function e(e,r){return t.options.debug&&a&&s.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},r.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify(t,e)})},r.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},o&&(o.fn.imagesLoaded=function(e,t){var n=new r(this,e,t);return n.jqDeferred.promise(o(this))});var f={};return c.prototype=new e,c.prototype.check=function(){var e=f[this.img.src];if(e)return this.useCached(e),void 0;if(f[this.img.src]=this,this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this.proxyImage=new Image;n.bind(t,"load",this),n.bind(t,"error",this),t.src=this.img.src},c.prototype.useCached=function(e){if(e.isConfirmed)this.confirm(e.isLoaded,"cached was confirmed");else{var t=this;e.on("confirm",function(e){return t.confirm(e.isLoaded,"cache emitted confirmed"),!0})}},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindProxyEvents()},c.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindProxyEvents()},c.prototype.unbindProxyEvents=function(){n.unbind(this.proxyImage,"load",this),n.unbind(this.proxyImage,"error",this)},r}var o=e.jQuery,s=e.console,a=s!==void 0,c=Object.prototype.toString;"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],r):e.imagesLoaded=r(e.EventEmitter,e.eventie)}(window);

;(function ( $, window, document, undefined ) {

	// Create the defaults once
	var pluginName = "uiVerticalCenter",
		defaults = {};

	// The actual plugin constructor
	function Plugin( element, options ) {
		this.element = element;
		this.options = $.extend( {}, defaults, options );

		this._defaults = defaults;
		this._name = pluginName;

		this.init();
	}

	Plugin.prototype = {

		init: function() {
			var element = jQuery(this.element);
			var images = element.find('img');
			var height = element.outerHeight();

			element.css({'margin-top' : - (height / 2) }).attr('data-height', height );
			if ( images.length ) {
				images.imagesLoaded(function(){
					var height = element.outerHeight();
					element.css({'margin-top' : - (height / 2) });
				});
			}

		},

        calcHeight: function () {
            var that = jQuery(this.element);

            var height =
                parseInt(that.css('margin-top'), 10) +
                parseInt(that.css('padding-top'), 10) +
                parseInt(that.css('border-top-width'), 10) +
                parseInt(that.height(), 10) +
                parseInt(that.css('border-bottom-width'), 10) +
                parseInt(that.css('padding-bottom'), 10) +
                parseInt(that.css('margin-bottom'), 10);

            return height;
        }


	};

	$.fn[pluginName] = function ( options ) {
		return this.each(function () {
			if (!$.data(this, "plugin_" + pluginName)) {
				$.data(this, "plugin_" + pluginName, new Plugin( this, options ));
			}
		});
	};

})( jQuery, window, document );

jQuery(document).ready(function(){
	var centerVertical = function(){
		jQuery('.ui--center-vertical').uiVerticalCenter();
	};

	setTimeout(function(){
		centerVertical();
	}, 100 );

	jQuery(window).resize( centerVertical );
	jQuery(window).on( 'load', centerVertical );	


});

jQuery(document).ready(function(){blogGalleryInit=function(a){jQuery(".ui--blog-gallery").each(function(){var e=jQuery(this),i=e.data("flexslider");if(!i){var l=jQuery(".ui--blog-gallery-item-1 img",e);l.imagesLoaded(function(){e.css({height:l.height()}),jQuery(window).on("load",function(){blogGalleryInit(a)});var i=CloudFwParseAttribute(e.attr("data-options"));i.auto_rotate="1"==i.auto_rotate?!0:!1,e.flexslider({namespace:"ui--blog-gallery-",selector:".slides > div",animation:i.effect||"slide",slideshow:i.auto_rotate||!1,slideshowSpeed:i.rotate_time||7e3,smoothHeight:!0,controlNav:!1,directionNav:!1,keyboard:!1});var o=(e.data("flexslider"),function(){e.flexslider("prev")}),n=function(){e.flexslider("next")};e.find(".ui--blog-gallery-navigation").remove(),e.append(jQuery("<div/>").addClass("ui--blog-gallery-navigation")),e.find(".ui--blog-gallery-navigation").html('<span class="arr arr-normal arr-left ui--carosuel-prev"><span></span><i class="fontawesome-chevron-left px18"></i></span> <span class="arr arr-normal ui--carosuel-next"><span></span><i class="fontawesome-chevron-right px18"></i></span>'),e.find(".ui--blog-gallery-navigation > .ui--carosuel-prev").click(o),e.find(".ui--blog-gallery-navigation > .ui--carosuel-next").click(n)})}})},blogGalleryInit(),jQuery(window).on("load",function(){blogGalleryInit()})});

jQuery(document).ready(function(){

	if( jQuery('body').hasClass('layout--boxed') ) {
		var calc_header_width = function(){
			var page_wrap_width = jQuery('#page-wrap').width();
			var header_container = jQuery('#header-container');

			header_container.width( page_wrap_width );
			
		}

		calc_header_width();
		jQuery(window).smartresize( calc_header_width );

	}

});

jQuery(document).ready(function(){
	"use strict";

	jQuery.fn.extend({
		/**
		 *	CloudFw Select Current Menu Item
		 *
		 *	@since 1.0
		 */
		selectCurrentMenu : function() {

			jQuery.fn.extend({

				/* Match Classes */
				matchClasses : function() {

					//this.addClass('passed');

					if ( this.is('.current-menu-item, .current-menu-ancestor, .current-menu-parent, .current_page_parent, .current_page_ancestor, .current_page_item') ) {
						if ( this.parents('.depth-0').length ) {
							this.parents('.depth-0').last().addClass('current-item-handler');
						} else {
							this.addClass('current-item-handler').addClass('current-sub-item');
						}
					}
					this.removeClass('current-menu-item current-menu-ancestor current-menu-parent current_page_parent current_page_ancestor current_page_item');
					return this;
				},

				/* Loop Items */
				loopItems : function() {

					if ( this.length ){

						this.each(function(){
							var item = jQuery(this);
							item.matchClasses();

							if ( item.children('.sub-menu').length ) {

								var children = item.children('.sub-menu').children();

								if ( !children.length ) {
									item.find('.ui--caret').remove();
									item.children('.sub-menu').remove();
								} else {
									children.loopItems();
								}
							}

						});

					}

				},

				/* Set Final */
				setCurrentItem : function() {

					var currentItemClass = 'current-menu-item';

					if ( this.find( '.current-item-handler' ).length ){
						if ( this.find( '.current-item-handler' ).is('.force-for-select') )
							this.find( '.current-item-handler.force-for-select' ).removeClass( 'current-item-handler' ).first().addClass( currentItemClass );
						else
							this.find( '.current-item-handler' ).removeClass( 'current-item-handler' ).first().addClass( currentItemClass );
					}
					/*else
						this.children().first().addClass( currentItemClass );*/

				}


			});

			/* Run the Plugin */
			return this.each(function() {
				var theMenu = jQuery(this);
				var menuItems = theMenu.children();

				menuItems.loopItems();
				theMenu.setCurrentItem();
			});
		},

		/**
		 *	CloudFw Prepare Menus
		 *
		 *	@since 1.0
		 */
		prepareMenu: function() {
			/* Run the Plugin */
			return this.each(function() {
				var theMenu = jQuery(this);
				var navMenuItems = theMenu.find('li');

				navMenuItems.each(function(){

					if ( jQuery(this).find('.sub-menu').length ) {

						if ( !jQuery(this).hasClass('has-sub-menu') )
							jQuery(this)
								.addClass('has-sub-menu')
								.find('a')
								.first()
								.append('<span class="indicator"></span>');

					}

				});

				/** Add class to first level navigation menu items */
				var navMenuFirstLevelItems = theMenu.children('ul > li.depth-0');
				var navMenuFirstLevelItemsLenght = navMenuFirstLevelItems.length;
				navMenuFirstLevelItems.each(function(itemNumber) {
					jQuery(this).addClass('asc-' + itemNumber++ ).addClass('desc-' + parseInt(navMenuFirstLevelItemsLenght - itemNumber, 10));
				});

			});

		}


	});

	jQuery('#header-navigation').selectCurrentMenu();

});

jQuery(document).ready(function(){
	'use strict';

	var initEffects = function() {

		jQuery('.ui--animation-in:in-viewport').each(function(){
			var parent = jQuery(this);

			if ( ! parent.is(':visible') ) {
				return true;
			}

			if ( parent.data('inViewport') ) {
				return true;
			}

			parent.data('inViewport', true);

			initEffectsFire( parent );

		});
		
	};

	var initEffectsFire = function( parent ) {

		var animator    = parent.hasClass('ui--animation-in') ? parent : parent.parents('.ui--animation-in:first');

		var elements    = parent.find('.ui--animation'),
			effect      = animator.attr('data-fx'),
			start_delay = parseInt( parent.attr('data-start-delay'), 10 ) || 0,
			delay       = parseInt( animator.attr('data-delay'), 10 ) || 150;

		var carousel = parent.find('.ui--carousel');
		if ( carousel.length ) {
			var active_carousel = carousel.find('.ui--carousel-active-slide'); 

			if ( active_carousel.length ) {
				var passive_elements = elements;

				if ( carousel.parents('.ui--animation').length ) {
					initEffectsFire( carousel.find('.ui--carousel-active-slide') );
				} else {
					elements = carousel.find('.ui--carousel-active-slide').find('.ui--animation');
				}
				passive_elements.not( elements ).addClass('ui--animation-fire');/*.removeClass('ui--animation')*/;
			}

		}

		elements = elements.filter(function(index){
			var parent_animations = jQuery(this).parents('.ui--animation');

			parent_animations = parent_animations.filter(function(){
				return jQuery(this).find('.ui--animation-in').length === 0;
			});

			return parent_animations.length === 0;
		});

		/*elements = elements.filter(function(index){
			var all_parents = jQuery(this).parents();
			var has_ui_animation = false;

			all_parents.each(function(){
				var up_element = jQuery(this);
				if ( up_element.hasClass( '.ui--animation-in' ) ) {
					return false;
				} else if ( up_element.hasClass( '.ui--animation' ) ) {
					has_ui_animation = true;
					return false;
				}
			});

			return has_ui_animation ? false : true;
		});*/



		elements.each(function(i){

			var element         = jQuery(this),
				element_effect  = element.attr('data-fx'),
				element_delay   = parseInt( element.attr('data-delay'), 10 ) || 0,
				current_delay   = (start_delay + element_delay) + (i * delay);

			//element.attr('data-current-delay', current_delay);

			if ( element_effect ) {
				element.addClass( element_effect );
			} else if ( effect ) {
				element.addClass( effect );
			}

			var timeout = setTimeout(function(){ 

				//element.bind("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd", function(){});
				element.addClass('ui--animation-fire').attr('delay', current_delay);

				if ( element.find('.ui--animation') ) {
					element.removeClass('ui--animation');
					initEffectsFire( element );
				}

			}, (current_delay));

		});

	};

	var animation_type = jQuery('html').hasClass('cssanimations') ? 'css' : 'javascript';

	if ( animation_type == 'css' ) {
		//setTimeout( initEffects, 200 );
		jQuery(document).ready( initEffects );
		jQuery(document).ajaxSuccess( initEffects );
		jQuery(window).on( 'load', initEffects );
		jQuery(window).focus( initEffects );
		jQuery(window).scroll( jQuery.throttle( 250, initEffects ) );
	}

});

/*
 * jQuery Fill Parent
 * 
 * Author: Orkun Gursel 
 */
;(function ( $, window, document, undefined ) {
    "use strict";

    var pluginName = 'fillParent',
        defaults = {

        };
 
    function Plugin( element, options ) {
        this.element = element;
        this.options = $.extend( {}, defaults, options);
 
        this._defaults = defaults;
        this._name = pluginName;
 
        var that = this;
        this.init();
        jQuery(window).on( 'load', function(){
            that.init();
        });
        jQuery(window).smartresize(function(){
            that.init();
        });
    }
 
    Plugin.prototype = {
        init: function () {

            var element = jQuery( this.element ),
                parent = element.parent();

            var parentWidth = parent.width(); 
            var parentHeight = parent.height();

            var elementWidth = element.attr('width');
            var elementHeight = element.attr('height');

            if ( ! elementWidth ) {
                element.css({ width: '' });
                elementWidth = element.width();
            }

            if ( ! elementHeight ) {
                element.css({ height: '' });
                elementHeight = element.height();
            }

            var newsizes = this.fill( parentWidth, parentHeight, elementWidth, elementHeight ); 

            element.css( newsizes ).addClass('ui--filled');

            /*console.log( 'parentWidth: ' + parentWidth );
            console.log( 'parentHeight: ' + parentHeight );
            console.log( 'elementWidth: ' + elementWidth );
            console.log( 'elementHeight: ' + elementHeight );
            console.log( newsizes );*/
        }, 

        fill: function( parentWidth, boxHeight, elementWidth, elementHeight ) {
            var out = {};
            var initW = elementWidth;
            var initH = elementHeight;
            var ratio = initH / initW;

            elementWidth = parentWidth;
            elementHeight = parentWidth * ratio;

            if(elementHeight < boxHeight){
                elementHeight = boxHeight;
                elementWidth = elementHeight / ratio;
            }

            elementWidth = Math.round(elementWidth);
            elementHeight = Math.round(elementHeight);

            out.width = elementWidth;
            out.height = elementHeight;

            if( elementWidth > parentWidth ) {
                out.marginLeft = Math.round( (parentWidth - elementWidth) / 2 );
                out.marginTop = ''; 
            } else {    
                out.marginLeft = ''; 
                out.marginTop = Math.round( (boxHeight - elementHeight) / 2 );
            }

            return out;
        }

    };
 
    $.fn[pluginName] = function ( options ) {
        return this.each(function () {
            if (!$.data(this, 'plugin_' + pluginName)) {
                $.data(this, 'plugin_' + pluginName,
                new Plugin( this, options ));
            }
        });
    }
 
})( jQuery, window, document );

(function(){

	jQuery(document).ready(function(){

		var video_bg_page_height = function(){
			var win_height = win_height_alias = jQuery(window).height();
			var body = jQuery('body');
			var header = jQuery('#page-header');
			var titlebar = jQuery('#titlebar');
			var adminbar = body.hasClass("admin-bar");
			var total_content_height = 0;

			var is_overlapping = body.hasClass('header-overlapping');

			if( ! is_overlapping && header.length ) {
				var header_height = header.height();
				win_height = win_height - header_height;
				total_content_height += header_height;
			}

			if( titlebar.length ) {
				var titlebar_height = titlebar.height();
				win_height = win_height - titlebar_height;
				total_content_height += titlebar_height;
			}

			if( adminbar ) {
				var adminbar_height = 32;
				win_height = win_height - adminbar_height;
				total_content_height += adminbar_height;
			}

			jQuery('.ui--section-content-v-center').css({
				'height': win_height > 0 ? win_height : win_height_alias
			});

			/** Sticky Footer */
			if ( body.hasClass('sticky-footer') ) {
				var footer = jQuery('#page-wrap > footer'),
					footer_height = footer.height(),
					page_content = jQuery('#page-content');

				page_content.css({'min-height': ''});
				var	page_content_height = page_content.outerHeight() - page_content.height() + 1;

				if( footer.length ) {

					var value = win_height_alias - (total_content_height + footer_height) - page_content_height;
					page_content.css({
						'min-height': value > 0 ? value : ''
					});

				}

			}

		}

		if ( jQuery('.ui--section-content-v-center').length || jQuery('body').hasClass('sticky-footer') ) {
			video_bg_page_height();
			jQuery(window).on( 'load', video_bg_page_height );
			jQuery(window).smartresize( video_bg_page_height, 20 );
		}

		jQuery('.ui--video-background-video video, .ui--video-background-video iframe').fillParent();
	});

})(jQuery);

jQuery(document).ready(function(){

	var doneElements = new Array;

	jQuery("a[data-rel^='prettyPhoto']").each(function(){
		var that = jQuery(this),
			href = that.attr('href');

		if ( ! doneElements[ href ] ) {
			doneElements[ href ] = true;

			var same_hrefs = jQuery('a[href^="'+ href +'"]').not(that);

			if( same_hrefs.length ) {
				same_hrefs.each(function( index ){
					if ( jQuery(this).attr('data-rel') !== 'undefined' && jQuery(this).attr('data-rel') == that.attr('data-rel') ){
						jQuery(this).removeAttr('data-rel');
						jQuery(this).on('click', function( event ){
							event.preventDefault();
							that.trigger('click');
						});
					}
				});
			}
		}
	});


	jQuery("a[data-rel^='prettyPhoto']").CloudFwPrettyPhoto({
		theme: 'pp_envision',
		show_title: true,
		slideshow: false,
		social_tools: false,
		deeplinking: false,
		modal: false
	});

});

jQuery(function(){
	"use strict";

	var getParam = function (name,url){
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = ""+name+"[\:|\=]([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( url );
	  return ( results == null ) ? "" : results[1];
	}

	var listenHash = jQuery.debounce(100, function( hash, that ){
		if ( hash == '' || hash == '#' ) {
			return true;
		}

		/** Scroll */
		var to = getParam( 'to', hash );
		if ( typeof to !== undefined && to != '' ) {

			var anchor = jQuery('#' + to);
			if ( anchor.length === 0 ) {
				return true;
			}

			if ( to == 'top' && anchor.length === 0 ) {
				var scrollTo = '0';
			} else {
				var scrollTo = anchor.offset().top;
				var offset = getParam( 'offset', hash );

				if ( typeof offset !== undefined && offset !== '' ) {
					scrollTo = scrollTo + parseInt(offset, 10);
					if ( scrollTo < 0 ) {
						scrollTo = 0;
					}
				}

			}

			jQuery('html, body').stop( true ).animate({scrollTop: scrollTo}, 500, function () {/**window.location.hash = id;*/});

			var update_hash = getParam( 'update', hash );
			if ( typeof update_hash !== undefined && update_hash == 'true' ) {
				return true;
			}

			return false;

		}

		/** Sidepanel */
		var sidepanel = getParam( 'sidepanel', hash );
		if ( typeof sidepanel !== undefined && sidepanel != '' ) {
			jQuery( document ).trigger( "openSidePanel", [ sidepanel ] );
			return false;
		}

		/** Filter */
		var filter = getParam( 'filter', hash );
		if ( typeof filter !== undefined && filter != '' ) {
			jQuery( document ).trigger( "filterChange", [ filter ] );
			return false;
		}

		/** Filter */
		var tab = getParam( 'tab', hash );
		if ( typeof tab !== undefined && tab != '' ) {
			var $tab = jQuery( "[href='#"+ tab +"']", '.ui--tabs-titles');
			if ( $tab.length ) {

				$tab.click();

				var scrollTo = $tab.offset().top;
				var offset = getParam( 'offset', hash );

				if ( typeof offset !== undefined && offset !== '' ) {
					scrollTo = scrollTo + parseInt(offset, 10);
					if ( scrollTo < 0 ) {
						scrollTo = 0;
					}
				}
				jQuery('html, body').stop( true ).animate({scrollTop: scrollTo}, 500, function () {});

			}

			return true;
		}


		/** Filter */
		var acc = getParam( 'acc', hash );
		if ( typeof acc !== undefined && acc != '' ) {
			var $acc = jQuery( "[href='#"+ acc +"']", '.ui--accordion-item');
			if ( $acc.length ) {

				if ( ! $acc.parent().hasClass('ui--accordion-state-opened') ) {
					$acc.click();
				}


				var scrollTo = $acc.offset().top;
				var offset = getParam( 'offset', hash );

				if ( typeof offset !== undefined && offset !== '' ) {
					scrollTo = scrollTo + parseInt(offset, 10);
					if ( scrollTo < 0 ) {
						scrollTo = 0;
					}
				}
				jQuery('html, body').stop( true ).animate({scrollTop: scrollTo}, 500, function () {});

			}

			return true;
		}

		if ( hash ) {
			var $item = jQuery( "[href='#"+ hash +"']", '.ui--accordion-item');
			if ( $item.length ) {
				if ( ! $item.parent().hasClass('ui--accordion-state-opened') ) {
					$item.click();
					var scrollTo = $item.offset().top - 200;
					if ( scrollTo < 0 ) {
						scrollTo = 0;
					}
					jQuery('html, body').stop( true ).animate({scrollTop: scrollTo}, 500, function () {});
				}
			}
			return true;
		}

		return true;

	})

	jQuery("[href^='#']").click(function() {
		var that = jQuery(this),
			hash = that.attr('href').replace('#', '');

		return listenHash( hash, that );
	});

	jQuery(window).on('load hashchange',function(){
		var hash = location.hash.replace('#', '');
		listenHash( hash, undefined );
	});

});


/*
 * jQuery hashchange event - v1.3 - 7/21/2010
 * http://benalman.com/projects/jquery-hashchange-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$('html').hasClass('ie')&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);

jQuery(function(){
	"use strict";

	jQuery(window).hashchange( function() {

		var hash = location.hash.replace('#', '');
		/*if ( hash.match("^to:") ) {
			hash = hash.replace('to:', '');
			location.hash = '';

			var toElement = jQuery( '#' + hash );
			if ( toElement.length ) {
				jQuery.smoothScroll({
					speed: 500,
					scrollTarget: '#' + hash,
					afterScroll: function() { location.hash = hash; }
				});
			}

		} else */if ( hash ) {   
			jQuery('a[href$="' + hash + '"]').click(); 
		}

	});

	jQuery(window).hashchange();

});

jQuery(document).ready(function($){

	jQuery('.ui--likes').on('click',
		function() {
			var that = jQuery(this);

			//if(that.hasClass('active')) 
			//  return false;

			var id      = that.attr('data-post-id'),
				options = CloudFwParseAttribute(that.attr('data-options'));

			var options_encoded = {};
			jQuery.each( options, function( k, v ){
				options_encoded[ k ] = encodeURIComponent(v);
			});

			jQuery.post(CloudFwOp.ajaxUrl, {
				action: 'cloudfw_likes',
				likes_id: id,
				options: options_encoded
			}, function(data){
				that.html(data).addClass('active').attr('title','You already like this');
			});

			return false;
	});

});

var CloudFwLoaded = function( item ){
	if ( typeof item.jquery == 'undefined' )
		return false;

	if ( item.hasClass('ui--loading') ) {
		item.removeClass('ui--loading');
		item.next('.ui--loading-progress').addClass('loaded');

		//console.log(item.next('.ui--loading-progress'));
	}

};

/**
 * Midway.js
 * Version: 1.0
 * Author: Shipp Co. (Brandon Jacoby, Jordan Singer, Jeremy Goldberg)
 * Copyright (c) 2013 - Midway.  All rights reserved.
 * http://www.shipp.co/midway
 */
(function($) {
	eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(m).l(5(){4 c=$(\'.0\').1(\'6\',- +$(\'.0\').7()/2);4 d=$(\'.3\').1(\'8\',- +$(\'.3\').9()/2);c;d;$(".0").1({\'h\':\'f\',\'g\':\'e%\',\'i\':\'e%\'});$(j).k(5(){4 a=$(\'.0\').1(\'6\',- +$(\'.0\').7()/2);4 b=$(\'.3\').1(\'8\',- +$(\'.3\').9()/2);a;b})});',23,23,'centerHorizontal|css||centerVertical|var|function|marginLeft|width|marginTop|outerHeight|||||50|absolute|top|position|left|window|resize|ready|document'.split('|'),0,{}))
})(jQuery);

(function($) {
    "use strict";

    $(document).ready(function()
    {
    	$.cloudfw_utilities = $.cloudfw_utilities || {};
		$.cloudfw_utilities.supported	= {};
		$.cloudfw_utilities.supports	= (function() {
			var div		= document.createElement('div'),
				vendors	= ['Khtml', 'Ms', 'Moz', 'Webkit'];

			return function(prop, vendor_overwrite)	{
				if ( div.style[prop] !== undefined  ) { return ""; }
				if (vendor_overwrite !== undefined) { vendors = vendor_overwrite; }

				prop = prop.replace(/^[a-z]/, function(val) {
					return val.toUpperCase();
				});

				var len	= vendors.length;
				while(len--) {
					if ( div.style[vendors[len] + prop] !== undefined ){
						return "-" + vendors[len].toLowerCase() + "-";
					}
				}

				return false;
			};

		}());

		$.cloudfw_utilities.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && 'ontouchstart' in document.documentElement;

    	//activate parallax scrolling for backgrounds.
    	if( $.fn.cloudfw_parallax ) {
			$('.ui--parallax').cloudfw_parallax();
    	}

    });

	$.CloudFwParallaxElement  =  function(options, element) {
	    this.$el  	  	 = $( element ).addClass('active-parallax');
	    this.$win	  	 = $( window );
	    this.$parent  	 = this.$el.parent();
	    this.property	 = {};
	    this.isMobile 	 = $.cloudfw_utilities.isMobile;
	    this.ratio		 = this.$el.data('data-stellar-ratio') || 0.5;
	    this.transform   = document.documentElement.className.indexOf('csstransforms') !== -1 ? true : false;
	    this.transform3d = document.documentElement.className.indexOf('csstransforms3d') !== -1 ? true : false;

	    if( $.cloudfw_utilities.supported.transition === undefined ){
			$.cloudfw_utilities.supported.transition = $.cloudfw_utilities.supports('transition');
		}

	    this._init( options );
	}

	$.CloudFwParallaxElement.prototype = {

		_init: function( options )
    	{
    		var _self = this;
			/*if( _self.isMobile )
			{
				return; //disable parallax scrolling on mobile
			}*/

			//fetch window constants
			this._fetch_properties();
			//this.$win.on("load resize make@2x",  $.proxy( _self._fetch_properties, _self));
			this.$win.on('load', $.proxy( _self._fetch_properties, _self));
			this.$win.smartresize($.proxy( _self._fetch_properties, _self));

			setTimeout(function(){
				_self._fetch_properties();
    		},1000);

			//activate the scrolling
			setTimeout(function()
			{
    			_self.$win.on( 'scroll',  function(){ window.requestAnimationFrame( $.proxy( _self._parallax_scroll, _self) )} );

    		},100);
		},

		_fetch_properties: function()
		{
			this.property.offset 	= this.$parent.offset().top;
			this.property.wh 		= this.$win.height();
			this.property.height 	= this.$parent.outerHeight();

			//set the height of the element based on the windows height, offset ratio and parent height
			this.$el.height(Math.ceil((this.property.wh * this.ratio) + this.property.height));

			//re-position the element
			this._parallax_scroll();
		},

		_parallax_scroll: function(e) {
    		var winTop		=  this.$win.scrollTop(),
    			winBottom	=  winTop + this.property.wh,
    			scrollPos 	= "0",
    			prop = {};

    		if( this.property.offset < winBottom && winTop <= this.property.offset + this.property.height )
    		{
    			scrollPos = Math.round( (winBottom - this.property.offset) * this.ratio );

    			if( this.transform3d ) {
    				prop[$.cloudfw_utilities.supported.transition+"transform"] = "translate3d(0px,"+ scrollPos +"px, 0px)";
    			} else if( this.transform ) {
    				prop[$.cloudfw_utilities.supported.transition+"transform"] = "translate(0px,"+ scrollPos +"px)";
    			} else {
    				prop["background-position"] = "0px "+ scrollPos +"px";
    			}

	    		this.$el.css(prop);
    		}
    	}
	}


	$.fn.cloudfw_parallax = function(options){

		return this.each(function(){
			var self = $.data( this, 'cloudfw_parallax' );
			if( ! self ) {
				self = $.data( this, 'cloudfw_parallax', new $.CloudFwParallaxElement( options, this ) );
			}
		});
	}

}(jQuery));

jQuery(document).ready(function(){
	
	var filters = [];
	var can_multiple = false;
	var changePortfolioFilter = function( that ) {
		var wrapper   = that.parents('.portfolio-container-wrapper').first(),
			container = wrapper.find('.portfolio-container'),
			layout    = wrapper.attr('data-layout'),
			columns   = parseInt(wrapper.attr('data-columns')),
			parent    = that.parents('.portfolio-filters').first(),
			parent_li = that.parent('li'),
			isotope   = parent.attr('data-isotope'),
			multiple  = parent.attr('data-multiple'),
			selector  = that.attr('data-filter');

		if ( layout == 'masonry' ) {
			if ( parent_li.hasClass('active-item') ){
				filters = jQuery.grep(filters, function(value) {
				  return value != selector;
				});
			} else {
				filters.push( selector );
			}

			if ( multiple != '1' || can_multiple ) {
				filters = [ selector ];
			}

			if ( selector == '*' ) {
				filters = [];
			}

			parent.children('li.active-item').removeClass('active-item');
			var filterValue = '';
			for ( var prop in filters ) {
				if ( ! jQuery.isFunction( filters[ prop ] ) ) {
					filterValue += filters[ prop ];
				}
				jQuery('[data-filter="'+ filters[ prop ] +'"]', parent).parent().addClass('active-item');
			}

			if ( filters.length === 0 ) {
				filterValue = '*';
				jQuery('[data-filter="*"]', parent).parent().addClass('active-item');
			}

			jQuery(""+isotope+"").find('.ui--masonry').first().CloudFwisotope({ filter: filterValue });

		} else {

			var items = container.find('> .ui-row > .ui-column'),
				count = items.length,
				rows  = container.children('.ui-row');

			items.show().removeClass('passive-item').fadeTo(1000,1).not('' + selector).stop(1).addClass('passive-item').fadeTo(1000,.3);

			parent.children('li.active-item').removeClass('active-item');
			parent_li.addClass('active-item');
			parent.children('li').not('.active-item');
		}
	}

    /** Portfolio Filters */
	jQuery('.portfolio-filters > li > a').click(function(e){
		e.preventDefault();
		//changePortfolioFilter( jQuery(this) );
		can_multiple = true;
		var href = jQuery(this).attr('href');
		if ( href != '#' ) {
			history.pushState ? history.pushState(null, null, href) : (location.hash = href);
		} else {
			changePortfolioFilter( jQuery('a', '.portfolio-filters > li.item-filter-reset') );
			history.pushState ? history.pushState(null, null, '#/') : (location.hash = '#/');
		}
		can_multiple = false;
	});

	jQuery( document ).on( "filterChange", {}, function( event, target ) {
		changePortfolioFilter( jQuery('a[data-filter=".filter-'+ target +'"]', '.portfolio-filters > li') );
	});

});

jQuery(document).ready(function(){

	if ( jQuery.isFunction( jQuery.fn.superfish ) ) {
		var navigation = jQuery('#header-navigation');

		navigation.superfish({
			hoverClass: 'hover',
			fire_event: CloudFwOp.navigation_event || 'hover',
			cssArrows: false,
			delay: parseInt(CloudFwOp.nav_hover_delay, 10) || 10,
			speed: 200,
			speedOut: 200,
			onBeforeShow: function( $sub ){

				var $device = detectDeviceViaPageWidth();
				if ( $device != 'phone' ) {
					var $parent = $sub.parent('li').first();

					if ( $parent.hasClass('level-0') ) {
						var $height = $parent.height();
						if ( $parent.css('position') != 'relative' ) {
							var $pos = $parent.position().top;
						}
						$sub.css({'top': $height + $pos});
					}
				}
				navigation.addClass('active');

			},
			onShow: function( $sub ){

				jQuery(window).trigger('scroll');
				jQuery(window).trigger('make@2x');
			},
			onBeforeHide: function( $sub ){
				var $parent = $sub.parent('li').first();

				if ( $parent.hasClass('level-0') ) {
					navigation.removeClass('active');
					$sub.css({'top': ''});
				}

			}
		});
	}


	jQuery('#header-navigation-toggle > a').click(function(){
		var that = jQuery(this),
			nav = jQuery('#header-navigation');

		if ( nav.is(':visible') ) {
			nav.attr('style', '');
		} else {
			nav.attr('style', 'display: block !important');
		}
	});

});

jQuery(document).ready(function(){
	var header_overlapping = function(){
		var win_height = win_height_alias = jQuery(window).height();
		var header = jQuery('#page-header');

		if( header.length ) {
			var device = detectDeviceViaPageWidth();
			var header_height = header.height();
			var helper = jQuery('#header-overlapping-helper');
			var header_overlapping_mobile = jQuery('body').hasClass('header-overlapping-mobile');

			if ( helper.length ) {
				if ( device == 'widescreen' || header_overlapping_mobile ) {
					helper.height( header_height );
				} else {
					helper.css('height', '' );
				}

			} else {

				var titlebar = jQuery('#titlebar');
				if( titlebar.length ) {

					if ( device == 'widescreen' || header_overlapping_mobile ) {
						titlebar.css('padding-top', header_height );
					} else {
						titlebar.css('padding-top', '' );
					}
				} else {
					var contentArea = jQuery('#the-content');

					if ( contentArea.length ) {
						if ( device == 'widescreen' || header_overlapping_mobile ) {
							contentArea.children().first().css('padding-top', header_height );
						} else {
							contentArea.children().first().css('padding-top', '' );
						}
					}
				}
			}

			jQuery('body').addClass('header-overlapping-ok');

		}

	}

	if ( jQuery('body').hasClass('header-overlapping') ) {
		header_overlapping();
		jQuery(window).on( 'load', header_overlapping );
		jQuery(window).smartresize( header_overlapping, 20 );
	}

});

jQuery(document).ready(function(){

	jQuery('.ui--quickview-button > .btn').click(function(e){
		e.preventDefault();
		var that = jQuery(this);
		jQuery.CloudFwPrettyPhoto.open( that.attr('data-href') );
	});

});

function detectDeviceViaPageWidth(){
	"use strict";

	var device;

	if ( Modernizr.mq('only all and (max-width: 767px)') ) {
		device = 'phone';
	}
	else if ( Modernizr.mq('only all and (min-width: 768px) and (max-width: 979px)') ) {
		device = 'tablet';
	}
	else {
		device = 'widescreen';
	}

	if ( ! CloudFwOp.responsive ) {
		device = 'widescreen';
	}

	return device;

};

var responsiveOptionsCallback = function(){
	"use strict";

	var elements = jQuery("[data-responsive]");
	elements.each(function(){
		var that = jQuery(this);
		var options = {};
		var data_responsive = that.attr('data-responsive');
		var device = detectDeviceViaPageWidth();

		if ( data_responsive ) {
			try {
				options = jQuery.parseJSON( data_responsive );
			} catch (e) {}

			if ( options.replaceClass ) {
				jQuery.each( options.replaceClass, function( k,v ){
					var default_val = k,
						new_class = '';

					if ( typeof v[ device ] != 'undefined' || v[ device ] !== null )
						new_class = v[ device ];
					else
						new_class = default_val;


					if ( new_class !== '' && new_class != default_val ) {
						that.removeClass( that.attr('data-replaced-class') ).removeClass( default_val ).addClass( new_class );
						that.attr('data-replaced-class', new_class);
					} else {
						var replaced_class = that.attr('data-replaced-class');
						if ( replaced_class )
							that.removeClass( replaced_class ).addClass( default_val );

					}

				});
			}

			if ( options.css ) {
				jQuery.each( options.css, function( k,v ){
					var property = k,
						object = {};

					object[ property ] = (typeof v[ device ] == 'undefined' || v[ device ] === null) ?
										( (typeof v.widescreen != 'undefined' && v.widescreen !== null) ? v.widescreen : '' )
									: v[ device ];

					that.css(object);

				});
			}

		}

	});


};

jQuery(document).ready(responsiveOptionsCallback);
jQuery(window).resize(responsiveOptionsCallback);


var prepareResponsiveFullwidthContainer = function(){
	"use strict";

	var fullwidth_containers = jQuery('.fullwidth-container');

	if ( fullwidth_containers.length ) {

		var prepareResponsiveFullwidthContainer_Resize = function(){

			var page_width = jQuery('body').innerWidth();
			if ( page_width <= 767 ) {
				fullwidth_containers.each(function(){
					var that = jQuery(this);
					that.width( that.parent().width() );
				});

			} else {
				fullwidth_containers.css({width: ''});
			}

		}

		prepareResponsiveFullwidthContainer_Resize();
		jQuery(window).resize(prepareResponsiveFullwidthContainer_Resize);

	}
};
jQuery(document).ready(prepareResponsiveFullwidthContainer);

/**
 * Resizes fullwidth container by the page width
 * @return void
 */
var prepareResponsiveFullwidthContainerPage = function(){
	"use strict";

	var fullwidth_contents = jQuery('.fullwidth-content');

	if ( fullwidth_contents.length ) {

		var prepareResponsiveFullwidthContainerPage_Resize = function(){

			var is_boxed = jQuery('body').hasClass('layout--boxed');
			var content_width = jQuery('#page-content > .container').width();

			if ( is_boxed ) {
				var page_width = jQuery('#page-content').innerWidth();
				var offset = 0 - (( page_width - content_width ) / 2) - 1;
			} else {
				var page_width = jQuery('body').innerWidth();
				var offset = 0 - (( page_width - content_width ) / 2) - 1;
			}

			if ( ! CloudFwOp.RTL ) {
				fullwidth_contents.css({
					'width': page_width + 1,
					'margin-left': offset,
					'margin-right': 0
				});
			} else {
				fullwidth_contents.css({
					'width': page_width + 1,
					'margin-right': offset,
					'margin-left': 0
				});
			}
		}

		prepareResponsiveFullwidthContainerPage_Resize();
		jQuery(window).resize(prepareResponsiveFullwidthContainerPage_Resize);

	}
};
jQuery(document).ready(prepareResponsiveFullwidthContainerPage);


var parseResponsiveAttribute = function( data_responsive, selector, default_value ){
	"use strict";

	var data = {};

	if ( data_responsive ) {
		try {

			if ( typeof data_responsive != 'object' )
				data = jQuery.parseJSON( data_responsive );

		} catch (e) {}

		if ( typeof data[ selector ] != 'undefined' || data[ selector ] !== null )
			return data[ selector ];
		else
			return default_value;
	}

};


jQuery(document).on("ready", function(){
	jQuery("rs-module-wrap[data-alias]")
		.find('rs-module')
		.on('revolution.slide.onloaded',
			function(event, data) {
				jQuery(this).revredraw();
			}
		);
});


jQuery(document).ready(function(){
	"use strict";

	var side_panel_handlers = jQuery('.ui--side-panel'),
		side_panel          = jQuery('#side-panel'),
		side_panel_items    = jQuery('#side-panel').children('div'),
		html               = jQuery('html'),
		listener           = false;

	if ( side_panel.length && side_panel_handlers.length ) {

		var side_panel_close_listener = function(){
			listener = true;

			jQuery('#main-container').click(function(event){
				if ( ! jQuery(event.target).is('a') ) {
					html.removeClass('side-panel-open');
					jQuery(window).trigger('resize');
				}
			});

			jQuery('#ui--side-panel-close-button').click(function(){
				html.removeClass('side-panel-open');
				jQuery(window).trigger('resize');
			});
		}

		var side_panel_toggle = function( target ){

			if ( ! html.hasClass('side-panel-open') ) {

				setTimeout( function() {
					side_panel.show();
					side_panel_items.hide();

					if ( target ) {
						side_panel_items.filter('#' + target).show();
					} else {
						side_panel_items.first().show();
					}

					jQuery('body, html').animate({scrollTop:0}, '500', 'swing', function() {
						html.addClass('side-panel-open');
					});

				}, 25 );

			} else {
				html.removeClass('side-panel-open');
			}

			if ( ! listener ) {
				side_panel_close_listener();
			}

		}

		side_panel_handlers.bind('click', function(e){
			e.preventDefault();
			side_panel_toggle( jQuery(this).attr('data-target') );
		});

		jQuery( document ).on( "openSidePanel", {}, function( event, target ) {
			side_panel_toggle( target );
		});

	}

});

jQuery(document).ready(function(){"use strict";var e=jQuery(".ui--side-panel"),n=jQuery("#side-panel"),i=jQuery("#side-panel").children("div"),t=jQuery("html"),s=!1;if(n.length&&e.length){var a=function(){s=!0,jQuery("#main-container").click(function(e){jQuery(e.target).is("a")||t.removeClass("side-panel-open")}),jQuery("#ui--side-panel-close-button").click(function(){t.removeClass("side-panel-open")})},o=function(e){t.hasClass("side-panel-open")?t.removeClass("side-panel-open"):setTimeout(function(){n.show(),i.hide(),e?i.filter("#"+e).show():i.first().show(),jQuery("body, html").animate({scrollTop:0},"500","swing",function(){t.addClass("side-panel-open")})},25),s||a()};e.bind("click",function(e){e.preventDefault(),o(jQuery(this).attr("data-target"))}),jQuery(document).on("openSidePanel",{},function(e,n){o(n)})}});

jQuery(document).ready(function(){

	if ( jQuery.isFunction( jQuery.fn.superfish ) ) {

		var topbar_menu = jQuery('.ui--custom-menu', '#top-bar');
		var topbar_menu_custom_animation_speed = topbar_menu.attr('data-animation-speed');

		topbar_menu.superfish({
			hoverClass: 'hover',
			cssArrows: false,
			delay: 500,
			speed: topbar_menu_custom_animation_speed || 50,
			speedOut: topbar_menu_custom_animation_speed || 50
		});
	}


	var search_form = jQuery('#widget--search', '#top-bar'),
		toggle 		= search_form.find('a'),
		input 		= search_form.find('input'),
		form 		= search_form.find('.ui--search-form'),
		cssanimations = jQuery('html').hasClass('cssanimations'); 


	toggle.click(function(e){
		e.preventDefault();
		input.focus();

	});

	input.bind('focus', function(){
		if( cssanimations ) {
			search_form.addClass('state--open');
		}
		else {
			form.stop(1).animate({'width': 150});
		}
		
		//toggle.addClass('ui--gradient-primary').removeClass('ui--gradient-grey');

	});

	input.bind('blur', function(){
		if( cssanimations ) {
			search_form.removeClass('state--open');
		}
		else {
			form.stop(1).animate({'width': 0});
		}
		
		//toggle.removeClass('ui--gradient-primary').addClass('ui--gradient-grey');
	});

});

jQuery(document).ready(function(){
	"use strict";

	if ( ! CloudFwOp.uniform_elements ) {
		return true;
	}

	var CloudFw_Uniform = function( wrapper ){

		if( jQuery('html').hasClass('old-browser') )
			return true;

		if ( ! wrapper )
			wrapper = null;
		else {
			if ( typeof wrapper.jquery == 'undefined' )
				wrapper = jQuery( wrapper );

			if ( ! wrapper.length )
				return true;
		}

		/**
		 *	Select
		 */
		jQuery("select", wrapper).each(function(){
			var that = jQuery(this);

			if ( that.css('display') == 'none' ) {
				return true;
			}

			if ( that.hasClass('no-uniform') || that.parents('.widget_categories').length > 0 ) {
				return true;
			}

			if ( CloudFwOp.disable_gravity_uniform_select ) {
				if ( that.hasClass('gfield_select') ) {
					return true;
				}
			}

			if ( that.parents('.woocommerce').length ) {
				return true;
			}

			if ( CloudFw_jQueried('cloudfw-select', that) ) {
				return true;
			}

			if ( that.attr('multiple') ) {
				return true;
			}

			var ui_wrapper = jQuery('<span/>').addClass('ui--select-wrapper ui--box ui--gradient ui--gradient-grey').addClass( that.attr('data-wrapper-classes') );
	        var resize_callback = function(){
	        	var margin = that.css({'margin': ''}).css('margin');
	        	var width = that.css({'width': ''}).css('width');

	        	ui_wrapper.css({'margin': margin});
	        	ui_wrapper.css({'width': width});

	        }
	        resize_callback();

			that.wrap( ui_wrapper );

			var	title = jQuery('<span/>').addClass('ui--select-title');
			that.before( title );

			var	arrow = jQuery('<i/>').addClass('ui--icon icon fontawesome-angle-down ui--select-arrow');
			that.before( arrow );


			var change_callback = function() {
	        	var val = that.find(':selected').first().text();

	        	if ( val == '' ) {
	        		var default_title = that.attr('data-default-title');
	        		if ( default_title )
	        			var val = default_title;
	        	}

	        	title.text(val);
	        }

	        jQuery(document).delegate( that, 'change', change_callback);
	        change_callback();

	        that.bind('focus', function(){
	        	that.parent().addClass('active');
	        });

	        that.bind('blur', function(){
	        	that.parent().removeClass('active');
	        });

	        if ( that.attr('data-init') )
	        	that.change();



		});


	}

	CloudFw_Uniform();
	jQuery(document).on('ajaxSuccess',CloudFw_Uniform);

});

jQuery(document).ready(function(){

	jQuery( '.woocommerce-tabs' ).each( function() {
		var hash		= window.location.hash,
			url			= window.location.href,
			tabs		= jQuery( this ),
			tabs_offset	= tabs.offset().top;

		if ( hash.toLowerCase().indexOf( "comment-" ) >= 0 ) {
			jQuery('ul.ui--tabs-titles li.reviews_tab a', tabs ).click();
		    
		    jQuery('html, body').animate({
		        scrollTop: tabs_offset
		    }, 2000);

		} else if ( url.indexOf( "comment-page-" ) > 0 || url.indexOf( "cpage=" ) > 0 ) {
			jQuery('ul.ui--tabs-titles li.reviews_tab a', tabs ).click();

		    jQuery('html, body').animate({
		        scrollTop: tabs_offset
		    }, 2000);

		}
	});

	jQuery( 'a.woocommerce-review-link' ).click( function() {
		jQuery('ul.ui--tabs-titles li.reviews_tab a', jQuery( '.woocommerce-tabs' ) ).click();

	    jQuery('html, body').animate({
	        scrollTop: jQuery( '.woocommerce-tabs' ).offset().top
	    }, 2000);

		return true;
	});

});

jQuery(document).ready(function(){
	"use strict";

	jQuery.fn.extend({

		CloudFwAccordions: function() {
			var in_progress = false,
				accordion_wrap  = this,
				accordion_items = accordion_wrap.children().not('.ui--accordion-state-static');

			accordion_items.find('> a').click(function( e ) {
				e.preventDefault();
				e.stopPropagation();

				if ( in_progress === true ) {
					return false;
				}

				in_progress = true;

				var that = jQuery(this),
					item = that.parents('.ui--accordion-item').first();

				item.addClass('not');
				accordion_items.not('.not').removeClass('ui--accordion-state-opened').addClass('ui--accordion-state-closed');

				if (item.hasClass('ui--accordion-state-opened')) {
					item.removeClass('ui--accordion-state-opened').removeClass('not').addClass('ui--accordion-state-closed');
					in_progress = false;
				} else {
					item.removeClass('ui--accordion-state-closed').removeClass('not').addClass('ui--accordion-state-opened');
					in_progress = false;
				}

				jQuery(window).trigger('scroll');
				jQuery(window).trigger('make@2x');
				jQuery(window).trigger('resize');
			});

		}

	});

    /** Init Toggles */
    jQuery('.ui--accordion').each(function () {
        jQuery(this).CloudFwAccordions();
    });

});


var boxGalleryInit;

jQuery(document).ready(function(){
	"use strict";

	if ( jQuery.isFunction( jQuery.fn.flexslider ) ) {

		var carouselInit = function( parent ){
			if ( typeof parent == 'undefined' || !parent.jquery )
				parent = jQuery( '.ui--carousel' );

			parent.each(function(){
				var that = jQuery(this);
				var fullwidth = ! that.parents('.ui-row').length;
				var pass = that.parents('.ui--pass');
				var wrapper = pass.length ? pass : that;

				var title_bordered = that.prev('.ui--title-bordered').length ? that.prev('.ui--title-bordered') : wrapper.prev('.ui--title-bordered');
				var title_widget = wrapper.prev('.ui--widget-title');
				var slider_data = that.data('flexslider');


				if ( ! slider_data ) {

					var options = CloudFwParseAttribute(that.attr('data-options'));
					var slides = that.find('.slides');

					if ( options.disable_on_mobile == '1' && detectDeviceViaPageWidth() == 'phone' ) {
						var items = slides.children();
						items.show();
						return false;
					}

					if ( slides.length > 1 ) {
						slides.last().unwrap();
					}

					if ( fullwidth ) {
						that.addClass( 'fullwidth-content' );
						var children = slides.first().children();

						children.each(function(){
							var child = jQuery(this);

							if ( child.hasClass('.ui-row') ) {
								child.wrap('<div class="ui--carousel-content clearfix" />').wrap('<div class="container" />');
							} else {
								child.wrap('<div class="ui--carousel-content clearfix" />').wrap('<div class="container" />').wrap('<div class="ui-row" />');
							}

						});

						prepareResponsiveFullwidthContainerPage( that );
					} else {
						slides.first().children('.ui-row').wrap('<div class="ui--carousel-content clearfix" />');
					}

					var items = slides.children();
					if ( !( items.length > 1 ) ) {
						items.show();
						return false;
					}


					//console.log(options);

					if ( options.auto_rotate == '1' ) {
						options.auto_rotate = true;
					} else {
						options.auto_rotate = false;
					}

					if ( options.animation_loop == '1' ) {
						options.animation_loop = true;
					} else {
						options.animation_loop = false;
					}

					if ( typeof options.animate == 'undefined' || options.animate == '1' ) {
						options.animate = 600;
					} else {
						options.animate = 1;
					}

					var that = that.flexslider({
						namespace: "ui--carousel-",
						selector: ".slides > div",
						animation: options.effect || "slide",
						slideshow: options.auto_rotate,
						//slideshow: false,
						slideshowSpeed: options.rotate_time || 7000,
						smoothHeight: true,
						animationLoop: options.animation_loop || false,
						controlNav: false,
						directionNav: false,
						pauseOnHover: true,
						animationSpeed: 1000,
						itemMargin: 30,
						start: function( obj ) {
							if ( typeof boxGalleryInit != 'undefined' ) {
								boxGalleryInit( that );
							}
						}

					});

					var slider_data = that.data('flexslider');

					if ( options.arrows == '1' ) {

						var to_prev = function(){ that.flexslider('prev'); jQuery(window).scroll(); }
						var to_next = function(){ that.flexslider('next'); jQuery(window).scroll(); }

						if ( title_bordered.length ) {
							title_bordered.addClass('with-navigation');
							title_bordered.find('.ui--title-navigation').remove();
							title_bordered.append( jQuery('<div/>').addClass('ui--title-navigation') );
							title_bordered.find('.ui--title-navigation').html('<span class=\"arr arr-small arr-plain arr-left ui--carosuel-prev\"><span></span><i class=\"fontawesome-angle-left px18\"></i></span> <span class=\"arr arr-small arr-plain ui--carosuel-next\"><span></span><i class=\"fontawesome-angle-right px18\"></i></span>');
							title_bordered.find('.ui--title-navigation > .ui--carosuel-prev').click( to_prev );
							title_bordered.find('.ui--title-navigation > .ui--carosuel-next').click( to_next );
						} else if ( title_widget.length ) {
							title_widget.addClass('with-navigation');
							title_widget.find('.ui--title-navigation').remove();
							title_widget.append( jQuery('<div/>').addClass('ui--title-navigation') );
							title_widget.find('.ui--title-navigation').html('<span class=\"arr arr-plain arr-left ui--carosuel-prev\"><span></span><i class=\"fontawesome-angle-left px18\"></i></span> <span class=\"arr arr-plain ui--carosuel-next\"><span></span><i class=\"fontawesome-angle-right px18\"></i></span>');
							title_widget.find('.ui--title-navigation > .ui--carosuel-prev').click( to_prev );
							title_widget.find('.ui--title-navigation > .ui--carosuel-next').click( to_next );
						} else {
							that.find('.ui--carousel-navigation').remove();
							that.append( jQuery('<div/>').addClass('ui--carousel-navigation clearfix') );
							that.find('.ui--carousel-navigation').html('<span class=\"arr arr-normal arr-left ui--carosuel-prev\"><span></span><i class=\"fontawesome-chevron-left px18\"></i></span> <span class=\"arr arr-normal ui--carosuel-next\"><span></span><i class=\"fontawesome-chevron-right px18\"></i></span>');
							that.find('.ui--carousel-navigation > .ui--carosuel-prev').click( to_prev );
							that.find('.ui--carousel-navigation > .ui--carosuel-next').click( to_next );
						}

					}

				}

			});

		}

		/*var timeout = setTimeout( function(){
			carouselInit();
			clearTimeout( timeout );
		}, 500);
		*/
		jQuery( '.ui--carousel' ).each(function(){
			var that = jQuery(this);
			that.find('.slides > div:first').find('img:first').imagesLoaded(function(){
				var timeout = setTimeout( function(){
					carouselInit( that );
					clearTimeout( timeout );
				}, 300);

			});
		});
		jQuery(window).on( 'load',carouselInit);




		boxGalleryInit = function( parent ){

			parent.find( '.ui--content-box-gallery' ).each(function(){
				var that = jQuery(this);
				var slider_data = that.data('flexslider');


				if ( !slider_data ) {

					jQuery(window).on( 'load', function(){ boxGalleryInit( parent ); });
					var options = CloudFwParseAttribute(that.attr('data-options'));
						options.auto_rotate = (options.auto_rotate == '1') ? true : false;

					that.flexslider({
						namespace: "ui--content-box-gallery-",
						selector: ".mini-slides > div",
						animation: options.effect || "slide",
						slideshow: options.auto_rotate || false,
						slideshowSpeed: 7000,
						smoothHeight: true,
						controlNav: false,
						directionNav: false,
						keyboard: false
					});

					slider_data = that.data('flexslider');

					var to_prev = function(){ that.flexslider("prev"); }
					var to_next = function(){ that.flexslider("next"); }

					that.find('.ui--content-box-gallery-navigation').remove();
					that.append( jQuery('<div/>').addClass('ui--content-box-gallery-navigation') );
					that.find('.ui--content-box-gallery-navigation').html('<span class=\"arr arr-normal arr-left ui--carosuel-prev\"><span></span><i class=\"fontawesome-chevron-left px18\"></i></span> <span class=\"arr arr-normal ui--carosuel-next\"><span></span><i class=\"fontawesome-chevron-right px18\"></i></span>');
					that.find('.ui--content-box-gallery-navigation > .ui--carosuel-prev').click( to_prev );
					that.find('.ui--content-box-gallery-navigation > .ui--carosuel-next').click( to_next );


				} else {
					setTimeout(function(){
						if ( slider_data && slider_data.resize ) {
							slider_data.resize();
						}
					}, 100);
				}

			});

		}

		jQuery('.ui--content-box').each(function(){
			var that = jQuery(this),
				parents = that.parents();

			if ( !parents.filter('.ui--carousel').length && !parents.filter('.ui--masonry').length ) {
				boxGalleryInit( that );
				jQuery(window).on( 'load', function(){ boxGalleryInit( that ); });
			}


		});




	}

});


(function( jQuery ){
	"use strict";

	jQuery(document).ready(function(){

		if ( !CloudFwOp.gallery_overlay_opacity ) {
			CloudFwOp.gallery_overlay_opacity = 90;
		}

		jQuery('.ui--gallery-item a').hover(function(){
			var that = jQuery(this),
				overlay = that.find('.ui--gallery-overlay');

			overlay.stop(1).fadeTo(500, CloudFwOp.gallery_overlay_opacity / 100);

		},function(){
			var that = jQuery(this),
				overlay = that.find('.ui--gallery-overlay');

			overlay.stop(1).fadeTo(500,0);

		});

	});

})(jQuery);

jQuery(document).ready(function(){
	"use strict";

	jQuery(".gmap").each(function(){
		var that     = jQuery(this),
			gmap     = '',
			api      = '',
			data     = that.attr('data-gmap-options') || '',
			defaults = {};

		try {

			if ( typeof data != 'object' ) {
				var gmap_metadata = jQuery.parseJSON( data );
			} else {
				var gmap_metadata = data;
			}

		} catch (e) {
			var gmap_metadata = {};
		}

		var defaults = {
			zoom            : 12,
			latitude        : 0,
			longitude       : 0,
			maptype         : "ROADMAP",
			doubleclickzoom : 1,
			scrollwheel     : 1,
			controls        : false
		};


		var gmap_options = jQuery.extend( {}, defaults, gmap_metadata );
		jQuery( gmap_options.markers ).each(function( index, value ) {
			gmap_options.markers[ index ].html = jQuery('<div />').html( gmap_options.markers[ index ].html ).text().replace(/\n/g,'<br/>');
		});

		that.unbind('gMapReady').bind('gMapReady',function(){
			gmap = that.gMap( gmap_options );
			api  = that.data('gMap.reference');
			that.data( "gMapReady", true );

			var styles = gmap_options.stylers || {};

			if ( styles ) {
				api.setOptions({styles: styles});
			}

		}).data("gMapReady", false);

		var init_now = true;

		if ( init_now ) {
			that.trigger( 'gMapReady' );
		}

		var device_callback = function(){
			var device = detectDeviceViaPageWidth();

			if ( device == 'phone' ) {
				that.trigger('gMapReady');
			}
		}

		device_callback();
		//jQuery(window).bind('CloudFwDetectDevice', device_callback );

	});

});

jQuery(document).ready(function(){
	"use strict";

	var isRtl = jQuery('html').attr('dir')=='rtl';

	//return true;

	if ( jQuery.isFunction( jQuery.fn.CloudFwisotope ) ) {
		var masonryInit = function(){

			jQuery( '.ui--masonry' ).each(function(){
				var that = jQuery(this);
				var title_bordered = that.prev('.ui--title-bordered');
				var title_widget = that.prev('.ui--widget-title');
				var masonry_data = that.data('masonry');
				var init = new Object();
				var is_fluid = false;


				if ( that.hasClass('row-fluid') || that.parents('.ui-row').length ) {
					is_fluid = true;
				}

				if ( ! masonry_data ) {
					CloudFwLoaded( that );

					var items = that.find('.ui--content-item');
					items.each(function(){
						if( !jQuery(this).parent().hasClass('ui-column') ) {
							//jQuery(this).wrap('<div class="ui-column span12"/>');
						}
					});

					var pass =  that.children('.ui--pass');
					if ( pass.length ) {
						pass.find('.ui-row > .ui-column').addClass('ui--isotope-item');
					} else {
						that.find('> .ui-row > .ui-column').addClass('ui--isotope-item');
					}

					//that.imagesLoaded(masonryInit);
				}

				if ( masonry_data == true && !is_fluid ) {
					that.CloudFwisotope( 'reloadItems' );

					return false;
				}

				/** Init Object */
				init.resize = true;
				init.resizable = true;
				init.itemSelector = '.ui--isotope-item';
				init.layoutMode = 'masonry';
				init.originLeft = isRtl ? false : true;

				if ( is_fluid ) {
					var containerWidth = that.width();

					var column = that.children().first().attr('data-columns');

					if ( ! column ) {
						var	column = CloudFwGetColumByClassname( that.find('.ui--isotope-item') );
					}

					var firstColumnWidth = that.find('.ui--isotope-item').first().width();
					var gutter = Math.floor( ( containerWidth - ( firstColumnWidth * column ) ) / ( ( column - 1 ) ) );

					init.percentPosition = true;
					init.masonry = {
						gutter: gutter
					};
				}

				that.data('masonry',true);
				that.css("visibility", "visible").css("overflow", "visible").CloudFwisotope(init);
				that.addClass('ui--done');

				function onComplete(){
					that.show();
					if ( typeof boxGalleryInit !== 'undefined' ) {
						boxGalleryInit( that );
					}
				}

				that.on( 'layoutComplete', onComplete);
				that.on( 'arrangeComplete', onComplete);
				onComplete();
			});

		}

		if ( BrowserDetect.browser == 'IE' ) {
			jQuery(window).on( 'load', masonryInit);
		} else {
			masonryInit();
		}

		jQuery(window).smartresize(masonryInit, 5000);
		jQuery(document).ajaxSuccess(masonryInit);
	}
});


jQuery(document).ready(function(){
	"use strict";

	var pricingTableInit = function(){

		jQuery('.ui--pricing-table').each(function(){
			var that = jQuery(this),
				before_htmls = that.find( '.ui--pricing-table-before-html' ),
				features = that.find( '.ui--pricing-table-features' );

			before_htmls.css({'min-height': ''}).css({'min-height': Math.max.apply(null, before_htmls.map(function(){return jQuery(this).height();}).get())});

			features.first().children('.ui--pricing-table-feature').each(function(){
				var group = jQuery(this).attr('data-group'),
					items = that.find( '.' + group ); 

				items.css({'min-height': ''}).css({'min-height': Math.max.apply(null, items.map(function(){return jQuery(this).height();}).get())});

			});

		});

	}

	pricingTableInit();
	jQuery(window).on( 'load', pricingTableInit );
	jQuery(window).smartresize( pricingTableInit );

});

jQuery(document).ready(function(){
	"use strict";

	if ( ! jQuery.isFunction( jQuery.inviewport ) ) 
		return false;

	var progressBarInit = function(){

		jQuery('.ui--progress:in-viewport').each(function(){
			var that = jQuery(this);

			if( ! that.hasClass('animated') ) {
				var percent	= that.find('.ui--progress-percent');
				var callback = function(){

				}

				percent.css({'visibility': 'visible'});
				if ( animation_type == 'css' ) {

					that.addClass('lock');
					that.addClass('animated');

			        var delay = setInterval(function(){
						that.removeClass('lock');
			            clearInterval(delay);
			        }, 500);

					that.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", callback);

				} else {
					
					that.addClass('animated');
					var width = percent.attr('data-value');
					percent.width('0').animate({'width': width}, 600, callback);
				
				}
				

			}
		});

	} 

	if ( jQuery('.ui--progress').length ) {
		var animation_type = jQuery('html').hasClass('cssanimations') ? 'css' : 'javascript';

		if ( animation_type == 'css' ) {
			progressBarInit();
			jQuery(window).on( 'load', progressBarInit );
			jQuery(window).scroll( jQuery.throttle( 250, progressBarInit ) );
		}
		
	}
});

jQuery(document).ready(function(){
	"use strict";

	if ( ! jQuery.isFunction( jQuery.inviewport ) || ! jQuery.isFunction( jQuery.easyPieChart ) ) {
		return false;
	}

	var initPieChart = function() {
		jQuery('.ui--progress-circle').each(function(){
			var that = jQuery(this),
				wrapper = that.parent(),
				wrapper_width = wrapper.width(),
				percent_text = wrapper.find('.ui--progress-circle-percent'),
				percent = parseInt(that.attr('data-percent-update'), 10),
				width = parseInt(that.attr('data-width'), 10);

			if ( !width || width > wrapper_width ) {
				width = wrapper_width;
			}

			that.easyPieChart({
				animate: 1000,
				trackColor: '#f1f1f1',
				barColor: '#169FE5',
				scaleColor: false,
				lineCap: 'butt',
				rotate: -90,
				lineWidth: 15,
				size: width,
				onStep: function(value) { percent_text.text(~~value); },
				onStop: function(value) { percent_text.text(percent); }
			});

			that.find('.ui--center-vertical').uiVerticalCenter();


		});

		initPieChartUpdate();

	};

	var initPieChartResize = function() {

		jQuery('.ui--progress-circle').each(function(){
			var that = jQuery(this);

			that.removeData( 'easyPieChart' );
			that.removeData( 'inViewport' );
			that.css({
				'width'			: '',
				'height'		: '',
				'line-height'	: ''
			});
			that.find('canvas').remove();

		});

		initPieChart();

	};

	var initPieChartUpdate = function() {
		jQuery('.ui--progress-circle:in-viewport').each(function(){
			var that = jQuery(this);

			if ( ! that.is(':visible') ) {
				return true;
			}

			if ( that.data('inViewport') ) {
				return true;
			}

			that.data('inViewport', true);

			var percent = parseInt(that.attr('data-percent-update'), 10);
			that.data('easyPieChart').update( percent );
		});
	};


	if ( jQuery('.ui--progress-circle').length ) {
		var animation_type = jQuery('html').hasClass('cssanimations') ? 'css' : 'javascript';

		if ( animation_type == 'css' ) {
			initPieChart();
			jQuery(window).on( 'load', initPieChartUpdate );
			jQuery(window).scroll( jQuery.throttle( 250, initPieChartUpdate ) );
			jQuery(window).smartresize( initPieChartResize, 5000 );
		}
	};

});

jQuery(document).ready(function(){
	"use strict";

	jQuery.fn.extend({
		/**
		 *  CloudFw Tabs
		 *
		 *  @since 1.0
		 */
		CloudFwTabs: function() {
			var in_proccess = false,
				tabs = this,
				tabs_header = tabs.children('.ui--tabs-header'),
				titles = tabs_header.find('.ui--tabs-titles').children('li'),
				border_before = tabs_header.find('.ui--tabs-border-before'),
				border_after = tabs_header.find('.ui--tabs-border-after'),
				border_top = tabs_header.find('.ui--tabs-border-top'),
				border_bottom = tabs_header.find('.ui--tabs-border-bottom'),
				contents = tabs.find('> .ui--tabs-contents > li');

			titles.first().addClass('first-item');
			titles.last().addClass('last-item');

			contents.first().show().removeClass('hidden').addClass('active').addClass('first-item');
			contents.last().addClass('last-item');

			var update_hash = false;

			titles.find('a').click(function(e) {
				e.preventDefault();

				var that    = jQuery(this),
					li      = that.parents('li').first(),
					width   = li.width(),
					height  = li.height(),
					pos     = li.position(),
					index   = li.index();


				if ( in_proccess === true ) {
					return false;
				}

				in_proccess = true;

				if ( ! li.hasClass('active') ) {
					contents.filter('.active').removeClass('active').addClass('hidden');
					var current_item = contents.eq( index );

					current_item.removeClass('hidden').addClass('active');

					titles.filter('.active').removeClass('active');
					li.addClass('active');

					if ( update_hash ) {
						if (history.pushState) {
							history.pushState(null, null, that.attr('href'));
						}
						else {
							location.hash = that.attr('href');
						}
					}
				}

				border_after.css( { left: (pos.left + width) } );
				border_before.css( { left: -(border_before.width() - pos.left) } );

				border_top.css( { top: -(border_top.height() - pos.top) } );
				border_bottom.css( { top: (pos.top + height) } );

				tabs.addClass('ui--done');

				in_proccess = false;
				jQuery(window).trigger('scroll');
				jQuery(window).trigger('make@2x');

			});

			titles.first().find('a').click();
			update_hash = true;

			var refresh_titles = function(){
				titles.filter('.active').find('a').click();
			};

			jQuery(window).smartresize( refresh_titles, 20 );
			jQuery(document).ready( refresh_titles );
			jQuery(window).on( 'load', refresh_titles);

		}

	});

	/** Prepare Tabs */
	jQuery('.ui--tabs').each(function () {
		jQuery(this).CloudFwTabs();
	});

});


jQuery(document).ready(function(){
	"use strict";

	var bordered_titles_callback = function(){
		jQuery('.ui--title-bordered').each(function(){
			var that		 = jQuery(this),
				text 		 = that.find('.ui--title-text'),
				pos			 = text.position(),
				width		 = text.outerWidth(),
				border_left  = that.find('.ui--title-border-left'),
				border_right = that.find('.ui--title-border-right');


			border_left.show().css({ left: 0 - (border_left.width() - pos.left) });
			border_right.show().css( { left: (pos.left + width) } );

		});
	}

	bordered_titles_callback();
	jQuery(window).on( 'load', bordered_titles_callback );
	jQuery(window).smartresize( bordered_titles_callback );
	jQuery(document).ajaxComplete(bordered_titles_callback);
});


jQuery(document).ready(function(){
	"use strict";

	jQuery.fn.extend({

		CloudFwToggle: function() {
			var in_progress = false,
				toggle      = this,
				title       = toggle.children('.ui--toggle-title'),
				title_link  = title.children('a'),
				content     = toggle.children('.ui--toggle-content');

			title_link.click(function( e ) {
				e.preventDefault();

				if (in_progress === true) {
					return false;
				}

				in_progress = true;

				var that = jQuery(this),
					group = toggle.attr("data-group");

				toggle.addClass('not');

				if (group && toggle.hasClass('ui--toggle-state-closed')) {
					jQuery('[data-group="' + group + '"]').not('.not').removeClass('ui--toggle-state-opened').addClass('ui--toggle-state-closed');
				}

				if (toggle.hasClass('ui--toggle-state-opened')) {
					toggle.removeClass('ui--toggle-state-opened').removeClass('not').addClass('ui--toggle-state-closed');
					in_progress = false;

				} else {
					toggle.removeClass('ui--toggle-state-closed').removeClass('not').addClass('ui--toggle-state-opened');
					in_progress = false;
					jQuery(window).trigger('scroll');
					jQuery(window).trigger('make@2x');
				}

			});


		}

	});

	/** Init Toggles */
	jQuery('.ui--toggle').each(function () {
		jQuery(this).CloudFwToggle();
	});

});

jQuery(document).ready(function(){
	"use strict";

	if ( jQuery.isFunction( jQuery.fn.flexslider ) ) {
		//jQuery( '.ui--carousel' ).imagesLoaded(boxGalleryInit);
	}

	jQuery('.ui--content-box').each(function(){
		var that = jQuery(this),
			options = CloudFwParseAttribute( that.attr( 'data-ligthbox' ) );

		if ( options && options.src ) {
			that.find('.ui--content-box-link').bind('click', function(){
				jQuery.CloudFwPrettyPhoto.open( options.src, null, options.desc );
				return false;
			});
		}
	});
});

jQuery(document).ready(function(){

	jQuery('.flexslider-navigation-prev').click(function(){
		var that = jQuery(this);
		var slider = that.parents('.flexslider-wrapper').first().find('.flexslider');

		slider.flexslider("prev");
	});


	jQuery('.flexslider-navigation-next').click(function(){
		var that = jQuery(this);
		var slider = that.parents('.flexslider-wrapper').first().find('.flexslider');

		slider.flexslider("next");
	});


});

jQuery(window).on( 'load', function(){
	jQuery('.flexslider .flex-control-paging li a').html('<div class="ui--bullets"><div class="ui--bullets-color ui--accent-gradient"></div></div>');
});