/*
//
// beijing2008.nikkansports.com  config.js
//
// DATE      : 2007/11/05
// COPYRIGHT : Nikkan Sports News.
// WRITER    : Chiaki Hatanaka
//
//
 */




// -------------------------------------------------------------------
// OS、ブラウザ判別
// -------------------------------------------------------------------
var ua = navigator.userAgent;
var an = navigator.appName;

var Explorer7 = ( ua.indexOf("MSIE 7", 0) >= 0 );
var Explorer6 = ( ua.indexOf("MSIE 6", 0) >= 0 );
var Explorer5 = ( ua.indexOf("MSIE 5", 0) >= 0 );
var Explorer = ( ua.indexOf("MSIE", 0) >= 0 );
var Mozilla5 = ( ua.indexOf("Mozilla/5", 0) >= 0 );
var Mozilla4 = ( ua.indexOf("Mozilla/4", 0) >= 0 );
var Opera = ( an.indexOf ("Opera") != -1 );

if ( ua.indexOf ("Mac") != -1 ) {

	// Macintoshは字間を詰める
	document.writeln('<style type="text/css">');
	document.writeln('*{ letter-spacing: -0.05em; }');
	document.writeln('</style>');

	} else {

	if ( Explorer6 || Explorer5 ) {

		// 透過pngを使用する
//		document.writeln('<script type="text/javascript" src="/js/iepng.js"></script>');

		// min-max用
		document.writeln('<script type="text/javascript" src="/js/height-minmax.js"></script>');
	}
}



// -------------------------------------------------------------------
// ロールオーバー
// -------------------------------------------------------------------
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match(/_off\./))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace(/_off\./, "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace(/_on\./, "_off."));
				}
			}
		}
	}
}

if (window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if (window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}




// -------------------------------------------------------------------
// for jQuery
// -------------------------------------------------------------------
$(document).ready(function() {


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

	// :hoverをクラスとして追加
	$('tr').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});

	$('.scheduleMenuTable table td').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});

	$('#wnpaTable').each(function(){
		$('caption + th').addClass('left');
	});


	$('#medalRank').each(function(){
		$('td:nth-child(2)').addClass('left');
	});


});




