var $ = jQuery.noConflict();
jQuery(document).ready(function(){
//Lightbox
$('.mfp-image').magnificPopup({
type: 'image',
gallery: {
enabled:false
}
});
//responsive videos
$("#main").fitVids();
//portable devices menu slidebar
var sbleftStatus = 0;
jQuery('#pmenu-toggle').click(function(event) {
event.preventDefault();
if (sbleftStatus == 0) {
$('#sb-left').animate({left: 0});
$('#wrap').animate({left: 260});
$('html').css({"overflow-y": "hidden"});
sbleftStatus = 1;
}else{
$('#sb-left').animate({left: -260});
$('#wrap').animate({left: 0});
$('html').css({"overflow-y": "visible"});
sbleftStatus = 0;
}
});
jQuery('#close-sb-left').click(function(event) {
event.preventDefault();
if (sbleftStatus == 1) {
$('#sb-left').animate({left: -260});
$('#wrap').animate({left: 0});
$('html').css({"overflow-y": "visible"});
sbleftStatus = 0;
}
});
//prepend arrow to portable menu links
jQuery("#portable-devices-navigation li a").prepend('');
//append down arrow to main menu top-level links with sub-level children
jQuery("#site-navigation ul li.menu-item-has-children > a").not("#site-navigation ul li ul a").append('');
jQuery("#site-navigation ul li.page_item_has_children > a").not("#site-navigation ul li ul a").append('');
//append right arrow to main menu links that are below top-level and have sub-level items
jQuery("#site-navigation ul li ul li.menu-item-has-children> a").append('');
jQuery("#site-navigation ul li ul li.page_item_has_children> a").append('');
//portable menu scrollbar
var wsHeight = jQuery(window).height();
$('#sb-left-inner').css({height: wsHeight});
$('.slidebar-inner').jScrollPane();
//scroll to top
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('#scrollToTop').fadeIn();
} else {
$('#scrollToTop').fadeOut();
}
});
$('#scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},1000);
return false;
});
//resize event functions
(function($) {
$(window).resize(windowResizeFunction);
function windowResizeFunction () {
windowWidth = jQuery(window).width();
//menu slidebar check
if (sbleftStatus == 1 && windowWidth > 959) {
$('#sb-left').css({left: -260});
$('#wrap').css({left: 0});
$('html').css({"overflow-y": "visible"});
sbleftStatus = 0;
} else {
wsHeight = jQuery(window).height();
$('#sb-left-inner').css({height: wsHeight});
$('.slidebar-inner').jScrollPane();
}
};
})(jQuery);
});