//MOVEING OBJECT-----------------------------------------------------

(function($) {

		$(document).ready(function() {
			$(".first li, .second li").hover(function() { 
				$(this).animate({ marginRight: 4 },150);
			}, function() { 
				$(this).animate({ marginRight: 0 }, 150);
			});

			$(".jump").hover(function() { 
				$(this).animate({ marginRight: -2 },150);
			}, function() { 
				$(this).animate({ marginRight: 0 }, 150);
			});

			$("#open").hover(function() { 
				$(this).animate({ paddingTop: 2 },150);
			}, function() { 
				$(this).animate({ paddingTop: 0 }, 150);
			});

			$("#close").hover(function() { 
				$(this).animate({ paddingTop: 2 },150);
			}, function() { 
				$(this).animate({ paddingTop: 0 }, 150);
			});

			$(".totop").hover(function() { 
				$(this).animate({ paddingTop: 2 },150);
			}, function() { 
				$(this).animate({ paddingTop: 0 }, 150);
			});
		});
})(jQuery);


//SITE MAP------------------------------------------------------

$(function() {

	$("#open").click(function(){
		$('#main').animate({paddingBottom: 154},300);
		$("#site_map").slideDown("500");
		var targetOffset = $('#site_map').offset().top;
		$('html,body').animate({scrollTop: targetOffset},1000);
	});

	$("#close").click(function(){
		$("#main").animate({paddingBottom: 0});
		$("#site_map").slideUp("500");
	});

//botton
	$("#open").click(function(){
		$("#open").fadeOut("fast");
		$("#close").fadeIn("slow");
	});

	$("#close").click(function(){
		$("#open").fadeIn("slow");
		$("#close").fadeOut("fast");
	});
});


//SEARCH DISPLAY------------------------------------------------------

$(function() {

	$("#search_open").click(function(){
		$("#search").slideDown("fast");
		$("#search_open").fadeOut("fast");
		$("#search_close").fadeIn("fast");
	});

	$("#search_close").click(function(){
		$("#search").slideUp("fast");
		$("#search_open").fadeIn("fast");
		$("#search_close").fadeOut("fast");
	});
});


//HELP DISPLAY------------------------------------------------------

$(function() {

	$("#help_open").click(function(){
		$(".sup").slideDown("fast");
		$("#help_open").fadeOut("fast");
		$("#help_close").fadeIn("fast");
	});

	$("#help_close").click(function(){
		$(".sup").slideUp("fast");
		$("#help_open").fadeIn("fast");
		$("#help_close").fadeOut("fast");
	});
});


//TO PAGE TOP------------------------------------------------------

function TOP() {
	var aTagList = document.getElementsByTagName('a');
	for (var i = 0; i < aTagList.length; i++) {
		if (aTagList[i].href.match(/#top/i)) {
			aTagList[i].onclick = goPageTop;
		}
	}
}
var MOVE = 20;
var POSITION;
function goPageTop() {
	var yPos = document.body.scrollTop || document.documentElement.scrollTop;
	mObj(yPos);
	return false;
}
function mObj(y, s) {
	if (s) MOVE = s;
	POSITION = parseInt(y - y * 2 / MOVE);
	scrollTo(0, POSITION);
	if (POSITION > 0) setTimeout('mObj(POSITION, MOVE)', 1);
}
if (window.addEventListener) window.addEventListener('load', TOP, false);
if (window.attachEvent) window.attachEvent('onload', TOP);


//OUTLINE BLUR------------------------------------------------------
window.onload = outline;
function outline (){
var tgt = function (){ this.blur() };
for (var i = 0; i < document.links.length; i++)
document.links[i].onfocus = tgt;
}

