// JavaScript Document

$(document).ready(function(){

	//メニュー隠す
	$("#secondary .rensai").css({display:"none"});
	
	
	$('#secondary .menu .nav01, #secondary .rensai .close').css({cursor:'pointer'})
	
	
	$('#secondary .menu .nav01').click(function(){
		$("#secondary .rensai").css({display:"block"}),
		$('#secondary .rensai')
			//.animate({'left' : '0px'}, 1000, "easeOutQuart")
			// .animate({'left' : '10px'}, 80, "easeOutQuart")
			.animate({'left' : '0px'}, 200, "easeOutQuart");
			return false;
		 }
	);
	
	$('#secondary .rensai li *').click(function(){
		$("#secondary .rensai").css({display:"none"}),
		$('#secondary .rensai').stop().animate({'left' : '-445px'});
		 }
	);
	
	$('#secondary .rensai .close').click(function(){
		$("#secondary .rensai").css({display:"none"}),
		$('#secondary .rensai').stop().animate({'left' : '-445px'});
		 }
	);
	
});

// viewer
$(function() {
	$('.viewer a').click(function() {
	
		var t = String(this);
		var a = t.match(/\/manga\/([-_0-9a-zA-Z]+)\//);
		var n = (a)? a[1]: 'viewer';
		
		window.open(
			t,
			n,
			'width=797, height=680, toolbar=0, menuber=0, scrollbars=0, status=1, resizable=1, top=0, left=0'
		);
		
		return false;
	});
});
// viewer
$(function() {
	$('.viewer2 a').click(function() {
	
		var t = String(this);
		var a = t.match(/\/manga\/([-_0-9a-zA-Z]+)\//);
		var n = (a)? a[1]: 'viewer';
		
		window.open(
			t,
			n,
			'width=932, height=775, toolbar=0, menuber=0, scrollbars=0, status=1, resizable=1, top=0, left=0'
		);
		
		return false;
	});
});

// quiz
$(function() {
	$('.quiz a').click(function() {
	
		var t = String(this);
		
		window.open(
			t,
			'quiz',
			'width=580, height=420, toolbar=0, menuber=0, scrollbars=0, status=1, resizable=1, top=0, left=0'
		);
		
		return false;
	});
});

//scroll to top
$(function() {
	$('.pgtop a[href*=#]').click(function() {
		//if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') &&　location.hostname == this.hostname) {
			var target = $(this.hash);
			target = target.length && target;
			if (target.length) {
				var scldurat = 800;
				var targetOffset = target.offset().top;
				$('html,body')
					.animate(
						{scrollTop: targetOffset}, 
						{duration: scldurat, 
						easing: "easeOutExpo"
						}
					);
				return false;
			}
		//}
	});
});

// pop up
$(function() {
	$('.popwin1 a').click(function() {
		
		var t = String(this);
		
		window.open(
			t,
			'popup',
			'width=600, height=500, toolbar=0, menuber=0, scrollbars=0, status=1, resizable=1, top=0, left=0'
			//'width=' +i.width+ ', height=' +i.height+ ', toolbar=0, menuber=0, scrollbars=0, status=1, resizable=1, top=0, left=0'
		);
			
		return false;
		
	});
});

// pop up
$(function() {
	$('.flvplayer a').click(function() {
		
		var t = String(this);
		
		window.open(
			t,
			'popup',
			'width=570, height=345, toolbar=0, menuber=0, scrollbars=0, status=1, resizable=1, top=0, left=0'
			//'width=' +i.width+ ', height=' +i.height+ ', toolbar=0, menuber=0, scrollbars=0, status=1, resizable=1, top=0, left=0'
		);
			
		return false;
		
	});
});

// pop up
$(function() {
	$('.wazaanm a').click(function() {
		
		var t = String(this);
		
		window.open(
			t,
			'popup',
			'width=640, height=530, toolbar=0, menuber=0, scrollbars=0, status=1, resizable=1, top=0, left=0'
			//'width=' +i.width+ ', height=' +i.height+ ', toolbar=0, menuber=0, scrollbars=0, status=1, resizable=1, top=0, left=0'
		);
			
		return false;
		
	});
});


