// JavaScript Document
//監聽=======
$(document).ready(function() {
						   
	//置換各flash
	setTitle();
	setLogo();	
	setlimpid_Y_Flash();
	
	setMotion();
	
	//設定常數
	setBroser();
	setStillV(ScaleSide);
	
	
	//計算頁面上各個的位置
	header_and_footer();
	
	//改變視窗大小時，相關的設定...
	$(window).bind("resize",header_and_footer);
		
	//menu
	menusetup();
	
	// footer 的展開與收縮
	$("#footer .tag").toggle(
		function () {
			footer_move(true);
		},
		function () {
			footer_move(false);
		}
	);	
	
	
	//footer slideshow 設定每3秒有slideshow的效果
	if($(".hot_news ul li").length>(Math.floor(($(".hot_news").width()+1)/420))){
		var setIntervalA = setInterval("newsSlideshow()", 8000);
		$(".hot_news ul li a").bind("mouseover",function(){clearInterval(setIntervalA);});
		$(".hot_news ul li a").bind("mouseout",function(){setIntervalA=setInterval("newsSlideshow()", 8000);});
	}
	
	//ajax監聽(loading圖)
	$("#loadingImg").bind("ajaxSend", function(){
	  $(this).show();
	  $("#loadingImg").css("width",$(".newslist ul").css("width")); //設定loading畫面的寬
	}).bind("ajaxComplete", function(){
	  $(this).hide();
	});
	//ajax==========================================
	newslistAjax(0);
	
	
	
});


var t1 = new Sequence();
var t2 = new Sequence();
function setMotion(){
	var target = $(".content").children();	
	
	for(var i=0;i<target.length;i++){
		t1.addChild(new OpacityTween(target[i],Tween.regularEaseOut,0,100,0.5));
		t2.addChild(new Tween(target[i].style,'marginTop',Tween.backEaseOut,30,0,0.5,'px'));

	}
	t2.start();
	t1.start();
}

