jQuery(document).ready(function($){
(function(){
var scrollWidget=$('.shop-filters-area .sidebar-widget');
scrollWidget.each(function(){
var content=$(this).find('> ul, > div, > form');
if(content.height() > 190){
$(this).addClass('nano-scroll-apply');
content.addClass('widget-content');
$(this).nanoScroller({
contentClass:'widget-content',
preventPageScrolling:true
});
}});
})();
var et_fragment_refresh={
url:myAjax.ajaxurl,
type:'POST',
data:{ action:'et_refreshed_fragments' },
success:function(data){
if(data&&data.fragments){
$.each(data.fragments, function(key, value){
$("." + key).replaceWith(value);
});
}}
};
$.ajax(et_fragment_refresh);
$(function(){
if($(window).width() < 992) return;
$('.fixed-product-block').each(function(){
var el=$(this),
parent=el.parent(),
heightOffsetEl=$('.product-images'),
parentHeight=heightOffsetEl.outerHeight();
if(parent.outerHeight() > parentHeight) return;
$(window).resize(function(){
parentHeight=heightOffsetEl.outerHeight();
el.css('max-width', parent.width());
parent.height(parentHeight);
});
$(window).resize();
$(this).stick_in_parent();
});
});
(function(){
var menu=$('.menu');
menu.each(function(){
var that=$(this);
var links=$(this).find('a');
if(!that.parent().hasClass('one-page-menu')) return;
links.click(function(e){
if($(this).attr('href').split('#')[0]==window.location.href.split('#')[0]){
e.preventDefault();
var hash=$(this).attr('href').split('#')[1];
et_change_active_item(hash);
et_scroll_to_id(hash);
}});
});
var windowHash=window.location.hash.split('#')[1];
if(window.location.hash.length > 1){
setTimeout(function(){
et_scroll_to_id(windowHash);
}, 600);
}
function et_scroll_to_id(id){
var offset=85;
var position=0;
if($('body').hasClass('full-page-on')){
offset=0;
}
if(id!='top'){
if($('#'+id).length < 1){
return;
}
position=$('#'+id).offset().top - offset;
}
if($(window).width() < 992&&menu.parent().hasClass('one-page-menu')){
$('.menu-icon').first().click()
}
$('html, body').stop().animate({
scrollTop:position
}, 1000, 'easeOutCubic', function(){
et_change_active_item(id);
});
}
function et_change_active_item(hash){
var itemId;
var menu=$('.menu');
if(!menu.parent().hasClass('one-page-menu')) return;
menu.find('.current-menu-item').removeClass('current-menu-item');
if(hash=='top'){
menu.each(function(){
$(this).find('li').first().addClass('current-menu-item');
});
return;
}
menu.find('li').each(function(){
if($(this).find('>a').attr('href')){
var thisHash=$(this).find('>a').attr('href').split('#')[1];
if(thisHash==hash){
itemId=$(this).attr('id');
}}
});
$('.'+itemId).addClass('current-menu-item');
}
$(window).scroll(function(){
if($(window).scrollTop() < 200){
et_change_active_item('top');
}});
$('.content > .wpb_row').waypoint(function(){
var id=$(this).attr('id');
et_change_active_item(id);
}, { offset:150 });
})();
(function(){
if($('body').hasClass('full-page-on')&&$(window).width() > 768){
$.scrollify({
section:'.wpb_row[id]',
before:function(i){
$('.sections-nav').find('.active-nav').removeClass('active-nav');
$('.sections-nav li').eq(i).addClass('active-nav');
}});
var sections=$('.content > .wpb_row'),
pointsHTML='';
for (var i=0; i < sections.length; i++){
pointsHTML +='<li>' + i + '</li>';
};
$('body').append('<ul class="sections-nav">' + pointsHTML + '</ul>');
$(document).on('click', '.sections-nav li', function(){
$('.sections-nav').find('.active-nav').removeClass('active-nav');
$(this).addClass('active-nav');
$.scrollify.move($(this).index());
});
}})();
$('body.disabled-right').mousedown(function(e){
if(e.button==2){
$('body').addClass('shown-credentials');
return false;
}
return true;
});
$('.credentials-html .close-credentials').click(function(){
$('body').removeClass('shown-credentials');
});
$('.full-height').etFullHeight();
$('.st-pusher').etFullHeight();
$(window).resize(function(){
$('.copyright-bottom').css({
'marginTop':-$('.copyright-bottom').height(),
'marginBottom':0
}).prev().css({
'paddingBottom':$('.copyright-bottom').height()+20
});
});
$('.cta-block.style-fullwidth').etFullWidth();
$('.title-toolip').tooltipster();
$(window).resize(function(){
var headerWrapper=$('.header-wrapper');
if(headerWrapper.hasClass('slider-overlap')){
var headerHeight=headerWrapper.height();
var revSlider=$('.page-heading-slider .wpb_revslider_element').first();
revSlider.css({
'marginTop':- headerHeight
});
}});
$('ul li:last-child').addClass('lastItem');
$('ul li:first-child').addClass('firstItem');
$(function(){
if($(window).width() < 1200) return;
var previousScroll=0,
deltaY=0,
breadcrumbs=$('.bc-type-7, .bc-type-8').find('.container'),
opacity=1,
finalOpacity=0.3,
scale=1,
finalScale=0.8,
scrollTo=300;
$(window).scroll(function(){
var currentScroll=$(this).scrollTop();
if(currentScroll > 1&&currentScroll < scrollTo){
opacity=1 -(1 - finalOpacity) *(currentScroll / scrollTo);
scale=1 -(1 - finalScale)   *(currentScroll / scrollTo);
opacity=opacity.toFixed(3);
scale=scale.toFixed(3);
breadcrumbsAnimation(breadcrumbs);
}else if(currentScroll < 10){
opacity=1;
scale=1;
breadcrumbsAnimation(breadcrumbs);
}});
var breadcrumbsAnimation=function(el){
if(deltaY >=0||$(window).scrollTop() < 1) deltaY=0;
el.css({
'transform':'scale(' + scale + ')',
'opacity':opacity
});
};});
$.fn.etMegaSearch=function(options){
var et_search=$(this);
var form=et_search.find('form');
var input=form.find('input[type="text"]');
var resultArea=et_search.find('.et-search-result');
var close=et_search.find('.et-close-results');
input.keyup(function(){
if($(this).val()==''||$(this).val().length < 3){
et_search.removeClass('loading result-exist');
return;
}
data='s='+$(this).val() + '&products=' + et_search.data('products') + '&count=' + et_search.data('count') + '&images=' + et_search.data('images') + '&posts=' + et_search.data('posts') + '&action=et_get_search_result';
et_search.addClass('loading');
resultArea.html('');
$.ajax({
url:myAjax.ajaxurl,
method:'GET',
data:data,
dataType:'JSON',
error:function(data){
console.log('AJAX error');
},
success:function(data){
if(data.results){
et_search.addClass('result-exist');
}else{
et_search.removeClass('result-exist');
}
resultArea.html(data.html);
},
complete:function(){
et_search.removeClass('loading');
}});
});
close.click(function(){
et_search.removeClass('result-exist');
});
return this;
}
$('.et-mega-search').each(function(){
$(this).etMegaSearch();
});
(function(){
if("-ms-user-select" in document.documentElement.style&&navigator.userAgent.match(/IEMobile\/10\.0/)){
var msViewportStyle=document.createElement("style");
msViewportStyle.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")
);
document.getElementsByTagName("head")[0].appendChild(msViewportStyle);
}})();
var et_popup_closed=$.cookie('etheme_popup_closed');
$('.etheme-popup').magnificPopup({
items:{
src:'#etheme-popup',
type:'inline'
},
closeOnBgClick:true,
removalDelay:300,
callbacks:{
beforeOpen:function(){
this.st.mainClass='my-mfp-slide-bottom';
},
beforeClose:function(){
if($('#showagain:checked').val()=='do-not-show')
$.cookie('etheme_popup_closed', 'do-not-show', { expires:1, path:'/' });
},
}});
if(et_popup_closed!='do-not-show'&&$('.etheme-popup').length > 0&&$('body').hasClass('open-popup')){
$('.etheme-popup').magnificPopup('open');
}
$('.popup-with-form').magnificPopup({
type:'inline',
closeBtnInside:true,
preloader:false,
midClick:true,
closeOnBgClick:true,
removalDelay:300,
focus:'#Modalsearch',
mainClass:'my-mfp-slide-bottom effect-delay2',
callbacks:{
beforeOpen:function(){
this.st.focus='#Modalsearch';
},
open:function(){
$('#s').focus();
}}
});
$('.search-dropdown').on('mouseover', function(){
$(this).find('input').focus();
}).on('touchstart click', '.popup-with-form', function(){
$('.search-dropdown').find('input').focus();
});
$('.popup-btn').magnificPopup({
type:'inline',
midClick:true
});
$('.et-gallery').each(function(){
var gal=$(this);
var time=300;
var preview=gal.find('.gallery-preview');
gal.find('a').mouseover(function(){
var newSrc=$(this).attr('href');
var index=$(this).parent().attr('data-index');
preview.attr('data-index',index);
preview.stop().animate({
'opacity':0
}, time, function(){
preview.find('img').attr('src', newSrc);
preview.stop().animate({
'opacity':1
}, time);
});
});
preview.click(function(){
var index=$(this).attr('data-index');
gal.find('dt[data-index="' + index + '"] a').click();
});
});
$("a[rel^='lightboxGall']").magnificPopup({
type:'image',
gallery:{
enabled:true
}});
$('.images-popups-gallery').each(function(){
$(this).magnificPopup({
delegate:"a[data-rel^='gallery']",
type:'image',
gallery:{
enabled:true
}});
});
$("a[rel='lightbox'], a[rel='pphoto']").magnificPopup({
type:'image',
closeBtnInside:true,
preloader:false,
midClick:true,
removalDelay:300,
callbacks:{
beforeOpen:function(){
this.st.mainClass='my-mfp-slide-bottom effect-delay2';
}}
});
$('.mobile-loader > div').fadeOut(300);
$('.mobile-loader').delay(300).fadeOut(800, function(){
$('.mobile-loader').remove();
});
$('.single-product-page .images').addClass('shown');
function animateCounter(el){
var initVal=parseInt(el.text());
var finalVal=el.data('value');
if(finalVal <=initVal) return;
var intervalTime=1;
var time=200;
var step=parseInt((finalVal - initVal)/time.toFixed());
if(step < 1){
step=1;
time=finalVal - initVal;
}
var firstAdd=(finalVal - initVal)/step - time;
var counter=parseInt((firstAdd*step).toFixed()) + initVal;
var i=0;
var interval=setInterval(function(){
i++;
counter=counter + step;
el.text(counter);
if(i==time){
clearInterval(interval);
}}, intervalTime);
}
function et_sections(){
$('.full-width-section').each(function(){
if($(this).parents('.et_section').length==0){
$(this).css({'visibility':'visible'}).wrap("<div class='et_section'><div class='container'></div></div>");
}});
$('.et_section').each(function(){
$(this).css({
'left':- ($(window).width() - $('.header > .container').width())/2,
'width':$(window).width(),
'visibility':'visible'
});
var videoTag=$(this).find('.section-back-video video');
videoTag.css({
'width':$(window).width(),
});
});
}
et_sections()
$(window).resize(function(){
et_sections();
})
$(function(){
var topPanel=$('.top-panel');
var pageWrapper=$('.page-wrapper');
var showPanel=$('.show-top-panel');
var panelHeight=topPanel.outerHeight();
showPanel.toggle(function(){
$(this).addClass('show-panel');
pageWrapper.attr('style','transform:translateY('+panelHeight+'px);-ms-transform:translateY('+panelHeight+'px);-webkit-transform:translateY('+panelHeight+'px);');
topPanel.addClass('show-panel');
},function(){
pageWrapper.attr('style','')
topPanel.removeClass('show-panel');
$(this).removeClass('show-panel');
});
});
$('.toggle-element ~ br').remove();
$('.toggle-element ~ p').remove();
$('.block-with-ico h5').next('p').remove();
$('.tab-content .row-fluid').next('p').remove();
$('.tab-content .row-fluid').prev('p').remove();
function et_update_favicon(){
var itemsCount=$('.cart-summ').data('items-count');
var enableBadge=$('.shopping-container').data('fav-badge');
var favicon=new Favico({
animation:'popFade',
fontStyle:'normal',
});
if(enableBadge=='enable'){
favicon.badge(itemsCount);
}}
et_update_favicon();
setTimeout(function(){
$('.fade-in').removeClass('fade-in');
}, 500);
function contentProdImages(){
$('.hover-effect-slider').each(function(){
var slider=$(this);
var index=0;
var autoSlide;
var imageLink=slider.find('.product-content-image');
var imagesList=imageLink.data('images');
imagesList=imagesList.split(",");
var arrowsHTML='<div class="sm-arrow arrow-left">left</div><div class="sm-arrow arrow-right">right</div>';
var counterHTML='<div class="slider-counter"><span class="current-index">1</span>/<span class="slides-count">' + imagesList.length + '</span></div>';
if(imagesList.length > 1){
slider.prepend(arrowsHTML);
slider.find('.arrow-left').click(function(event){
if(index > 0){
index--;
}else{
index=imagesList.length-1;
}
imageLink.find('img').attr('src', imagesList[index]).attr('srcset', imagesList[index]);
slider.find('.current-index').text(index + 1);
});
slider.find('.arrow-right').click(function(event){
if(index < imagesList.length - 1){
index++;
}else{
index=0;
}
imageLink.find('img').attr('src', imagesList[index]).attr('srcset', imagesList[index]);
slider.find('.current-index').text(index + 1);
});
}});
}
contentProdImages();
$('.yith-wcwl-add-button.show').each(function(){
var wishListText=$(this).find('a').text();
$(this).find('a').attr('data-hover',wishListText);
});
$.fn.et_menu=function(options){
var methods={
init:function(el){
methods.el=el;
$(window).resize(function(){
methods.setOffsets();
methods.sideMenu();
});
methods.setOffsets();
el.find('a').has('.nav-item-tooltip').hover(function(){
var newContent='';
var tooltip=$(this).find('.nav-item-tooltip');
var src=tooltip.find('>div').first().attr('data-src');
if(src.length > 10){
newContent='<img src="' + src + '" />';
tooltip.html(newContent);
}});
},
setOffsets:function(){
methods.el.find('.menu-full-width > .nav-sublist-dropdown').each(function(){
var boxed=$('body').hasClass('boxed');
var extraBoxedOffset=0;
if(boxed){
extraBoxedOffset=$('.page-wrapper').offset().left;
}
var li=$(this).parent();
var liOffset=li.offset().left - extraBoxedOffset;
var liOffsetTop=li.offset().top;
var liWidth=$(this).parent().width();
var dropdowntMarginLeft=liWidth/2;
var dropdownWidth=$(this).outerWidth();
var dropdowntLeft=liOffset - dropdownWidth/2;
var dropdownBottom=liOffsetTop - $(window).scrollTop() + $(this).outerHeight();
if(dropdowntLeft < 0){
var left=liOffset - 10;
dropdowntMarginLeft=0;
}else{
var left=dropdownWidth/2;
}
$(this).css({
'left':- left,
'marginLeft':dropdowntMarginLeft
});
var dropdownRight=($(window).width() - extraBoxedOffset*2) - (liOffset - left + dropdownWidth + dropdowntMarginLeft);
if(dropdownRight < 0){
$(this).css({
'left':'auto',
'right':- ($(window).width() - liOffset - liWidth - 10) + extraBoxedOffset*2
});
}
if(($('.header-wrapper').hasClass('header-type-vertical')||$('.header-wrapper').hasClass('header-type-vertical2'))&&dropdownBottom > $(window).height()){
$(this).css({
'top':'auto',
'bottom':- ($(window).height() - (liOffsetTop - $(window).scrollTop() + li.outerHeight())) + 15
});
}});
},
sideMenu:function(){
if($(window).height() < 800){
$('.header-wrapper').addClass('header-scrolling');
}else{
$('.header-wrapper').removeClass('header-scrolling');
}}
};
var settings=$.extend({
type:"default"
}, options);
methods.init(this);
return this;
}
$('.menu-main-container .menu').et_menu({
type:"default"
});
function et_equalize_height(elements, removeHeight){
var heights=[];
if(removeHeight){
elements.attr('style', '');
}
elements.each(function(){
heights.push($(this).height());
});
var maxHeight=Math.max.apply(Math, heights);
if($(window).width() > 767){
elements.height(maxHeight);
}}
$(window).resize(function(){
});
var scroll_timer;
var displayed=false;
var $message=jQuery('.back-top');
jQuery(window).scroll(function (){
window.clearTimeout(scroll_timer);
scroll_timer=window.setTimeout(function (){
if(jQuery(window).scrollTop() <=0){
displayed=false;
$message.addClass('bounceOut').removeClass('bounceIn');
}
else if(displayed==false){
displayed=true;
$message.stop(true, true).removeClass('bounceOut').addClass('bounceIn').click(function (){ $message.addClass('bounceOut').removeClass('bounceIn'); });
}}, 400);
});
jQuery('.back-top').click(function(e){
jQuery('html, body').animate({scrollTop:0}, 600);
return false;
});
$portfolio=$('.masonry');
$portfolio.each(function(){
var portfolioGrid=$(this);
portfolioGrid.isotope({
itemSelector:'.portfolio-item'
});
$(window).smartresize(function(){
portfolioGrid.isotope({
itemSelector:'.portfolio-item'
});
});
portfolioGrid.parent().find('.portfolio-filters a').click(function(){
var selector=$(this).attr('data-filter');
portfolioGrid.parent().find('.portfolio-filters a').removeClass('active');
if(!$(this).hasClass('active')){
$(this).addClass('active');
}
portfolioGrid.isotope({ filter:selector });
return false;
});
});
setTimeout(function(){
$('.portfolio').addClass('with-transition');
$('.portfolio-item').addClass('with-transition');
$(window).resize();
},500);
$blog=$('.blog-masonry');
$blog.isotope({
itemSelector:'.post-grid'
});
$(window).smartresize(function(){
$blog.isotope({
itemSelector:'.post-grid'
});
});
$('body').on('click', '.load-more-posts a', function(e){
e.preventDefault();
var url=$(this).attr('href');
if($(this).length>0){
et_add_blog_posts(url);
$loading=true;
}});
var $loading=false;
$(window).scroll(function(){
var $window=$(window);
var $element=$('.load-more-posts');
if($element.length>0){
var pos=$window.scrollTop();
windowHeight=$window.height();
var top=$element.offset().top;
var height=$element.height();
var viewportBottom=pos + windowHeight;
if(top + height < pos||top > viewportBottom){
return;
}
var url=$element.find('a').attr('href');
if($element.find('a').length>0){
et_add_blog_posts(url);
$loading=true;
}}
});
function et_add_blog_posts(url){
if($loading) return;
$.ajax({
url:url,
method:'GET',
timeout:10000,
dataType:'text',
beforeSend:function(){
$('.load-more-posts').addClass('loading');
},
success:function(data){
$('.blog-masonry').addClass('with-transition');
$('.post-grid').addClass('with-transition');
$('.blog-masonry').isotope('insert', $(data).find('.blog-masonry .post-grid'));
$('.load-more-posts').html($(data).find('.load-more-posts').html());
},
error:function(data){
console.log('Error loading ajax content!');
window.location.reload();
},
complete:function(){
setTimeout(function(){
$(window).resize();
},100);
setTimeout(function(){
$loading=false;
},500);
$('.load-more-posts').removeClass('loading');
}});
return;
}
$container=$('.isotope-container');
$isotope=$('.et_isotope');
$isotope.each(function(){
var isotope=$(this);
isotope.isotope({
itemSelector:'.et_isotope-item'
});
$(window).smartresize(function(){
isotope.isotope({
itemSelector:'.et_isotope-item'
});
});
setTimeout(function(){
isotope.addClass('with-transition');
isotope.find('.et_isotope-item').addClass('with-transition');;
},500);
});
$container.each(function(){
var container=$(this);
var isotope=container.find('.et_isotope');
container.find('.et_categories_filter a').data('isotope', isotope).click(function(e){
e.preventDefault();
var isotope=jQuery(this).data('isotope');
jQuery(this).parent().parent().find('.active').removeClass('active');
jQuery(this).addClass('active');
isotope.isotope({filter:jQuery(this).attr('data-filter')});
});
});
$(window).scroll(function(){
if(!$('body').hasClass('fixNav-enabled')){return false; }
var fixedHeader=$('.fixed-header-area');
var scrollTop=$(this).scrollTop();
var headerHeight=$('.header-wrapper').height() + 20;
if(scrollTop > headerHeight){
if(!fixedHeader.hasClass('fixed-already')){
fixedHeader.stop().addClass('fixed-already');
}}else{
if(fixedHeader.hasClass('fixed-already')){
fixedHeader.stop().removeClass('fixed-already');
}}
});
var modalDiv=$('#iconModal');
$('.demo-icons .demo-icon').click(function(){
var name=$(this).find('i').attr('class');
modalDiv.find('i').each(function(){
$(this).attr('class',name);
});
modalDiv.find('#myModalLabel').text(name);
modalDiv.modal();
});
$(".testimonials-slider").each(function(){
var navigation=($(this).data('navigation')==1);
var autoplay=false;
if($(this).data('interval')!=''){
autoplay=$(this).data('interval');
}
$(this).owlCarousel({
items:1,
lazyLoad:true,
autoPlay:autoplay,
navigation:navigation,
navigationText:false,
rewindNav:true,
itemsCustom:[[0, 1], [479,1], [619,1], [768,1],  [1200, 1], [1600, 1]]
});
});
$('.woocommerce-review-link').click(function(){
$('#tab_reviews').click();
});
$('.open-terms-link').click(function(){
$.magnificPopup.open({
items:{ src:'#terms-popup' },
type:'inline',
removalDelay:500,
callbacks:{
beforeOpen:function(){
this.st.mainClass='mfp-zoom-in-to-left-out';
}}
}, 0);
});
$(document.body).on('click', '.cart-popup .delete-btn, .shopping-cart .product-remove a', function(e){
e.preventDefault();
var $this=$(this);
var key=$this.data('key');
$.ajax({
method:"POST",
url:woocommerce_params.ajax_url,
data:{
'action':'et_remove_from_cart',
'key':key
},
error:function(){
console.log('removing from cart AJAX error');
},
success:function(response){
$('#cartModal').replaceWith(response.fragments.cart_modal);
$('.shopping-cart-widget').replaceWith(response.fragments.top_cart);
et_update_favicon();
$this.parent().parent().remove();
$('.success').remove();
$('table.cart').before('<p class="success">' + response.msg + '<span class="close-parent">close</span></p>');
}});
});
function listSwitcher(){
var activeClass='switcher-active';
var gridClass='products-grid';
var listClass='products-list';
jQuery('.switchToList').click(function(){
if(!jQuery.cookie('products_page')||jQuery.cookie('products_page')=='grid'){
switchToList();
}});
jQuery('.switchToGrid').click(function(){
if(!jQuery.cookie('products_page')||jQuery.cookie('products_page')=='list'){
switchToGrid();
}});
function switchToList(){
jQuery('.switchToList').addClass(activeClass);
jQuery('.switchToGrid').removeClass(activeClass);
jQuery('.main-products-loop .products-loop').fadeOut(300,function(){
jQuery(this).removeClass(gridClass).addClass(listClass).fadeIn(300);
jQuery.cookie('products_page', 'list', { expires:3, path:'/' });
});
}
function switchToGrid(){
jQuery('.switchToGrid').addClass(activeClass);
jQuery('.switchToList').removeClass(activeClass);
jQuery('.main-products-loop .products-loop').fadeOut(300,function(){
jQuery(this).removeClass(listClass).addClass(gridClass).fadeIn(300);
jQuery.cookie('products_page', 'grid', { expires:3, path:'/' });
});
}}
function check_view_mod(){
var activeClass='switcher-active';
if(jQuery.cookie('products_page')=='grid'){
jQuery('.main-products-loop .products-loop').removeClass('products-list').addClass('products-grid');
jQuery('.switchToGrid').addClass(activeClass);
}else if(jQuery.cookie('products_page')=='list'){
jQuery('.main-products-loop .products-loop').removeClass('products-grid').addClass('products-list');
jQuery('.switchToList').addClass(activeClass);
}else{
if(view_mode_default=='list_grid'||view_mode_default=='list'){
jQuery('.switchToList').addClass(activeClass);
}else{
jQuery('.switchToGrid').addClass(activeClass);
}}
}
listSwitcher();
check_view_mod();
var stepsNav=$('.checkout-steps-nav');
var steps=$('.checkout-steps');
var nextStepBtn=$('.continue-checkout');
stepsNav.find('li a').click(function(e){
e.preventDefault();
var link=$(this);
var stepId=link.data('step');
showStep(stepId);
});
nextStepBtn.click(function(e){
e.preventDefault();
var nextId=$(this).data('next');
showStep(nextId);
});
steps.find('.active').show();
var radioBtns=$('input[name="method"]');
radioBtns.change(function(){
var checkedMethod=jQuery(this).val();
checkMethod(checkedMethod);
});
checkMethod($('input[name="method"]:checked').val());
function showStep(id){
var stepsNav=$('.checkout-steps-nav');
$('.checkout-step').fadeOut(200);
stepsNav.find('li a').removeClass('active filled');
for(var i=id; i>0; i--){
$('#tostep' + i + ' a').addClass('filled');
}
$('#tostep' + id + ' a').addClass('active');
setTimeout(function(){
$('#step' + id).fadeIn(200);
}, 200);
}
function checkMethod(val){
if(val==2){
$('#tostep2').css('display','inline-block');
$('#createaccount').attr('checked', true);
$('#step1 .continue-checkout').data('next',2);
}else{
$('#tostep2').hide();
$('#createaccount').attr('checked', false);
$('#step1 .continue-checkout').data('next',3);
}}
function ajaxProductLoad(url,blockId){
$.ajax({
url:url,
method:'GET',
timeout:10000,
dataType:'text',
success:function(data){
productLoaded(data,blockId);
},
error:function(data){
alert('Error loading ajax content!');
window.location.reload();
}});
}
function productLoaded(data,blockId){
$('.woocommerce-pagination').html($(data).find('.woocommerce-pagination').html());
for(var i=0; i<blockId.length; i++){
jQuery(blockId[i]).html(jQuery(data).find(blockId[i]).html());
}
$('.content.span9').html($(data).find('.content.span9').html());
$('.widget_layered_nav_filters').html($(data).find('.widget_layered_nav_filters').html());
$('.content.span12').html($(data).find('.content.span12').html());
$('.product-grid').removeClass('loading').find('#floatingCirclesG').remove();
$('select.orderby').change(function(){
$(this).closest('form').submit();
});
check_view_mod();
listSwitcher();
contentProdImages();
}
if(ajaxFilterEnabled=='enabled'){
$('.widget_layered_nav a, .woocommerce-pagination a').live('click', function(event){
var url=$(this).attr('href');
if(url==''){
url=$(this).attr('value');
}
var blockId=[];
jQuery('.widget_layered_nav').each(function(){
blockId.push('#' + jQuery(this).attr('id'));
});
$('.product-loop .product').addClass('loading').prepend('<div id="floatingCirclesG"><div class="f_circleG" id="frotateG_01"></div><div class="f_circleG" id="frotateG_02"></div><div class="f_circleG" id="frotateG_03"></div><div class="f_circleG" id="frotateG_04"></div><div class="f_circleG" id="frotateG_05"></div><div class="f_circleG" id="frotateG_06"></div><div class="f_circleG" id="frotateG_07"></div><div class="f_circleG" id="frotateG_08"></div></div>');
ajaxProductLoad(url,blockId);
event.stopPropagation();
return false;
});
}
var modalWindow=jQuery('.etheme-simple-product').eModal();
$('.etheme-simple-product, .ajax-enabled .variations_form .single_add_to_cart_button').live('click', function(e){
e.preventDefault();
var $thisbutton=$(this);
if($thisbutton.is('.single_add_to_cart_button, .etheme-simple-product, .product_type_downloadable, .product_type_virtual')){
$('#top-cart').addClass('updating');
var form=$('form.cart');
formAction=form.attr('action');
var variation={};
form.find('select').each(function(){
var key=$(this).attr('name');
var value=$(this).val();
variation[key]=value;
});
var data={
action:'et_woocommerce_add_to_cart',
product_id:form.find('[name="add-to-cart"]').val(),
quantity:form.find('.qty').val(),
variation_id:form.find('[name="variation_id"]').val(),
variation:variation
};
et_add_to_cart(data, $thisbutton, true);
return false;
}else{
return true;
}});
if(!isIE()){
[].slice.call(document.querySelectorAll('.progress-button')).forEach(function(bttn){
if($('body').hasClass('woocommerce-wishlist')) return;
new ProgressButton(bttn, {
callback:function(instance){
var progress=0,
interval=setInterval(function(){
progress=Math.min(progress + Math.random() * 0.01, 1);
instance._setProgress(progress);
if(progress===1){
instance._stop(1);
clearInterval(interval);
}}, 5);
}});
});
}
function isIE (){
if(navigator.userAgent.indexOf('MSIE')!==-1||navigator.appVersion.indexOf('Trident/') > 0){
return true;
}
return false;
}
$(document).on('click', '.etheme_add_to_cart_button', function(){
var $thisbutton=$(this);
if($thisbutton.is('.product_type_simple, .product_type_downloadable, .product_type_virtual')&&!$('body').hasClass('woocommerce-wishlist')){
if(!$thisbutton.attr('data-product_id')) return true;
var data={
action:'et_woocommerce_add_to_cart',
product_id:$thisbutton.attr('data-product_id'),
quantity:1
};
et_add_to_cart(data, $thisbutton, false);
return false;
}else{
return true;
}});
function et_add_to_cart(data, $thisbutton, showEmodal){
if(showEmodal){
modalWindow.eModal('showModal');
}
if(isIE()){
$thisbutton.addClass('adding-to-cart');
}
$.post(woocommerce_params.ajax_url, data, function(response){
if(showEmodal){
if($('.product-thumbnails img').length > 0){
productImageSrc=$('.product-thumbnails img').first().attr('src');
}else{
productImageSrc=$('.product-images img, .images img').first().attr('src');
}
productName=$('.product-information .product-name, .product_title').first().text();
modalWindow.eModal('endLoading')
.eModal('setTitle',productName)
.eModal('addImage', productImageSrc)
.eModal('addText', successfullyAdded)
.eModal('addBtn',{
title:contBtn,
href:'javascript:void(0);',
cssClass:'btn filled',
hideOnClick:true
})
.eModal('addBtn',{
title:checkBtn,
href:checkoutUrl,
cssClass:'btn filled active'
});
}
if(! response)
return false;
var this_page=window.location.toString();
this_page=this_page.replace('add-to-cart', 'added-to-cart');
$thisbutton.parent().find('#floatingCirclesG').remove();
fragments=response.fragments;
cart_hash=response.cart_hash;
if(isIE()){
$thisbutton.removeClass('adding-to-cart');
}
setTimeout(function(){
$thisbutton.parent().parent().removeClass('loading');
$thisbutton.removeClass('added');
}, 3000)
$('#cartModal').replaceWith(fragments.cart_modal);
$('.cart_list').replaceWith($(fragments.top_cart).find('.cart_list'));
$('.shopping-container').replaceWith(fragments.top_cart);
et_update_favicon();
$('body').trigger('cart_widget_refreshed');
$('.widget_shopping_cart, .updating').stop(true).css('opacity', '1').unblock();
$('.shop_table.cart').load(this_page + ' .shop_table.cart:eq(0) > *', function(){
$('.shop_table.cart').stop(true).css('opacity', '1').unblock();
$('body').trigger('cart_page_refreshed');
});
$('.cart_totals').load(this_page + ' .cart_totals:eq(0) > *', function(){
$('.cart_totals').stop(true).css('opacity', '1').unblock();
});
$('body').trigger('added_to_cart', [ fragments, cart_hash ]);
return true;
});
}
$(document.body).on('click', '.show-quickly, .show-quickly-btn', (function(){
var $thisbutton=$(this);
var $productCont=$(this).parent().parent().parent();
var prodid=$thisbutton.data('prodid');
var magnificPopup;
$.ajax({
url:woocommerce_params.ajax_url,
method:'POST',
data:{
'action':'et_product_quick_view',
'prodid':prodid
},
dataType:'html',
beforeSend:function(){
$productCont.addClass('loading');
$productCont.append('<div id="floatingCirclesG"><div class="f_circleG" id="frotateG_01"></div><div class="f_circleG" id="frotateG_02"></div><div class="f_circleG" id="frotateG_03"></div><div class="f_circleG" id="frotateG_04"></div><div class="f_circleG" id="frotateG_05"></div><div class="f_circleG" id="frotateG_06"></div><div class="f_circleG" id="frotateG_07"></div><div class="f_circleG" id="frotateG_08"></div></div>');
},
complete:function(){
$productCont.find('#floatingCirclesG').remove();
$productCont.removeClass('loading');
},
success:function(response){
$.magnificPopup.open({
items:{ src:'<div class="quick-view-popup mfp-with-anim"><div class="doubled-border">' + response + '</div></div>' },
type:'inline',
removalDelay:300,
callbacks:{
beforeOpen:function(){
this.st.mainClass='my-mfp-slide-bottom';
}}
}, 0);
$(function(){
$('.quick-view-popup .variations_form').wc_variation_form();
$('.quick-view-popup .variations_form .variations select').change();
});
$('.quick-view-popup .images').addClass('shown');
},
error:function(){
$.magnificPopup.open({
items:{
src:'<div class="quick-view-popup mfp-with-anim"><div class="doubled-border">Error with AJAX request</div></div>'
},
type:'inline',
removalDelay:500,
callbacks:{
beforeOpen:function(){
this.st.mainClass='mfp-zoom-in-to-left-out';
}}
}, 0);
}});
}));
$('form.variations_form').on('found_variation', function(event, variation){
var $variation_form=$(this);
var $product=$(this).closest('.product');
var $product_img=$product.find('.woocommerce-main-image img:eq(0)');
var $product_link=$product.find('.woocommerce-main-image');
var $lighbox_link=$product.find('.product-lightbox-btn').first();
var o_src=$product_img.attr('data-o_src');
var o_title=$product_img.attr('data-o_title');
var o_href=$product_link.attr('data-o_href');
var variation_image=variation.image_src;
var variation_link=variation.image_link;
var variation_title=variation.image_title;
$product_link.attr('href', variation_image);
if($('.main-images').hasClass('zoom-enabled')){
if($(window).width() > 768&&variation_image.length > 5&&variation_link.length > 5){
try {
$product_link.swinxyzoom('load', variation_image,  variation_link);
} catch(e){}}
$product_link.attr('href', variation_link);
}else{
$product_link.attr('href', variation_link);
}
if(variation_image.length > 5) $('.product-thumbnails img').first().attr('src', variation_image);
if(variation_link.length > 5) $lighbox_link.attr('href', variation_link);
var owlMain=jQuery(".main-images").data('owlCarousel');
if(typeof owlMain!='undefined'){
owlMain.goTo(0);
}})
.on('reset_image', function(event){
var $product=$(this).closest('.product');
var $product_img=$product.find('.woocommerce-main-image img:eq(0)');
var $product_link=$product.find('.woocommerce-main-image');
var $lighbox_link=$product.find('.product-lightbox-btn').first();
var o_src=$product_img.attr('data-o_src');
var o_href=$product_link.attr('data-o_href');
$product_link.attr('href', o_href);
if($('.main-images').hasClass('zoom-enabled')){
if($(window).width() > 768&&typeof $product_img.attr('data-o_src')!='undefined'&&o_src.length > 5&&o_href.length > 5){
try {
$product_link.swinxyzoom('load', o_src,  o_href);
} catch(e){}}
$product_link.attr('href', o_href);
}else{
$product_link.attr('href', o_href);
}
if(o_href.length > 5) $lighbox_link.attr('href', o_href);
if(typeof o_src!='undefined'&&o_src.length > 5) $('.product-thumbnails img').first().attr('src', o_src);
var owlMain=jQuery(".main-images").data('owlCarousel');
if(typeof owlMain!='undefined'){
owlMain.goTo(0);
}});
$('.variations_form .variations select').change();
var searchBlock=$('.search.hide-input');
var searchForm=searchBlock.find('#searchform');
var searchBtn=searchForm.find('.button');
var searchInput=searchForm.find('input[type="text"]');
searchBtn.click(function(e){
e.preventDefault();
searchInput.fadeIn(200).focus();
$('body').addClass('search-input-shown');
$(document).click(function(e){
var target=e.target;
if(!$(target).is('.search.hide-input')&&!$(target).parents().is('.search.hide-input')){
searchInput.fadeOut(200);
$('body').removeClass('search-input-shown');
}});
});
var tabs=$('.tabs');
$('.tabs > p > a').unwrap('p');
var leftTabs=$('.left-bar, .right-bar');
var newTitles;
leftTabs.each(function(){
var currTab=$(this);
newTitles=currTab.find('> a.tab-title').clone().removeClass('tab-title').addClass('tab-title-left');
newTitles.first().addClass('opened');
var tabNewTitles=$('<div class="left-titles"></div>').prependTo(currTab);
tabNewTitles.html(newTitles);
currTab.find('.tab-content').css({
'minHeight':tabNewTitles.height()
});
});
tabs.each(function(){
var currTab=$(this);
var openNumber=parseInt(currTab.attr('data-active'));
if(currTab.attr('data-active')=='false'){
}else if(!isNaN(openNumber)){
openNumber--;
currTab.find('.tab-title:eq('+openNumber+')').addClass('opened').next().show();
}else{
currTab.find('.tab-title').first().addClass('opened').next().show();
}
currTab.find('.tab-title, .tab-title-left').click(function(e){
e.preventDefault();
var tabId=$(this).attr('id');
var time=250;
if($(this).hasClass('opened')){
if(currTab.hasClass('accordion')||($(window).width() < 992&&!currTab.hasClass('products-tabs'))){
$(this).removeClass('opened');
$('#content_'+tabId).slideUp(time);
}}else{
currTab.find('.tab-title, .tab-title-left').each(function(){
var tabId=$(this).attr('id');
$(this).removeClass('opened');
if(currTab.hasClass('accordion')||($(window).width() < 992&&!currTab.hasClass('products-tabs'))){
$('#content_'+tabId).slideUp(time);
}else{
$('#content_'+tabId).hide();
}});
if(currTab.hasClass('accordion')||($(window).width() < 992&&!currTab.hasClass('products-tabs'))){
$('html, body').animate({
scrollTop:currTab.offset().top - 50
}, 800);
setTimeout(function(){
$('#content_'+tabId).addClass('tab-content').slideDown(time);
},1);
}else{
$('#content_'+tabId).show();
}
$(this).addClass('opened');
}});
});
jQuery.fn.etAccordionMenu=function(options){
var $this=jQuery(this);
var plusIcon='+';
var minusIcon='&ndash;';
var etCats=$('.product-categories');
$this.addClass('with-accordion')
var openerHTML='<div class="open-this">'+plusIcon+'</div>';
$this.find('li').has('.children, .nav-sublist-dropdown').has('li').addClass('parent-level0').prepend(openerHTML);
if($this.find('.current-cat.parent-level0, .current-cat, .current-cat-parent').length > 0){
$this.find('.current-cat.parent-level0, .current-cat-parent').find('.open-this').html(minusIcon).parent().addClass('opened').find('ul.children').show();
}else{
$this.find('>li').first().find('.open-this').html(minusIcon).parent().addClass('opened').find('ul.children').show();
}
$this.find('.open-this').click(function(){
if($(this).parent().hasClass('opened')){
$(this).html(plusIcon).parent().removeClass('opened').find('> ul, > div.nav-sublist-dropdown').slideUp(200);
}else{
$(this).html(minusIcon).parent().addClass('opened').find('> ul, > div.nav-sublist-dropdown').slideDown(200);
}});
return this;
}
if(catsAccordion){
$('.product-categories').etAccordionMenu();
}
var etoggle=$('.toggle-block'),
etoggleEl=etoggle.find('.toggle-element'),
etoggleTitle=etoggleEl.find('.toggle-title'),
plusIcon='+',
minusIcon='&ndash;';
etoggleTitle.click(function(e){
e.preventDefault();
if($(this).hasClass('opened')){
$(this).removeClass('opened').find('.open-this').html(plusIcon).parent().parent().find('.toggle-content').slideUp(200);
}else{
if($(this).parent().hasClass('noMultiple')){
$(this).parent().find('.toggle-element').removeClass('opened').find('.open-this').html(plusIcon).parent().parent().find('.toggle-content').slideUp(200);
}
$(this).addClass('opened').find('.open-this').html(minusIcon).parent().parent().find('.toggle-content').slideDown(200);
}});
var navList=$('.mobile-nav .menu');
var etOpener='<span class="open-child">(open)</span>';
navList.addClass('et-mobile-menu');
navList.find('li:has(ul)',this).each(function(){
$(this).prepend(etOpener);
});
navList.find('.open-child').click(function(){
if($(this).parent().hasClass('over')){
$(this).parent().removeClass('over').find('> ul').slideUp(200);
}else{
$(this).parent().parent().find('> li.over').removeClass('over').find('> ul').slideUp(200);
$(this).parent().addClass('over').find('> ul').slideDown(200);
}});
navList.on('click', 'li > a', function(e){
if($(this).attr('href')=='#'){
e.preventDefault();
$(this).parent().find('> .open-child').click();
}});
function mobilecheck(){
var check=false;
(function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s)|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(|\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(|\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg(g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v)|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v)|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|)|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check=true})(navigator.userAgent||navigator.vendor||window.opera);
return check;
}
var eventtype=mobilecheck() ? 'touchstart':'click';
var container=document.getElementById('st-container');
var bodyClickFn=function(evt){
if(!hasParentClass(evt.target, 'st-menu')&&!hasParentClass(evt.target, 'rev_slider_wrapper')){
resetMenu();
document.removeEventListener(eventtype, bodyClickFn);
}}
$('.menu-icon, #st-trigger-effects button').bind('click', function(){
var effect=$(this).attr('data-effect');
if($('html').hasClass('st-menu-open')){
$('html').removeClass('st-menu-open');
}else{
classie.add(container, effect);
$('#st-container').addClass(effect);
$('html').addClass('st-menu-open');
setTimeout(function(){
document.addEventListener(eventtype, bodyClickFn);
}, 20);
}});
$('.close-mobile-nav').click(function(){
resetMenu();
document.removeEventListener(eventtype, bodyClickFn);
});
function resetMenu(){
$('html').removeClass('st-menu-open');
$('#st-container').removeClass('mobile-menu-block hide-filters-block');
}
function hasParentClass(e, classname){
if(e===document) return false;
if(classie.has(e, classname)){
return true;
}
return e.parentNode&&hasParentClass(e.parentNode, classname);
}
function closeParentBtn(){
var closeParentBtn=jQuery('.close-parent');
closeParentBtn.click(function(e){
closeParent(this);
});
function closeParent(el){
jQuery(el).parent().slideUp(100);
}}
closeParentBtn();
var eForm=$('#contact-form');
var spinner=jQuery('.spinner');
$('.required-field').focus(function(){
$(this).removeClass('validation-failed');
});
eForm.find('#submit').click(function(e){
e.preventDefault();
$('#contactsMsgs').html('');
spinner.show();
var errmsg;
errmsg='';
eForm.find('.required-field').each(function(){
if($(this).val()==''){
$(this).addClass('validation-failed');
}});
if(errmsg){
$('#contactsMsgs').html('<p class="error">' + errmsg + '</p>');
spinner.hide();
}else{
url=eForm.attr('action');
data=eForm.serialize();
data +='&action=et_send_msg_action';
$.ajax({
url:myAjax.ajaxurl,
method:'GET',
data:data,
error:function(data){
$('#contactsMsgs').html('<p class="error">Error while ajax request<span class="close-parent"></span></p>');
spinner.hide();
},
success:function(data){
if(data.status=='success'){
$('#contactsMsgs').html('<p class="success">' + data.msg + '<span class="close-parent"></span></p>');
eForm.find("input[type=text], textarea").val("");
}else{
$('#contactsMsgs').html('<p class="error">' + data.msg + '<span class="close-parent"></span></p>');
}
spinner.hide();
closeParentBtn();
}});
}});
var ethemeCommentForm=$('#commentform');
ethemeCommentForm.find('#submit').click(function(e){
$('#commentsMsgs').html('');
ethemeCommentForm.find('.required-field').each(function(){
if($(this).val()==''){
$(this).addClass('validation-failed');
e.preventDefault();
}});
});
var counters=$('.animated-counter');
counters.each(function(){
$(this).waypoint(function(){
animateCounter($(this));
}, { offset:'100%' });
});
var progressBars=$('.progress-bars');
progressBars.waypoint(function(){
i=0;
$(this).find('.progress-bar').each(function (){
i++;
var el=$(this);
var width=$(this).data('width');
setTimeout(function(){
el.find('div').animate({
'width':width + '%'
},400);
el.find('span').css({
'opacity':1
});
},i*300, "easeOutCirc");
});
}, { offset:'85%' });
function componentToHex(c){
var hex=c.toString(16);
return hex.length==1 ? "0" + hex:hex;
}
function rgbToHex(r, g, b){
return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
}
function hexToRgb(hex){
var result=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r:parseInt(result[1], 16),
g:parseInt(result[2], 16),
b:parseInt(result[3], 16)
}:null;
}
$('#scene').parallax();
$("#jquery_jplayer_1").jPlayer({
ready:function (){
$(this).jPlayer("setMedia", {
title:"Bubble",
mp3:"wp-content/themes/royal/images/assets/Halloween-March.mp3",
}).jPlayer("play");
},
swfPath:"/js",
supplied:"mp3"
});
$('.open-popup-link').magnificPopup({
type:'inline',
midClick:true
});
$('.prettySocial').prettySocial();
});
!function(r){var o=this.SelectBox=function(e,t){if(e instanceof jQuery){if(!(0<e.length))return;e=e[0]}return this.typeTimer=null,this.typeSearch="",this.isMac=navigator.platform.match(/mac/i),t="object"==typeof t?t:{},this.selectElement=e,!(!t.mobile&&navigator.userAgent.match(/iPad|iPhone|Android|IEMobile|BlackBerry/i))&&"select"===e.tagName.toLowerCase()&&void this.init(t)};o.prototype.version="1.2.0",o.prototype.init=function(t){var e=r(this.selectElement);if(e.data("selectBox-control"))return!1;var s,o=r('<a class="selectBox" />'),a=e.attr("multiple")||1<parseInt(e.attr("size")),n=t||{},l=parseInt(e.prop("tabindex"))||0,i=this;o.width(e.outerWidth()).addClass(e.attr("class")).attr("title",e.attr("title")||"").attr("tabindex",l).css("display","inline-block").bind("focus.selectBox",function(){this!==document.activeElement&&document.body!==document.activeElement&&r(document.activeElement).blur(),o.hasClass("selectBox-active")||(o.addClass("selectBox-active"),e.trigger("focus"))}).bind("blur.selectBox",function(){o.hasClass("selectBox-active")&&(o.removeClass("selectBox-active"),e.trigger("blur"))}),r(window).data("selectBox-bindings")||r(window).data("selectBox-bindings",!0).bind("scroll.selectBox",this.hideMenus).bind("resize.selectBox",this.hideMenus),e.attr("disabled")&&o.addClass("selectBox-disabled"),e.bind("click.selectBox",function(e){o.focus(),e.preventDefault()}),a?(t=this.getOptions("inline"),o.append(t).data("selectBox-options",t).addClass("selectBox-inline selectBox-menuShowing").bind("keydown.selectBox",function(e){i.handleKeyDown(e)}).bind("keypress.selectBox",function(e){i.handleKeyPress(e)}).bind("mousedown.selectBox",function(e){1!==e.which||(r(e.target).is("A.selectBox-inline")&&e.preventDefault(),o.hasClass("selectBox-focus"))||o.focus()}).insertAfter(e),e[0].style.height||(l=e.attr("size")?parseInt(e.attr("size")):5,(a=o.clone().removeAttr("id").css({position:"absolute",top:"-9999em"}).show().appendTo("body")).find(".selectBox-options").html("<li><a> </a></li>"),s=parseInt(a.find(".selectBox-options A:first").html("&nbsp;").outerHeight()),a.remove(),o.height(s*l))):(a=r('<span class="selectBox-label" />'),s=r('<span class="selectBox-arrow" />'),a.attr("class",this.getLabelClass()).text(this.getLabelText()),(t=this.getOptions("dropdown")).appendTo("BODY"),o.data("selectBox-options",t).addClass("selectBox-dropdown").append(a).append(s).bind("mousedown.selectBox",function(e){1===e.which&&(o.hasClass("selectBox-menuShowing")?i.hideMenus():(e.stopPropagation(),t.data("selectBox-down-at-x",e.screenX).data("selectBox-down-at-y",e.screenY),i.showMenu()))}).bind("keydown.selectBox",function(e){i.handleKeyDown(e)}).bind("keypress.selectBox",function(e){i.handleKeyPress(e)}).bind("open.selectBox",function(e,t){t&&!0===t._selectBox||i.showMenu()}).bind("close.selectBox",function(e,t){t&&!0===t._selectBox||i.hideMenus()}).insertAfter(e),l=o.width()-s.outerWidth()-parseInt(a.css("paddingLeft"))||0-parseInt(a.css("paddingRight"))||0,a.width(l)),this.disableSelection(o),e.addClass("selectBox").data("selectBox-control",o).data("selectBox-settings",n).hide()},o.prototype.getOptions=function(e){var t,s=r(this.selectElement),o=this,a=function(e,t){return e.children("OPTION, OPTGROUP").each(function(){var e;r(this).is("OPTION")?0<r(this).length?o.generateOptions(r(this),t):t.append("<li> </li>"):((e=r('<li class="selectBox-optgroup" />')).text(r(this).attr("label")),t.append(e),t=a(r(this),t))}),t};switch(e){case"inline":return t=r('<ul class="selectBox-options" />'),(t=a(s,t)).find("A").bind("mouseover.selectBox",function(e){o.addHover(r(this).parent())}).bind("mouseout.selectBox",function(e){o.removeHover(r(this).parent())}).bind("mousedown.selectBox",function(e){1!==e.which||(e.preventDefault(),s.selectBox("control").hasClass("selectBox-active"))||s.selectBox("control").focus()}).bind("mouseup.selectBox",function(e){1===e.which&&(o.hideMenus(),o.selectOption(r(this).parent(),e))}),this.disableSelection(t),t;case"dropdown":t=r('<ul class="selectBox-dropdown-menu selectBox-options" />'),(t=a(s,t)).data("selectBox-select",s).css("display","none").appendTo("BODY").find("A").bind("mousedown.selectBox",function(e){1===e.which&&(e.preventDefault(),e.screenX===t.data("selectBox-down-at-x"))&&e.screenY===t.data("selectBox-down-at-y")&&(t.removeData("selectBox-down-at-x").removeData("selectBox-down-at-y"),o.hideMenus())}).bind("mouseup.selectBox",function(e){1!==e.which||e.screenX===t.data("selectBox-down-at-x")&&e.screenY===t.data("selectBox-down-at-y")||(t.removeData("selectBox-down-at-x").removeData("selectBox-down-at-y"),o.selectOption(r(this).parent()),o.hideMenus())}).bind("mouseover.selectBox",function(e){o.addHover(r(this).parent())}).bind("mouseout.selectBox",function(e){o.removeHover(r(this).parent())});var n=s.attr("class")||"";if(""!==n)for(var l in n=n.split(" "))t.addClass(n[l]+"-selectBox-dropdown-menu");return this.disableSelection(t),t}},o.prototype.getLabelClass=function(){return("selectBox-label "+(r(this.selectElement).find("OPTION:selected").attr("class")||"")).replace(/\s+$/,"")},o.prototype.getLabelText=function(){return r(this.selectElement).find("OPTION:selected").text()||" "},o.prototype.setLabel=function(){var e=r(this.selectElement).data("selectBox-control");e&&e.find(".selectBox-label").attr("class",this.getLabelClass()).text(this.getLabelText())},o.prototype.destroy=function(){var e=r(this.selectElement),t=e.data("selectBox-control");t&&(t.data("selectBox-options").remove(),t.remove(),e.removeClass("selectBox").removeData("selectBox-control").data("selectBox-control",null).removeData("selectBox-settings").data("selectBox-settings",null).show())},o.prototype.refresh=function(){var e=r(this.selectElement),t=e.data("selectBox-control"),s=t.hasClass("selectBox-dropdown"),t=t.hasClass("selectBox-menuShowing");e.selectBox("options",e.html()),s&&t&&this.showMenu()},o.prototype.showMenu=function(){var t=this,e=r(this.selectElement),s=e.data("selectBox-control"),o=e.data("selectBox-settings"),a=s.data("selectBox-options");if(s.hasClass("selectBox-disabled"))return!1;this.hideMenus();var n=parseInt(s.css("borderBottomWidth"))||0;if(a.width(s.innerWidth()).css({top:s.offset().top+s.outerHeight()-n,left:s.offset().left}),e.triggerHandler("beforeopen"))return!1;var l=function(){e.triggerHandler("open",{_selectBox:!0})};switch(o.menuTransition){case"fade":a.fadeIn(o.menuSpeed,l);break;case"slide":a.slideDown(o.menuSpeed,l);break;default:a.show(o.menuSpeed,l)}o.menuSpeed||l();n=a.find(".selectBox-selected:first");this.keepOptionInView(n,!0),this.addHover(n),s.addClass("selectBox-menuShowing"),r(document).bind("mousedown.selectBox",function(e){1!==e.which||r(e.target).parents().andSelf().hasClass("selectBox-options")||t.hideMenus()})},o.prototype.hideMenus=function(){0!==r(".selectBox-dropdown-menu:visible").length&&(r(document).unbind("mousedown.selectBox"),r(".selectBox-dropdown-menu").each(function(){var e=r(this),t=e.data("selectBox-select"),s=t.data("selectBox-control"),o=t.data("selectBox-settings");if(t.triggerHandler("beforeclose"))return!1;var a=function(){t.triggerHandler("close",{_selectBox:!0})};if(o){switch(o.menuTransition){case"fade":e.fadeOut(o.menuSpeed,a);break;case"slide":e.slideUp(o.menuSpeed,a);break;default:e.hide(o.menuSpeed,a)}o.menuSpeed||a(),s.removeClass("selectBox-menuShowing")}else r(this).hide(),r(this).triggerHandler("close",{_selectBox:!0}),r(this).removeClass("selectBox-menuShowing")}))},o.prototype.selectOption=function(e,t){var s,o=r(this.selectElement),a=(e=r(e),o.data("selectBox-control"));o.data("selectBox-settings");if(a.hasClass("selectBox-disabled"))return!1;if(0===e.length||e.hasClass("selectBox-disabled"))return!1;o.attr("multiple")?t.shiftKey&&a.data("selectBox-last-selected")?(e.toggleClass("selectBox-selected"),s=(s=e.index()>a.data("selectBox-last-selected").index()?e.siblings().slice(a.data("selectBox-last-selected").index(),e.index()):e.siblings().slice(e.index(),a.data("selectBox-last-selected").index())).not(".selectBox-optgroup, .selectBox-disabled"),e.hasClass("selectBox-selected")?s.addClass("selectBox-selected"):s.removeClass("selectBox-selected")):this.isMac&&t.metaKey||!this.isMac&&t.ctrlKey?e.toggleClass("selectBox-selected"):(e.siblings().removeClass("selectBox-selected"),e.addClass("selectBox-selected")):(e.siblings().removeClass("selectBox-selected"),e.addClass("selectBox-selected")),a.hasClass("selectBox-dropdown")&&a.find(".selectBox-label").text(e.text());var n=0,l=[];return o.attr("multiple")?a.find(".selectBox-selected A").each(function(){l[n++]=r(this).attr("rel")}):l=e.find("A").attr("rel"),a.data("selectBox-last-selected",e),o.val()!==l&&(o.val(l),this.setLabel(),o.trigger("change")),!0},o.prototype.addHover=function(e){e=r(e),r(this.selectElement).data("selectBox-control").data("selectBox-options").find(".selectBox-hover").removeClass("selectBox-hover"),e.addClass("selectBox-hover")},o.prototype.getSelectElement=function(){return this.selectElement},o.prototype.removeHover=function(e){e=r(e),r(this.selectElement).data("selectBox-control").data("selectBox-options").find(".selectBox-hover").removeClass("selectBox-hover")},o.prototype.keepOptionInView=function(e,t){var s,o,a;e&&0!==e.length&&(o=(s=r(this.selectElement).data("selectBox-control")).data("selectBox-options"),s=s.hasClass("selectBox-dropdown")?o:o.parent(),o=parseInt(e.offset().top-s.position().top),a=parseInt(o+e.outerHeight()),t?s.scrollTop(e.offset().top-s.offset().top+s.scrollTop()-s.height()/2):(o<0&&s.scrollTop(e.offset().top-s.offset().top+s.scrollTop()),a>s.height()&&s.scrollTop(e.offset().top+e.outerHeight()-s.offset().top+s.scrollTop()-s.height())))},o.prototype.handleKeyDown=function(e){var t=r(this.selectElement),s=t.data("selectBox-control"),o=s.data("selectBox-options"),a=t.data("selectBox-settings"),n=0,l=0;if(!s.hasClass("selectBox-disabled"))switch(e.keyCode){case 8:e.preventDefault(),this.typeSearch="";break;case 9:case 27:this.hideMenus(),this.removeHover();break;case 13:s.hasClass("selectBox-menuShowing")?(this.selectOption(o.find("LI.selectBox-hover:first"),e),s.hasClass("selectBox-dropdown")&&this.hideMenus()):this.showMenu();break;case 38:case 37:if(e.preventDefault(),s.hasClass("selectBox-menuShowing")){for(var i=o.find(".selectBox-hover").prev("LI"),n=o.find("LI:not(.selectBox-optgroup)").length,l=0;(0===i.length||i.hasClass("selectBox-disabled")||i.hasClass("selectBox-optgroup"))&&(0===(i=i.prev("LI")).length&&(i=a.loopOptions?o.find("LI:last"):o.find("LI:first")),!(++l>=n)););this.addHover(i),this.selectOption(i,e),this.keepOptionInView(i)}else this.showMenu();break;case 40:case 39:if(e.preventDefault(),s.hasClass("selectBox-menuShowing")){var c=o.find(".selectBox-hover").next("LI");for(n=o.find("LI:not(.selectBox-optgroup)").length,l=0;(0===c.length||c.hasClass("selectBox-disabled")||c.hasClass("selectBox-optgroup"))&&(0===(c=c.next("LI")).length&&(c=a.loopOptions?o.find("LI:first"):o.find("LI:last")),!(++l>=n)););this.addHover(c),this.selectOption(c,e),this.keepOptionInView(c)}else this.showMenu()}},o.prototype.handleKeyPress=function(e){var t=r(this.selectElement).data("selectBox-control"),s=t.data("selectBox-options");if(!t.hasClass("selectBox-disabled"))switch(e.keyCode){case 9:case 27:case 13:case 38:case 37:case 40:case 39:break;default:t.hasClass("selectBox-menuShowing")||this.showMenu(),e.preventDefault(),clearTimeout(this.typeTimer),this.typeSearch+=String.fromCharCode(e.charCode||e.keyCode),s.find("A").each(function(){if(r(this).text().substr(0,this.typeSearch.length).toLowerCase()===this.typeSearch.toLowerCase())return this.addHover(r(this).parent()),this.selectOption(r(this).parent(),e),this.keepOptionInView(r(this).parent()),!1}),this.typeTimer=setTimeout(function(){this.typeSearch=""},1e3)}},o.prototype.enable=function(){var e=r(this.selectElement),e=(e.prop("disabled",!1),e.data("selectBox-control"));e&&e.removeClass("selectBox-disabled")},o.prototype.disable=function(){var e=r(this.selectElement),e=(e.prop("disabled",!0),e.data("selectBox-control"));e&&e.addClass("selectBox-disabled")},o.prototype.setValue=function(t){var e,s=r(this.selectElement),o=(s.val(t),null===(t=s.val())&&(t=s.children().first().val(),s.val(t)),s.data("selectBox-control"));o&&(e=s.data("selectBox-settings"),o=o.data("selectBox-options"),this.setLabel(),o.find(".selectBox-selected").removeClass("selectBox-selected"),o.find("A").each(function(){if("object"==typeof t)for(var e=0;e<t.length;e++)r(this).attr("rel")==t[e]&&r(this).parent().addClass("selectBox-selected");else r(this).attr("rel")==t&&r(this).parent().addClass("selectBox-selected")}),e.change)&&e.change.call(s)},o.prototype.setOptions=function(e){var t,s=r(this.selectElement),o=s.data("selectBox-control");s.data("selectBox-settings");switch(typeof e){case"string":s.html(e);break;case"object":for(var a in s.html(""),e)if(null!==e[a])if("object"==typeof e[a]){var n,l=r('<optgroup label="'+a+'" />');for(n in e[a])l.append('<option value="'+n+'">'+e[a][n]+"</option>");s.append(l)}else{var i=r('<option value="'+a+'">'+e[a]+"</option>");s.append(i)}}if(o)switch(o.data("selectBox-options").remove(),t=o.hasClass("selectBox-dropdown")?"dropdown":"inline",e=this.getOptions(t),o.data("selectBox-options",e),t){case"inline":o.append(e);break;case"dropdown":this.setLabel(),r("BODY").append(e)}},o.prototype.disableSelection=function(e){r(e).css("MozUserSelect","none").bind("selectstart",function(e){e.preventDefault()})},o.prototype.generateOptions=function(e,t){var s=r("<li />"),o=r("<a />");s.addClass(e.attr("class")),s.data(e.data()),o.attr("rel",e.val()).text(e.text()),s.append(o),e.attr("disabled")&&s.addClass("selectBox-disabled"),e.attr("selected")&&s.addClass("selectBox-selected"),t.append(s)},r.extend(r.fn,{selectBox:function(s,e){var t;switch(s){case"control":return r(this).data("selectBox-control");case"settings":if(!e)return r(this).data("selectBox-settings");r(this).each(function(){r(this).data("selectBox-settings",r.extend(!0,r(this).data("selectBox-settings"),e))});break;case"options":if(undefined===e)return r(this).data("selectBox-control").data("selectBox-options");r(this).each(function(){(t=r(this).data("selectBox"))&&t.setOptions(e)});break;case"value":if(undefined===e)return r(this).val();r(this).each(function(){(t=r(this).data("selectBox"))&&t.setValue(e)});break;case"refresh":r(this).each(function(){(t=r(this).data("selectBox"))&&t.refresh()});break;case"enable":r(this).each(function(){(t=r(this).data("selectBox"))&&t.enable(this)});break;case"disable":r(this).each(function(){(t=r(this).data("selectBox"))&&t.disable()});break;case"destroy":r(this).each(function(){(t=r(this).data("selectBox"))&&(t.destroy(),r(this).data("selectBox",null))});break;case"instance":return r(this).data("selectBox");default:r(this).each(function(e,t){r(t).data("selectBox")||r(t).data("selectBox",new o(t,s))})}return r(this)}})}(jQuery);
!function(t){function e(){var t=location.href;return hashtag=-1!==t.indexOf("#prettyPhoto")&&decodeURI(t.substring(t.indexOf("#prettyPhoto")+1,t.length)),hashtag&&(hashtag=hashtag.replace(/<|>/g,"")),hashtag}function i(t,e){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null==i?"":i[1]}t.prettyPhoto={version:"3.1.6"},t.fn.prettyPhoto=function(o){o=jQuery.extend({hook:"rel",animation_speed:"fast",ajaxcallback:function(){},slideshow:5e3,autoplay_slideshow:!1,opacity:.8,show_title:!0,allow_resize:!0,allow_expand:!0,default_width:500,default_height:344,counter_separator_label:"/",theme:"pp_default",horizontal_padding:20,hideflash:!1,wmode:"opaque",autoplay:!0,modal:!1,deeplinking:!0,overlay_gallery:!0,overlay_gallery_max:30,keyboard_shortcuts:!0,changepicturecallback:function(){},callback:function(){},ie6_fallback:!0,markup:'<div class="pp_pic_holder"> \t\t\t\t\t\t<div class="ppt">&nbsp;</div> \t\t\t\t\t\t<div class="pp_top"> \t\t\t\t\t\t\t<div class="pp_left"></div> \t\t\t\t\t\t\t<div class="pp_middle"></div> \t\t\t\t\t\t\t<div class="pp_right"></div> \t\t\t\t\t\t</div> \t\t\t\t\t\t<div class="pp_content_container"> \t\t\t\t\t\t\t<div class="pp_left"> \t\t\t\t\t\t\t<div class="pp_right"> \t\t\t\t\t\t\t\t<div class="pp_content"> \t\t\t\t\t\t\t\t\t<div class="pp_loaderIcon"></div> \t\t\t\t\t\t\t\t\t<div class="pp_fade"> \t\t\t\t\t\t\t\t\t\t<a href="#" class="pp_expand" title="Expand the image">Expand</a> \t\t\t\t\t\t\t\t\t\t<div class="pp_hoverContainer"> \t\t\t\t\t\t\t\t\t\t\t<a class="pp_next" href="#">next</a> \t\t\t\t\t\t\t\t\t\t\t<a class="pp_previous" href="#">previous</a> \t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t<div id="pp_full_res"></div> \t\t\t\t\t\t\t\t\t\t<div class="pp_details"> \t\t\t\t\t\t\t\t\t\t\t<div class="pp_nav"> \t\t\t\t\t\t\t\t\t\t\t\t<a href="#" class="pp_arrow_previous">Previous</a> \t\t\t\t\t\t\t\t\t\t\t\t<p class="currentTextHolder">0/0</p> \t\t\t\t\t\t\t\t\t\t\t\t<a href="#" class="pp_arrow_next">Next</a> \t\t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t\t\t<p class="pp_description"></p> \t\t\t\t\t\t\t\t\t\t\t<div class="pp_social">{pp_social}</div> \t\t\t\t\t\t\t\t\t\t\t<a class="pp_close" href="#">Close</a> \t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t</div> \t\t\t\t\t\t</div> \t\t\t\t\t\t<div class="pp_bottom"> \t\t\t\t\t\t\t<div class="pp_left"></div> \t\t\t\t\t\t\t<div class="pp_middle"></div> \t\t\t\t\t\t\t<div class="pp_right"></div> \t\t\t\t\t\t</div> \t\t\t\t\t</div> \t\t\t\t\t<div class="pp_overlay"></div>',gallery_markup:'<div class="pp_gallery"> \t\t\t\t\t\t\t\t<a href="#" class="pp_arrow_previous">Previous</a> \t\t\t\t\t\t\t\t<div> \t\t\t\t\t\t\t\t\t<ul> \t\t\t\t\t\t\t\t\t\t{gallery} \t\t\t\t\t\t\t\t\t</ul> \t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t<a href="#" class="pp_arrow_next">Next</a> \t\t\t\t\t\t\t</div>',image_markup:'<img id="fullResImage" src="{path}" />',flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="https://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="https://www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline">{content}</div>',custom_markup:"",social_tools:'<div class="twitter"><a href="//twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"><\/script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>'},o);var p,a,s,n,l,r,d,h=this,c=!1,_=t(window).height(),g=t(window).width();function m(){t(".pp_loaderIcon").hide(),projectedTop=scroll_pos.scrollTop+(_/2-p.containerHeight/2),projectedTop<0&&(projectedTop=0),$ppt.fadeTo(settings.animation_speed,1),$pp_pic_holder.find(".pp_content").animate({height:p.contentHeight,width:p.contentWidth},settings.animation_speed),$pp_pic_holder.animate({top:projectedTop,left:g/2-p.containerWidth/2<0?0:g/2-p.containerWidth/2,width:p.containerWidth},settings.animation_speed,function(){$pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(p.height).width(p.width),$pp_pic_holder.find(".pp_fade").fadeIn(settings.animation_speed),isSet&&"image"==y(pp_images[set_position])?$pp_pic_holder.find(".pp_hoverContainer").show():$pp_pic_holder.find(".pp_hoverContainer").hide(),settings.allow_expand&&(p.resized?t("a.pp_expand,a.pp_contract").show():t("a.pp_expand").hide()),!settings.autoplay_slideshow||d||a||t.prettyPhoto.startSlideshow(),settings.changepicturecallback(),a=!0}),isSet&&settings.overlay_gallery&&"image"==y(pp_images[set_position])?(itemWidth=57,navWidth="facebook"==settings.theme||"pp_default"==settings.theme?50:30,itemsPerPage=Math.floor((p.containerWidth-100-navWidth)/itemWidth),itemsPerPage=itemsPerPage<pp_images.length?itemsPerPage:pp_images.length,totalPage=Math.ceil(pp_images.length/itemsPerPage)-1,0==totalPage?(navWidth=0,$pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").hide()):$pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").show(),galleryWidth=itemsPerPage*itemWidth,fullGalleryWidth=pp_images.length*itemWidth,$pp_gallery.css("margin-left",-(galleryWidth/2+navWidth/2)).find("div:first").width(galleryWidth+5).find("ul").width(fullGalleryWidth).find("li.selected").removeClass("selected"),goToPage=Math.floor(set_position/itemsPerPage)<totalPage?Math.floor(set_position/itemsPerPage):totalPage,t.prettyPhoto.changeGalleryPage(goToPage),$pp_gallery_li.filter(":eq("+set_position+")").addClass("selected")):$pp_pic_holder.find(".pp_content").off("mouseenter mouseleave"),o.ajaxcallback()}function f(e){$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(){t(".pp_loaderIcon").show(),e()})}function u(t,e){if(resized=!1,v(t,e),imageWidth=t,imageHeight=e,(r>g||l>_)&&doresize&&settings.allow_resize&&!c){for(resized=!0,fitting=!1;!fitting;)r>g?(imageWidth=g-200,imageHeight=e/t*imageWidth):l>_?(imageHeight=_-200,imageWidth=t/e*imageHeight):fitting=!0,l=imageHeight,r=imageWidth;(r>g||l>_)&&u(r,l),v(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(l),containerWidth:Math.floor(r)+2*settings.horizontal_padding,contentHeight:Math.floor(s),contentWidth:Math.floor(n),resized:resized}}function v(e,i){e=parseFloat(e),i=parseFloat(i),$pp_details=$pp_pic_holder.find(".pp_details"),$pp_details.width(e),detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom")),$pp_details=$pp_details.clone().addClass(settings.theme).width(e).appendTo(t("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(e),titleHeight=parseFloat($pp_title.css("marginTop"))+parseFloat($pp_title.css("marginBottom")),$pp_title=$pp_title.clone().appendTo(t("body")).css({position:"absolute",top:-1e4}),titleHeight+=$pp_title.height(),$pp_title.remove(),s=i+detailsHeight,n=e,l=s+titleHeight+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height(),r=e}function y(t){return t.match(/youtube\.com\/watch/i)||t.match(/youtu\.be/i)?"youtube":t.match(/vimeo\.com/i)?"vimeo":t.match(/\b.mov\b/i)?"quicktime":t.match(/\b.swf\b/i)?"flash":t.match(/\biframe=true\b/i)?"iframe":t.match(/\bajax=true\b/i)?"ajax":t.match(/\bcustom=true\b/i)?"custom":"#"==t.substr(0,1)?"inline":"image"}function w(){if(doresize&&"undefined"!=typeof $pp_pic_holder){if(scroll_pos=b(),contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width(),projectedTop=_/2+scroll_pos.scrollTop-contentHeight/2,projectedTop<0&&(projectedTop=0),contentHeight>_)return;$pp_pic_holder.css({top:projectedTop,left:g/2+scroll_pos.scrollLeft-contentwidth/2})}}function b(){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 k(e){if(settings.social_tools&&(facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href))),settings.markup=settings.markup.replace("{pp_social}",""),t("body").append(settings.markup),$pp_pic_holder=t(".pp_pic_holder"),$ppt=t(".ppt"),$pp_overlay=t("div.pp_overlay"),isSet&&settings.overlay_gallery){currentGalleryPage=0,toInject="";for(var i=0;i<pp_images.length;i++)pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)?(classname="",img_src=pp_images[i]):(classname="default",img_src=""),toInject+="<li class='"+classname+"'><a href='#'><img src='"+img_src+"' width='50' alt='' /></a></li>";toInject=settings.gallery_markup.replace(/{gallery}/g,toInject),$pp_pic_holder.find("#pp_full_res").after(toInject),$pp_gallery=t(".pp_pic_holder .pp_gallery"),$pp_gallery_li=$pp_gallery.find("li"),$pp_gallery.find(".pp_arrow_next").on("click",function(){return t.prettyPhoto.changeGalleryPage("next"),t.prettyPhoto.stopSlideshow(),!1}),$pp_gallery.find(".pp_arrow_previous").on("click",function(){return t.prettyPhoto.changeGalleryPage("previous"),t.prettyPhoto.stopSlideshow(),!1}),$pp_pic_holder.find(".pp_content").on("mouseenter",function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeIn()}).on("mouseleave",function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeOut()}),itemWidth=57,$pp_gallery_li.each(function(e){t(this).find("a").on("click",function(){return t.prettyPhoto.changePage(e),t.prettyPhoto.stopSlideshow(),!1})})}settings.slideshow&&($pp_pic_holder.find(".pp_nav").prepend('<a href="#" class="pp_play">Play</a>'),$pp_pic_holder.find(".pp_nav .pp_play").on("click",function(){return t.prettyPhoto.startSlideshow(),!1})),$pp_pic_holder.attr("class","pp_pic_holder "+settings.theme),$pp_overlay.css({opacity:0,height:t(document).height(),width:t(window).width()}).on("click",function(){settings.modal||t.prettyPhoto.close()}),t("a.pp_close").on("click",function(){return t.prettyPhoto.close(),!1}),settings.allow_expand&&t("a.pp_expand").on("click",function(e){return t(this).hasClass("pp_expand")?(t(this).removeClass("pp_expand").addClass("pp_contract"),doresize=!1):(t(this).removeClass("pp_contract").addClass("pp_expand"),doresize=!0),f(function(){t.prettyPhoto.open()}),!1}),$pp_pic_holder.find(".pp_previous, .pp_nav .pp_arrow_previous").on("click",function(){return t.prettyPhoto.changePage("previous"),t.prettyPhoto.stopSlideshow(),!1}),$pp_pic_holder.find(".pp_next, .pp_nav .pp_arrow_next").on("click",function(){return t.prettyPhoto.changePage("next"),t.prettyPhoto.stopSlideshow(),!1}),w()}return doresize=!0,scroll_pos=b(),t(window).off("resize.prettyphoto").on("resize.prettyphoto",function(){w(),_=t(window).height(),g=t(window).width(),"undefined"!=typeof $pp_overlay&&$pp_overlay.height(t(document).height()).width(g)}),o.keyboard_shortcuts&&t(document).off("keydown.prettyphoto").on("keydown.prettyphoto",function(e){if("undefined"!=typeof $pp_pic_holder&&$pp_pic_holder.is(":visible"))switch(e.keyCode){case 37:t.prettyPhoto.changePage("previous"),e.preventDefault();break;case 39:t.prettyPhoto.changePage("next"),e.preventDefault();break;case 27:settings.modal||t.prettyPhoto.close(),e.preventDefault()}}),t.prettyPhoto.initialize=function(){return settings=o,"pp_default"==settings.theme&&(settings.horizontal_padding=16),theRel=t(this).attr(settings.hook),galleryRegExp=/\[(?:.*)\]/,isSet=!!galleryRegExp.exec(theRel),pp_images=isSet?jQuery.map(h,function(e,i){if(-1!=t(e).attr(settings.hook).indexOf(theRel))return t(e).attr("href")}):t.makeArray(t(this).attr("href")),pp_titles=isSet?jQuery.map(h,function(e,i){if(-1!=t(e).attr(settings.hook).indexOf(theRel))return t(e).find("img").attr("alt")?t(e).find("img").attr("alt"):""}):t.makeArray(t(this).find("img").attr("alt")),pp_descriptions=isSet?jQuery.map(h,function(e,i){if(-1!=t(e).attr(settings.hook).indexOf(theRel))return t(e).attr("title")?t(e).attr("title"):""}):t.makeArray(t(this).attr("title")),pp_images.length>settings.overlay_gallery_max&&(settings.overlay_gallery=!1),set_position=jQuery.inArray(t(this).attr("href"),pp_images),rel_index=isSet?set_position:t("a["+settings.hook+"^='"+theRel+"']").index(t(this)),k(this),settings.allow_resize&&t(window).on("scroll.prettyphoto",function(){w()}),t.prettyPhoto.open(),!1},t.prettyPhoto.open=function(e){return"undefined"==typeof settings&&(settings=o,pp_images=t.makeArray(arguments[0]),pp_titles=arguments[1]?t.makeArray(arguments[1]):t.makeArray(""),pp_descriptions=arguments[2]?t.makeArray(arguments[2]):t.makeArray(""),isSet=pp_images.length>1,set_position=arguments[3]?arguments[3]:0,k(e.target)),settings.hideflash&&t("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","hidden"),t(pp_images).length>1?t(".pp_nav").show():t(".pp_nav").hide(),t(".pp_loaderIcon").show(),settings.deeplinking&&function(){if("undefined"==typeof theRel)return;location.hash=theRel+"/"+rel_index+"/"}(),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+t(pp_images).length),"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(i("width",pp_images[set_position]))?i("width",pp_images[set_position]):settings.default_width.toString(),movie_height=parseFloat(i("height",pp_images[set_position]))?i("height",pp_images[set_position]):settings.default_height.toString(),c=!1,-1!=movie_height.indexOf("%")&&(movie_height=parseFloat(t(window).height()*parseFloat(movie_height)/100-150),c=!0),-1!=movie_width.indexOf("%")&&(movie_width=parseFloat(t(window).width()*parseFloat(movie_width)/100-150),c=!0),$pp_pic_holder.fadeIn(function(){switch(settings.show_title&&""!=pp_titles[set_position]&&"undefined"!=typeof pp_titles[set_position]?$ppt.html(unescape(pp_titles[set_position])):$ppt.html("&nbsp;"),imgPreloader="",skipInjection=!1,y(pp_images[set_position])){case"image":imgPreloader=new Image,nextImage=new Image,isSet&&set_position<t(pp_images).length-1&&(nextImage.src=pp_images[set_position+1]),prevImage=new Image,isSet&&pp_images[set_position-1]&&(prevImage.src=pp_images[set_position-1]),$pp_pic_holder.find("#pp_full_res")[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]),imgPreloader.onload=function(){p=u(imgPreloader.width,imgPreloader.height),m()},imgPreloader.onerror=function(){alert("Image cannot be loaded. Make sure the path is correct and image exist."),t.prettyPhoto.close()},imgPreloader.src=pp_images[set_position];break;case"youtube":p=u(movie_width,movie_height),movie_id=i("v",pp_images[set_position]),""==movie_id&&(movie_id=pp_images[set_position].split("youtu.be/"),movie_id=movie_id[1],movie_id.indexOf("?")>0&&(movie_id=movie_id.substr(0,movie_id.indexOf("?"))),movie_id.indexOf("&")>0&&(movie_id=movie_id.substr(0,movie_id.indexOf("&")))),movie="//www.youtube.com/embed/"+movie_id,i("rel",pp_images[set_position])?movie+="?rel="+i("rel",pp_images[set_position]):movie+="?rel=1",settings.autoplay&&(movie+="&autoplay=1"),toInject=settings.iframe_markup.replace(/{width}/g,p.width).replace(/{height}/g,p.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case"vimeo":p=u(movie_width,movie_height),movie_id=pp_images[set_position];var e=movie_id.match(/http(s?):\/\/(www\.)?vimeo.com\/(\d+)/);movie="//player.vimeo.com/video/"+e[3]+"?title=0&amp;byline=0&amp;portrait=0",settings.autoplay&&(movie+="&autoplay=1;"),vimeo_width=p.width+"/embed/?moog_width="+p.width,toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,p.height).replace(/{path}/g,movie);break;case"quicktime":(p=u(movie_width,movie_height)).height+=15,p.contentHeight+=15,p.containerHeight+=15,toInject=settings.quicktime_markup.replace(/{width}/g,p.width).replace(/{height}/g,p.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case"flash":p=u(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,p.width).replace(/{height}/g,p.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case"iframe":p=u(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,p.width).replace(/{height}/g,p.height).replace(/{path}/g,frame_url);break;case"ajax":doresize=!1,p=u(movie_width,movie_height),doresize=!0,skipInjection=!0,t.get(pp_images[set_position],function(t){toInject=settings.inline_markup.replace(/{content}/g,t),$pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject,m()});break;case"custom":p=u(movie_width,movie_height),toInject=settings.custom_markup;break;case"inline":myClone=t(pp_images[set_position]).clone().append('<br clear="all" />').css({width:settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo(t("body")).show(),doresize=!1,p=u(t(myClone).width(),t(myClone).height()),doresize=!0,t(myClone).remove(),toInject=settings.inline_markup.replace(/{content}/g,t(pp_images[set_position]).html())}imgPreloader||skipInjection||($pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject,m())}),!1},t.prettyPhoto.changePage=function(e){currentGalleryPage=0,"previous"==e?(set_position--,set_position<0&&(set_position=t(pp_images).length-1)):"next"==e?(set_position++,set_position>t(pp_images).length-1&&(set_position=0)):set_position=e,rel_index=set_position,doresize||(doresize=!0),settings.allow_expand&&t(".pp_contract").removeClass("pp_contract").addClass("pp_expand"),f(function(){t.prettyPhoto.open()})},t.prettyPhoto.changeGalleryPage=function(t){"next"==t?(currentGalleryPage++,currentGalleryPage>totalPage&&(currentGalleryPage=0)):"previous"==t?(currentGalleryPage--,currentGalleryPage<0&&(currentGalleryPage=totalPage)):currentGalleryPage=t,slide_speed="next"==t||"previous"==t?settings.animation_speed:0,slide_to=currentGalleryPage*(itemsPerPage*itemWidth),$pp_gallery.find("ul").animate({left:-slide_to},slide_speed)},t.prettyPhoto.startSlideshow=function(){void 0===d?($pp_pic_holder.find(".pp_play").off("click").removeClass("pp_play").addClass("pp_pause").on("click",function(){return t.prettyPhoto.stopSlideshow(),!1}),d=setInterval(t.prettyPhoto.startSlideshow,settings.slideshow)):t.prettyPhoto.changePage("next")},t.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find(".pp_pause").off("click").removeClass("pp_pause").addClass("pp_play").on("click",function(){return t.prettyPhoto.startSlideshow(),!1}),clearInterval(d),d=undefined},t.prettyPhoto.close=function(){$pp_overlay.is(":animated")||(t.prettyPhoto.stopSlideshow(),$pp_pic_holder.stop().find("object,embed").css("visibility","hidden"),t("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animation_speed,function(){t(this).remove()}),$pp_overlay.fadeOut(settings.animation_speed,function(){settings.hideflash&&t("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","visible"),t(this).remove(),t(window).off("scroll.prettyphoto"),-1!==location.href.indexOf("#prettyPhoto")&&(location.hash="prettyPhoto"),settings.callback(),doresize=!0,a=!1,delete settings}))},!pp_alreadyInitialized&&e()&&(pp_alreadyInitialized=!0,hashIndex=e(),hashRel=hashIndex,hashIndex=hashIndex.substring(hashIndex.indexOf("/")+1,hashIndex.length-1),hashRel=hashRel.substring(0,hashRel.indexOf("/")),setTimeout(function(){t("a["+o.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger("click")},50)),this.off("click.prettyphoto").on("click.prettyphoto",t.prettyPhoto.initialize)}}(jQuery);var pp_alreadyInitialized=!1;