// JavaScript Document
function slideLine(box,delay,speed,h){
	var slideBox = document.getElementById(box);
	var delay = delay||1000,speed = speed||20,h = h||20;
	var tid = null,pause = false;
	var s = function(){tid=setInterval(slide, speed);}
	
	var slide = function(){
		if(pause) return;
		slideBox.scrollTop += 1;
		if(slideBox.scrollTop%h == 0){
			clearInterval(tid);
			$('#ann_box').append($('#ann_box > li:first'));
			slideBox.scrollTop = 0;
			setTimeout(s, delay);
		}
	}
	$('#ann_box').hover(function(){pause=true;},function(){pause=false;});
	setTimeout(s, delay);
}

function checkHover() {
	if (obj) {
		obj.find('ul').fadeOut('fast');	
	} //if
} //checkHover

$(function(){
	
	$('#menu > li').hover(function() {
		if (obj) {
			obj.find('ul').fadeOut('fast');
			obj = null;
		} //if
		$(this).find('ul').fadeIn('fast');
	}, function() {
		obj = $(this);
		setTimeout( "checkHover()",	400);
	});

	slideLine('ann_box',1000,100,20);
})

