$(function(){
	var scrtime;
 	$("#con").hover(function(){
		clearInterval(scrtime);
	},function(){
	scrtime = setInterval(function(){
		var $lg = $("#con .everysay");
		var dlHeight = $lg.find("li:last").height();
		$lg.animate({marginTop : dlHeight+15 +"px"},1000,function(){
		
		$lg.find("li:last").prependTo($lg)
		$lg.find("li:first").hide();
		$lg.css({marginTop:0});
		$lg.find("li:first").fadeIn(1000);
		});	
	},5000);
	}).trigger("mouseleave");
});
var setint = null;
var nowplay = 1;
$(function(){
	setint=setInterval(function(){ nowplay++; nowplay = nowplay >=4 ? 1: nowplay; autoplay();},5000);
	var $ahover=$('#num').find('a');
	$ahover.each(function(index){
		$ahover[index].onmouseover=function(){
			clearInterval(setint);
			$(this).parent().children().removeClass('hover');
			$(this).addClass("hover");
			var showli = $("#imgplay").find("li:visible");
			showli.hide();
			$("#li_"+$(this).text()).fadeIn(500);
		}
		$ahover[index].onmouseout=function(){
			nowplay=index+1;
			setint=setInterval(function(){ nowplay++; nowplay = nowplay >=4 ? 1 : nowplay; autoplay();},5000);
		}
	});
});
function autoplay(){
	$('#num').children().removeClass('hover');
	$('#num a').eq(nowplay-1).addClass("hover");
	var showli = $("#imgplay").find("li:visible");
	showli.hide();
	$("#li_"+nowplay).fadeIn(500);
}

function moveKey(type)
{
	var b = $("#keyword").find("a");
	var c = 0;
	
	if(b.length<=5) return false;
	for(var i=0;i<b.length;i++)
	{
		if(b[i].style.display=='inline' || b[i].style.display=='')
		{
			c = i;break;
		}
	}
	
	if(type=='left')
	{
		
		if(c<=0)
		{
			return false;
		}
		
		if(b[c-1])
		{
			b[c-1].style.display = "inline";
			b[c+4].style.display = "none";
		}
		
	}else{
		
		if(c>=b.length)
		{
			return false;
		}
		
		if(b[c+5])
		{
			b[c+5].style.display = "inline";
			b[c].style.display = "none";
		}	
	}
}
function in_array(v, a) {  
  var i;  
  for (i = 0; i < a.length; i++) {  
    if (v === a[i]) {  
      return i;  
    }  
  }  
  return -1;  
}
s=document.getElementsByTagName("A");
