; (function ($) {
	const hash = window.location.hash.replace('#', '').split('#')[1];
	$(window).on('hashchange', function() {
		let hash = window.location.hash.replace('#', '').split('#')[1];
		
		if ('get-start' === hash || 'recommended' === hash || 'lite-to-pro' === hash || 'pro-plugins' === hash || '#tab=help' === window.location.hash) {
			$('.csf-nav.csf-nav-options ul li:last-child a').addClass('csf-active');
			$('.csf-section[data-section-id="help"]').show();
		}
		if( !hash && '#tab=help' !== window.location.hash ) {
			$('.csf-section[data-section-id="help"]').hide();
		}
	})
	// Help page tab menu script.
	$('.vchat').on('click', '.header_nav a', function (e) {
		if ($(this).hasClass('active')) {
			return;
		}
		let tabId = $(this).attr('data-id');
		$('.header_nav a').each((i, item) => {
			$(item).removeClass('active');
			$('#' + $(item).attr('data-id')).css('display', 'none');
		})
		$(this).addClass('active');

		$('#' + tabId).css('display', 'block');
	})

	if ('get-start' === hash || 'recommended' === hash || 'lite-to-pro' === hash || 'pro-plugins' === hash) {
		$('.csf-nav.csf-nav-options ul li:last-child a').addClass('csf-active');
		$('.csf-section[data-section-id="help"]').show();
	}

	if ('get-start' === hash) {
		$('.vchat .header_nav a[data-id="get-start-tab"]').trigger('click');
	}

    if ('recommended' === hash) {
		$('.vchat .header_nav a[data-id="recommended-tab"]').trigger('click');
	}
	if ('lite-to-pro' === hash) {
		$('.vchat .header_nav a[data-id="lite-to-pro-tab"]').trigger('click');
	}
	if ('pro-plugins' === hash) {
		$('.vchat .header_nav a[data-id="pro-plugins-tab"]').trigger('click');
	}

	$('body').on('click', '.install-now', function (e) {
		var _this = $(this);
		var _href = _this.attr('href');

		_this.addClass('updating-message').html('Installing...');

		$.get(_href, function (data) {
			location.reload();
		});

		e.preventDefault();
	});

})(jQuery);