');}
item.inlineElement=el;return el;}
mfp.updateStatus('ready');mfp._parseMarkup(template,{},item);return template;}}});var AJAX_NS='ajax',_ajaxCur,_removeAjaxCursor=function(){if(_ajaxCur){_body.removeClass(_ajaxCur);}},_destroyAjaxRequest=function(){_removeAjaxCursor();if(mfp.req){mfp.req.abort();}};$.magnificPopup.registerModule(AJAX_NS,{options:{settings:null,cursor:'mfp-ajax-cur',tError:'
The content could not be loaded.'},proto:{initAjax:function(){mfp.types.push(AJAX_NS);_ajaxCur=mfp.st.ajax.cursor;_mfpOn(CLOSE_EVENT+'.'+AJAX_NS,_destroyAjaxRequest);_mfpOn('BeforeChange.'+AJAX_NS,_destroyAjaxRequest);},getAjax:function(item){if(_ajaxCur)
_body.addClass(_ajaxCur);mfp.updateStatus('loading');var opts=$.extend({url:item.src,success:function(data,textStatus,jqXHR){var temp={data:data,xhr:jqXHR};_mfpTrigger('ParseAjax',temp);mfp.appendContent($(temp.data),AJAX_NS);item.finished=true;_removeAjaxCursor();mfp._setFocus();setTimeout(function(){mfp.wrap.addClass(READY_CLASS);},16);mfp.updateStatus('ready');_mfpTrigger('AjaxContentAdded');},error:function(){_removeAjaxCursor();item.finished=item.loadError=true;mfp.updateStatus('error',mfp.st.ajax.tError.replace('%url%',item.src));}},mfp.st.ajax.settings);mfp.req=$.ajax(opts);return'';}}});var _imgInterval,_getTitle=function(item){if(item.data&&item.data.title!==undefined)
return item.data.title;var src=mfp.st.image.titleSrc;if(src){if($.isFunction(src)){return src.call(mfp,item);}else if(item.el){return item.el.attr(src)||'';}}
return'';};$.magnificPopup.registerModule('image',{options:{markup:'
',cursor:'mfp-zoom-out-cur',titleSrc:'title',verticalFit:true,tError:'
The image could not be loaded.'},proto:{initImage:function(){var imgSt=mfp.st.image,ns='.image';mfp.types.push('image');_mfpOn(OPEN_EVENT+ns,function(){if(mfp.currItem.type==='image'&&imgSt.cursor){_body.addClass(imgSt.cursor);}});_mfpOn(CLOSE_EVENT+ns,function(){if(imgSt.cursor){_body.removeClass(imgSt.cursor);}
_window.off('resize'+EVENT_NS);});_mfpOn('Resize'+ns,mfp.resizeImage);if(mfp.isLowIE){_mfpOn('AfterChange',mfp.resizeImage);}},resizeImage:function(){var item=mfp.currItem;if(!item||!item.img)return;if(mfp.st.image.verticalFit){var decr=0;if(mfp.isLowIE){decr=parseInt(item.img.css('padding-top'),10)+parseInt(item.img.css('padding-bottom'),10);}
item.img.css('max-height',mfp.wH-decr);}},_onImageHasSize:function(item){if(item.img){item.hasSize=true;if(_imgInterval){clearInterval(_imgInterval);}
item.isCheckingImgSize=false;_mfpTrigger('ImageHasSize',item);if(item.imgHidden){if(mfp.content)
mfp.content.removeClass('mfp-loading');item.imgHidden=false;}}},findImageSize:function(item){var counter=0,img=item.img[0],mfpSetInterval=function(delay){if(_imgInterval){clearInterval(_imgInterval);}
_imgInterval=setInterval(function(){if(img.naturalWidth>0){mfp._onImageHasSize(item);return;}
if(counter>200){clearInterval(_imgInterval);}
counter++;if(counter===3){mfpSetInterval(10);}else if(counter===40){mfpSetInterval(50);}else if(counter===100){mfpSetInterval(500);}},delay);};mfpSetInterval(1);},getImage:function(item,template){var guard=0,onLoadComplete=function(){if(item){if(item.img[0].complete){item.img.off('.mfploader');if(item===mfp.currItem){mfp._onImageHasSize(item);mfp.updateStatus('ready');}
item.hasSize=true;item.loaded=true;_mfpTrigger('ImageLoadComplete');}
else{guard++;if(guard<200){setTimeout(onLoadComplete,100);}else{onLoadError();}}}},onLoadError=function(){if(item){item.img.off('.mfploader');if(item===mfp.currItem){mfp._onImageHasSize(item);mfp.updateStatus('error',imgSt.tError.replace('%url%',item.src));}
item.hasSize=true;item.loaded=true;item.loadError=true;}},imgSt=mfp.st.image;var el=template.find('.mfp-img');if(el.length){var img=document.createElement('img');img.className='mfp-img';item.img=$(img).on('load.mfploader',onLoadComplete).on('error.mfploader',onLoadError);img.src=item.src;if(el.is('img')){item.img=item.img.clone();}
img=item.img[0];if(img.naturalWidth>0){item.hasSize=true;}else if(!img.width){item.hasSize=false;}}
mfp._parseMarkup(template,{title:_getTitle(item),img_replaceWith:item.img},item);mfp.resizeImage();if(item.hasSize){if(_imgInterval)clearInterval(_imgInterval);if(item.loadError){template.addClass('mfp-loading');mfp.updateStatus('error',imgSt.tError.replace('%url%',item.src));}else{template.removeClass('mfp-loading');mfp.updateStatus('ready');}
return template;}
mfp.updateStatus('loading');item.loading=true;if(!item.hasSize){item.imgHidden=true;template.addClass('mfp-loading');mfp.findImageSize(item);}
return template;}}});var hasMozTransform,getHasMozTransform=function(){if(hasMozTransform===undefined){hasMozTransform=document.createElement('p').style.MozTransform!==undefined;}
return hasMozTransform;};$.magnificPopup.registerModule('zoom',{options:{enabled:false,easing:'ease-in-out',duration:300,opener:function(element){return element.is('img')?element:element.find('img');}},proto:{initZoom:function(){var zoomSt=mfp.st.zoom,ns='.zoom',image;if(!zoomSt.enabled||!mfp.supportsTransition){return;}
var duration=zoomSt.duration,getElToAnimate=function(image){var newImg=image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'),transition='all '+(zoomSt.duration/1000)+'s '+zoomSt.easing,cssObj={position:'fixed',zIndex:9999,left:0,top:0,'-webkit-backface-visibility':'hidden'},t='transition';cssObj['-webkit-'+t]=cssObj['-moz-'+t]=cssObj['-o-'+t]=cssObj[t]=transition;newImg.css(cssObj);return newImg;},showMainContent=function(){mfp.content.css('visibility','visible');},openTimeout,animatedImg;_mfpOn('BuildControls'+ns,function(){if(mfp._allowZoom()){clearTimeout(openTimeout);mfp.content.css('visibility','hidden');image=mfp._getItemToZoom();if(!image){showMainContent();return;}
animatedImg=getElToAnimate(image);animatedImg.css(mfp._getOffset());mfp.wrap.append(animatedImg);openTimeout=setTimeout(function(){animatedImg.css(mfp._getOffset(true));openTimeout=setTimeout(function(){showMainContent();setTimeout(function(){animatedImg.remove();image=animatedImg=null;_mfpTrigger('ZoomAnimationEnded');},16);},duration);},16);}});_mfpOn(BEFORE_CLOSE_EVENT+ns,function(){if(mfp._allowZoom()){clearTimeout(openTimeout);mfp.st.removalDelay=duration;if(!image){image=mfp._getItemToZoom();if(!image){return;}
animatedImg=getElToAnimate(image);}
animatedImg.css(mfp._getOffset(true));mfp.wrap.append(animatedImg);mfp.content.css('visibility','hidden');setTimeout(function(){animatedImg.css(mfp._getOffset());},16);}});_mfpOn(CLOSE_EVENT+ns,function(){if(mfp._allowZoom()){showMainContent();if(animatedImg){animatedImg.remove();}
image=null;}});},_allowZoom:function(){return mfp.currItem.type==='image';},_getItemToZoom:function(){if(mfp.currItem.hasSize){return mfp.currItem.img;}else{return false;}},_getOffset:function(isLarge){var el;if(isLarge){el=mfp.currItem.img;}else{el=mfp.st.zoom.opener(mfp.currItem.el||mfp.currItem);}
var offset=el.offset();var paddingTop=parseInt(el.css('padding-top'),10);var paddingBottom=parseInt(el.css('padding-bottom'),10);offset.top-=($(window).scrollTop()-paddingTop);var obj={width:el.width(),height:(_isJQ?el.innerHeight():el[0].offsetHeight)-paddingBottom-paddingTop};if(getHasMozTransform()){obj['-moz-transform']=obj['transform']='translate('+offset.left+'px,'+offset.top+'px)';}else{obj.left=offset.left;obj.top=offset.top;}
return obj;}}});var IFRAME_NS='iframe',_emptyPage='//about:blank',_fixIframeBugs=function(isShowing){if(mfp.currTemplate[IFRAME_NS]){var el=mfp.currTemplate[IFRAME_NS].find('iframe');if(el.length){if(!isShowing){el[0].src=_emptyPage;}
if(mfp.isIE8){el.css('display',isShowing?'block':'none');}}}};$.magnificPopup.registerModule(IFRAME_NS,{options:{markup:'
',srcAction:'iframe_src',patterns:{youtube:{index:'youtube.com',id:'v=',src:'//www.youtube.com/embed/%id%?autoplay=1'},vimeo:{index:'vimeo.com/',id:'/',src:'//player.vimeo.com/video/%id%?autoplay=1'},gmaps:{index:'//maps.google.',src:'%id%&output=embed'}}},proto:{initIframe:function(){mfp.types.push(IFRAME_NS);_mfpOn('BeforeChange',function(e,prevType,newType){if(prevType!==newType){if(prevType===IFRAME_NS){_fixIframeBugs();}else if(newType===IFRAME_NS){_fixIframeBugs(true);}}});_mfpOn(CLOSE_EVENT+'.'+IFRAME_NS,function(){_fixIframeBugs();});},getIframe:function(item,template){var embedSrc=item.src;var iframeSt=mfp.st.iframe;$.each(iframeSt.patterns,function(){if(embedSrc.indexOf(this.index)>-1){if(this.id){if(typeof this.id==='string'){embedSrc=embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length,embedSrc.length);}else{embedSrc=this.id.call(this,embedSrc);}}
embedSrc=this.src.replace('%id%',embedSrc);return false;}});var dataObj={};if(iframeSt.srcAction){dataObj[iframeSt.srcAction]=embedSrc;}
mfp._parseMarkup(template,dataObj,item);mfp.updateStatus('ready');return template;}}});var _getLoopedId=function(index){var numSlides=mfp.items.length;if(index>numSlides-1){return index-numSlides;}else if(index<0){return numSlides+index;}
return index;},_replaceCurrTotal=function(text,curr,total){return text.replace(/%curr%/gi,curr+1).replace(/%total%/gi,total);};$.magnificPopup.registerModule('gallery',{options:{enabled:false,arrowMarkup:'
',preload:[0,2],navigateByImgClick:true,arrows:true,tPrev:'Previous (Left arrow key)',tNext:'Next (Right arrow key)',tCounter:'%curr% of %total%'},proto:{initGallery:function(){var gSt=mfp.st.gallery,ns='.mfp-gallery',supportsFastClick=Boolean($.fn.mfpFastClick);mfp.direction=true;if(!gSt||!gSt.enabled)return false;_wrapClasses+=' mfp-gallery';_mfpOn(OPEN_EVENT+ns,function(){if(gSt.navigateByImgClick){mfp.wrap.on('click'+ns,'.mfp-img',function(){if(mfp.items.length>1){mfp.next();return false;}});}
_document.on('keydown'+ns,function(e){if(e.keyCode===37){mfp.prev();}else if(e.keyCode===39){mfp.next();}});});_mfpOn('UpdateStatus'+ns,function(e,data){if(data.text){data.text=_replaceCurrTotal(data.text,mfp.currItem.index,mfp.items.length);}});_mfpOn(MARKUP_PARSE_EVENT+ns,function(e,element,values,item){var l=mfp.items.length;values.counter=l>1?_replaceCurrTotal(gSt.tCounter,item.index,l):'';});_mfpOn('BuildControls'+ns,function(){if(mfp.items.length>1&&gSt.arrows&&!mfp.arrowLeft){var markup=gSt.arrowMarkup,arrowLeft=mfp.arrowLeft=$(markup.replace(/%title%/gi,gSt.tPrev).replace(/%dir%/gi,'left')).addClass(PREVENT_CLOSE_CLASS),arrowRight=mfp.arrowRight=$(markup.replace(/%title%/gi,gSt.tNext).replace(/%dir%/gi,'right')).addClass(PREVENT_CLOSE_CLASS);var eName=supportsFastClick?'mfpFastClick':'click';arrowLeft[eName](function(){mfp.prev();});arrowRight[eName](function(){mfp.next();});if(mfp.isIE7){_getEl('b',arrowLeft[0],false,true);_getEl('a',arrowLeft[0],false,true);_getEl('b',arrowRight[0],false,true);_getEl('a',arrowRight[0],false,true);}
mfp.container.append(arrowLeft.add(arrowRight));}});_mfpOn(CHANGE_EVENT+ns,function(){if(mfp._preloadTimeout)clearTimeout(mfp._preloadTimeout);mfp._preloadTimeout=setTimeout(function(){mfp.preloadNearbyImages();mfp._preloadTimeout=null;},16);});_mfpOn(CLOSE_EVENT+ns,function(){_document.off(ns);mfp.wrap.off('click'+ns);if(mfp.arrowLeft&&supportsFastClick){mfp.arrowLeft.add(mfp.arrowRight).destroyMfpFastClick();}
mfp.arrowRight=mfp.arrowLeft=null;});},next:function(){mfp.direction=true;mfp.index=_getLoopedId(mfp.index+1);mfp.updateItemHTML();},prev:function(){mfp.direction=false;mfp.index=_getLoopedId(mfp.index-1);mfp.updateItemHTML();},goTo:function(newIndex){mfp.direction=(newIndex>=mfp.index);mfp.index=newIndex;mfp.updateItemHTML();},preloadNearbyImages:function(){var p=mfp.st.gallery.preload,preloadBefore=Math.min(p[0],mfp.items.length),preloadAfter=Math.min(p[1],mfp.items.length),i;for(i=1;i<=(mfp.direction?preloadAfter:preloadBefore);i++){mfp._preloadItem(mfp.index+i);}
for(i=1;i<=(mfp.direction?preloadBefore:preloadAfter);i++){mfp._preloadItem(mfp.index-i);}},_preloadItem:function(index){index=_getLoopedId(index);if(mfp.items[index].preloaded){return;}
var item=mfp.items[index];if(!item.parsed){item=mfp.parseEl(index);}
_mfpTrigger('LazyLoad',item);if(item.type==='image'){item.img=$('
').on('load.mfploader',function(){item.hasSize=true;}).on('error.mfploader',function(){item.hasSize=true;item.loadError=true;_mfpTrigger('LazyLoadError',item);}).attr('src',item.src);}
item.preloaded=true;}}});var RETINA_NS='retina';$.magnificPopup.registerModule(RETINA_NS,{options:{replaceSrc:function(item){return item.src.replace(/\.\w+$/,function(m){return'@2x'+m;});},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var st=mfp.st.retina,ratio=st.ratio;ratio=!isNaN(ratio)?ratio:ratio();if(ratio>1){_mfpOn('ImageHasSize'+'.'+RETINA_NS,function(e,item){item.img.css({'max-width':item.img[0].naturalWidth/ratio,'width':'100%'});});_mfpOn('ElementParse'+'.'+RETINA_NS,function(e,item){item.src=st.replaceSrc(item,ratio);});}}}}});(function(){var ghostClickDelay=1000,supportsTouch='ontouchstart'in window,unbindTouchMove=function(){_window.off('touchmove'+ns+' touchend'+ns);},eName='mfpFastClick',ns='.'+eName;$.fn.mfpFastClick=function(callback){return $(this).each(function(){var elem=$(this),lock;if(supportsTouch){var timeout,startX,startY,pointerMoved,point,numPointers;elem.on('touchstart'+ns,function(e){pointerMoved=false;numPointers=1;point=e.originalEvent?e.originalEvent.touches[0]:e.touches[0];startX=point.clientX;startY=point.clientY;_window.on('touchmove'+ns,function(e){point=e.originalEvent?e.originalEvent.touches:e.touches;numPointers=point.length;point=point[0];if(Math.abs(point.clientX-startX)>10||Math.abs(point.clientY-startY)>10){pointerMoved=true;unbindTouchMove();}}).on('touchend'+ns,function(e){unbindTouchMove();if(pointerMoved||numPointers>1){return;}
lock=true;e.preventDefault();clearTimeout(timeout);timeout=setTimeout(function(){lock=false;},ghostClickDelay);callback();});});}
elem.on('click'+ns,function(){if(!lock){callback();}});});};$.fn.destroyMfpFastClick=function(){$(this).off('touchstart'+ns+' click'+ns);if(supportsTouch)_window.off('touchmove'+ns+' touchend'+ns);};})();_checkInstance();})(window.jQuery||window.Zepto);;!function(e){function t(){var e=location.href;return hashtag=-1!==e.indexOf("#prettyPhoto")?decodeURI(e.substring(e.indexOf("#prettyPhoto")+1,e.length)):!1,hashtag&&(hashtag=hashtag.replace(/<|>/g,"")),hashtag}function i(){"undefined"!=typeof theRel&&(location.hash=theRel+"/"+rel_index+"/")}function p(){-1!==location.href.indexOf("#prettyPhoto")&&(location.hash="prettyPhoto")}function o(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i="[\\?&]"+e+"=([^]*)",p=new RegExp(i),o=p.exec(t);return null==o?"":o[1]}e.prettyPhoto={version:"3.1.6"},e.fn.prettyPhoto=function(a){function s(){e(".pp_loaderIcon").hide(),projectedTop=scroll_pos.scrollTop+(I/2-f.containerHeight/2),projectedTop<0&&(projectedTop=0),$ppt.fadeTo(settings.animation_speed,1),$pp_pic_holder.find(".pp_content").animate({height:f.contentHeight,width:f.contentWidth},settings.animation_speed),$pp_pic_holder.animate({top:projectedTop,left:j/2-f.containerWidth/2<0?0:j/2-f.containerWidth/2,width:f.containerWidth},settings.animation_speed,function(){$pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(f.height).width(f.width),$pp_pic_holder.find(".pp_fade").fadeIn(settings.animation_speed),isSet&&"image"==h(pp_images[set_position])?$pp_pic_holder.find(".pp_hoverContainer").show():$pp_pic_holder.find(".pp_hoverContainer").hide(),settings.allow_expand&&(f.resized?e("a.pp_expand,a.pp_contract").show():e("a.pp_expand").hide()),!settings.autoplay_slideshow||P||v||e.prettyPhoto.startSlideshow(),settings.changepicturecallback(),v=!0}),m(),a.ajaxcallback()}function n(t){$pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden"),$pp_pic_holder.find(".pp_fade").fadeOut(settings.animation_speed,function(){e(".pp_loaderIcon").show(),t()})}function r(t){t>1?e(".pp_nav").show():e(".pp_nav").hide()}function l(e,t){if(resized=!1,d(e,t),imageWidth=e,imageHeight=t,(k>j||b>I)&&doresize&&settings.allow_resize&&!$){for(resized=!0,fitting=!1;!fitting;)k>j?(imageWidth=j-200,imageHeight=t/e*imageWidth):b>I?(imageHeight=I-200,imageWidth=e/t*imageHeight):fitting=!0,b=imageHeight,k=imageWidth;(k>j||b>I)&&l(k,b),d(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(b),containerWidth:Math.floor(k)+2*settings.horizontal_padding,contentHeight:Math.floor(y),contentWidth:Math.floor(w),resized:resized}}function d(t,i){t=parseFloat(t),i=parseFloat(i),$pp_details=$pp_pic_holder.find(".pp_details"),$pp_details.width(t),detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom")),$pp_details=$pp_details.clone().addClass(settings.theme).width(t).appendTo(e("body")).css({position:"absolute",top:-1e4}),detailsHeight+=$pp_details.height(),detailsHeight=detailsHeight<=34?36:detailsHeight,$pp_details.remove(),$pp_title=$pp_pic_holder.find(".ppt"),$pp_title.width(t),titleHeight=parseFloat($pp_title.css("marginTop"))+parseFloat($pp_title.css("marginBottom")),$pp_title=$pp_title.clone().appendTo(e("body")).css({position:"absolute",top:-1e4}),titleHeight+=$pp_title.height(),$pp_title.remove(),y=i+detailsHeight,w=t,b=y+titleHeight+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height(),k=t}function h(e){return e.match(/youtube\.com\/watch/i)||e.match(/youtu\.be/i)?"youtube":e.match(/vimeo\.com/i)?"vimeo":e.match(/\b.mov\b/i)?"quicktime":e.match(/\b.swf\b/i)?"flash":e.match(/\biframe=true\b/i)?"iframe":e.match(/\bajax=true\b/i)?"ajax":e.match(/\bcustom=true\b/i)?"custom":"#"==e.substr(0,1)?"inline":"image"}function c(){if(doresize&&"undefined"!=typeof $pp_pic_holder){if(scroll_pos=_(),contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width(),projectedTop=I/2+scroll_pos.scrollTop-contentHeight/2,projectedTop<0&&(projectedTop=0),contentHeight>I)return;$pp_pic_holder.css({top:projectedTop,left:j/2+scroll_pos.scrollLeft-contentwidth/2})}}function _(){return self.pageYOffset?{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset}:document.documentElement&&document.documentElement.scrollTop?{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft}:document.body?{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}:void 0}function g(){I=e(window).height(),j=e(window).width(),"undefined"!=typeof $pp_overlay&&$pp_overlay.height(e(document).height()).width(j)}function m(){isSet&&settings.overlay_gallery&&"image"==h(pp_images[set_position])?(itemWidth=57,navWidth="facebook"==settings.theme||"pp_default"==settings.theme?50:30,itemsPerPage=Math.floor((f.containerWidth-100-navWidth)/itemWidth),itemsPerPage=itemsPerPage
";toInject=settings.gallery_markup.replace(/{gallery}/g,toInject),$pp_pic_holder.find("#pp_full_res").after(toInject),$pp_gallery=e(".pp_pic_holder .pp_gallery"),$pp_gallery_li=$pp_gallery.find("li"),$pp_gallery.find(".pp_arrow_next").click(function(){return e.prettyPhoto.changeGalleryPage("next"),e.prettyPhoto.stopSlideshow(),!1}),$pp_gallery.find(".pp_arrow_previous").click(function(){return e.prettyPhoto.changeGalleryPage("previous"),e.prettyPhoto.stopSlideshow(),!1}),$pp_pic_holder.find(".pp_content").hover(function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeIn()},function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeOut()}),itemWidth=57,$pp_gallery_li.each(function(t){e(this).find("a").click(function(){return e.prettyPhoto.changePage(t),e.prettyPhoto.stopSlideshow(),!1})})}settings.slideshow&&($pp_pic_holder.find(".pp_nav").prepend('Play '),$pp_pic_holder.find(".pp_nav .pp_play").click(function(){return e.prettyPhoto.startSlideshow(),!1})),$pp_pic_holder.attr("class","pp_pic_holder "+settings.theme),$pp_overlay.css({opacity:0,height:e(document).height(),width:e(window).width()}).bind("click",function(){settings.modal||e.prettyPhoto.close()}),e("a.pp_close").bind("click",function(){return e.prettyPhoto.close(),!1}),settings.allow_expand&&e("a.pp_expand").bind("click",function(){return e(this).hasClass("pp_expand")?(e(this).removeClass("pp_expand").addClass("pp_contract"),doresize=!1):(e(this).removeClass("pp_contract").addClass("pp_expand"),doresize=!0),n(function(){e.prettyPhoto.open()}),!1}),$pp_pic_holder.find(".pp_previous, .pp_nav .pp_arrow_previous").bind("click",function(){return e.prettyPhoto.changePage("previous"),e.prettyPhoto.stopSlideshow(),!1}),$pp_pic_holder.find(".pp_next, .pp_nav .pp_arrow_next").bind("click",function(){return e.prettyPhoto.changePage("next"),e.prettyPhoto.stopSlideshow(),!1}),c()}a=jQuery.extend({hook:"rel",animation_speed:"fast",ajaxcallback:function(){},slideshow:5e3,autoplay_slideshow:!1,opacity:.8,show_title:!0,allow_resize:!0,allow_expand:!0,default_width:500,default_height:344,counter_separator_label:"/",theme:"pp_default",horizontal_padding:20,hideflash:!1,wmode:"opaque",autoplay:!0,modal:!1,deeplinking:!0,overlay_gallery:!0,overlay_gallery_max:30,keyboard_shortcuts:!0,changepicturecallback:function(){},callback:function(){},ie6_fallback:!0,markup:'
',gallery_markup:'',image_markup:' ',flash_markup:' ',quicktime_markup:' ',iframe_markup:'',inline_markup:'{content}
',custom_markup:"",social_tools:'
'},a);var f,v,y,w,b,k,P,x=this,$=!1,I=e(window).height(),j=e(window).width();return doresize=!0,scroll_pos=_(),e(window).unbind("resize.prettyphoto").bind("resize.prettyphoto",function(){c(),g()}),a.keyboard_shortcuts&&e(document).unbind("keydown.prettyphoto").bind("keydown.prettyphoto",function(t){if("undefined"!=typeof $pp_pic_holder&&$pp_pic_holder.is(":visible"))switch(t.keyCode){case 37:e.prettyPhoto.changePage("previous"),t.preventDefault();break;case 39:e.prettyPhoto.changePage("next"),t.preventDefault();break;case 27:settings.modal||e.prettyPhoto.close(),t.preventDefault()}}),e.prettyPhoto.initialize=function(){return settings=a,"pp_default"==settings.theme&&(settings.horizontal_padding=16),theRel=e(this).attr(settings.hook),galleryRegExp=/\[(?:.*)\]/,isSet=galleryRegExp.exec(theRel)?!0:!1,pp_images=isSet?jQuery.map(x,function(t){return-1!=e(t).attr(settings.hook).indexOf(theRel)?e(t).attr("href"):void 0}):e.makeArray(e(this).attr("href")),pp_titles=isSet?jQuery.map(x,function(t){return-1!=e(t).attr(settings.hook).indexOf(theRel)?e(t).find("img").attr("alt")?e(t).find("img").attr("alt"):"":void 0}):e.makeArray(e(this).find("img").attr("alt")),pp_descriptions=isSet?jQuery.map(x,function(t){return-1!=e(t).attr(settings.hook).indexOf(theRel)?e(t).attr("title")?e(t).attr("title"):"":void 0}):e.makeArray(e(this).attr("title")),pp_images.length>settings.overlay_gallery_max&&(settings.overlay_gallery=!1),set_position=jQuery.inArray(e(this).attr("href"),pp_images),rel_index=isSet?set_position:e("a["+settings.hook+"^='"+theRel+"']").index(e(this)),u(this),settings.allow_resize&&e(window).bind("scroll.prettyphoto",function(){c()}),e.prettyPhoto.open(),!1},e.prettyPhoto.open=function(t){return"undefined"==typeof settings&&(settings=a,pp_images=e.makeArray(arguments[0]),pp_titles=e.makeArray(arguments[1]?arguments[1]:""),pp_descriptions=e.makeArray(arguments[2]?arguments[2]:""),isSet=pp_images.length>1?!0:!1,set_position=arguments[3]?arguments[3]:0,u(t.target)),settings.hideflash&&e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","hidden"),r(e(pp_images).size()),e(".pp_loaderIcon").show(),settings.deeplinking&&i(),settings.social_tools&&(facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href)),$pp_pic_holder.find(".pp_social").html(facebook_like_link)),$ppt.is(":hidden")&&$ppt.css("opacity",0).show(),$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity),$pp_pic_holder.find(".currentTextHolder").text(set_position+1+settings.counter_separator_label+e(pp_images).size()),"undefined"!=typeof pp_descriptions[set_position]&&""!=pp_descriptions[set_position]?$pp_pic_holder.find(".pp_description").show().html(unescape(pp_descriptions[set_position])):$pp_pic_holder.find(".pp_description").hide(),movie_width=parseFloat(o("width",pp_images[set_position]))?o("width",pp_images[set_position]):settings.default_width.toString(),movie_height=parseFloat(o("height",pp_images[set_position]))?o("height",pp_images[set_position]):settings.default_height.toString(),$=!1,-1!=movie_height.indexOf("%")&&(movie_height=parseFloat(e(window).height()*parseFloat(movie_height)/100-150),$=!0),-1!=movie_width.indexOf("%")&&(movie_width=parseFloat(e(window).width()*parseFloat(movie_width)/100-150),$=!0),$pp_pic_holder.fadeIn(function(){switch($ppt.html(settings.show_title&&""!=pp_titles[set_position]&&"undefined"!=typeof pp_titles[set_position]?unescape(pp_titles[set_position]):" "),imgPreloader="",skipInjection=!1,h(pp_images[set_position])){case"image":imgPreloader=new Image,nextImage=new Image,isSet&&set_position0&&(movie_id=movie_id.substr(0,movie_id.indexOf("?"))),movie_id.indexOf("&")>0&&(movie_id=movie_id.substr(0,movie_id.indexOf("&")))),movie="http://www.youtube.com/embed/"+movie_id,movie+=o("rel",pp_images[set_position])?"?rel="+o("rel",pp_images[set_position]):"?rel=1",settings.autoplay&&(movie+="&autoplay=1"),toInject=settings.iframe_markup.replace(/{width}/g,f.width).replace(/{height}/g,f.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case"vimeo":f=l(movie_width,movie_height),movie_id=pp_images[set_position];var t=/http(s?):\/\/(www\.)?vimeo.com\/(\d+)/,i=movie_id.match(t);movie="http://player.vimeo.com/video/"+i[3]+"?title=0&byline=0&portrait=0",settings.autoplay&&(movie+="&autoplay=1;"),vimeo_width=f.width+"/embed/?moog_width="+f.width,toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,f.height).replace(/{path}/g,movie);break;case"quicktime":f=l(movie_width,movie_height),f.height+=15,f.contentHeight+=15,f.containerHeight+=15,toInject=settings.quicktime_markup.replace(/{width}/g,f.width).replace(/{height}/g,f.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case"flash":f=l(movie_width,movie_height),flash_vars=pp_images[set_position],flash_vars=flash_vars.substring(pp_images[set_position].indexOf("flashvars")+10,pp_images[set_position].length),filename=pp_images[set_position],filename=filename.substring(0,filename.indexOf("?")),toInject=settings.flash_markup.replace(/{width}/g,f.width).replace(/{height}/g,f.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case"iframe":f=l(movie_width,movie_height),frame_url=pp_images[set_position],frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1),toInject=settings.iframe_markup.replace(/{width}/g,f.width).replace(/{height}/g,f.height).replace(/{path}/g,frame_url);break;case"ajax":doresize=!1,f=l(movie_width,movie_height),doresize=!0,skipInjection=!0,e.get(pp_images[set_position],function(e){toInject=settings.inline_markup.replace(/{content}/g,e),$pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject,s()});break;case"custom":f=l(movie_width,movie_height),toInject=settings.custom_markup;break;case"inline":myClone=e(pp_images[set_position]).clone().append(' ').css({width:settings.default_width}).wrapInner('').appendTo(e("body")).show(),doresize=!1,f=l(e(myClone).width(),e(myClone).height()),doresize=!0,e(myClone).remove(),toInject=settings.inline_markup.replace(/{content}/g,e(pp_images[set_position]).html())}imgPreloader||skipInjection||($pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject,s())}),!1},e.prettyPhoto.changePage=function(t){currentGalleryPage=0,"previous"==t?(set_position--,set_position<0&&(set_position=e(pp_images).size()-1)):"next"==t?(set_position++,set_position>e(pp_images).size()-1&&(set_position=0)):set_position=t,rel_index=set_position,doresize||(doresize=!0),settings.allow_expand&&e(".pp_contract").removeClass("pp_contract").addClass("pp_expand"),n(function(){e.prettyPhoto.open()})},e.prettyPhoto.changeGalleryPage=function(e){"next"==e?(currentGalleryPage++,currentGalleryPage>totalPage&&(currentGalleryPage=0)):"previous"==e?(currentGalleryPage--,currentGalleryPage<0&&(currentGalleryPage=totalPage)):currentGalleryPage=e,slide_speed="next"==e||"previous"==e?settings.animation_speed:0,slide_to=currentGalleryPage*itemsPerPage*itemWidth,$pp_gallery.find("ul").animate({left:-slide_to},slide_speed)},e.prettyPhoto.startSlideshow=function(){"undefined"==typeof P?($pp_pic_holder.find(".pp_play").unbind("click").removeClass("pp_play").addClass("pp_pause").click(function(){return e.prettyPhoto.stopSlideshow(),!1}),P=setInterval(e.prettyPhoto.startSlideshow,settings.slideshow)):e.prettyPhoto.changePage("next")},e.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find(".pp_pause").unbind("click").removeClass("pp_pause").addClass("pp_play").click(function(){return e.prettyPhoto.startSlideshow(),!1}),clearInterval(P),P=void 0},e.prettyPhoto.close=function(){$pp_overlay.is(":animated")||(e.prettyPhoto.stopSlideshow(),$pp_pic_holder.stop().find("object,embed").css("visibility","hidden"),e("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animation_speed,function(){e(this).remove()}),$pp_overlay.fadeOut(settings.animation_speed,function(){settings.hideflash&&e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","visible"),e(this).remove(),e(window).unbind("scroll.prettyphoto"),p(),settings.callback(),doresize=!0,v=!1,delete settings}))},!pp_alreadyInitialized&&t()&&(pp_alreadyInitialized=!0,hashIndex=t(),hashRel=hashIndex,hashIndex=hashIndex.substring(hashIndex.indexOf("../../index.html")+1,hashIndex.length-1),hashRel=hashRel.substring(0,hashRel.indexOf("../../index.html")),setTimeout(function(){e("a["+a.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger("click")},50)),this.unbind("click.prettyphoto").bind("click.prettyphoto",e.prettyPhoto.initialize)}}(jQuery);var pp_alreadyInitialized=!1;;
/*!
* jQuery Selectbox plugin 0.2
*
* Copyright 2011-2012, Dimitar Ivanov (http://www.bulgaria-web-developers.com/projects/javascript/selectbox/)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*
* Date: Tue Jul 17 19:58:36 2012 +0300
*/
(function($,undefined){var PROP_NAME='selectbox',FALSE=false,TRUE=true;function Selectbox(){this._state=[];this._defaults={classHolder:"sbHolder",classHolderDisabled:"sbHolderDisabled",classSelector:"sbSelector",classOptions:"sbOptions",classGroup:"sbGroup",classSub:"sbSub",classDisabled:"sbDisabled",classToggleOpen:"sbToggleOpen",classToggle:"sbToggle",classFocus:"sbFocus",speed:200,effect:"slide",onChange:null,onOpen:null,onClose:null};}
$.extend(Selectbox.prototype,{_isOpenSelectbox:function(target){if(!target){return FALSE;}
var inst=this._getInst(target);return inst.isOpen;},_isDisabledSelectbox:function(target){if(!target){return FALSE;}
var inst=this._getInst(target);return inst.isDisabled;},_attachSelectbox:function(target,settings){if(this._getInst(target)){return FALSE;}
var $target=$(target),self=this,inst=self._newInst($target),sbHolder,sbSelector,sbToggle,sbOptions,s=FALSE,optGroup=$target.find("optgroup"),opts=$target.find("option"),olen=opts.length;$target.attr("sb",inst.uid);$.extend(inst.settings,self._defaults,settings);self._state[inst.uid]=FALSE;$target.hide();function closeOthers(){var key,sel,uid=this.attr("id").split("_")[1];for(key in self._state){if(key!==uid){if(self._state.hasOwnProperty(key)){sel=$("select[sb='"+key+"']")[0];if(sel){self._closeSelectbox(sel);}}}}}
sbHolder=$("',image:' ',iframe:'",error:'The requested content cannot be loaded. Please try again later.
',closeBtn:' ',next:' ',prev:' '},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k,c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&&k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current||b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer=setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")),b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(),y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHeight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0,{},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case"inline":case"ajax":case"html":a.selector?e=f("").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case"image":e=a.tpl.image.replace("{href}",g);break;case"swf":e='
',h="",f.each(a.swf,function(a,b){e+=' ';h+=" "+a+'="'+b+'"'}),e+='"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll":"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),c
z||y>r)&&(c>m&&j>u)&&!(19n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&jz||y>r)&&c>m&&j>u;c=h.aspectRatio?cu&&j
').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive?b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth),p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"===f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f(''+e+"
");switch(c){case"inside":c=b.skin;break;case"outside":c=b.wrap;break;case"over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner(' '),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('
').appendTo("body");var e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("").appendTo("head")})})(window,document,jQuery);
;/*!
* sly 1.2.3 - 9th Feb 2014
* https://github.com/darsain/sly
*
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*/
;(function ($, w, undefined) {
'use strict';
var pluginName = 'sly';
var className = 'Sly';
var namespace = pluginName;
// Local WindowAnimationTiming interface
var cAF = w.cancelAnimationFrame || w.cancelRequestAnimationFrame;
var rAF = w.requestAnimationFrame;
// Support indicators
var transform, gpuAcceleration;
// Other global values
var $doc = $(document);
var dragInitEvents = 'touchstart.' + namespace + ' mousedown.' + namespace;
var dragMouseEvents = 'mousemove.' + namespace + ' mouseup.' + namespace;
var dragTouchEvents = 'touchmove.' + namespace + ' touchend.' + namespace;
var clickEvent = 'click.' + namespace;
var mouseDownEvent = 'mousedown.' + namespace;
var interactiveElements = ['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA'];
var tmpArray = [];
var time;
/**
* Sly.
*
* @class
*
* @param {Element} frame DOM element of sly container.
* @param {Object} options Object with options.
* @param {Object} callbackMap Callbacks map.
*/
function Sly(frame, options, callbackMap) {
// Extend options
var o = $.extend({}, Sly.defaults, options);
// Private variables
var self = this;
var parallax = isNumber(frame);
// Frame
var $frame = $(frame);
var $slidee = $frame.children().eq(0);
var frameSize = 0;
var slideeSize = 0;
var pos = {
start: 0,
center: 0,
end: 0,
cur: 0,
dest: 0
};
// Scrollbar
var $sb = $(o.scrollBar).eq(0);
var $handle = $sb.children().eq(0);
var sbSize = 0;
var handleSize = 0;
var hPos = {
start: 0,
end: 0,
cur: 0
};
// Pagesbar
var $pb = $(o.pagesBar);
var $pages = 0;
var pages = [];
// Items
var $items = 0;
var items = [];
var rel = {
firstItem: 0,
lastItem: 0,
centerItem: 0,
activeItem: -1,
activePage: 0
};
// Navigation type booleans
var basicNav = o.itemNav === 'basic';
var forceCenteredNav = o.itemNav === 'forceCentered';
var centeredNav = o.itemNav === 'centered' || forceCenteredNav;
var itemNav = !parallax && (basicNav || centeredNav || forceCenteredNav);
// Miscellaneous
var $scrollSource = o.scrollSource ? $(o.scrollSource) : $frame;
var $dragSource = o.dragSource ? $(o.dragSource) : $frame;
var $forwardButton = $(o.forward);
var $backwardButton = $(o.backward);
var $prevButton = $(o.prev);
var $nextButton = $(o.next);
var $prevPageButton = $(o.prevPage);
var $nextPageButton = $(o.nextPage);
var callbacks = {};
var last = {};
var animation = {};
var move = {};
var dragging = {
released: 1
};
var scrolling = {
last: 0,
delta: 0,
resetTime: 200
};
var renderID = 0;
var historyID = 0;
var cycleID = 0;
var continuousID = 0;
var i, l;
// Normalizing frame
if (!parallax) {
frame = $frame[0];
}
// Expose properties
self.initialized = 0;
self.frame = frame;
self.slidee = $slidee[0];
self.pos = pos;
self.rel = rel;
self.items = items;
self.pages = pages;
self.isPaused = 0;
self.options = o;
self.dragging = dragging;
/**
* (Re)Loading function.
*
* Populate arrays, set sizes, bind events, ...
*
* @return {Void}
*/
function load() {
// Local variables
var lastItemsCount = 0;
var lastPagesCount = pages.length;
// Save old position
pos.old = $.extend({}, pos);
// Reset global variables
frameSize = parallax ? 0 : $frame[o.horizontal ? 'width' : 'height']();
sbSize = $sb[o.horizontal ? 'width' : 'height']();
slideeSize = parallax ? frame : $slidee[o.horizontal ? 'outerWidth' : 'outerHeight']();
pages.length = 0;
// Set position limits & relatives
pos.start = 0;
pos.end = Math.max(slideeSize - frameSize, 0);
// Sizes & offsets for item based navigations
if (itemNav) {
// Save the number of current items
lastItemsCount = items.length;
// Reset itemNav related variables
$items = $slidee.children(o.itemSelector);
items.length = 0;
// Needed variables
var paddingStart = getPx($slidee, o.horizontal ? 'paddingLeft' : 'paddingTop');
var paddingEnd = getPx($slidee, o.horizontal ? 'paddingRight' : 'paddingBottom');
var borderBox = $($items).css('boxSizing') === 'border-box';
var areFloated = $items.css('float') !== 'none';
var ignoredMargin = 0;
var lastItemIndex = $items.length - 1;
var lastItem;
// Reset slideeSize
slideeSize = 0;
// Iterate through items
$items.each(function (i, element) {
// Item
var $item = $(element);
if( $item.hasClass('portfolio-item')){
var itemSize = ($item[o.horizontal ? 'outerWidth' : 'outerHeight']())/2;
}
else{
var itemSize = $item[o.horizontal ? 'outerWidth' : 'outerHeight']();
}
var itemMarginStart = getPx($item, o.horizontal ? 'marginLeft' : 'marginTop');
var itemMarginEnd = getPx($item, o.horizontal ? 'marginRight' : 'marginBottom');
var itemSizeFull = itemSize + itemMarginStart + itemMarginEnd;
var singleSpaced = !itemMarginStart || !itemMarginEnd;
var item = {};
item.el = element;
item.size = singleSpaced ? itemSize : itemSizeFull;
item.half = item.size / 4;
item.start = slideeSize + (singleSpaced ? itemMarginStart : 0);
item.center = item.start - Math.round(frameSize / 2 - item.size / 2);
item.end = item.start - frameSize + item.size;
// Account for slidee padding
if (!i) {
slideeSize += paddingStart;
}
// Increment slidee size for size of the active element
slideeSize += itemSizeFull;
// Try to account for vertical margin collapsing in vertical mode
// It's not bulletproof, but should work in 99% of cases
if (!o.horizontal && !areFloated) {
// Subtract smaller margin, but only when top margin is not 0, and this is not the first element
if (itemMarginEnd && itemMarginStart && i > 0) {
slideeSize -= Math.min(itemMarginStart, itemMarginEnd);
}
}
// Things to be done on last item
if (i === lastItemIndex) {
item.end += paddingEnd;
slideeSize += paddingEnd;
ignoredMargin = singleSpaced ? itemMarginEnd : 0;
}
// Add item object to items array
items.push(item);
lastItem = item;
});
// Resize SLIDEE to fit all items
$slidee[0].style[o.horizontal ? 'width' : 'height'] = (borderBox ? slideeSize: slideeSize - paddingStart - paddingEnd) + 'px';
// Adjust internal SLIDEE size for last margin
slideeSize -= ignoredMargin;
// Set limits
if (items.length) {
pos.start = items[0][forceCenteredNav ? 'center' : 'start'];
pos.end = forceCenteredNav ? lastItem.center : frameSize < slideeSize ? lastItem.end : pos.start;
} else {
pos.start = pos.end = 0;
}
}
// Calculate SLIDEE center position
pos.center = Math.round(pos.end / 2 + pos.start / 2);
// Update relative positions
updateRelatives();
// Scrollbar
if ($handle.length && sbSize > 0) {
// Stretch scrollbar handle to represent the visible area
if (o.dynamicHandle) {
handleSize = pos.start === pos.end ? sbSize : Math.round(sbSize * frameSize / slideeSize);
handleSize = within(handleSize, o.minHandleSize, sbSize);
$handle[0].style[o.horizontal ? 'width' : 'height'] = handleSize + 'px';
} else {
handleSize = $handle[o.horizontal ? 'outerWidth' : 'outerHeight']();
}
hPos.end = sbSize - handleSize;
if (!renderID) {
syncScrollbar();
}
}
// Pages
if (!parallax && frameSize > 0) {
var tempPagePos = pos.start;
var pagesHtml = '';
// Populate pages array
if (itemNav) {
$.each(items, function (i, item) {
if (forceCenteredNav) {
pages.push(item.center);
} else if (item.start + item.size > tempPagePos && tempPagePos <= pos.end) {
tempPagePos = item.start;
pages.push(tempPagePos);
tempPagePos += frameSize;
if (tempPagePos > pos.end && tempPagePos < pos.end + frameSize) {
pages.push(pos.end);
}
}
});
} else {
while (tempPagePos - frameSize < pos.end) {
pages.push(tempPagePos);
tempPagePos += frameSize;
}
}
// Pages bar
if ($pb[0] && lastPagesCount !== pages.length) {
for (var i = 0; i < pages.length; i++) {
pagesHtml += o.pageBuilder.call(self, i);
}
$pages = $pb.html(pagesHtml).children();
$pages.eq(rel.activePage).addClass(o.activeClass);
}
}
// Extend relative variables object with some useful info
rel.slideeSize = slideeSize;
rel.frameSize = frameSize;
rel.sbSize = sbSize;
rel.handleSize = handleSize;
// Activate requested position
if (itemNav) {
if (!self.initialized) {
activate(o.startAt);
self[centeredNav ? 'toCenter' : 'toStart'](o.startAt);
} else if (rel.activeItem >= items.length || lastItemsCount === 0 && items.length > 0) {
// Activate last item if previous active has been removed, or first item
// when there were no items before, and new got appended.
activate(rel.activeItem >= items.length ? items.length - 1 : 0, !lastItemsCount);
}
// Fix possible overflowing
slideTo(centeredNav && items.length ? items[rel.activeItem].center : within(pos.dest, pos.start, pos.end));
} else {
if (!self.initialized) {
slideTo(o.startAt, 1);
} else {
// Fix possible overflowing
slideTo(within(pos.dest, pos.start, pos.end));
}
}
// Trigger load event
trigger('load');
}
self.reload = load;
/**
* Animate to a position.
*
* @param {Int} newPos New position.
* @param {Bool} immediate Reposition immediately without an animation.
* @param {Bool} dontAlign Do not align items, use the raw position passed in first argument.
*
* @return {Void}
*/
function slideTo(newPos, immediate, dontAlign) {
// Align items
if (itemNav && dragging.released && !dontAlign) {
var tempRel = getRelatives(newPos);
var isNotBordering = newPos > pos.start && newPos < pos.end;
if (centeredNav) {
if (isNotBordering) {
newPos = items[tempRel.centerItem].center;
}
if (forceCenteredNav && o.activateMiddle) {
activate(tempRel.centerItem);
}
} else if (isNotBordering) {
newPos = items[tempRel.firstItem].start;
}
}
// Handle overflowing position limits
if (dragging.init && dragging.slidee && o.elasticBounds) {
if (newPos > pos.end) {
newPos = pos.end + (newPos - pos.end) / 6;
} else if (newPos < pos.start) {
newPos = pos.start + (newPos - pos.start) / 6;
}
} else {
newPos = within(newPos, pos.start, pos.end);
}
// Update the animation object
animation.start = +new Date();
animation.time = 0;
animation.from = pos.cur;
animation.to = newPos;
animation.delta = newPos - pos.cur;
animation.tweesing = dragging.tweese || dragging.init && !dragging.slidee;
animation.immediate = !animation.tweesing && (immediate || dragging.init && dragging.slidee || !o.speed);
// Reset dragging tweesing request
dragging.tweese = 0;
// Start animation rendering
if (newPos !== pos.dest) {
pos.dest = newPos;
trigger('change');
if (!renderID) {
render();
}
}
// Reset next cycle timeout
resetCycle();
// Synchronize states
updateRelatives();
updateButtonsState();
syncPagesbar();
}
/**
* Render animation frame.
*
* @return {Void}
*/
function render() {
// If first render call, wait for next animationFrame
if (!renderID) {
renderID = rAF(render);
if (dragging.released) {
trigger('moveStart');
}
return;
}
// If immediate repositioning is requested, don't animate.
if (animation.immediate) {
pos.cur = animation.to;
}
// Use tweesing for animations without known end point
else if (animation.tweesing) {
animation.tweeseDelta = animation.to - pos.cur;
// Fuck Zeno's paradox
if (Math.abs(animation.tweeseDelta) < 0.1) {
pos.cur = animation.to;
} else {
pos.cur += animation.tweeseDelta * (dragging.released ? o.swingSpeed : o.syncSpeed);
}
}
// Use tweening for basic animations with known end point
else {
animation.time = Math.min(+new Date() - animation.start, o.speed);
pos.cur = animation.from + animation.delta * jQuery.easing[o.easing](animation.time/o.speed, animation.time, 0, 1, o.speed);
}
// If there is nothing more to render break the rendering loop, otherwise request new animation frame.
if (animation.to === pos.cur) {
pos.cur = animation.to;
dragging.tweese = renderID = 0;
} else {
renderID = rAF(render);
}
trigger('move');
// Update SLIDEE position
if (!parallax) {
if (transform) {
$slidee[0].style[transform] = gpuAcceleration + (o.horizontal ? 'translateX' : 'translateY') + '(' + (-pos.cur) + 'px)';
} else {
$slidee[0].style[o.horizontal ? 'left' : 'top'] = -Math.round(pos.cur) + 'px';
}
}
// When animation reached the end, and dragging is not active, trigger moveEnd
if (!renderID && dragging.released) {
trigger('moveEnd');
}
syncScrollbar();
}
/**
* Synchronizes scrollbar with the SLIDEE.
*
* @return {Void}
*/
function syncScrollbar() {
if ($handle.length) {
hPos.cur = pos.start === pos.end ? 0 : (((dragging.init && !dragging.slidee) ? pos.dest : pos.cur) - pos.start) / (pos.end - pos.start) * hPos.end;
hPos.cur = within(Math.round(hPos.cur), hPos.start, hPos.end);
if (last.hPos !== hPos.cur) {
last.hPos = hPos.cur;
if (transform) {
$handle[0].style[transform] = gpuAcceleration + (o.horizontal ? 'translateX' : 'translateY') + '(' + hPos.cur + 'px)';
} else {
$handle[0].style[o.horizontal ? 'left' : 'top'] = hPos.cur + 'px';
}
}
}
}
/**
* Synchronizes pagesbar with SLIDEE.
*
* @return {Void}
*/
function syncPagesbar() {
if ($pages[0] && last.page !== rel.activePage) {
last.page = rel.activePage;
$pages.removeClass(o.activeClass).eq(rel.activePage).addClass(o.activeClass);
trigger('activePage', last.page);
}
}
/**
* Returns the position object.
*
* @param {Mixed} item
*
* @return {Object}
*/
self.getPos = function (item) {
if (itemNav) {
var index = getIndex(item);
return index !== -1 ? items[index] : false;
} else {
var $item = $slidee.find(item).eq(0);
if ($item[0]) {
var offset = o.horizontal ? $item.offset().left - $slidee.offset().left : $item.offset().top - $slidee.offset().top;
var size = $item[o.horizontal ? 'outerWidth' : 'outerHeight']();
return {
start: offset,
center: offset - frameSize / 2 + size / 2,
end: offset - frameSize + size,
size: size
};
} else {
return false;
}
}
};
/**
* Continuous move in a specified direction.
*
* @param {Bool} forward True for forward movement, otherwise it'll go backwards.
* @param {Int} speed Movement speed in pixels per frame. Overrides options.moveBy value.
*
* @return {Void}
*/
self.moveBy = function (speed) {
move.speed = speed;
// If already initiated, or there is nowhere to move, abort
if (dragging.init || !move.speed || pos.cur === (move.speed > 0 ? pos.end : pos.start)) {
return;
}
// Initiate move object
move.lastTime = +new Date();
move.startPos = pos.cur;
// Set dragging as initiated
continuousInit('button');
dragging.init = 1;
// Start movement
trigger('moveStart');
cAF(continuousID);
moveLoop();
};
/**
* Continuous movement loop.
*
* @return {Void}
*/
function moveLoop() {
// If there is nowhere to move anymore, stop
if (!move.speed || pos.cur === (move.speed > 0 ? pos.end : pos.start)) {
self.stop();
}
// Request new move loop if it hasn't been stopped
continuousID = dragging.init ? rAF(moveLoop) : 0;
// Update move object
move.now = +new Date();
move.pos = pos.cur + (move.now - move.lastTime) / 1000 * move.speed;
// Slide
slideTo(dragging.init ? move.pos : Math.round(move.pos));
// Normally, this is triggered in render(), but if there
// is nothing to render, we have to do it manually here.
if (!dragging.init && pos.cur === pos.dest) {
trigger('moveEnd');
}
// Update times for future iteration
move.lastTime = move.now;
}
/**
* Stops continuous movement.
*
* @return {Void}
*/
self.stop = function () {
if (dragging.source === 'button') {
dragging.init = 0;
dragging.released = 1;
}
};
/**
* Activate previous item.
*
* @return {Void}
*/
self.prev = function () {
self.activate(rel.activeItem - 1);
};
/**
* Activate next item.
*
* @return {Void}
*/
self.next = function () {
self.activate(rel.activeItem + 1);
};
/**
* Activate previous page.
*
* @return {Void}
*/
self.prevPage = function () {
self.activatePage(rel.activePage - 1);
};
/**
* Activate next page.
*
* @return {Void}
*/
self.nextPage = function () {
self.activatePage(rel.activePage + 1);
};
/**
* Slide SLIDEE by amount of pixels.
*
* @param {Int} delta Pixels/Items. Positive means forward, negative means backward.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.slideBy = function (delta, immediate) {
if (!delta) {
return;
}
if (itemNav) {
self[centeredNav ? 'toCenter' : 'toStart'](
within((centeredNav ? rel.centerItem : rel.firstItem) + o.scrollBy * delta, 0, items.length)
);
} else {
slideTo(pos.dest + delta, immediate);
}
};
/**
* Animate SLIDEE to a specific position.
*
* @param {Int} pos New position.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.slideTo = function (pos, immediate) {
slideTo(pos, immediate);
};
/**
* Core method for handling `toLocation` methods.
*
* @param {String} location
* @param {Mixed} item
* @param {Bool} immediate
*
* @return {Void}
*/
function to(location, item, immediate) {
// Optional arguments logic
if (type(item) === 'boolean') {
immediate = item;
item = undefined;
}
if (item === undefined) {
slideTo(pos[location], immediate);
} else {
// You can't align items to sides of the frame
// when centered navigation type is enabled
if (centeredNav && location !== 'center') {
return;
}
var itemPos = self.getPos(item);
if (itemPos) {
slideTo(itemPos[location], immediate, !centeredNav);
}
}
}
/**
* Animate element or the whole SLIDEE to the start of the frame.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Omitting will animate SLIDEE.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.toStart = function (item, immediate) {
to('start', item, immediate);
};
/**
* Animate element or the whole SLIDEE to the end of the frame.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Omitting will animate SLIDEE.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.toEnd = function (item, immediate) {
to('end', item, immediate);
};
/**
* Animate element or the whole SLIDEE to the center of the frame.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Omitting will animate SLIDEE.
* @param {Bool} immediate Reposition immediately without an animation.
*
* @return {Void}
*/
self.toCenter = function (item, immediate) {
to('center', item, immediate);
};
/**
* Get the index of an item in SLIDEE.
*
* @param {Mixed} item Item DOM element.
*
* @return {Int} Item index, or -1 if not found.
*/
function getIndex(item) {
return item != null ?
isNumber(item) ?
item >= 0 && item < items.length ? item : -1 :
$items.index(item) :
-1;
}
// Expose getIndex without lowering the compressibility of it,
// as it is used quite often throughout Sly.
self.getIndex = getIndex;
/**
* Get index of an item in SLIDEE based on a variety of input types.
*
* @param {Mixed} item DOM element, positive or negative integer.
*
* @return {Int} Item index, or -1 if not found.
*/
function getRelativeIndex(item) {
return getIndex(isNumber(item) && item < 0 ? item + items.length : item);
}
/**
* Activates an item.
*
* @param {Mixed} item Item DOM element, or index starting at 0.
*
* @return {Mixed} Activated item index or false on fail.
*/
function activate(item, force) {
var index = getIndex(item);
if (!itemNav || index < 0) {
return false;
}
// Update classes, last active index, and trigger active event only when there
// has been a change. Otherwise just return the current active index.
if (last.active !== index || force) {
// Update classes
$items.eq(rel.activeItem).removeClass(o.activeClass);
$items.eq(index).addClass(o.activeClass);
last.active = rel.activeItem = index;
updateButtonsState();
trigger('active', index);
}
return index;
}
/**
* Activates an item and helps with further navigation when o.smart is enabled.
*
* @param {Mixed} item Item DOM element, or index starting at 0.
* @param {Bool} immediate Whether to reposition immediately in smart navigation.
*
* @return {Void}
*/
self.activate = function (item, immediate) {
var index = activate(item);
// Smart navigation
if (o.smart && index !== false) {
// When centeredNav is enabled, center the element.
// Otherwise, determine where to position the element based on its current position.
// If the element is currently on the far end side of the frame, assume that user is
// moving forward and animate it to the start of the visible frame, and vice versa.
if (centeredNav) {
self.toCenter(index, immediate);
} else if (index >= rel.lastItem) {
self.toStart(index, immediate);
} else if (index <= rel.firstItem) {
self.toEnd(index, immediate);
} else {
resetCycle();
}
}
};
/**
* Activates a page.
*
* @param {Int} index Page index, starting from 0.
* @param {Bool} immediate Whether to reposition immediately without animation.
*
* @return {Void}
*/
self.activatePage = function (index, immediate) {
if (isNumber(index)) {
slideTo(pages[within(index, 0, pages.length - 1)], immediate);
}
};
/**
* Return relative positions of items based on their visibility within FRAME.
*
* @param {Int} slideePos Position of SLIDEE.
*
* @return {Void}
*/
function getRelatives(slideePos) {
slideePos = within(isNumber(slideePos) ? slideePos : pos.dest, pos.start, pos.end);
var relatives = {};
var centerOffset = forceCenteredNav ? 0 : frameSize / 2;
// Determine active page
if (!parallax) {
for (var p = 0, pl = pages.length; p < pl; p++) {
if (slideePos >= pos.end || p === pages.length - 1) {
relatives.activePage = pages.length - 1;
break;
}
if (slideePos <= pages[p] + centerOffset) {
relatives.activePage = p;
break;
}
}
}
// Relative item indexes
if (itemNav) {
var first = false;
var last = false;
var center = false;
// From start
for (var i = 0, il = items.length; i < il; i++) {
// First item
if (first === false && slideePos <= items[i].start + items[i].half) {
first = i;
}
// Center item
if (center === false && slideePos <= items[i].center + items[i].half) {
center = i;
}
// Last item
if (i === il - 1 || slideePos <= items[i].end + items[i].half) {
last = i;
break;
}
}
// Safe assignment, just to be sure the false won't be returned
relatives.firstItem = isNumber(first) ? first : 0;
relatives.centerItem = isNumber(center) ? center : relatives.firstItem;
relatives.lastItem = isNumber(last) ? last : relatives.centerItem;
}
return relatives;
}
/**
* Update object with relative positions.
*
* @param {Int} newPos
*
* @return {Void}
*/
function updateRelatives(newPos) {
$.extend(rel, getRelatives(newPos));
}
/**
* Disable navigation buttons when needed.
*
* Adds disabledClass, and when the button is or , activates :disabled state.
*
* @return {Void}
*/
function updateButtonsState() {
var isStart = pos.dest <= pos.start;
var isEnd = pos.dest >= pos.end;
var slideePosState = isStart ? 1 : isEnd ? 2 : 3;
// Update paging buttons only if there has been a change in SLIDEE position
if (last.slideePosState !== slideePosState) {
last.slideePosState = slideePosState;
if ($prevPageButton.is('button,input')) {
$prevPageButton.prop('disabled', isStart);
}
if ($nextPageButton.is('button,input')) {
$nextPageButton.prop('disabled', isEnd);
}
$prevPageButton.add($backwardButton)[isStart ? 'addClass' : 'removeClass'](o.disabledClass);
$nextPageButton.add($forwardButton)[isEnd ? 'addClass' : 'removeClass'](o.disabledClass);
}
// Forward & Backward buttons need a separate state caching because we cannot "property disable"
// them while they are being used, as disabled buttons stop emitting mouse events.
if (last.fwdbwdState !== slideePosState && dragging.released) {
last.fwdbwdState = slideePosState;
if ($backwardButton.is('button,input')) {
$backwardButton.prop('disabled', isStart);
}
if ($forwardButton.is('button,input')) {
$forwardButton.prop('disabled', isEnd);
}
}
// Item navigation
if (itemNav) {
var isFirst = rel.activeItem === 0;
var isLast = rel.activeItem >= items.length - 1;
var itemsButtonState = isFirst ? 1 : isLast ? 2 : 3;
if (last.itemsButtonState !== itemsButtonState) {
last.itemsButtonState = itemsButtonState;
if ($prevButton.is('button,input')) {
$prevButton.prop('disabled', isFirst);
}
if ($nextButton.is('button,input')) {
$nextButton.prop('disabled', isLast);
}
$prevButton[isFirst ? 'addClass' : 'removeClass'](o.disabledClass);
$nextButton[isLast ? 'addClass' : 'removeClass'](o.disabledClass);
}
}
}
/**
* Resume cycling.
*
* @param {Int} priority Resume pause with priority lower or equal than this. Used internally for pauseOnHover.
*
* @return {Void}
*/
self.resume = function (priority) {
if (!o.cycleBy || !o.cycleInterval || o.cycleBy === 'items' && !items[0] || priority < self.isPaused) {
return;
}
self.isPaused = 0;
if (cycleID) {
cycleID = clearTimeout(cycleID);
} else {
trigger('resume');
}
cycleID = setTimeout(function () {
trigger('cycle');
switch (o.cycleBy) {
case 'items':
self.activate(rel.activeItem >= items.length - 1 ? 0 : rel.activeItem + 1);
break;
case 'pages':
self.activatePage(rel.activePage >= pages.length - 1 ? 0 : rel.activePage + 1);
break;
}
}, o.cycleInterval);
};
/**
* Pause cycling.
*
* @param {Int} priority Pause priority. 100 is default. Used internally for pauseOnHover.
*
* @return {Void}
*/
self.pause = function (priority) {
if (priority < self.isPaused) {
return;
}
self.isPaused = priority || 100;
if (cycleID) {
cycleID = clearTimeout(cycleID);
trigger('pause');
}
};
/**
* Toggle cycling.
*
* @return {Void}
*/
self.toggle = function () {
self[cycleID ? 'pause' : 'resume']();
};
/**
* Updates a signle or multiple option values.
*
* @param {Mixed} name Name of the option that should be updated, or object that will extend the options.
* @param {Mixed} value New option value.
*
* @return {Void}
*/
self.set = function (name, value) {
if ($.isPlainObject(name)) {
$.extend(o, name);
} else if (o.hasOwnProperty(name)) {
o[name] = value;
}
};
/**
* Add one or multiple items to the SLIDEE end, or a specified position index.
*
* @param {Mixed} element Node element, or HTML string.
* @param {Int} index Index of a new item position. By default item is appended at the end.
*
* @return {Void}
*/
self.add = function (element, index) {
var $element = $(element);
if (itemNav) {
// Insert the element(s)
if (index == null || !items[0]) {
$element.appendTo($slidee);
} else if (items.length) {
$element.insertBefore(items[index].el);
}
// Adjust the activeItem index
if (index <= rel.activeItem) {
last.active = rel.activeItem += $element.length;
}
} else {
$slidee.append($element);
}
// Reload
load();
};
/**
* Remove an item from SLIDEE.
*
* @param {Mixed} element Item index, or DOM element.
* @param {Int} index Index of a new item position. By default item is appended at the end.
*
* @return {Void}
*/
self.remove = function (element) {
if (itemNav) {
var index = getRelativeIndex(element);
if (index > -1) {
// Remove the element
$items.eq(index).remove();
// If the current item is being removed, activate new one after reload
var reactivate = index === rel.activeItem;
// Adjust the activeItem index
if (index < rel.activeItem) {
last.active = --rel.activeItem;
}
// Reload
load();
// Activate new item at the removed position
if (reactivate) {
last.active = null;
self.activate(rel.activeItem);
}
}
} else {
$(element).remove();
load();
}
};
/**
* Helps re-arranging items.
*
* @param {Mixed} item Item DOM element, or index starting at 0. Use negative numbers to select items from the end.
* @param {Mixed} position Item insertion anchor. Accepts same input types as item argument.
* @param {Bool} after Insert after instead of before the anchor.
*
* @return {Void}
*/
function moveItem(item, position, after) {
item = getRelativeIndex(item);
position = getRelativeIndex(position);
// Move only if there is an actual change requested
if (item > -1 && position > -1 && item !== position && (!after || position !== item - 1) && (after || position !== item + 1)) {
$items.eq(item)[after ? 'insertAfter' : 'insertBefore'](items[position].el);
var shiftStart = item < position ? item : (after ? position : position - 1);
var shiftEnd = item > position ? item : (after ? position + 1 : position);
var shiftsUp = item > position;
// Update activeItem index
if (item === rel.activeItem) {
last.active = rel.activeItem = after ? (shiftsUp ? position + 1 : position) : (shiftsUp ? position : position - 1);
} else if (rel.activeItem > shiftStart && rel.activeItem < shiftEnd) {
last.active = rel.activeItem += shiftsUp ? 1 : -1;
}
// Reload
load();
}
}
/**
* Move item after the target anchor.
*
* @param {Mixed} item Item to be moved. Can be DOM element or item index.
* @param {Mixed} position Target position anchor. Can be DOM element or item index.
*
* @return {Void}
*/
self.moveAfter = function (item, position) {
moveItem(item, position, 1);
};
/**
* Move item before the target anchor.
*
* @param {Mixed} item Item to be moved. Can be DOM element or item index.
* @param {Mixed} position Target position anchor. Can be DOM element or item index.
*
* @return {Void}
*/
self.moveBefore = function (item, position) {
moveItem(item, position);
};
/**
* Registers callbacks.
*
* @param {Mixed} name Event name, or callbacks map.
* @param {Mixed} fn Callback, or an array of callback functions.
*
* @return {Void}
*/
self.on = function (name, fn) {
// Callbacks map
if (type(name) === 'object') {
for (var key in name) {
if (name.hasOwnProperty(key)) {
self.on(key, name[key]);
}
}
// Callback
} else if (type(fn) === 'function') {
var names = name.split(' ');
for (var n = 0, nl = names.length; n < nl; n++) {
callbacks[names[n]] = callbacks[names[n]] || [];
if (callbackIndex(names[n], fn) === -1) {
callbacks[names[n]].push(fn);
}
}
// Callbacks array
} else if (type(fn) === 'array') {
for (var f = 0, fl = fn.length; f < fl; f++) {
self.on(name, fn[f]);
}
}
};
/**
* Registers callbacks to be executed only once.
*
* @param {Mixed} name Event name, or callbacks map.
* @param {Mixed} fn Callback, or an array of callback functions.
*
* @return {Void}
*/
self.one = function (name, fn) {
function proxy() {
fn.apply(self, arguments);
self.off(name, proxy);
}
self.on(name, proxy);
};
/**
* Remove one or all callbacks.
*
* @param {String} name Event name.
* @param {Mixed} fn Callback, or an array of callback functions. Omit to remove all callbacks.
*
* @return {Void}
*/
self.off = function (name, fn) {
if (fn instanceof Array) {
for (var f = 0, fl = fn.length; f < fl; f++) {
self.off(name, fn[f]);
}
} else {
var names = name.split(' ');
for (var n = 0, nl = names.length; n < nl; n++) {
callbacks[names[n]] = callbacks[names[n]] || [];
if (fn == null) {
callbacks[names[n]].length = 0;
} else {
var index = callbackIndex(names[n], fn);
if (index !== -1) {
callbacks[names[n]].splice(index, 1);
}
}
}
}
};
/**
* Returns callback array index.
*
* @param {String} name Event name.
* @param {Function} fn Function
*
* @return {Int} Callback array index, or -1 if isn't registered.
*/
function callbackIndex(name, fn) {
for (var i = 0, l = callbacks[name].length; i < l; i++) {
if (callbacks[name][i] === fn) {
return i;
}
}
return -1;
}
/**
* Reset next cycle timeout.
*
* @return {Void}
*/
function resetCycle() {
if (dragging.released && !self.isPaused) {
self.resume();
}
}
/**
* Calculate SLIDEE representation of handle position.
*
* @param {Int} handlePos
*
* @return {Int}
*/
function handleToSlidee(handlePos) {
return Math.round(within(handlePos, hPos.start, hPos.end) / hPos.end * (pos.end - pos.start)) + pos.start;
}
/**
* Keeps track of a dragging delta history.
*
* @return {Void}
*/
function draggingHistoryTick() {
// Looking at this, I know what you're thinking :) But as we need only 4 history states, doing it this way
// as opposed to a proper loop is ~25 bytes smaller (when minified with GCC), a lot faster, and doesn't
// generate garbage. The loop version would create 2 new variables on every tick. Unexaptable!
dragging.history[0] = dragging.history[1];
dragging.history[1] = dragging.history[2];
dragging.history[2] = dragging.history[3];
dragging.history[3] = dragging.delta;
}
/**
* Initialize continuous movement.
*
* @return {Void}
*/
function continuousInit(source) {
dragging.released = 0;
dragging.source = source;
dragging.slidee = source === 'slidee';
}
/**
* Dragging initiator.
*
* @param {Event} event
*
* @return {Void}
*/
function dragInit(event) {
// Ignore when already in progress, or interactive element
if (dragging.init || isInteractive(event.target)) {
return;
}
var isTouch = event.type === 'touchstart';
var source = event.data.source;
var isSlidee = source === 'slidee';
// Handle dragging conditions
if (source === 'handle' && (!o.dragHandle || hPos.start === hPos.end)) {
return;
}
// SLIDEE dragging conditions
if (isSlidee && !(isTouch ? o.touchDragging : o.mouseDragging && event.which < 2)) {
return;
}
if (!isTouch) {
stopDefault(event, 1);
}
// Reset dragging object
continuousInit(source);
// Properties used in dragHandler
dragging.init = 1;
dragging.$source = $(event.target);
dragging.touch = isTouch;
dragging.pointer = isTouch ? event.originalEvent.touches[0] : event;
dragging.initX = dragging.pointer.pageX;
dragging.initY = dragging.pointer.pageY;
dragging.initPos = isSlidee ? pos.cur : hPos.cur;
dragging.start = +new Date();
dragging.time = 0;
dragging.path = 0;
dragging.delta = 0;
dragging.locked = 0;
dragging.history = [0, 0, 0, 0];
dragging.pathToLock = isSlidee ? isTouch ? 30 : 10 : 0;
dragging.initLoc = dragging[o.horizontal ? 'initX' : 'initY'];
dragging.deltaMin = isSlidee ? -dragging.initLoc : -hPos.cur;
dragging.deltaMax = isSlidee ? document[o.horizontal ? 'width' : 'height'] - dragging.initLoc : hPos.end - hPos.cur;
// Bind dragging events
$doc.on(isTouch ? dragTouchEvents : dragMouseEvents, dragHandler);
// Pause ongoing cycle
self.pause(1);
// Add dragging class
(isSlidee ? $slidee : $handle).addClass(o.draggedClass);
// Trigger moveStart event
trigger('moveStart');
// Keep track of a dragging path history. This is later used in the
// dragging release swing calculation when dragging SLIDEE.
if (isSlidee) {
historyID = setInterval(draggingHistoryTick, 10);
}
}
/**
* Handler for dragging scrollbar handle or SLIDEE.
*
* @param {Event} event
*
* @return {Void}
*/
function dragHandler(event) {
dragging.released = event.type === 'mouseup' || event.type === 'touchend';
dragging.pointer = dragging.touch ? event.originalEvent[dragging.released ? 'changedTouches' : 'touches'][0] : event;
dragging.pathX = dragging.pointer.pageX - dragging.initX;
dragging.pathY = dragging.pointer.pageY - dragging.initY;
dragging.path = Math.sqrt(Math.pow(dragging.pathX, 2) + Math.pow(dragging.pathY, 2));
dragging.delta = within(o.horizontal ? dragging.pathX : dragging.pathY, dragging.deltaMin, dragging.deltaMax);
if (!dragging.locked && dragging.path > dragging.pathToLock) {
dragging.locked = 1;
if (o.horizontal ? Math.abs(dragging.pathX) < Math.abs(dragging.pathY) : Math.abs(dragging.pathX) > Math.abs(dragging.pathY)) {
// If path has reached the pathToLock distance, but in a wrong direction, cancel dragging
dragging.released = 1;
} else if (dragging.slidee) {
// Disable click on a source element, as it is unwelcome when dragging SLIDEE
dragging.$source.on(clickEvent, disableOneEvent);
}
}
// Cancel dragging on release
if (dragging.released) {
if (!dragging.touch) {
stopDefault(event);
}
dragEnd();
// Adjust path with a swing on mouse release
if (o.releaseSwing && dragging.slidee) {
dragging.swing = (dragging.delta - dragging.history[0]) / 40 * 300;
dragging.delta += dragging.swing;
dragging.tweese = Math.abs(dragging.swing) > 10;
}
} else if (dragging.locked || !dragging.touch) {
stopDefault(event);
}
slideTo(dragging.slidee ? Math.round(dragging.initPos - dragging.delta) : handleToSlidee(dragging.initPos + dragging.delta));
}
/**
* Stops dragging and cleans up after it.
*
* @return {Void}
*/
function dragEnd() {
clearInterval(historyID);
$doc.off(dragging.touch ? dragTouchEvents : dragMouseEvents, dragHandler);
(dragging.slidee ? $slidee : $handle).removeClass(o.draggedClass);
// Make sure that disableOneEvent is not active in next tick.
setTimeout(function () {
dragging.$source.off(clickEvent, disableOneEvent);
});
// Resume ongoing cycle
self.resume(1);
// Normally, this is triggered in render(), but if there
// is nothing to render, we have to do it manually here.
if (pos.cur === pos.dest && dragging.init) {
trigger('moveEnd');
}
dragging.init = 0;
}
/**
* Check whether element is interactive.
*
* @return {Boolean}
*/
function isInteractive(element) {
return ~$.inArray(element.nodeName, interactiveElements) || $(element).is(o.interactive);
}
/**
* Continuous movement cleanup on mouseup.
*
* @return {Void}
*/
function movementReleaseHandler() {
self.stop();
$doc.off('mouseup', movementReleaseHandler);
}
/**
* Buttons navigation handler.
*
* @param {Event} event
*
* @return {Void}
*/
function buttonsHandler(event) {
/*jshint validthis:true */
stopDefault(event);
switch (this) {
case $forwardButton[0]:
case $backwardButton[0]:
self.moveBy($forwardButton.is(this) ? o.moveBy : -o.moveBy);
$doc.on('mouseup', movementReleaseHandler);
break;
case $prevButton[0]:
self.prev();
break;
case $nextButton[0]:
self.next();
break;
case $prevPageButton[0]:
self.prevPage();
break;
case $nextPageButton[0]:
self.nextPage();
break;
}
}
/**
* Mouse wheel delta normalization.
*
* @param {Event} event
*
* @return {Int}
*/
function normalizeWheelDelta(event) {
// event.deltaY needed only for compatibility with jQuery mousewheel plugin in FF & IE
scrolling.curDelta = event.wheelDelta ? -event.wheelDelta / 120 : (event.detail || event.deltaY) / 3;
if (!itemNav) {
return scrolling.curDelta;
}
time = +new Date();
if (scrolling.last < time - scrolling.resetTime) {
scrolling.delta = 0;
}
scrolling.last = time;
scrolling.delta += scrolling.curDelta;
if (Math.abs(scrolling.delta) < 1) {
scrolling.finalDelta = 0;
} else {
scrolling.finalDelta = Math.round(scrolling.delta / 1);
scrolling.delta %= 1;
}
return scrolling.finalDelta;
}
/**
* Mouse scrolling handler.
*
* @param {Event} event
*
* @return {Void}
*/
function scrollHandler(event) {
// Ignore if there is no scrolling to be done
if (!o.scrollBy || pos.start === pos.end) {
return;
}
stopDefault(event, 1);
self.slideBy(o.scrollBy * normalizeWheelDelta(event.originalEvent));
}
/**
* Scrollbar click handler.
*
* @param {Event} event
*
* @return {Void}
*/
function scrollbarHandler(event) {
// Only clicks on scroll bar. Ignore the handle.
if (o.clickBar && event.target === $sb[0]) {
stopDefault(event);
// Calculate new handle position and sync SLIDEE to it
slideTo(handleToSlidee((o.horizontal ? event.pageX - $sb.offset().left : event.pageY - $sb.offset().top) - handleSize / 2));
}
}
/**
* Keyboard input handler.
*
* @param {Event} event
*
* @return {Void}
*/
function keyboardHandler(event) {
if (!o.keyboardNavBy) {
return;
}
switch (event.which) {
// Left or Up
case o.horizontal ? 37 : 38:
stopDefault(event);
self[o.keyboardNavBy === 'pages' ? 'prevPage' : 'prev']();
break;
// Right or Down
case o.horizontal ? 39 : 40:
stopDefault(event);
self[o.keyboardNavBy === 'pages' ? 'nextPage' : 'next']();
break;
}
}
/**
* Click on item activation handler.
*
* @param {Event} event
*
* @return {Void}
*/
function activateHandler(event) {
/*jshint validthis:true */
// Ignore clicks on interactive elements.
if (isInteractive(this)) {
event.stopPropagation();
return;
}
// Accept only events from direct SLIDEE children.
if (this.parentNode === $slidee[0]) {
self.activate(this);
}
}
/**
* Click on page button handler.
*
* @param {Event} event
*
* @return {Void}
*/
function activatePageHandler() {
/*jshint validthis:true */
// Accept only events from direct pages bar children.
if (this.parentNode === $pb[0]) {
self.activatePage($pages.index(this));
}
}
/**
* Pause on hover handler.
*
* @param {Event} event
*
* @return {Void}
*/
function pauseOnHoverHandler(event) {
if (o.pauseOnHover) {
self[event.type === 'mouseenter' ? 'pause' : 'resume'](2);
}
}
/**
* Trigger callbacks for event.
*
* @param {String} name Event name.
* @param {Mixed} argX Arguments passed to callbacks.
*
* @return {Void}
*/
function trigger(name, arg1) {
if (callbacks[name]) {
l = callbacks[name].length;
// Callbacks will be stored and executed from a temporary array to not
// break the execution queue when one of the callbacks unbinds itself.
tmpArray.length = 0;
for (i = 0; i < l; i++) {
tmpArray.push(callbacks[name][i]);
}
// Execute the callbacks
for (i = 0; i < l; i++) {
tmpArray[i].call(self, name, arg1);
}
}
}
/**
* Destroys instance and everything it created.
*
* @return {Void}
*/
self.destroy = function () {
// Unbind all events
$doc
.add($scrollSource)
.add($handle)
.add($sb)
.add($pb)
.add($forwardButton)
.add($backwardButton)
.add($prevButton)
.add($nextButton)
.add($prevPageButton)
.add($nextPageButton)
.unbind('.' + namespace);
// Remove classes
$prevButton
.add($nextButton)
.add($prevPageButton)
.add($nextPageButton)
.removeClass(o.disabledClass);
if ($items) {
$items.eq(rel.activeItem).removeClass(o.activeClass);
}
// Remove page items
$pb.empty();
if (!parallax) {
// Unbind events from frame
$frame.unbind('.' + namespace);
// Reset SLIDEE and handle positions
$slidee.add($handle).css(transform || (o.horizontal ? 'left' : 'top'), transform ? 'none' : 0);
// Remove the instance from element data storage
$.removeData(frame, namespace);
}
// Clean up collections
items.length = pages.length = 0;
last = {};
// Reset initialized status and return the instance
self.initialized = 0;
return self;
};
/**
* Initialize.
*
* @return {Object}
*/
self.init = function () {
if (self.initialized) {
return;
}
// Register callbacks map
self.on(callbackMap);
// Set required styles
var $movables = $handle;
if (!parallax) {
$movables = $movables.add($slidee);
$frame.css('overflow', 'hidden');
if (!transform && $frame.css('position') === 'static') {
$frame.css('position', 'relative');
}
}
if (transform) {
if (gpuAcceleration) {
$movables.css(transform, gpuAcceleration);
}
} else {
if ($sb.css('position') === 'static') {
$sb.css('position', 'relative');
}
$movables.css({ position: 'absolute' });
}
// Navigation buttons
if (o.forward) {
$forwardButton.on(mouseDownEvent, buttonsHandler);
}
if (o.backward) {
$backwardButton.on(mouseDownEvent, buttonsHandler);
}
if (o.prev) {
$prevButton.on(clickEvent, buttonsHandler);
}
if (o.next) {
$nextButton.on(clickEvent, buttonsHandler);
}
if (o.prevPage) {
$prevPageButton.on(clickEvent, buttonsHandler);
}
if (o.nextPage) {
$nextPageButton.on(clickEvent, buttonsHandler);
}
// Scrolling navigation
$scrollSource.on('DOMMouseScroll.' + namespace + ' mousewheel.' + namespace, scrollHandler);
// Clicking on scrollbar navigation
if ($sb[0]) {
$sb.on(clickEvent, scrollbarHandler);
}
// Click on items navigation
if (itemNav && o.activateOn) {
$frame.on(o.activateOn + '.' + namespace, '*', activateHandler);
}
// Pages navigation
if ($pb[0] && o.activatePageOn) {
$pb.on(o.activatePageOn + '.' + namespace, '*', activatePageHandler);
}
// Dragging navigation
$dragSource.on(dragInitEvents, { source: 'slidee' }, dragInit);
// Scrollbar dragging navigation
if ($handle) {
$handle.on(dragInitEvents, { source: 'handle' }, dragInit);
}
// Keyboard navigation
$doc.bind('keydown.' + namespace, keyboardHandler);
if (!parallax) {
// Pause on hover
$frame.on('mouseenter.' + namespace + ' mouseleave.' + namespace, pauseOnHoverHandler);
// Reset native FRAME element scroll
$frame.on('scroll.' + namespace, resetScroll);
}
// Load
load();
// Initiate automatic cycling
if (o.cycleBy && !parallax) {
self[o.startPaused ? 'pause' : 'resume']();
}
// Mark instance as initialized
self.initialized = 1;
// Return instance
return self;
};
}
/**
* Return type of the value.
*
* @param {Mixed} value
*
* @return {String}
*/
function type(value) {
if (value == null) {
return String(value);
}
if (typeof value === 'object' || typeof value === 'function') {
return Object.prototype.toString.call(value).match(/\s([a-z]+)/i)[1].toLowerCase() || 'object';
}
return typeof value;
}
/**
* Event preventDefault & stopPropagation helper.
*
* @param {Event} event Event object.
* @param {Bool} noBubbles Cancel event bubbling.
*
* @return {Void}
*/
function stopDefault(event, noBubbles) {
event.preventDefault();
if (noBubbles) {
event.stopPropagation();
}
}
/**
* Disables an event it was triggered on and unbinds itself.
*
* @param {Event} event
*
* @return {Void}
*/
function disableOneEvent(event) {
/*jshint validthis:true */
stopDefault(event, 1);
$(this).off(event.type, disableOneEvent);
}
/**
* Resets native element scroll values to 0.
*
* @return {Void}
*/
function resetScroll() {
/*jshint validthis:true */
this.scrollLeft = 0;
this.scrollTop = 0;
}
/**
* Check if variable is a number.
*
* @param {Mixed} value
*
* @return {Boolean}
*/
function isNumber(value) {
return !isNaN(parseFloat(value)) && isFinite(value);
}
/**
* Parse style to pixels.
*
* @param {Object} $item jQuery object with element.
* @param {Property} property CSS property to get the pixels from.
*
* @return {Int}
*/
function getPx($item, property) {
return 0 | Math.round(String($item.css(property)).replace(/[^\-0-9.]/g, ''));
}
/**
* Make sure that number is within the limits.
*
* @param {Number} number
* @param {Number} min
* @param {Number} max
*
* @return {Number}
*/
function within(number, min, max) {
return number < min ? min : number > max ? max : number;
}
// Local WindowAnimationTiming interface polyfill
(function (w) {
var vendors = ['moz', 'webkit', 'o'];
var lastTime = 0;
// For a more accurate WindowAnimationTiming interface implementation, ditch the native
// requestAnimationFrame when cancelAnimationFrame is not present (older versions of Firefox)
for(var i = 0, l = vendors.length; i < l && !cAF; ++i) {
cAF = w[vendors[i]+'CancelAnimationFrame'] || w[vendors[i]+'CancelRequestAnimationFrame'];
rAF = cAF && w[vendors[i]+'RequestAnimationFrame'];
}
if (!cAF) {
rAF = function (callback) {
var currTime = +new Date();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
lastTime = currTime + timeToCall;
return w.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall);
};
cAF = function (id) {
clearTimeout(id);
};
}
}(window));
// Feature detects
(function () {
var prefixes = ['', 'webkit', 'moz', 'ms', 'o'];
var el = document.createElement('div');
function testProp(prop) {
for (var p = 0, pl = prefixes.length; p < pl; p++) {
var prefixedProp = prefixes[p] ? prefixes[p] + prop.charAt(0).toUpperCase() + prop.slice(1) : prop;
if (el.style[prefixedProp] != null) {
return prefixedProp;
}
}
}
// Global support indicators
transform = testProp('transform');
gpuAcceleration = testProp('perspective') ? 'translateZ(0) ' : '';
}());
// Expose class globally
w[className] = Sly;
// jQuery proxy
$.fn[pluginName] = function (options, callbackMap) {
var method, methodArgs;
// Attributes logic
if (!$.isPlainObject(options)) {
if (type(options) === 'string' || options === false) {
method = options === false ? 'destroy' : options;
methodArgs = Array.prototype.slice.call(arguments, 1);
}
options = {};
}
// Apply to all elements
return this.each(function (i, element) {
// Call with prevention against multiple instantiations
var plugin = $.data(element, namespace);
if (!plugin && !method) {
// Create a new object if it doesn't exist yet
plugin = $.data(element, namespace, new Sly(element, options, callbackMap).init());
} else if (plugin && method) {
// Call method
if (plugin[method]) {
plugin[method].apply(plugin, methodArgs);
}
}
});
};
// Default options
Sly.defaults = {
horizontal: 0, // Switch to horizontal mode.
// Item based navigation
itemNav: null, // Item navigation type. Can be: 'basic', 'centered', 'forceCentered'.
itemSelector: null, // Select only items that match this selector.
smart: 0, // Repositions the activated item to help with further navigation.
activateOn: null, // Activate an item on this event. Can be: 'click', 'mouseenter', ...
activateMiddle: 0, // Always activate the item in the middle of the FRAME. forceCentered only.
// Scrolling
scrollSource: null, // Element for catching the mouse wheel scrolling. Default is FRAME.
scrollBy: 0, // Pixels or items to move per one mouse scroll. 0 to disable scrolling.
// Dragging
dragSource: null, // Selector or DOM element for catching dragging events. Default is FRAME.
mouseDragging: 0, // Enable navigation by dragging the SLIDEE with mouse cursor.
touchDragging: 0, // Enable navigation by dragging the SLIDEE with touch events.
releaseSwing: 0, // Ease out on dragging swing release.
swingSpeed: 0.2, // Swing synchronization speed, where: 1 = instant, 0 = infinite.
elasticBounds: 0, // Stretch SLIDEE position limits when dragging past FRAME boundaries.
interactive: null, // Selector for special interactive elements.
// Scrollbar
scrollBar: null, // Selector or DOM element for scrollbar container.
dragHandle: 0, // Whether the scrollbar handle should be draggable.
dynamicHandle: 0, // Scrollbar handle represents the ratio between hidden and visible content.
minHandleSize: 50, // Minimal height or width (depends on sly direction) of a handle in pixels.
clickBar: 0, // Enable navigation by clicking on scrollbar.
syncSpeed: 0.5, // Handle => SLIDEE synchronization speed, where: 1 = instant, 0 = infinite.
// Pagesbar
pagesBar: null, // Selector or DOM element for pages bar container.
activatePageOn: null, // Event used to activate page. Can be: click, mouseenter, ...
pageBuilder: // Page item generator.
function (index) {
return '' + (index + 1) + ' ';
},
// Navigation buttons
forward: null, // Selector or DOM element for "forward movement" button.
backward: null, // Selector or DOM element for "backward movement" button.
prev: null, // Selector or DOM element for "previous item" button.
next: null, // Selector or DOM element for "next item" button.
prevPage: null, // Selector or DOM element for "previous page" button.
nextPage: null, // Selector or DOM element for "next page" button.
// Automated cycling
cycleBy: null, // Enable automatic cycling by 'items' or 'pages'.
cycleInterval: 5000, // Delay between cycles in milliseconds.
pauseOnHover: 0, // Pause cycling when mouse hovers over the FRAME.
startPaused: 0, // Whether to start in paused sate.
// Mixed options
moveBy: 300, // Speed in pixels per second used by forward and backward buttons.
speed: 0, // Animations speed in milliseconds. 0 to disable animations.
easing: 'swing', // Easing for duration based (tweening) animations.
startAt: 0, // Starting offset in pixels or items.
keyboardNavBy: null, // Enable keyboard navigation by 'items' or 'pages'.
// Classes
draggedClass: 'dragged', // Class for dragged elements (like SLIDEE or scrollbar handle).
activeClass: 'active', // Class for active items and pages.
disabledClass: 'disabled' // Class for disabled navigation elements.
};
}(jQuery, window));
;jQuery(document).ready(function($){"use strict";var windowHeight=$(window).height();var windowWidth=$(window).width();$('ul li:last-child').addClass('li-last');var windowWidth=$(window).width();var tabletWidth=767;var mobileWidth=640;if($('.woocommerce-ordering select').length>0){$('.woocommerce-ordering select').selectBox({mobile:true,menuSpeed:'fast'});}
if($('.widget_layered_nav select').length>0){$('.widget_layered_nav select').selectBox({mobile:true,menuSpeed:'fast'});}
function carouselReload(){$(".bxslider").each(function(i){var widthslides=$(this).data("width-slides");var marginslides=$(this).data("margin-slides");var autoslides=$(this).data("auto-slides");var moveslides=$(this).data("move-slides");var infiniteslides=$(this).data("infinite-slides");var maxslides=$(this).data("max-slides");var minslides=$(this).data("min-slides");$(this).bxSlider({slideWidth:widthslides,minSlides:minslides,maxSlides:maxslides,slideMargin:marginslides,auto:autoslides,moveSlides:moveslides,infiniteLoop:false,hideControlOnEnd:true});$('.bx-next').html(' ')
$('.bx-prev').html(' ')});}
carouselReload();$("a.magnific").magnificPopup({type:'image'});$("#slider-product a").prettyPhoto();$("a.prettyphoto").prettyPhoto();$("a[rel^='prettyPhoto']").prettyPhoto();$(".prettyPhoto").prettyPhoto({});$(".video-popab").prettyPhoto({});$(".carousel-team .media a").prettyPhoto({});if($('#slider-product').length>0){$('#carousel').flexslider({animation:"slide",controlNav:false,animationLoop:false,slideshow:false,itemWidth:107,itemMargin:5,asNavFor:'#slider-product'});$('#slider-product').flexslider({animation:"slide",controlNav:false,animationLoop:false,slideshow:false,sync:"#carousel"});}
if($('#pix-portfolio .isotope-filter').length>0){var $container=$('.isotope-filter');$container.imagesLoaded(function(){$container.masonry();});$('#pix-portfolio .isotope-filter').isotope({itemSelector:'.isotope-item',resizesContainer:true});$('#pix-portfolio #filter a').click(function(){$('#pix-portfolio #filter a').removeClass('current');$(this).addClass('current');var selector=$(this).attr('data-filter');$('#pix-portfolio .isotope-filter').isotope({filter:selector,animationOptions:{duration:1000,easing:'easeOutQuart',queue:false}});return false;});}
$('.carousel-post').bxSlider({minSlides:1,maxSlides:1,slideWidth:850,infiniteLoop:true,auto:true,hideControlOnEnd:true,nextSelector:'#slider-next',prevSelector:'#slider-prev',nextText:' ',prevText:' '});$(window).scroll(function(e){parallax();});function parallax(){var scrolled=$(window).scrollTop();$('.bg-section').css('top',-(scrolled*0.3)+'px');}
if(windowWidthli").hover(function(){$('.dropdown-menu',this).fadeIn("fast");},function(){$('.dropdown-menu',this).fadeOut("fast");});window.prettyPrint&&prettyPrint()
$(document).on('click','.yamm .dropdown-menu',function(e){e.stopPropagation()})
if(windowWidth>1200){$(window).scroll(function(){$('.animatedEntrance').each(function(){var imagePos=$(this).offset().top;var topOfWindow=$(window).scrollTop();if(imagePos500){$(".scroll-top").addClass('scroll-top-view');}else{$(".scroll-top").removeClass('scroll-top-view');}});}
$('.scroll-top').click(function(event){event.preventDefault();$('html, body').animate({scrollTop:0},300);});if($('body').length){$(window).on('scroll',function(){var winH=$(window).scrollTop();$('.featured-item-simple-icon').waypoint(function(){$('.chart').each(function(){CharsStart();});},{offset:'80%'});});}
function CharsStart(){$('.chart').easyPieChart({barColor:false,trackColor:false,scaleColor:false,scaleLength:false,lineCap:false,lineWidth:false,size:false,animate:7000,onStep:function(from,to,percent){$(this.el).find('.percent').text(Math.round(percent));}});}
$('.ver-tabs .nav > li a').hover(function(){$(this).tab('show');});});
;/*!
* jQuery UI Widget 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/jQuery.widget/
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){var b=0,c=Array.prototype.slice;return a.cleanData=function(b){return function(c){var d,e,f;for(f=0;null!=(e=c[f]);f++)try{d=a._data(e,"events"),d&&d.remove&&a(e).triggerHandler("remove")}catch(g){}b(c)}}(a.cleanData),a.widget=function(b,c,d){var e,f,g,h,i={},j=b.split(".")[0];return b=b.split(".")[1],e=j+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e.toLowerCase()]=function(b){return!!a.data(b,e)},a[j]=a[j]||{},f=a[j][b],g=a[j][b]=function(a,b){return this._createWidget?void(arguments.length&&this._createWidget(a,b)):new g(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=new c,h.options=a.widget.extend({},h.options),a.each(d,function(b,d){return a.isFunction(d)?void(i[b]=function(){var a=function(){return c.prototype[b].apply(this,arguments)},e=function(a){return c.prototype[b].apply(this,a)};return function(){var b,c=this._super,f=this._superApply;return this._super=a,this._superApply=e,b=d.apply(this,arguments),this._super=c,this._superApply=f,b}}()):void(i[b]=d)}),g.prototype=a.widget.extend(h,{widgetEventPrefix:f?h.widgetEventPrefix||b:b},i,{constructor:g,namespace:j,widgetName:b,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){var d=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),delete f._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g),g},a.widget.extend=function(b){for(var d,e,f=c.call(arguments,1),g=0,h=f.length;g",options:{disabled:!1,create:null},_createWidget:function(c,d){d=a(d||this.defaultElement||this)[0],this.element=a(d),this.uuid=b++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=a(),this.hoverable=a(),this.focusable=a(),d!==this&&(a.data(d,this.widgetFullName,this),this._on(!0,this.element,{remove:function(a){a.target===d&&this.destroy()}}),this.document=a(d.style?d.ownerDocument:d.document||d),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this.options=a.widget.extend({},this.options,this._getCreateOptions(),c),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(b,c){var d,e,f,g=b;if(0===arguments.length)return a.widget.extend({},this.options);if("string"==typeof b)if(g={},d=b.split("."),b=d.shift(),d.length){for(e=g[b]=a.widget.extend({},this.options[b]),f=0;f