/* --------------------------------------
//
// nikkansports.com jQuery config.js
//
// DATE      : 2008/03/03
// COPYRIGHT : Nikkan Sports News.
// WRITER    : Chiaki Hatanaka
//
//
-------------------------------------- */




// -------------------------------------------------------------------
// prototype.js の $() とコンフリクトしないための処理
// 　　jquery では、$() を使用すること！
// -------------------------------------------------------------------


$(function(){


	// グローバルナビ画像を <body> の id により差し替える
	//
	var bodyID = $('body').attr('id');

	switch(bodyID) {

		case "baseball":
		$('#globalNavi ol li#naviBB').find('a').html('<img src="/img/global-navi_bb_current.gif" alt="野球ページ" width="50" height="32" />');
		break;

		case "mlb":
		$('#globalNavi ol li#naviMB').find('a').html('<img src="/img/global-navi_mb_current.gif" alt="ＭＬＢページ" width="52" height="32" />');
		break;

		case "soccer":
		$('#globalNavi ol li#naviSC').find('a').html('<img src="/img/global-navi_sc_current.gif" alt="サッカーページ" width="67" height="32" />');
		break;

		case "japan":
		$('#globalNavi ol li#naviJP').find('a').html('<img src="/img/global-navi_jp_current.gif" alt="サッカー日本代表" width="126" height="32" />');
		break;

		case "world":
		$('#globalNavi ol li#naviWD').find('a').html('<img src="/img/global-navi_wd_current.gif" alt="海外サッカー" width="96" height="32" />');
		break;

		case "sports":
		$('#globalNavi ol li#naviSP').find('a').html('<img src="/img/global-navi_sp_current.gif" alt="スポーツ" width="70" height="32" />');
		break;

		case "golf":
		$('#globalNavi ol li#naviGF').find('a').html('<img src="/img/global-navi_gf_current.gif" alt="ゴルフ" width="60" height="32" />');
		break;

		case "motor":
		$('#globalNavi ol li#naviMO').find('a').html('<img src="/img/global-navi_mo_current.gif" alt="モータースポーツ" width="115" height="32" />');
		break;

		case "battle":
		$('#globalNavi ol li#naviBT').find('a').html('<img src="/img/global-navi_bt_current.gif" alt="格闘技" width="63" height="32" />');
		break;

		case "race":
		$('#globalNavi ol li#naviRC').find('a').html('<img src="/img/global-navi_rc_current.gif" alt="競馬" width="48" height="32" />');
		break;

		case "entertainment":
		$('#globalNavi ol li#naviET').find('a').html('<img src="/img/global-navi_et_current.gif" alt="芸能" width="48" height="32" />');
		break;

		case "general":
		$('#globalNavi ol li#naviGN').find('a').html('<img src="/img/global-navi_gn_current.gif" alt="社会" width="49" height="32" />');
		break;


	}


	// <body> の class に応じてジャンルナビに class="current" を追加
	//
	var bodyClass = $('body').attr('class');

	switch(bodyClass) {

		case "newsBacknumber":
		$('#genreNavi ul li#genreNaviNews').find('a').addClass('current');
		break;

		case "photoNews":
		$('#genreNavi ul li#genreNaviPhoto').find('a').addClass('current');
		break;

	}



	// 奇数、偶数をクラスとして追加
	//
	$('table').each(function(){
		$(this).find('tr:odd').addClass('odd');
		$(this).find('tr:even').addClass('even');
	});

	
	// :first-child, :last-childをクラスとして追加
	//
	$('.line').each(function(){
		$('li:first-child').addClass('firstChild');
		$('li:last-child').addClass('lastChild');
	});


	// :hoverをクラスとして追加
	//
	$('tr.bgColor').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});

	$('.thumWrap p').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});

	$('.thumWrap dt').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});


	// 属性セレクタをクラスとして追加
	//
	$('input[@type="text"]').addClass('text');
	$('input[@type="image"]').addClass('image');


});
