var version, browser;


$(function(){

	jQuery.each(jQuery.browser, function(i, val){ //ブラウザの判別
		if(i == "version"){ //バージョンの取得
        	version = val;
		}else if(val){ //種類の取得
			browser = i;
		}
	});
	
	

	/* ==
	
	　メインビジュアル切替（#mainVisual）
	
	============================================================================================== */
	$("#mainVisual #nav dd li").each(function(i){
		$(this).hover(function(){
		
			$("#mainVisual #contents > div").hide();
			$("#mainVisual #contents > div").eq(i+1).show();
			
			$("#mainVisual #nav dd li a").css("backgroundPosition", "left top");
			$(this).children("a").css("backgroundPosition", "right top");
		
		},function(){
			//処理なし
		});
	});
	
	//Macの場合の処理
	if(navigator.userAgent.indexOf("Mac") >= 0){
		$("#mainVisual #contents div > ul").css("paddingBtm", "5px");
		$("#mainVisual #contents div li").css("marginBottom", "3px");
	}


	/* ==
	
	　コンテンツ一覧（.list_cnts）
	
	============================================================================================== */
	$("div.cnts_ir > div > ul > li").each(function(i){
		if(i != 0){
			$(this).hover(function(){
				$(this).children("div").show();
				$(this).children("a").css("backgroundColor", "#ddd");
				if(browser == "msie"){
					if((version == "7.0")||(version == "6.0")){
						$(this).css("marginBottom", "0"); //IE6,IE7で要素がずれるのを防ぐ
					}
				}
			},function(){
				$(this).children("div").hide();
				$(this).children("a").css("backgroundColor", "transparent");
				if(browser == "msie"){
					if((version == "7.0")||(version == "6.0")){
						$(this).css("marginBottom", "2px"); //「IE6,IE7で要素がずれるのを防ぐ」処理を元に戻る
					}
				}
			});
		}
	});


	/* ==
	
	　タブコンテンツ（#tabCnts）
	
	============================================================================================== */
	var thisCnts = [];
	
	$("#tabCnts div.tab").each(function(){
										
		$(this).find("li").each(function(j){
			
			thisCnts[j] = $(this).children("a").attr("href");
			$(this).children("a").attr("href", "javascript:void('0');");

			$(this).bind("click", function(){
				
				$("#tabCnts div.tab").find("li").children("a").css("backgroundPosition", "left top");
				$("#tabCnts div.tabTop").find("li").eq(j).children("a").css("backgroundPosition", "left bottom");
				$("#tabCnts div.tabBtm").find("li").eq(j).children("a").css("backgroundPosition", "left bottom");
				
				$("#tabCnts div.contents").load(thisCnts[j]);
			
			});
		
		});
	
	});

	//初期表示
	$("#tabCnts div.contents").load(thisCnts[0], function(html, status){ if(status == "success"){ $("#loadTabCnts").remove(); } });



});



