// JavaScript Document
//監聽=======
$(document).ready(function() {
						   
	//置換各flash
	setTitle();
	setBack();
	setIndexShow("c");
	setLogo();
	setMediaFlash();
	
	//設定常數
	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);
	
	
	$('.thumbs').piroBox({
			mySpeed: 500,  
			bg_alpha: 0.7,
			pathLoader : 'url(../css/css_pirobox/ajax-loader_w.gif) center center no-repeat;', 
			gallery : '.photolist li a', 
			gallery_li : '.photolist li', 
			next_class : '.next_in',
			previous_class : '.previous_in'
	});
	
});

function openBlogWindow(theURL,Wwidth,Wheight) { 
  var setStr = 'width='+Wwidth+',height='+Wheight+',scrollbars=yes,resizable=yes';
  window.open(theURL,'popBlogWindow',setStr);
}

function Add_Favorite(title,url) { 
	//title = "S-WAGON Motor Club"; 
	//url = "http://www.s-wagon.net/&quot";
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	}else if(window.external ) {
		window.external.AddFavorite( url, title);
	}else if(window.opera && window.print) {
		return true;
	}
} 
