// JavaScript Document
$(document).ready(function(){
	//文本滚动 
	function scrollTitle(changeSpeed,scrollSpeed){
	  //alert(11);
	  var con = document.getElementById("list_con");
	  var list = document.getElementById("news_list");
	  
	  /*var list_a=list.getElementsByTagName("a");
	  list_a.innerHTML += list_a.innerHTML;*/
	  
	  list.innerHTML+=list.innerHTML;
	  
	  var items = list.getElementsByTagName("li");
	  //alert('items.length:'+items.length);
	  var timer_1 = setInterval(_scrollTitle,changeSpeed);
	  var heightAll =0;
	  for(var i=0;i<items.length;i++){
		  heightAll += items[i].offsetHeight;
	  }
	  //alert('heightAll:'+heightAll);
	  var heightHalf = parseInt(heightAll/2);
	  con.onmouseover = function(){
		  if(timer_1){
			  clearInterval(timer_1);
			  timer_1=null;
		  }
	  }
	  con.onmouseout = function(){
		  if(timer_1){
			  clearInterval(timer_1);
			  timer_1=null;
		  }
		  timer_1 = setInterval(_scrollTitle,changeSpeed);
	  }
	  function _scrollTitle(){
		  var timer;
		  var num = 30;
		  timer = setInterval(scrollTop,scrollSpeed);
		  function scrollTop(){
		  if(con.scrollTop<heightHalf){
			  con.scrollTop += 3;
			  num -= 3;
			  }
		  else{
			  con.scrollTop = 0;
			  }
		  if(num <= 0){
		  clearInterval(timer);
			  }
		  }
		  //防止页面刷新时滚动错位
		  $(window).unload(function () {
				if(con.scrollTop%30!=0)
				{					
					con.scrollTop=con.scrollTop/30;
					num = 30;
				}
				return false;
			});
	   }

	}
	scrollTitle(3000,50);

	$(".bigad").show(); 
	$(".dia01").hide();
	$(".dia02").hide();
	$(".dia03").hide();
	$(".dia04").hide();
	$(".dia05").hide();
	$(".bigad").animate({ opacity: 0.85 }, 1 ); 
	
	
	/*$(".smallad li").click(function(){
		var i=parseInt($(this).html());
		$(".smallad li").eq(i).css("Left", "-10px");
		$(".bigad ul").animate({marginLeft:-980*i}, "slow");
	});*/
		
		$(".it").hover(function(){
		    $("#content .itbg").fadeIn("500");																		
		},function(){
			$("#content .itbg").fadeOut("500");
		});
		$(".time").hover(function(){
		    $("#content .timebg").fadeIn("500");																		
		},function(){
			$("#content .timebg").fadeOut("500");
		});
		$(".example").hover(function(){
		    $("#content .examplebg").fadeIn("500");																		
		},function(){
			$("#content .examplebg").fadeOut("500");
		});
	/*$(".box").hover(function(){
		$(this).find(".block_shodow").addClass("block_shodow_hover");
		},function(){
			$(this).find(".block_shodow").removeClass("block_shodow_hover");
	});*/
	//广告切换
	$(function() {
		$('.bigad ul').cycle({
			fx:     'scrollLeft',
			timeout: 5000,
			speed:500,
			pager:  '#changeimg'
		});
	});
});

