$(document).ready(function(){

	$('#navi').scrollFollow({speed:500,offset:0});	
	
	//for CONTAINER
	//$('.accordion').next().hide();
	$('#container h3.accordion').click(function(){
		$('#container h3.accordion').removeClass('active');						   
		$(this).addClass('active');
		$(this).next().slideToggle(500,function() {
			
			if ($(this).is(':hidden')) {
				$(this).prev().css("background-image","url(assets/images/arrow-right.gif)");
			} else { 
				$(this).prev().css("background-image","url(assets/images/arrow-down.gif)");
				$('#container h3.accordion').not('#container h3.active').css("background-image","url(assets/images/arrow-right.gif)");
			}
		var scrolls = $(this).prev().offset().top;
		$('html,body').animate({scrollTop: scrolls}, 500);				
		});
	});	

	
	//for COMPILE
	//$('.accordion_bk').next().hide();	
	$('#container h3.accordion_bk').click(function(){
		$('#container h3.accordion_bk').removeClass('active');
		$(this).addClass('active');
		$(this).next().slideToggle(500,function() {
			if ($(this).is(':hidden')) {
				$(this).prev().css("background-image","url(assets/images/arrow-right-bk.gif)");
			} else { 
				$(this).prev().css("background-image","url(assets/images/arrow-down-bk.gif)");
			}
		var scrolls = $(this).prev().offset().top;
		$('html,body').animate({scrollTop: scrolls}, 500);
		});
	});	

	//for MAP
	$('#info-store a.link-map').parent().parent().next().hide();
	$('a.link-map').click(function(){
		$(this).parent().parent().next().slideToggle(500,function() {
			if ($(this).is(':hidden')) {
			} else { 
			}
		});
		return false;
	});	

	//for slide-next
	$('#container h5.slide-next').next().hide();
	$('#container h5.slide-next').click(function(){
		$(this).next().slideToggle(500,function() {
			if ($(this).is(':hidden')) {
			} else { 
			}
		});
		return false;
	});	
	
	//MouseOver
	$('a img').hover(function(){ 
		$(this).fadeTo(400,0.3); 
	},function() {
		$(this).fadeTo(400,1); 
	});
	

	//SlideImage
	$('#container ul.thumb > li > a').click(function(){
		var src = $(this).attr("href");
		$(this).parent().parent().find("a").removeClass("selected");
		$(this).addClass("selected");
		$(this).parent().parent().parent().find("span").find("img").fadeOut("slow",function() {
			$(this).unbind().attr("src",src).fadeIn();
		});
		return false;
	});
	
	$('#container ul.thumb2 > li > a').click(function(){
		var src = $(this).attr("href");
		$(this).parent().parent().find("a").removeClass("selected");
		$(this).addClass("selected");
		$(this).parent().parent().parent().find("span").find("img").fadeOut("slow",function() {
			$(this).unbind().attr("src",src).fadeIn();
		});
		return false;
	});

	//usw mouseover
	$('#usw #usw-start > img').hover(function(){ 
		$(this).fadeTo(400,0);
	},function() {
		$(this).fadeTo(400,1)
	});

	//usw SlideImage
	$('#usw ul.thumb > li > a').click(function(){
		var src = $(this).attr("href");
		$('#usw-start').css("background","none");
		$(this).parent().parent().find("a").removeClass("selected");
		$(this).addClass("selected");
		$(this).parent().parent().parent().find("span").find("img").fadeOut("slow",function() {
			$(this).unbind().attr("src",src).fadeIn();
		});
		return false;
	});
	
	//SmoothScroll
	jQuery.easing.quart = function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; };
	$('div.link-top a').click(function () { $('html,body').animate({ scrollTop: 0 }, 1000, 'quart'); });

	$('#navi a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target
			|| $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body')
				.animate({scrollTop: targetOffset}, 500);
				return false;
			}
		}
	});
	
	
	/*
	var scrollbar = function() {
		$('#scroll').jScrollPane({showArrows:true,scrollbarWidth:25});	
	}
	scrollbar();
	*/

});

//window oepn
function openWindow(url,windowname) {
	var features="location=no, menubar=no, status=no, scrollbars=no, resizable=yes, toolbar=no, scroll=no";
	var width=1024;
	var height=710;
	
	if (width) {
		if (window.screen.width > width) features+=", left="+(window.screen.width-width)/2;
  		else width=window.screen.width;
  		features+=", width="+width;
 	}
	if (height) {
		if (window.screen.height > height) features+=", top="+(window.screen.height-height)/2;
		else height=window.screen.height;
		features+=", height="+height;
	}
	var win = window.open(url,windowname,features);
	win.focus();
}