/*//////////////////////////////////////////////

 トップページ表示用

*///////////////////////////////////////////////

$(function(){
	
//IE6の背景ズレ対応
	$("#topNavi").css("background-position","0");

	
//JSON読み込み

	//// Ajaxリクエストのキャッシュを防ぐ対策
	var TimeStamp = '?timestamp='+(new Date()).getTime();

	////JSONファイル名
	var JSON_Id01 = "/json/newstopics.json";
	var JSON_Id02 = JSON_Id01+TimeStamp;
	
    $.getJSON(JSON_Id02 ,function(data){
		
		//ニューストピックスを表示
		$.each(data,function(i,items){
			var MtUrl_01 = window.location.hostname;
			var Img_01 = items.Img.replace("http://"+MtUrl_01, "");
			if (i == "0") {
				$("#topLineupTopics").append("<div class='bkNone'><a href='" + items.Url + "'><img src='" + Img_01 + "' alt='' width='66' height='66' /></a><p>" + items.Date + "</p><a href='" + items.Url + "'>" + items.Title + "</a></div>");
			}else{
				$("#topLineupTopics").append("<div class='bkLine'><a href='" + items.Url + "'><img src='" + Img_01 + "' alt='' width='66' height='66' /></a><p>" + items.Date + "</p><a href='" + items.Url + "'>" + items.Title + "</a></div>");
			}
		});
	
	});
	
//画面サイズ取得
function WinSet(){
	var left_01 = $(window).width();
	var left_02 = (left_01 - 1008) / 2 + 523;
	$("#background img").css("marginLeft", left_02);
}

//ロード時
window.onload= function() {
	WinSet();
}
//リサイズ時
window.onresize = function(){
	WinSet();
}
	
//画像切替

	//初期透過設定
	$("#background div:last-child").css("display","block");
	
	var setImg = setTimeout(function(){
		$("#background div").css("display","block");
	}, 3900);
	
	//ループ表示スライド自動移動
	var roopImg01 = setInterval(function(){
		//IE6の場合
		if ($.browser.msie && $.browser.version == 6){
			 $("#background div:last").prependTo("#background");
		}
		//IE6以外
		else
		{
			//フェードアウト・移動
			$("#background div:last").fadeOut("slow",function() { $(this).prependTo("#background"); });
			//フェードイン
			$("#background div:first").fadeIn("slow");
		} 
	}, 4000);
	

//ポップアップメニュー

	//シャルレについて
	$("#gtnav1").click(function(){
		$("#popNavi_v4").fadeIn("slow");
		$("#topLineup:not(:animated)").animate({
			marginTop: "184px"
		}, 1000 ,"swing");
	});
	
	//閉じる
	$("#popNavi_v4 .closed").click(function(){
		$("#popNavi_v4").fadeOut("slow");
	});
	

//サブナビゲーション

	//ニューストピックス
	$("#lnnav1").click(function(){
		$("#topLineup:not(:animated)").animate({
			marginTop: "32px"
		},"slow","swing");
		$("#topLineupProduct").fadeOut("slow");
		$("#topLineupTopics").fadeIn("normal");
		$("#popNavi_v4").fadeOut("slow");
		$("#lnnav1").css("background-position-y","0px");
		$("#lnnav2").css("background-position-y","-30px");
	});
	
	//プロダクトラインナップ
	$("#lnnav2").click(function(){
		$("#topLineup:not(:animated)").animate({
			marginTop: "0px"
		},"slow","swing");
		$("#topLineupProduct").fadeIn("normal");
		$("#topLineupTopics").fadeOut("slow");
		$("#popNavi_v4").fadeOut("slow");
		$("#lnnav1").css("background-position-y","-30px");
		$("#lnnav2").css("background-position-y","0px");
	});
	
	//閉じる
	$("#lnnav3").click(function(){
		$("#topLineup:not(:animated)").animate({
			marginTop: "184px"
		}, 1000 ,"swing");

		$("#popNavi_v4").fadeOut("slow");
		$("#lnnav1").css("background-position-y","0px");
		$("#lnnav2").css("background-position-y","0px");
	});
	
});

