/* --------------------------------------
//
// nikkansports.com  common.js
//
// DATE      : 2008/03/03
// 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);
}



// -------------------------------------------------------------------
// 検索フォーム
// -------------------------------------------------------------------
function focusBG() {
	document.query.keyword.style.background = "url(/img/search-text_bg.gif) repeat-x";
}

function blurBG() {
	//	フォームに文字が入力されている場合は
	//	Gooロゴを表示させない
	if ($('#keyword').val() == ""){
		document.query.keyword.style.background = "url(/img/search-text_bg_goo.gif) no-repeat";
	}
}


function focusText(){
	txt = document.query.MT.value;
	if(txt== "検索キーワード"){
		document.query.MT.value = "";
		document.query.MT.style.color = "#000000";
	}
}

function blurText(){
	txt = document.query.MT.value;
	if(txt==""){
		document.query.MT.value = "検索キーワード";
		document.query.MT.style.color = "#969696";
	}
}


