$(document).ready(function(){
	//ティッカー
	setTicker();
	
	//マウスオーバー
	setBtnMouseOver();
});

function setTicker(){
	var speed = 700;
	var pause = 6000;
	var totalitems = $('#ticker ul li').length;
	var cnt = 0;
	function nextItem(){
		if(cnt < totalitems){
			cnt++;
			$('#ticker ul').animate({"top": "-=25px"}, speed, function() {
				if(cnt == totalitems){
					$('#ticker ul')
					//.css({"top": "0px", "display": "none"})
					//.fadeIn('slow');
					.css({"top": "25px"})
					.animate({"top": "0px"}, speed);
					cnt = 0;
				}
			});
		}
	}
	interval = setInterval(nextItem, pause);
}

function setBtnMouseOver(){
	$("a img.over").each(function() {
		var off = this.src;
		var dot = this.src.lastIndexOf('.');
		var on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
		var img = $("<img>").attr({
			src: on
		});
		$(this).hover(
			function() { this.src = on; },
			function() { this.src = off; }
		);
	});
}

