/**
 * @version $Id: jquery.djmobilemenu.js 38 2015-06-02 11:16:12Z szymon $
 * @package DJ-MegaMenu
 * @copyright Copyright (C) 2013 DJ-Extensions.com, All rights reserved.
 * @license DJ-Extensions.com Proprietary Use License
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 * @developer Szymon Woronowski - szymon.woronowski@design-joomla.eu
 */
(function($){var l=function(a,b){var c=$('<select id="'+a.attr('id')+'select" class="inputbox dj-select" />').on('change',function(){if($(this).val)window.location=$(this).val()});var d=a.find('li.dj-up');m(d,c,0);c.appendTo(b)};var m=function(g,h,j){var k='',active=false;for(var i=0;i<j;i++){k+='- '}g.each(function(){var a=$(this);var b=a.find('> a').first();var c=a.find('> .dj-subwrap > .dj-subwrap-in > .dj-subcol > .dj-submenu > li, > .dj-subtree > li');if(b.length){var d='';var e=b.find('img').first();if(e.length){d=k+e.attr('alt')}else{d=b.html().replace(/(<small[^<]+<\/small>)/ig,"");d=k+d.replace(/(<([^>]+)>)/ig,"")}var f=$('<option value="'+b.prop('href')+'">'+d+'</option>').appendTo(h);if(!b.prop('href')){f.prop('disabled',true)}if(a.hasClass('active')){h.val(f.val());active=true}}if(c)m(c,h,j+1)});if(!j&&!active){$('<option value="">- MENU -</option>').prependTo(h);h.val('')}};var n=function(c){c.find('ul.dj-mobile-nav > li, ul.dj-mobile-nav-child > li').each(function(){var a=$(this);if(a.hasClass('parent')){var b=a.find('> a').first();if(b.length){b.append('<span class="toggler"></span>');b.on('click',function(e){if(!a.hasClass('active'))e.preventDefault();else if($(e.target).hasClass('toggler')){e.preventDefault();e.stopPropagation();a.removeClass('active')}})}}a.on('click',function(){a.siblings().removeClass('active');a.addClass('active')})})};var o=function(a){var b=$(document.body).children();var c=$('<div class="dj-offcanvas-wrapper" />');var d=$('<div class="dj-offcanvas-pusher" />');var f=$('<div class="dj-offcanvas-pusher-in" />');var g=a.find('.dj-offcanvas').first();$(document.body).addClass('dj-offcanvas-effect-'+g.data('effect'));a.find('.dj-mobile-open-btn').on('click',function(e){e.stopPropagation();g.data('scroll',$(window).scrollTop());$(document.body).addClass('dj-offcanvas-open');f.css('margin-top',-g.data('scroll'))});$(document.body).prepend(c);c.append(g);c.append(d);d.append(f);f.append(b);$('.dj-offcanvas-pusher, .dj-offcanvas-close-btn').on('click',function(){if($(document.body).hasClass('dj-offcanvas-open')){f.css('margin-top',0);$(document.body).removeClass('dj-offcanvas-open');$(window).scrollTop(g.data('scroll'))}});n(g)};var p=function(a){a.find('.dj-mobile-open-btn').on('click',function(e){a.find('.dj-accordion-in').slideToggle('fast')});n(a)};var q=null;$(window).resize(function(){window.clearTimeout(q);q=window.setTimeout(function(){var c=$('body').css('overflow');if(c=='visible')c='';$('body').css('overflow','hidden');var d=$(window).innerWidth();$('body').css('overflow',c);var e=false;$('.dj-megamenu').each(function(){var a=$(this);var b=$('#'+a.prop('id')+'mobile');if(b.length){if(d<=a.data('trigger')){e=true;$(document.body).addClass(a.prop('id')+'-mobile')}else{$(document.body).removeClass(a.prop('id')+'-mobile')}}});if(e){$(document.body).addClass('dj-megamenu-mobile')}else{$(document.body).removeClass('dj-megamenu-mobile')}},100)});$(document).ready(function(){$('.dj-megamenu').each(function(){var a=$(this);var b=$('#'+a.prop('id')+'mobile');var c=$('#'+a.prop('id')+'mobileWrap');if(c.length){c.append(b)}if(b.length){b.find('.dj-hideitem').remove();if(b.hasClass('dj-megamenu-offcanvas')){o(b)}else if(b.hasClass('dj-megamenu-accordion')){p(b)}}});$(window).trigger('resize')});$(window).load(function(){$('.dj-megamenu').each(function(){var a=$(this);var b=$('#'+a.prop('id')+'mobile');if(b.length){if(b.hasClass('dj-megamenu-select')){l(a,b)}}})})})(jQuery);