here<\/a>.<\/p>\n\nIf the problems with your email address have been fixed or were only temporary, click the reset button below and we will try sending you another email to verify.<\/p>',
        title: 'Reset Email?',
        visible: false,
        width: mobileDevice ? "80%" : "500px"
      }).data("kendoDialog").open();
    });
    $('a.settings.tooltip').kendoTooltip({
      position: "left",
      show: function(e) {
        $("div.k-tooltip-button").addClass('hide');
        this.popup.element.addClass("tmdb_theme_white");
      }
    });
    $("body").on('click', 'a.export_csv', function(e) {
      e.preventDefault();
      $("#export_csv_window").kendoWindow({
        title: 'Export CSV',
        modal: true,
        draggable: false,
        resizable: false,
        width: mobileDevice ? "95%" : "600px",
        visible: false,
        pinned: true,
        animation: {
          open: {
            effects: "fade:in"
          },
          close: {
            effects: "fade:out"
          }
        },
        open: function() {
          $('body').addClass('monochrome');
        },
        close: function() {
          $('body').removeClass('monochrome');
        }
      }).data("kendoWindow").center().open();
    });
    $('#created_export').on('click', function(e) {
      e.preventDefault();
      $.ajax({
        url: '/u/dragon_53/export_csv',
        method: 'PUT',
        data: {
          list_type: list_export_type
        }
      }).fail(function() {
        showError('There was a problem.');
      }).done(function(response) {
        if (response.success) {
          $("#export_csv_window").data('kendoWindow').close();
          showSuccess('Success');
        }
      });
    });
    $('ul.user_menu.menu li a').on('click', function() {
      var contentDiv = $('div.account_page_data');
      var contentHeight = contentDiv.outerHeight();
      contentDiv.css({ height: contentHeight })
      contentDiv.html('');
      $('ul.user_menu.menu li').removeClass('selected');
      $(this).parent().addClass('selected');
      var href = $(this).attr('href');
      History.pushState({}, $(this).attr('data-title'), href);
      media_type = 'movie';
      clearWithTextSearch();
      $.ajax({
        url: $(this).attr('data-partial'),
        beforeSend: function() {
         activatePageLoader();
        }
      }).fail(function() {
        showError('There was a problem.');
        deactivatePageLoader();
      }).done(function(response) {
        deactivatePageLoader();
        contentDiv.css({ height: 'auto' }).html(response);
        $("time.timeago").timeago();
          pushGAEvent(href);
      });
    });
    $("div.account_page_data").on('click', 'a.sort_order', function(e) {
      $('a.sort_order').toggleClass('selected hide');
      $('li.selected a.filter_list').click();
    });
    $("div.account_page_data").on('click', 'div.title_header h3.scroll a', function(e) {
      media_type = $(this).attr('data-media-type');
      $('div.title_header h3').removeClass('on');
      $(this).parent().addClass('on');
      clearWithTextSearch();
    });
    $("div.account_page_data").on('click', ' a.filter_list', function(e) {
      var selected_sort = $(this).attr('data-sort-by');
      if ( selected_sort == 'default' || selected_sort == 'upcoming' ) {
        $('div.order_filter').addClass('hide');
      } else {
        $('div.order_filter').removeClass('hide');
      }
      if ( (selected_sort == 'upcoming' || selected_sort == 'account_rating' || selected_sort == 'created_at') && $('#with_text_search').val() ) {
        clearWithTextSearch();
      }
      setFilter(selected_sort);
    });
    $("div.account_page_data").on('click', 'div.title_header h3.scroll a, a.filter_list', function(e) {
      var href = $(this).attr('href');
      var partial_href = $(this).attr('data-partial');
      History.pushState({}, $(this).attr('data-title'), href);
      $.extend(requestParams, { sort_by: $(this).attr('data-sort-by') });
      filterItems(partial_href);
        pushGAEvent(href);
    });
    $("div.account_page_data").on('click', 'a.item_search_button', function(e) {
      var selected_form = $('form.item_search_form');
      selected_form.toggleClass('hide');
      $('div.content div.title_header div.filter_group div.sort_filter').toggleClass('hide');
      selected_form.one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function(e) {
        $('form.item_search_form input').focus();
      });
    });
    $("div.account_page_data").on('input', '#with_text_search', function(e) {
      setFilter('popularity');
      filterItems($(this).attr('data-partial'), { sort_by: 'popularity', with_text_query: $(this).val() });
    });
    $("div.account_page_data").on('click', 'a.load_more', function(e) {
      var currentPage = $(this).attr('data-current-page');
      var nextPage = $(this).attr('data-next-page');
      var href = $(this).attr('data-partial');
      loadPage(href, currentPage, nextPage);
    });
    $('div.moderator_options_wrapper').kendoTooltip({
      autoHide: false,
      content: function() {
        return $("#moderator_options_content").html();
      },
      showOn: 'click',
      width: 'auto',
      position: "bottom",
      show: function(e) {
        $("div.k-tooltip-button").addClass('hide');
        this.popup.element.addClass("tmdb_theme_white no_pad");
      }
    }).data("kendoTooltip");
  });
  function attachOptionsTooltip() {
    $('div.list_option_wrapper').kendoTooltip({
      autoHide: false,
      content: function() {
        return $("div.list_options_content").html();
      },
      showOn: 'click',
      width: 'auto',
      position: "top",
      show: function(e) {
        $("div.k-tooltip-button").addClass('hide');
        this.popup.element.addClass("tmdb_theme");
      }
    }).data("kendoTooltip");
  }
  function loadPage(href, currentPage, nextPage) {
    $.ajax({
      url: href,
      beforeSend: function() {
       activatePageLoader();
       $('p.load_more').addClass('hide');
       $('#pagination_page_' + currentPage + ' div.loading_wrapper').removeClass('hide');
      }
    }).fail(function() {
      showError('There was a problem.');
      deactivatePageLoader();
    }).done(function(response) {
      deactivatePageLoader();
      $('#pagination_page_' + currentPage).addClass('hide');
      $('.items_wrapper').append(response);
      createInview($('#pagination_page_' + nextPage));
      $("time.timeago").timeago();
    });
  }
  function createInview(element) {
    new Waypoint.Inview({
      element: element,
      enter: function(direction) {
        var loadMore = $(this.element).find('a.load_more');
        loadMore.click();
        this.disable();
      },
      offset: {
        bottom: -800
      }
    });
  }
  function setFilter(filter) {
    $('span.sort_text').addClass('hide');
    $('span#sort_by_' + filter).removeClass('hide');
    $('ul.filters li').removeClass('selected');
    $('li#filter_by_' + filter).addClass('selected');
  }
  function clearWithTextSearch() {
    $('form.item_search_form').addClass('hide');
    $('#with_text_search').val('');
    delete(requestParams.with_text_query);
  }
  function filterItems(partial_href, params) {
    var data = $.extend(requestParams, { sort_order: $('a.sort_order.selected').attr('data-order') });
    if (params) {
      $.extend(data, params);
    }
    $.ajax({
      url: kendo.format("{0}", partial_href),
      data: data,
      beforeSend: function() {
       activatePageLoader();
      }
    }).fail(function() {
      showError('There was a problem.');
      deactivatePageLoader();
    }).done(function(response) {
      deactivatePageLoader();
      $('div.items_wrapper').html(response);
      $("time.timeago").timeago();
    });
  }
  $(function() {
    $('div.header .user_score_chart').easyPieChart({
      lineCap: 'butt',
      lineWidth: mobileDevice ? 3 : 4,
      scaleColor: false,
      size: mobileDevice ? 44 : 60,
      animate: {
        enabled: false
      }
    });
  });