
/* goto page top */
function backToTop (y) {
	if (!y) var y = document.body.scrollTop || document.documentElement.scrollTop;
	var speed = 15;
	next_position = parseInt (y - y * 2 / speed);
	scrollTo (0, next_position);
	if (next_position > 0) setTimeout ('backToTop (next_position)' , 1);
}



$(function(){

	$('img').bind("contextmenu",function(){
		return false
	})


	/* for biography  */
	if ($('body').is('#biography')) {
	
		$('#member').bind("contextmenu", function(){
			return false
		})

		$('table','#history')
		.addClass('hide')
		.prev()
		.prepend('<span>&nbsp;&gt;&gt; </span>')
		.addClass('a')
		.hover(function(){
			$(this).addClass('hover')
		},function(){
			$(this).removeClass('hover')
		})
		.click(function(){
			$(this).next().toggleClass('hide')
		})
		
	}


	/* for faq */
	else if ($('body').is('#faq')) {
	
		$('ul','#questions')
		.addClass('hide')
		.prev()
		.prepend('<span>&gt;&gt; </span>')
		.addClass('a')
		.hover(function(){
			$(this).addClass('hover')
		},function(){
			$(this).removeClass('hover')
		})
		.click(function(){
			$(this).next().toggleClass('hide')
		})
		
	}


	/* for discography */
	else if ($('body').is('#discography')) {
		
		$('#index')
		.prepend('<ul id="category"><li class="nav01"><a href="">all</a></li><li class="nav02"><a href="">single</a></li><li class="nav03"><a href="">album</a></li><li class="nav04"><a href="">dvd</a></li><li class="nav05"><a href="">other</a></li></ul><div id="stylesheet"><style type="text/css">body#discography ul#category li.nav01 a , body#discography ul#category li.nav01 a:hover { background-position:right 0; }</style></div>')
		
		$('#category a').click(function(){
			var number = parseInt($(this).parent().attr('class').slice(-1))
			if (number == 1) {
				$('#index div.box').show()
				$('#stylesheet').html('<span style="display:none;">css</span><style type="text/css">body#discography ul#category li.nav01 a , body#discography ul#category li.nav01 a:hover { background-position:right 0 !important; }</style>')
			} else {
				$('#index div.box').hide()
				$('#index div.' + $(this).text()).show()
				$('#stylesheet').html('<span style="display:none;">css</span><style type="text/css">body#discography ul#category li.nav0' + number + ' a , body#discography ul#category li.nav0' + number + ' a:hover { background-position:right -' + 25 * (number-1) + 'px !important; }</style>')
			}
			return false
		})
		
	}


	/* for top */
	else if ($('body').is('#top')) {
		
		$('#open').toggle(function(){
			$('#photo > span').stop().animate({height:$('#photo > span > img').height()},1000,'easeOutQuint')
			return false
		},function(){
			$('#photo > span').stop().animate({height:250},100)
			return false
		}).mouseover(function(){
			$('#photo > span > img').stop().fadeTo(0,0.7).fadeTo(1000,1)
		})
		
		$('#photo > a > img').mouseover(function(){
			$(this).stop().fadeTo(0,0.7).fadeTo(1000,1)
		})

		$('#newrelease a').css({opacity:0,background:'#fff'}).hover(function(){
			$(this).css({opacity:0.3})
		},function(){
			$(this).css({opacity:0})
		})

	}

})


