/* IE6ちらつき回避
************************************************************/

try { 
document.execCommand('BackgroundImageCache', false, true); 
} catch(e) {} 



/* 共通ロールオーバーイベント
************************************************************/

function roEvent() {
	var allImg = document.getElementsByTagName('img');
	var allInput = document.getElementsByTagName('input');
	for (var i = 0; i < allImg.length; i++) {
		if (allImg[i].className == 'roBtn') {
			runROEvent(allImg[i]);
		}
	}
	for (var i = 0; i < allInput.length; i++) {
		if (allInput[i].className == 'roBtn') {
			runROEvent(allInput[i]);
		}
	}
}

function runROEvent(roImg) {
	roImg.onmouseover = function() {
		var src = this.getAttribute("src");
		var ftype = src.substring(src.lastIndexOf('.'), src.length);
		this.setAttribute("src", src.replace(ftype, "_o" + ftype));
	}	
	
	roImg.onmouseout = function() {
		var src = this.getAttribute("src");
		var ftype = src.substring(src.lastIndexOf('.'), src.length);
		this.setAttribute("src", src.replace("_o" + ftype, ftype));
	}
}

/* ポップアップ関数
************************************************************/

function subWin(theURL,winName,features) {
	var winFocus;
	winFocus = window.open(theURL,winName,features);
	winFocus.focus();
}

/* 実行処理
************************************************************/

window.onload = function(){
	roEvent();
	setHeaderNavigation()
}


/* 検索フォーム未入力チェック
************************************************************/

function SFcheck(){ 

var flag = 0; 

if(document.GoogleSearch.q.value == ""){ // 入力チェック 
flag = 1; 
}

else if(document.GoogleSearch.q.value == " "){ // 入力チェック 
flag = 1; 
}

else if(document.GoogleSearch.q.value == "　"){ // 入力チェック 
flag = 1; 
}

// 設定終了 


if(flag){ 
window.alert('キーワードをご入力ください'); // 未入力であればダイアログを表示 
return false; // 中止 
} 
else{ 
return true; // 実行
} 

} 


/* ナビゲーションの展開処理 2011
******************************/

function setHeaderNavigation()
{
	var headSnav = $("#headSnav div")
	
	$("#headGnav ul li").hover(function()
	{
		var thisUl = headSnav.eq($(this).index());		
		headSnav.hide();
		//thisUl.slideDown(500);
		thisUl.show()
	},function()
	{
	});
	$("#contents,#wrapper,.headerLogo,#headRight").bind("mouseover",function()
	{
		headSnav.hide();
	});
	
}

$(document).ready(function(){
	var ua = navigator.userAgent;
	if (ua.indexOf('iPhone') > 0 || ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0 || ua.indexOf('iPod') > 0){
		$('#headSrc').width(287);
		//alert($('body').attr("class"))
	}
});

