// JavaScript Document
// Menu
$(document).ready(function() {

	$("#navi li").prepend("<span></span>"); //Throws an empty span tag right before the a tag

	$("#navi li").each(function() { //For each list item...
		var linkText = $(this).find("a").html(); //Find the text inside of the <a> tag
		$(this).find("span").show().html(linkText); //Add the text in the <span> tag
	}); 

	$("#navi li").hover(function() {	//On hover...
		$(this).find("span").stop().animate({
			marginTop: "-49" //Find the <span> tag and move it up 40 pixels
		}, 250);
	} , function() { //On hover out...
		$(this).find("span").stop().animate({
			marginTop: "0"  //Move the <span> back to its original state (0px)
		}, 250);
	});

	$("#navi li#navi_0").hover(function() {	//On hover...
		$(this).find("span").stop().animate({
			marginTop: "-150" //Find the <span> tag and move it up 40 pixels
		}, 250);
	} , function() { //On hover out...
		$(this).find("span").stop().animate({
			marginTop: "0"  //Move the <span> back to its original state (0px)
		}, 250);
	});

	$("#navi li#navi_7").hover(function() {	//On hover...
		$(this).find("span").stop().animate({
			marginTop: "-69" //Find the <span> tag and move it up 40 pixels
		}, 250);
	} , function() { //On hover out...
		$(this).find("span").stop().animate({
			marginTop: "0"  //Move the <span> back to its original state (0px)
		}, 250);
	});

});

// Crients
$(function(){

$('#ticker').wrapAll('<div id="client_loopslider_wrap"></div>');
	var loopsliderHeight = $('#ticker').height();
	var loopWidth = 4015;
	var loopTime = 60000; // アイコンが一周するのにかかる時間
	
	$('#client_loopslider_wrap').css({
		width: ((loopWidth) * 2),
		height: 54,
		overflow: 'hidden',
		position: 'fixed',
		'border-top': '1px solid #001721',
		'border-bottom': '1px solid #001721',
		background: 'white'
	});
	
	
	$('#client_loopslider_wrap ul').css({
		width: (loopWidth)
	});

	$('#client_loopslider_wrap>ul').clone().appendTo('#client_loopslider_wrap');

	var current = 0;	
	loopsliderPosition();
	function loopsliderPosition(){
		var _loopTime = current != 0 ? loopTime -(loopTime/(loopWidth/-(current))) : loopTime;

		$('#client_loopslider_wrap').css({left: current});
		current = 0;
		$('#client_loopslider_wrap').animate({left:'-' + (loopWidth) + 'px'}, _loopTime, 'linear', function(){loopsliderPosition();});
	};
	
	$('#pagetop').click(function(){
		$('body, html').animate({
			scrollTop: 0
		});
	});
});
