let pop_scroll = 0;

$.fn.pop_show = function() {
	this.fadeIn(100, function() {
		$(window).scrollTop(0);
		$('body').css({
			'position': 'fixed',
			'left': '0',
			'width': '100%'
		});
	});
	return this;
};

$.fn.pop_hide = function() {
	$('body').removeAttr('style');
	$(window).scrollTop(pop_scroll);
	pop_scroll = 0;
	this.fadeOut(100);
	return this;
};

$(function() {

	pop_load = $('#pop_load');

	//ページ遷移
	$(window).
	on('beforeunload', function() {
		pop_load.show();
		setTimeout(function() {
			pop_load.hide();
		}, 5000);
	});

	$('.top_menu').
	hover(
		function() {
			$(this).children('.cate_list').show();
		},
		function() {
			$(this).children('.cate_list').hide();
		}
	).
	children('a').
//	on('touchend', function() {
//		$(this).next('.cate_list').hide();
//		location.href = $(this).attr("href");
//		return false;
//	}).
	on('click', function() {
		$(this).next('.cate_list').hide();
	});
	$(document).on('touchend', function(e) {
		var li = $('.top_menu > .cate_list:visible');
		if (! $(e.target).closest(li).length) {
			li.hide();
		}
	});

	pop_load.fadeOut(100);

});