diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index dcf5ab0a..53af30e3 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -455,7 +455,7 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, //$(".scroll").mCustomScrollbar(); // initialize scroll bar for filter by metacode, then hide it and position it correctly again - $("#filter_by_metacode").mCustomScrollbar(); + $("#filter_by_metacode").mCustomScrollbar({advanced: { updateOnContentResize: true }}); $('.sidebarFilterBox').hide().css({ position:'absolute', top: '35px', diff --git a/app/assets/javascripts/application.js~ b/app/assets/javascripts/application.js~ new file mode 100644 index 00000000..dcf5ab0a --- /dev/null +++ b/app/assets/javascripts/application.js~ @@ -0,0 +1,804 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +// require autocomplete-rails-uncompressed +// +//= require jquery +//= require jquery-ui +//= require jquery.purr +//= require jquery.lettering +//= require jquery.textillate +//= require jquery.roundabout.min +//= require best_in_place +//= require jquery_ujs +//= require_tree . + +// other options are 'graph' +var viewMode = "list"; + +var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, goRealtime = false, mapid = null, mapperm = false, touchPos, touchDragNode, mouseIsDown = false; + + $(document).ready(function() { + + function bindMainMenuHover() { + + var menuIsOpen = false + + // controls the sliding hover of the bottom left menu + var sliding1 = false; + var lT; + + var closeMenu = function() { + lT = setTimeout(function() { + if (! sliding1) { + sliding1 = true; + // $('.footer .menu').animate({ + // height: '0px' + // }, 300, function() { + // sliding1 = false; + // menuIsOpen = false; + // }); + $('.footer').css('border-top-right-radius','5px'); + $('.logo').animate({ + 'background-position-x':'-10px' + }, 200); + $('.footer .menu').fadeOut(200, function() { + sliding1 = false; + menuIsOpen = false; + }); + } + },500); + } + + var openMenu = function() { + clearTimeout(lT); + if (! sliding1) { + sliding1 = true; + + // $('.footer .menu').animate({ + // height: listLength + 'px' + // }, 300, function() { + // sliding1 = false; + // }); + $('.footer').css('border-top-right-radius','0'); + $('.logo').animate({ + 'background-position-x':'-7px' + }, 200); + $('.footer .menu').fadeIn(200, function() { + sliding1 = false; + }); + } + } + // bind the hover events + $(".logo").hover(openMenu, closeMenu); + + // when on touch screen, make touching on the logo do what hovering does on desktop + $("#mainTitle a").bind('touchend', function(evt) { + if (!menuIsOpen) { + openMenu(); + evt.preventDefault(); + evt.stopPropagation(); + } + }); + } + + function bindSearchHover() { + + var searchIsOpen = false + + // controls the sliding hover of the search + var sliding1 = false; + var lT; + + var openSearch = function() { + clearTimeout(lT); + if (!sliding1 && !searchIsOpen) { + hideCards(); + sliding1 = true; + $('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({ + width: '200px' + }, 200, function() { + $('.sidebarSearchField, .sidebarSearch .tt-hint').css({padding:'5px 10px', width:'180px'}); + $('.sidebarSearchField').focus(); + sliding1 = false + searchIsOpen = true; + }); + } + } + var closeSearch = function(closeAfter) { + lT = setTimeout(function() { + if (!sliding1 && searchIsOpen && $('.sidebarSearchField').val() == '') { + sliding1 = true; + $('.sidebarSearchField, .sidebarSearch .tt-hint').css({padding:'5px 0', width:'200px'}); + $('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({ + width: '0' + }, 200, function() { + $('.sidebarSearchField').typeahead('setQuery',''); + sliding1 = false; + searchIsOpen = false; + }); + } + },closeAfter); + } + + // bind the hover events + $(".sidebarSearch").hover(function(){ openSearch() }, function() { closeSearch(800) }); + + $('.sidebarSearchIcon').click(function(e) { + $('.sidebarSearchField').focus(); + }); + $('.sidebarSearch').click(function(e) { + e.stopPropagation(); + }); + $('body').click(function(e) { + closeSearch(0); + }); + + // if the search is closed and user hits SHIFT+S + $('body').bind('keyup', function(e) { + switch(e.which) { + case 83: + if (e.shiftKey && !searchIsOpen) { + openSearch(); + } + break; + default: break; //console.log(e.which); + } + }); + + // initialize the search box autocomplete results + var mapheader = userid ? '

Maps

' : '

Maps

'; + var topicheader = userid ? '

Topics

' : '

Topics

'; + $('.sidebarSearchField').typeahead([ + { + name: 'topics', + dupChecker: function (datum1,datum2) { + return false; + }, + template: $('.topicTemplate').html(), + remote: { + url: '/search/topics?term=%QUERY', + replace: function () { + var q = '/search/topics?term=' + $('.sidebarSearchField').val(); + if ($("#limitTopicsToMe").is(':checked')) { + q += "&user=" + userid.toString(); + } + return q; + }, + filter: function(dataset) { + if (dataset.length == 0) { + dataset.push({ + value: "No results", + label: "No results", + typeImageURL: "/assets/wildcard.png", + rtype: "noresult" + }); + } + return dataset; + } + }, + engine: Hogan, + header: topicheader + }, + { + name: 'maps', + dupChecker: function (datum1,datum2) { + return false; + }, + template: $('.mapTemplate').html(), + remote: { + url: '/search/maps?term=%QUERY', + replace: function () { + var q = '/search/maps?term=' + $('.sidebarSearchField').val(); + if ($("#limitMapsToMe").is(':checked')) { + q += "&user=" + userid.toString(); + } + return q; + }, + filter: function(dataset) { + if (dataset.length == 0) { + dataset.push({ + value: "No results", + label: "No results", + rtype: "noresult" + }); + } + return dataset; + } + }, + engine: Hogan, + header: mapheader + }, + { + name: 'mappers', + dupChecker: function (datum1,datum2) { + return false; + }, + template: $('.mapperTemplate').html(), + remote: { + url: '/search/mappers?term=%QUERY', + filter: function(dataset) { + if (dataset.length == 0) { + dataset.push({ + value: "No results", + label: "No results", + rtype: "noresult" + }); + } + return dataset; + } + }, + engine: Hogan, + header: '

Mappers

' + } + ]); + // tell the autocomplete to launch a new tab with the topic, map, or mapper you clicked on + $('.sidebarSearchField').bind('typeahead:selected', function (event, datum, dataset) { + console.log(event); + if (datum.rtype != "noresult") { + var win; + if (dataset == "topics") { + win=window.open('/topics/' + datum.id, '_blank'); + } + else if (dataset == "maps") { + win=window.open('/maps/' + datum.id, '_blank'); + } + else if (dataset == "mappers") { + win=window.open('/maps/mappers/' + datum.id, '_blank'); + } + win.focus(); + closeSearch(0); + } + }); + + + var checkboxChangeInit = false, minimizeInit = false; + + $('.sidebarSearchField').bind('keyup', function () { + + // when the user selects 'added by me' resend the query with their userid attached + if (!checkboxChangeInit) { + $('.limitToMe').bind("change", function(e) { + // set the value of the search equal to itself to retrigger the autocomplete event + searchIsOpen = false; + $('.sidebarSearchField').typeahead('setQuery',$('.sidebarSearchField').val()); + setTimeout(function() { searchIsOpen = true; }, 2000); + }); + checkboxChangeInit = true; + } + + // when the user clicks minimize section, hide the results for that section + if (!minimizeInit) { + $('.minimizeMapperResults').click(function(e) { + var s = $('.tt-dataset-mappers .tt-suggestions'); + console.log(s.css('height')); + if (s.css('height') == '0px') { + $('.tt-dataset-mappers .tt-suggestions').css({'height':'auto','overflow':'visible'}); + $(this).removeClass('maximizeResults').addClass('minimizeResults'); + } else { + $('.tt-dataset-mappers .tt-suggestions').css({'height':'0','overflow':'hidden'}); + $(this).removeClass('minimizeResults').addClass('maximizeResults'); + } + }); + $('.minimizeTopicResults').click(function(e) { + var s = $('.tt-dataset-topics .tt-suggestions'); + console.log(s.css('height')); + if (s.css('height') == '0px') { + s.css({'height':'auto','border-top':'none','overflow':'visible'}); + $(this).removeClass('maximizeResults').addClass('minimizeResults'); + } else { + s.css({'height':'0','border-top':'1px solid rgb(56, 56, 56)','overflow':'hidden'}); + $(this).removeClass('minimizeResults').addClass('maximizeResults'); + } + }); + $('.minimizeMapResults').click(function(e) { + var s = $('.tt-dataset-maps .tt-suggestions'); + console.log(s.css('height')); + if (s.css('height') == '0px') { + s.css({'height':'auto','border-top':'none','overflow':'visible'}); + $(this).removeClass('maximizeResults').addClass('minimizeResults'); + } else { + s.css({'height':'0','border-top':'1px solid rgb(56, 56, 56)','overflow':'hidden'}); + $(this).removeClass('minimizeResults').addClass('maximizeResults'); + } + }); + minimizeInit = true; + } + }); + + // + + $('.sidebarSearch button.addToMap').click(function(event){ + event.stopPropagation(); + }); + } // end bindSearchHover + + function bindAccountHover() { + + var accountIsOpen = false + + // controls the sliding hover of the bottom left menu + var sliding1 = false; + var lT; + + var closeAccount = function() { + lT = setTimeout(function() { + if (! sliding1) { + sliding1 = true; + $('.sidebarAccountIcon').css('background-color','#0F1519'); + $('.sidebarAccountBox').fadeOut(200, function() { + sliding1 = false; + accountIsOpen = false; + }); + } + },300); + } + + var openAccount = function() { + clearTimeout(lT); + if (! sliding1) { + sliding1 = true; + + // hide the other two + $('.sidebarFilterBox').hide(); + $('.sidebarWandBox').hide(); + $('.sidebarFilterIcon').css('background-color','#0F1519'); + $('.sidebarWandIcon').css('background-color','#0F1519'); + + $('.sidebarAccountIcon').css('background-color','#000'); + $('.sidebarAccountBox').fadeIn(200, function() { + sliding1 = false; + accountIsOpen = true; + }); + } + } + // bind the hover events + $(".sidebarAccount").hover(openAccount, closeAccount); + } // end bindAccountHover + + // bind hover events + bindMainMenuHover(); + bindSearchHover(); + bindAccountHover(); + + // disable right click events on the new topic and new synapse input fields + $('#new_topic, #new_synapse').bind('contextmenu', function(e){ + return false; + }); + + // initialize the autocomplete results for the metacode spinner + $('#topic_name').typeahead([ + { + name: 'topic_autocomplete', + limit: 8, + template: '{{type}}

{{label}}

{{originator}}
', + remote: { + url: '/topics/autocomplete_topic?term=%QUERY' + }, + engine: Hogan + } + ]); + // tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete + $('#topic_name').bind('typeahead:selected', function (event, datum, dataset) { + $('#topic_grabTopic').val(datum.id); + event.preventDefault(); + event.stopPropagation(); + }); + // bind keyboard handlers + $('#topic_name').bind('keyup', function(e) { + switch(e.which) { + case 13: + $('.new_topic').submit(); + break; + default: break; + } + }); + + // initialize the autocomplete results for the metacode spinner + $('#synapse_desc').typeahead([ + { + name: 'synapse_autocomplete', + template: "{{label}}", + remote: { + url: '/search/synapses?term=%QUERY' + }, + engine: Hogan + }, + { + name: 'existing_synapses', + limit: 50, + template: $('.synapseTemplate').html(), + remote: { + url: '/search/synapses', + replace: function () { + var q = '/search/synapses?topic1id=' + $('#synapse_topic1id').val() + '&topic2id=' + $('#synapse_topic2id').val(); + return q; + } + }, + engine: Hogan, + header: "

Existing Synapses

" + }, + ]); + // tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete + $('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) { + if (datum.id) { // if they clicked on an existing synapse get it + $('#synapse_grabSynapse').val(datum.id); + } + event.preventDefault(); + event.stopPropagation(); + }); + // bind keyboard handlers + $('#synapse_desc').bind('keyup', function(e) { + switch(e.which) { + case 13: + $('.new_synapse').submit(); + break; + default: break; + } + }); + + // when either form submits, don't leave the page + $('.new_topic, .new_synapse').bind('submit', function(event, data){ + event.preventDefault(); + }); + + + //$(".scroll").mCustomScrollbar(); + + // initialize scroll bar for filter by metacode, then hide it and position it correctly again + $("#filter_by_metacode").mCustomScrollbar(); + $('.sidebarFilterBox').hide().css({ + position:'absolute', + top: '35px', + right: '-36px' + }); + + // initialize metacode spinner and then hide it + $("#metacodeImg").CloudCarousel( { + titleBox: $('#metacodeImgTitle'), + yRadius:40, + xPos: 150, + yPos: 40, + speed:0.3, + mouseWheel:true, + bringToFront: true + }); + $('.new_topic').hide(); + + + $('.notice.metamaps').delay(10000).fadeOut('fast'); + $('.alert.metamaps').delay(10000).fadeOut('fast'); + + $('#center-container').bind('contextmenu', function(e){ + return false; + }); + + addHoverForSettings(); + + //bind best_in_place ajax callbacks + $('.best_in_place_desc').bind("ajax:success", function() { + $(this).parents('.CardOnGraph').find('.scroll').mCustomScrollbar("update"); + }); + $('.best_in_place_link').bind("ajax:success", function() { + var link = $(this).html(); + $(this).parents('.CardOnGraph').find('.go-link').attr('href', link); + }); + + //bind lightbox clicks + $('.openLightbox').click(function(event) { + openLightbox($(this).attr('data-open')); + event.preventDefault(); + return false; + }); + + // bind permission changer events + $('.permIcon').click(function() { + $(this).siblings('#map_permission').val( $(this).attr('data-permission') ); + $(this).siblings('.permIcon').find('.mapPermIcon').removeClass('selected'); + $(this).find('.mapPermIcon').addClass('selected'); + }); + + // bind keyboard handlers + $('body').bind('keyup', function(e) { + switch(e.which) { + case 13: enterKeyHandler(e); break; + case 27: escKeyHandler(); break; + default: break; //console.log(e.which); + } + }); + +}); // end document.ready + +function addHoverForSettings() { + // controls the sliding hover of the settings for cards + $(".permActivator").unbind('mouseover'); + $(".permActivator").unbind('mouseout'); + var sliding2 = false; + var lT1,lT2; + $(".permActivator").bind('mouseover', + function () { + clearTimeout(lT2); + that = this; + lT1 = setTimeout(function() { + if (! sliding2) { + sliding2 = true; + $(that).animate({ + width: '203px', + height: '37px' + }, 300, function() { + sliding2 = false; + }); + } + }, 300); + }); + + $(".permActivator").bind('mouseout', + function () { + clearTimeout(lT1); + that = this; + lT2 = setTimeout(function() { + if (! sliding2) { + sliding2 = true; + $(that).animate({ + height: '16px', + width: '16px' + }, 300, function() { + sliding2 = false; + }); + } + },800); + } + ); + + $('.best_in_place_permission').unbind("ajax:success"); + //bind best_in_place ajax callbacks + $('.best_in_place_permission').bind("ajax:success", function() { + var permission = $(this).html(); + var el = $(this).parents('.cardSettings').find('.mapPerm'); + el.attr('title', permission); + if (permission == "commons") el.html("co"); + else if (permission == "public") el.html("pu"); + else if (permission == "private") el.html("pr"); + }); +} + +// this is to save the layout of a map +function saveLayoutAll() { + $('.sidebarSave .tip').html('Saving...'); + var coor = ""; + if (gType == "arranged" || gType == "chaotic") { + Mconsole.graph.eachNode(function(n) { + coor = coor + n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y + ','; + }); + coor = coor.slice(0, -1); + $('#map_coordinates').val(coor); + $('#saveMapLayout').submit(); + } +} + +// this is to update the location coordinate of a single node on a map +function saveLayout(id) { + var n = Mconsole.graph.getNode(id); + $('#map_coordinates').val(n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y); + $('#saveMapLayout').submit(); + dragged = 0; + //$('.wandSaveLayout').html('Saved!'); + //setTimeout(function(){$('.wandSaveLayout').html('Save Layout')},1500); +} + +// this is to save your console to a map +function saveToMap() { + var nodes_data = "", synapses_data = ""; + var synapses_array = new Array(); + Mconsole.graph.eachNode(function(n) { + //don't add to the map if it was filtered out + if (categoryVisible[n.getData('metacode')] == false) { + return; + } + + var x, y; + if (n.pos.x && n.pos.y) { + x = n.pos.x; + y = n.pos.y; + } else { + var x = Math.cos(n.pos.theta) * n.pos.rho; + var y = Math.sin(n.pos.theta) * n.pos.rho; + } + nodes_data += n.id + '/' + x + '/' + y + ','; + n.eachAdjacency(function(adj) { + synapses_array.push(adj.getData("id")); + }); + }); + + //get unique values only + synapses_array = $.grep(synapses_array, function(value, key){ + return $.inArray(value, synapses_array) === key; + }); + + synapses_data = synapses_array.join(); + nodes_data = nodes_data.slice(0, -1); + + $('#map_topicsToMap').val(nodes_data); + $('#map_synapsesToMap').val(synapses_data); + openLightbox('forkmap'); +} + +function fetchRelatives(node) { + var myA = $.ajax({ + type: "Get", + url: "/topics/" + node.id + "?format=json", + success: function(data) { + if (gType == "centered") { + Mconsole.busy = true; + Mconsole.op.sum(data, { + type: 'fade', + duration: 500, + hideLabels: false + }); + Mconsole.graph.eachNode(function (n) { + n.eachAdjacency(function (a) { + if (!a.getData('showDesc')) { + a.setData('alpha', 0.4, 'start'); + a.setData('alpha', 0.4, 'current'); + a.setData('alpha', 0.4, 'end'); + } + }); + }); + Mconsole.busy = false; + } + else { + Mconsole.op.sum(data, { + type: 'nothing', + }); + Mconsole.plot(); + } + /*Mconsole.op.contract(node, { + type: 'replot' + }); + Mconsole.op.expand(node, { + type: 'animate', + transition: $jit.Trans.Elastic.easeOut, + duration: 1000 + });*/ + }, + error: function(){ + alert('failure'); + } + }); +} + +// @param node = JIT node object +// @param metacode = STRING like "Idea", "Action", etc. +function updateMetacode(node, metacode) { + var mdata = { "topic": { "metacode": metacode } }; + $.ajax({ + type: "PUT", + dataType: 'json', + url: "/topics/" + node.id, + data: mdata, + success: function(data) { + $('.CardOnGraph').find('.metacodeTitle').text(metacode); + $('.CardOnGraph').find('.metacodeImage').css('background-image', 'url(' + imgArray[metacode].src + ')'); + node.setData("metacode", metacode); + Mconsole.plot(); + $('.metacodeTitle').removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow + $('.metacodeSelect').hide(); + setTimeout(function() { $('.metacodeTitle').hide(); $('.showcard .icon').css('z-index','1'); }, 500); + }, + error: function(){ + alert('failed to update metacode'); + } + }); +} + +function updateTopicPermission(node, permission) { + var mdata = { "topic": { "permission": permission } }; + $.ajax({ + type: "PUT", + dataType: 'json', + url: "/topics/" + node.id, + data: mdata, + success: function(data) { + $('.showcard .mapPerm').removeClass('co pu pr minimize').addClass( permission.substring(0,2) ); + $('.permissionSelect').remove(); + node.setData("permission", permission); + }, + error: function(){ + alert('failed to update permission'); + } + }); +} + +function updateSynapsePermission(edge, permission) { + var mdata = { "synapse": { "permission": permission } }; + $.ajax({ + type: "PUT", + dataType: 'json', + url: "/synapses/" + edge.data.$id, + data: mdata, + success: function(data) { + $('#edit_synapse .mapPerm').removeClass('co pu pr minimize').addClass( permission.substring(0,2) ); + $('#edit_synapse .permissionSelect').remove(); + edge.setData("permission", permission); + }, + error: function(){ + alert('failed to update permission'); + } + }); +} + +function updateMapPermission(mapid, permission) { + var mdata = { "map": { "permission": permission } }; + $.ajax({ + type: "PUT", + dataType: 'json', + url: "/maps/" + mapid, + data: mdata, + success: function(data) { + $('.mapPermission').removeClass('commons public private minimize').addClass( permission ); + $('.mapPermission .permissionSelect').remove(); + }, + error: function(){ + alert('failed to update permission'); + } + }); +} + +function MconsoleReset() { + + var tX = Mconsole.canvas.translateOffsetX; + var tY = Mconsole.canvas.translateOffsetY; + Mconsole.canvas.translate(-tX,-tY); + + var mX = Mconsole.canvas.scaleOffsetX; + var mY = Mconsole.canvas.scaleOffsetY; + Mconsole.canvas.scale((1/mX),(1/mY)); +} + +function openNodeShowcard(node) { + //populate the card that's about to show with the right topics data + populateShowCard(node); + + $('.showcard').fadeIn('fast'); + var s = $('.showcard').find('.scroll'); + s.height( s.height() ).mCustomScrollbar(); + //node.setData('dim', 1, 'current'); + MetamapsModel.showcardInUse = node.id; +} + +function openLightbox(which) { + $('.lightboxContent').hide(); + $('#' + which).show(); + + $('#lightbox_overlay').show(); + $('#lightbox_main').css('margin-top', '-' + ($('#lightbox_main').height() / 2) + 'px' ); +} + +function cancelMapCreate(id) { + + $('#lightbox_overlay').hide(); + + var form = $('#' + id); + + form.find('#map_name').val(''); + form.find('#map_desc').val(''); + form.find('#map_permission').val('commons'); + + if (id == "fork_map") { + form.find('#map_topicsToMap').val('0'); + form.find('#map_synapsesToMap').val('0'); + } + form.find('.mapPermIcon').removeClass('selected'); + form.find('.mapCommonsIcon').addClass('selected'); + + return false; +} diff --git a/app/assets/javascripts/scroll/jquery.mCustomScrollbar.min.js b/app/assets/javascripts/scroll/jquery.mCustomScrollbar.min.js index 94da2581..7a20d615 100644 --- a/app/assets/javascripts/scroll/jquery.mCustomScrollbar.min.js +++ b/app/assets/javascripts/scroll/jquery.mCustomScrollbar.min.js @@ -1 +1 @@ -(function(c){var b={init:function(e){var f={set_width:false,set_height:false,horizontalScroll:false,scrollInertia:950,mouseWheel:true,mouseWheelPixels:"auto",autoDraggerLength:true,autoHideScrollbar:false,alwaysShowScrollbar:false,snapAmount:null,snapOffset:0,scrollButtons:{enable:false,scrollType:"continuous",scrollSpeed:"auto",scrollAmount:40},advanced:{updateOnBrowserResize:true,updateOnContentResize:false,autoExpandHorizontalScroll:false,autoScrollOnFocus:true,normalizeMouseWheelDelta:false},contentTouchScroll:true,callbacks:{onScrollStart:function(){},onScroll:function(){},onTotalScroll:function(){},onTotalScrollBack:function(){},onTotalScrollOffset:0,onTotalScrollBackOffset:0,whileScrolling:function(){}},theme:"light"},e=c.extend(true,f,e);return this.each(function(){var m=c(this);if(e.set_width){m.css("width",e.set_width)}if(e.set_height){m.css("height",e.set_height)}if(!c(document).data("mCustomScrollbar-index")){c(document).data("mCustomScrollbar-index","1")}else{var t=parseInt(c(document).data("mCustomScrollbar-index"));c(document).data("mCustomScrollbar-index",t+1)}m.wrapInner("
").addClass("mCustomScrollbar _mCS_"+c(document).data("mCustomScrollbar-index"));var g=m.children(".mCustomScrollBox");if(e.horizontalScroll){g.addClass("mCSB_horizontal").wrapInner("
");var k=g.children(".mCSB_h_wrapper");k.wrapInner("
").children(".mCSB_container").css({width:k.children().outerWidth(),position:"relative"}).unwrap()}else{g.wrapInner("
")}var o=g.children(".mCSB_container");if(c.support.touch){o.addClass("mCS_touch")}o.after("
");var l=g.children(".mCSB_scrollTools"),h=l.children(".mCSB_draggerContainer"),q=h.children(".mCSB_dragger");if(e.horizontalScroll){q.data("minDraggerWidth",q.width())}else{q.data("minDraggerHeight",q.height())}if(e.scrollButtons.enable){if(e.horizontalScroll){l.prepend("").append("")}else{l.prepend("").append("")}}g.bind("scroll",function(){if(!m.is(".mCS_disabled")){g.scrollTop(0).scrollLeft(0)}});m.data({mCS_Init:true,mCustomScrollbarIndex:c(document).data("mCustomScrollbar-index"),horizontalScroll:e.horizontalScroll,scrollInertia:e.scrollInertia,scrollEasing:"mcsEaseOut",mouseWheel:e.mouseWheel,mouseWheelPixels:e.mouseWheelPixels,autoDraggerLength:e.autoDraggerLength,autoHideScrollbar:e.autoHideScrollbar,alwaysShowScrollbar:e.alwaysShowScrollbar,snapAmount:e.snapAmount,snapOffset:e.snapOffset,scrollButtons_enable:e.scrollButtons.enable,scrollButtons_scrollType:e.scrollButtons.scrollType,scrollButtons_scrollSpeed:e.scrollButtons.scrollSpeed,scrollButtons_scrollAmount:e.scrollButtons.scrollAmount,autoExpandHorizontalScroll:e.advanced.autoExpandHorizontalScroll,autoScrollOnFocus:e.advanced.autoScrollOnFocus,normalizeMouseWheelDelta:e.advanced.normalizeMouseWheelDelta,contentTouchScroll:e.contentTouchScroll,onScrollStart_Callback:e.callbacks.onScrollStart,onScroll_Callback:e.callbacks.onScroll,onTotalScroll_Callback:e.callbacks.onTotalScroll,onTotalScrollBack_Callback:e.callbacks.onTotalScrollBack,onTotalScroll_Offset:e.callbacks.onTotalScrollOffset,onTotalScrollBack_Offset:e.callbacks.onTotalScrollBackOffset,whileScrolling_Callback:e.callbacks.whileScrolling,bindEvent_scrollbar_drag:false,bindEvent_content_touch:false,bindEvent_scrollbar_click:false,bindEvent_mousewheel:false,bindEvent_buttonsContinuous_y:false,bindEvent_buttonsContinuous_x:false,bindEvent_buttonsPixels_y:false,bindEvent_buttonsPixels_x:false,bindEvent_focusin:false,bindEvent_autoHideScrollbar:false,mCSB_buttonScrollRight:false,mCSB_buttonScrollLeft:false,mCSB_buttonScrollDown:false,mCSB_buttonScrollUp:false});if(e.horizontalScroll){if(m.css("max-width")!=="none"){if(!e.advanced.updateOnContentResize){e.advanced.updateOnContentResize=true}}}else{if(m.css("max-height")!=="none"){var s=false,r=parseInt(m.css("max-height"));if(m.css("max-height").indexOf("%")>=0){s=r,r=m.parent().height()*s/100}m.css("overflow","hidden");g.css("max-height",r)}}m.mCustomScrollbar("update");if(e.advanced.updateOnBrowserResize){var i,j=c(window).width(),u=c(window).height();c(window).bind("resize."+m.data("mCustomScrollbarIndex"),function(){if(i){clearTimeout(i)}i=setTimeout(function(){if(!m.is(".mCS_disabled")&&!m.is(".mCS_destroyed")){var w=c(window).width(),v=c(window).height();if(j!==w||u!==v){if(m.css("max-height")!=="none"&&s){g.css("max-height",m.parent().height()*s/100)}m.mCustomScrollbar("update");j=w;u=v}}},150)})}if(e.advanced.updateOnContentResize){var p;if(e.horizontalScroll){var n=o.outerWidth()}else{var n=o.outerHeight()}p=setInterval(function(){if(e.horizontalScroll){if(e.advanced.autoExpandHorizontalScroll){o.css({position:"absolute",width:"auto"}).wrap("
").css({width:o.outerWidth(),position:"relative"}).unwrap()}var v=o.outerWidth()}else{var v=o.outerHeight()}if(v!=n){m.mCustomScrollbar("update");n=v}},300)}})},update:function(){var n=c(this),k=n.children(".mCustomScrollBox"),q=k.children(".mCSB_container");q.removeClass("mCS_no_scrollbar");n.removeClass("mCS_disabled mCS_destroyed");k.scrollTop(0).scrollLeft(0);var y=k.children(".mCSB_scrollTools"),o=y.children(".mCSB_draggerContainer"),m=o.children(".mCSB_dragger");if(n.data("horizontalScroll")){var A=y.children(".mCSB_buttonLeft"),t=y.children(".mCSB_buttonRight"),f=k.width();if(n.data("autoExpandHorizontalScroll")){q.css({position:"absolute",width:"auto"}).wrap("
").css({width:q.outerWidth(),position:"relative"}).unwrap()}var z=q.outerWidth()}else{var w=y.children(".mCSB_buttonUp"),g=y.children(".mCSB_buttonDown"),r=k.height(),i=q.outerHeight()}if(i>r&&!n.data("horizontalScroll")){y.css("display","block");var s=o.height();if(n.data("autoDraggerLength")){var u=Math.round(r/i*s),l=m.data("minDraggerHeight");if(u<=l){m.css({height:l})}else{if(u>=s-10){var p=s-10;m.css({height:p})}else{m.css({height:u})}}m.children(".mCSB_dragger_bar").css({"line-height":m.height()+"px"})}var B=m.height(),x=(i-r)/(s-B);n.data("scrollAmount",x).mCustomScrollbar("scrolling",k,q,o,m,w,g,A,t);var D=Math.abs(q.position().top);n.mCustomScrollbar("scrollTo",D,{scrollInertia:0,trigger:"internal"})}else{if(z>f&&n.data("horizontalScroll")){y.css("display","block");var h=o.width();if(n.data("autoDraggerLength")){var j=Math.round(f/z*h),C=m.data("minDraggerWidth");if(j<=C){m.css({width:C})}else{if(j>=h-10){var e=h-10;m.css({width:e})}else{m.css({width:j})}}}var v=m.width(),x=(z-f)/(h-v);n.data("scrollAmount",x).mCustomScrollbar("scrolling",k,q,o,m,w,g,A,t);var D=Math.abs(q.position().left);n.mCustomScrollbar("scrollTo",D,{scrollInertia:0,trigger:"internal"})}else{k.unbind("mousewheel focusin");if(n.data("horizontalScroll")){m.add(q).css("left",0)}else{m.add(q).css("top",0)}if(n.data("alwaysShowScrollbar")){if(!n.data("horizontalScroll")){m.css({height:o.height()})}else{if(n.data("horizontalScroll")){m.css({width:o.width()})}}}else{y.css("display","none");q.addClass("mCS_no_scrollbar")}n.data({bindEvent_mousewheel:false,bindEvent_focusin:false})}}},scrolling:function(i,q,n,k,A,f,D,w){var l=c(this);if(!l.data("bindEvent_scrollbar_drag")){var o,p,C,z,e;if(c.support.pointer){C="pointerdown";z="pointermove";e="pointerup"}else{if(c.support.msPointer){C="MSPointerDown";z="MSPointerMove";e="MSPointerUp"}}if(c.support.pointer||c.support.msPointer){k.bind(C,function(K){K.preventDefault();l.data({on_drag:true});k.addClass("mCSB_dragger_onDrag");var J=c(this),M=J.offset(),I=K.originalEvent.pageX-M.left,L=K.originalEvent.pageY-M.top;if(I0&&L0){o=L;p=I}});c(document).bind(z+"."+l.data("mCustomScrollbarIndex"),function(K){K.preventDefault();if(l.data("on_drag")){var J=k,M=J.offset(),I=K.originalEvent.pageX-M.left,L=K.originalEvent.pageY-M.top;G(o,p,L,I)}}).bind(e+"."+l.data("mCustomScrollbarIndex"),function(x){l.data({on_drag:false});k.removeClass("mCSB_dragger_onDrag")})}else{k.bind("mousedown touchstart",function(K){K.preventDefault();K.stopImmediatePropagation();var J=c(this),N=J.offset(),I,M;if(K.type==="touchstart"){var L=K.originalEvent.touches[0]||K.originalEvent.changedTouches[0];I=L.pageX-N.left;M=L.pageY-N.top}else{l.data({on_drag:true});k.addClass("mCSB_dragger_onDrag");I=K.pageX-N.left;M=K.pageY-N.top}if(I0&&M0){o=M;p=I}}).bind("touchmove",function(K){K.preventDefault();K.stopImmediatePropagation();var N=K.originalEvent.touches[0]||K.originalEvent.changedTouches[0],J=c(this),M=J.offset(),I=N.pageX-M.left,L=N.pageY-M.top;G(o,p,L,I)});c(document).bind("mousemove."+l.data("mCustomScrollbarIndex"),function(K){if(l.data("on_drag")){var J=k,M=J.offset(),I=K.pageX-M.left,L=K.pageY-M.top;G(o,p,L,I)}}).bind("mouseup."+l.data("mCustomScrollbarIndex"),function(x){l.data({on_drag:false});k.removeClass("mCSB_dragger_onDrag")})}l.data({bindEvent_scrollbar_drag:true})}function G(J,K,L,I){if(l.data("horizontalScroll")){l.mCustomScrollbar("scrollTo",(k.position().left-(K))+I,{moveDragger:true,trigger:"internal"})}else{l.mCustomScrollbar("scrollTo",(k.position().top-(J))+L,{moveDragger:true,trigger:"internal"})}}if(c.support.touch&&l.data("contentTouchScroll")){if(!l.data("bindEvent_content_touch")){var m,E,s,t,v,F,H;q.bind("touchstart",function(x){x.stopImmediatePropagation();m=x.originalEvent.touches[0]||x.originalEvent.changedTouches[0];E=c(this);s=E.offset();v=m.pageX-s.left;t=m.pageY-s.top;F=t;H=v});q.bind("touchmove",function(x){x.preventDefault();x.stopImmediatePropagation();m=x.originalEvent.touches[0]||x.originalEvent.changedTouches[0];E=c(this).parent();s=E.offset();v=m.pageX-s.left;t=m.pageY-s.top;if(l.data("horizontalScroll")){l.mCustomScrollbar("scrollTo",H-v,{trigger:"internal"})}else{l.mCustomScrollbar("scrollTo",F-t,{trigger:"internal"})}})}}if(!l.data("bindEvent_scrollbar_click")){n.bind("click",function(I){var x=(I.pageY-n.offset().top)*l.data("scrollAmount"),y=c(I.target);if(l.data("horizontalScroll")){x=(I.pageX-n.offset().left)*l.data("scrollAmount")}if(y.hasClass("mCSB_draggerContainer")||y.hasClass("mCSB_draggerRail")){l.mCustomScrollbar("scrollTo",x,{trigger:"internal",scrollEasing:"draggerRailEase"})}});l.data({bindEvent_scrollbar_click:true})}if(l.data("mouseWheel")){if(!l.data("bindEvent_mousewheel")){i.bind("mousewheel",function(K,M){var J,I=l.data("mouseWheelPixels"),x=Math.abs(q.position().top),L=k.position().top,y=n.height()-k.height();if(l.data("normalizeMouseWheelDelta")){if(M<0){M=-1}else{M=1}}if(I==="auto"){I=100+Math.round(l.data("scrollAmount")/2)}if(l.data("horizontalScroll")){L=k.position().left;y=n.width()-k.width();x=Math.abs(q.position().left)}if((M>0&&L!==0)||(M<0&&L!==y)){K.preventDefault();K.stopImmediatePropagation()}J=x-(M*I);l.mCustomScrollbar("scrollTo",J,{trigger:"internal"})});l.data({bindEvent_mousewheel:true})}}if(l.data("scrollButtons_enable")){if(l.data("scrollButtons_scrollType")==="pixels"){if(l.data("horizontalScroll")){w.add(D).unbind("mousedown touchstart MSPointerDown pointerdown mouseup MSPointerUp pointerup mouseout MSPointerOut pointerout touchend",j,h);l.data({bindEvent_buttonsContinuous_x:false});if(!l.data("bindEvent_buttonsPixels_x")){w.bind("click",function(x){x.preventDefault();r(Math.abs(q.position().left)+l.data("scrollButtons_scrollAmount"))});D.bind("click",function(x){x.preventDefault();r(Math.abs(q.position().left)-l.data("scrollButtons_scrollAmount"))});l.data({bindEvent_buttonsPixels_x:true})}}else{f.add(A).unbind("mousedown touchstart MSPointerDown pointerdown mouseup MSPointerUp pointerup mouseout MSPointerOut pointerout touchend",j,h);l.data({bindEvent_buttonsContinuous_y:false});if(!l.data("bindEvent_buttonsPixels_y")){f.bind("click",function(x){x.preventDefault();r(Math.abs(q.position().top)+l.data("scrollButtons_scrollAmount"))});A.bind("click",function(x){x.preventDefault();r(Math.abs(q.position().top)-l.data("scrollButtons_scrollAmount"))});l.data({bindEvent_buttonsPixels_y:true})}}function r(x){if(!k.data("preventAction")){k.data("preventAction",true);l.mCustomScrollbar("scrollTo",x,{trigger:"internal"})}}}else{if(l.data("horizontalScroll")){w.add(D).unbind("click");l.data({bindEvent_buttonsPixels_x:false});if(!l.data("bindEvent_buttonsContinuous_x")){w.bind("mousedown touchstart MSPointerDown pointerdown",function(y){y.preventDefault();var x=B();l.data({mCSB_buttonScrollRight:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(q.position().left)+x,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var j=function(x){x.preventDefault();clearInterval(l.data("mCSB_buttonScrollRight"))};w.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",j);D.bind("mousedown touchstart MSPointerDown pointerdown",function(y){y.preventDefault();var x=B();l.data({mCSB_buttonScrollLeft:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(q.position().left)-x,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var h=function(x){x.preventDefault();clearInterval(l.data("mCSB_buttonScrollLeft"))};D.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",h);l.data({bindEvent_buttonsContinuous_x:true})}}else{f.add(A).unbind("click");l.data({bindEvent_buttonsPixels_y:false});if(!l.data("bindEvent_buttonsContinuous_y")){f.bind("mousedown touchstart MSPointerDown pointerdown",function(y){y.preventDefault();var x=B();l.data({mCSB_buttonScrollDown:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(q.position().top)+x,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var u=function(x){x.preventDefault();clearInterval(l.data("mCSB_buttonScrollDown"))};f.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",u);A.bind("mousedown touchstart MSPointerDown pointerdown",function(y){y.preventDefault();var x=B();l.data({mCSB_buttonScrollUp:setInterval(function(){l.mCustomScrollbar("scrollTo",Math.abs(q.position().top)-x,{trigger:"internal",scrollEasing:"easeOutCirc"})},17)})});var g=function(x){x.preventDefault();clearInterval(l.data("mCSB_buttonScrollUp"))};A.bind("mouseup touchend MSPointerUp pointerup mouseout MSPointerOut pointerout",g);l.data({bindEvent_buttonsContinuous_y:true})}}function B(){var x=l.data("scrollButtons_scrollSpeed");if(l.data("scrollButtons_scrollSpeed")==="auto"){x=Math.round((l.data("scrollInertia")+100)/40)}return x}}}if(l.data("autoScrollOnFocus")){if(!l.data("bindEvent_focusin")){i.bind("focusin",function(){i.scrollTop(0).scrollLeft(0);var x=c(document.activeElement);if(x.is("input,textarea,select,button,a[tabindex],area,object")){var J=q.position().top,y=x.position().top,I=i.height()-x.outerHeight();if(l.data("horizontalScroll")){J=q.position().left;y=x.position().left;I=i.width()-x.outerWidth()}if(J+y<0||J+y>I){l.mCustomScrollbar("scrollTo",y,{trigger:"internal"})}}});l.data({bindEvent_focusin:true})}}if(l.data("autoHideScrollbar")&&!l.data("alwaysShowScrollbar")){if(!l.data("bindEvent_autoHideScrollbar")){i.bind("mouseenter",function(x){i.addClass("mCS-mouse-over");d.showScrollbar.call(i.children(".mCSB_scrollTools"))}).bind("mouseleave touchend",function(x){i.removeClass("mCS-mouse-over");if(x.type==="mouseleave"){d.hideScrollbar.call(i.children(".mCSB_scrollTools"))}});l.data({bindEvent_autoHideScrollbar:true})}}},scrollTo:function(e,f){var i=c(this),o={moveDragger:false,trigger:"external",callbacks:true,scrollInertia:i.data("scrollInertia"),scrollEasing:i.data("scrollEasing")},f=c.extend(o,f),p,g=i.children(".mCustomScrollBox"),k=g.children(".mCSB_container"),r=g.children(".mCSB_scrollTools"),j=r.children(".mCSB_draggerContainer"),h=j.children(".mCSB_dragger"),t=draggerSpeed=f.scrollInertia,q,s,m,l;if(!k.hasClass("mCS_no_scrollbar")){i.data({mCS_trigger:f.trigger});if(i.data("mCS_Init")){f.callbacks=false}if(e||e===0){if(typeof(e)==="number"){if(f.moveDragger){p=e;if(i.data("horizontalScroll")){e=h.position().left*i.data("scrollAmount")}else{e=h.position().top*i.data("scrollAmount")}draggerSpeed=0}else{p=e/i.data("scrollAmount")}}else{if(typeof(e)==="string"){var v;if(e==="top"){v=0}else{if(e==="bottom"&&!i.data("horizontalScroll")){v=k.outerHeight()-g.height()}else{if(e==="left"){v=0}else{if(e==="right"&&i.data("horizontalScroll")){v=k.outerWidth()-g.width()}else{if(e==="first"){v=i.find(".mCSB_container").find(":first")}else{if(e==="last"){v=i.find(".mCSB_container").find(":last")}else{v=i.find(e)}}}}}}if(v.length===1){if(i.data("horizontalScroll")){e=v.position().left}else{e=v.position().top}p=e/i.data("scrollAmount")}else{p=e=v}}}if(i.data("horizontalScroll")){if(i.data("onTotalScrollBack_Offset")){s=-i.data("onTotalScrollBack_Offset")}if(i.data("onTotalScroll_Offset")){l=g.width()-k.outerWidth()+i.data("onTotalScroll_Offset")}if(p<0){p=e=0;clearInterval(i.data("mCSB_buttonScrollLeft"));if(!s){q=true}}else{if(p>=j.width()-h.width()){p=j.width()-h.width();e=g.width()-k.outerWidth();clearInterval(i.data("mCSB_buttonScrollRight"));if(!l){m=true}}else{e=-e}}var n=i.data("snapAmount");if(n){e=Math.round(e/n)*n-i.data("snapOffset")}d.mTweenAxis.call(this,h[0],"left",Math.round(p),draggerSpeed,f.scrollEasing);d.mTweenAxis.call(this,k[0],"left",Math.round(e),t,f.scrollEasing,{onStart:function(){if(f.callbacks&&!i.data("mCS_tweenRunning")){u("onScrollStart")}if(i.data("autoHideScrollbar")&&!i.data("alwaysShowScrollbar")){d.showScrollbar.call(r)}},onUpdate:function(){if(f.callbacks){u("whileScrolling")}},onComplete:function(){if(f.callbacks){u("onScroll");if(q||(s&&k.position().left>=s)){u("onTotalScrollBack")}if(m||(l&&k.position().left<=l)){u("onTotalScroll")}}h.data("preventAction",false);i.data("mCS_tweenRunning",false);if(i.data("autoHideScrollbar")&&!i.data("alwaysShowScrollbar")){if(!g.hasClass("mCS-mouse-over")){d.hideScrollbar.call(r)}}}})}else{if(i.data("onTotalScrollBack_Offset")){s=-i.data("onTotalScrollBack_Offset")}if(i.data("onTotalScroll_Offset")){l=g.height()-k.outerHeight()+i.data("onTotalScroll_Offset")}if(p<0){p=e=0;clearInterval(i.data("mCSB_buttonScrollUp"));if(!s){q=true}}else{if(p>=j.height()-h.height()){p=j.height()-h.height();e=g.height()-k.outerHeight();clearInterval(i.data("mCSB_buttonScrollDown"));if(!l){m=true}}else{e=-e}}var n=i.data("snapAmount");if(n){e=Math.round(e/n)*n-i.data("snapOffset")}d.mTweenAxis.call(this,h[0],"top",Math.round(p),draggerSpeed,f.scrollEasing);d.mTweenAxis.call(this,k[0],"top",Math.round(e),t,f.scrollEasing,{onStart:function(){if(f.callbacks&&!i.data("mCS_tweenRunning")){u("onScrollStart")}if(i.data("autoHideScrollbar")&&!i.data("alwaysShowScrollbar")){d.showScrollbar.call(r)}},onUpdate:function(){if(f.callbacks){u("whileScrolling")}},onComplete:function(){if(f.callbacks){u("onScroll");if(q||(s&&k.position().top>=s)){u("onTotalScrollBack")}if(m||(l&&k.position().top<=l)){u("onTotalScroll")}}h.data("preventAction",false);i.data("mCS_tweenRunning",false);if(i.data("autoHideScrollbar")&&!i.data("alwaysShowScrollbar")){if(!g.hasClass("mCS-mouse-over")){d.hideScrollbar.call(r)}}}})}if(i.data("mCS_Init")){i.data({mCS_Init:false})}}}function u(w){if(i.data("mCustomScrollbarIndex")){this.mcs={top:k.position().top,left:k.position().left,draggerTop:h.position().top,draggerLeft:h.position().left,topPct:Math.round((100*Math.abs(k.position().top))/Math.abs(k.outerHeight()-g.height())),leftPct:Math.round((100*Math.abs(k.position().left))/Math.abs(k.outerWidth()-g.width()))};switch(w){case"onScrollStart":i.data("mCS_tweenRunning",true).data("onScrollStart_Callback").call(i,this.mcs);break;case"whileScrolling":i.data("whileScrolling_Callback").call(i,this.mcs);break;case"onScroll":i.data("onScroll_Callback").call(i,this.mcs);break;case"onTotalScrollBack":i.data("onTotalScrollBack_Callback").call(i,this.mcs);break;case"onTotalScroll":i.data("onTotalScroll_Callback").call(i,this.mcs);break}}}},stop:function(){var g=c(this),e=g.children().children(".mCSB_container"),f=g.children().children().children().children(".mCSB_dragger");d.mTweenAxisStop.call(this,e[0]);d.mTweenAxisStop.call(this,f[0])},disable:function(e){var j=c(this),f=j.children(".mCustomScrollBox"),h=f.children(".mCSB_container"),g=f.children(".mCSB_scrollTools"),i=g.children().children(".mCSB_dragger");f.unbind("mousewheel focusin mouseenter mouseleave touchend");h.unbind("touchstart touchmove");if(e){if(j.data("horizontalScroll")){i.add(h).css("left",0)}else{i.add(h).css("top",0)}}g.css("display","none");h.addClass("mCS_no_scrollbar");j.data({bindEvent_mousewheel:false,bindEvent_focusin:false,bindEvent_content_touch:false,bindEvent_autoHideScrollbar:false}).addClass("mCS_disabled")},destroy:function(){var e=c(this);e.removeClass("mCustomScrollbar _mCS_"+e.data("mCustomScrollbarIndex")).addClass("mCS_destroyed").children().children(".mCSB_container").unwrap().children().unwrap().siblings(".mCSB_scrollTools").remove();c(document).unbind("mousemove."+e.data("mCustomScrollbarIndex")+" mouseup."+e.data("mCustomScrollbarIndex")+" MSPointerMove."+e.data("mCustomScrollbarIndex")+" MSPointerUp."+e.data("mCustomScrollbarIndex"));c(window).unbind("resize."+e.data("mCustomScrollbarIndex"))}},d={showScrollbar:function(){this.stop().animate({opacity:1},"fast")},hideScrollbar:function(){this.stop().animate({opacity:0},"fast")},mTweenAxis:function(g,i,h,f,o,y){var y=y||{},v=y.onStart||function(){},p=y.onUpdate||function(){},w=y.onComplete||function(){};var n=t(),l,j=0,r=g.offsetTop,s=g.style;if(i==="left"){r=g.offsetLeft}var m=h-r;q();e();function t(){if(window.performance&&window.performance.now){return window.performance.now()}else{if(window.performance&&window.performance.webkitNow){return window.performance.webkitNow()}else{if(Date.now){return Date.now()}else{return new Date().getTime()}}}}function x(){if(!j){v.call()}j=t()-n;u();if(j>=g._time){g._time=(j>g._time)?j+l-(j-g._time):j+l-1;if(g._time0){g.currVal=k(g._time,r,m,f,o);s[i]=Math.round(g.currVal)+"px"}else{s[i]=h+"px"}p.call()}function e(){l=1000/60;g._time=j+l;_request=(!window.requestAnimationFrame)?function(z){u();return setTimeout(z,0.01)}:window.requestAnimationFrame;g._id=_request(x)}function q(){if(g._id==null){return}if(!window.requestAnimationFrame){clearTimeout(g._id)}else{window.cancelAnimationFrame(g._id)}g._id=null}function k(B,A,F,E,C){switch(C){case"linear":return F*B/E+A;break;case"easeOutQuad":B/=E;return -F*B*(B-2)+A;break;case"easeInOutQuad":B/=E/2;if(B<1){return F/2*B*B+A}B--;return -F/2*(B*(B-2)-1)+A;break;case"easeOutCubic":B/=E;B--;return F*(B*B*B+1)+A;break;case"easeOutQuart":B/=E;B--;return -F*(B*B*B*B-1)+A;break;case"easeOutQuint":B/=E;B--;return F*(B*B*B*B*B+1)+A;break;case"easeOutCirc":B/=E;B--;return F*Math.sqrt(1-B*B)+A;break;case"easeOutSine":return F*Math.sin(B/E*(Math.PI/2))+A;break;case"easeOutExpo":return F*(-Math.pow(2,-10*B/E)+1)+A;break;case"mcsEaseOut":var D=(B/=E)*B,z=D*B;return A+F*(0.499999999999997*z*D+-2.5*D*D+5.5*z+-6.5*D+4*B);break;case"draggerRailEase":B/=E/2;if(B<1){return F/2*B*B*B+A}B-=2;return F/2*(B*B*B+2)+A;break}}},mTweenAxisStop:function(e){if(e._id==null){return}if(!window.requestAnimationFrame){clearTimeout(e._id)}else{window.cancelAnimationFrame(e._id)}e._id=null},rafPolyfill:function(){var f=["ms","moz","webkit","o"],e=f.length;while(--e>-1&&!window.requestAnimationFrame){window.requestAnimationFrame=window[f[e]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[f[e]+"CancelAnimationFrame"]||window[f[e]+"CancelRequestAnimationFrame"]}}};d.rafPolyfill.call();c.support.touch=!!("ontouchstart" in window);c.support.pointer=window.navigator.pointerEnabled;c.support.msPointer=window.navigator.msPointerEnabled;var a=("https:"==document.location.protocol)?"https:":"http:";c.event.special.mousewheel||document.write('