//Script For Change Image
function initRollovers() {
	if (!document.getElementById) return

	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

//onload Script
window.onload = function() {
	initRollovers();
}

//フォームアクションを変更する
function changeFormAction() 
{
	//献立から探すが選択された場合
	if(document.searchForm.searchItem[1].checked == true)
	{
		//テキストに値が入っていない場合はエラーページに遷移する
		if(document.searchForm.searchTxt.value != "")
		{
			document.searchForm.action="/cs/catalog/recipe_menu/1.htm";
			document.searchForm.submit();
		}
		else
		{
			document.searchForm.action="/htm/search_blank_menu.htm";
			document.searchForm.submit();
		}
	}
	//レシピから探すが選択された場合
	else
	{
		//テキストに値が入っていない場合はエラーページに遷移する
		if(document.searchForm.searchTxt.value != "")
		{
			document.searchForm.action="/cs/catalog/recipe_recipe/srt1_s1/1.htm";
			document.searchForm.submit();
		}
		else
		{
			document.searchForm.action="/htm/search_blank_recipe.htm";
			document.searchForm.submit();
		}
	}
}

//フォームアクションを変更する
//function changeFormAction() 
//{
//	//献立から探すが選択された場合
//	if(document.searchForm.searchItem.selectedIndex != 0)
//	{
//		//テキストに値が入っていない場合はエラーページに遷移する
//		if(document.searchForm.searchTxt.value != "")
//		{
//			document.searchForm.action="/cs/catalog/recipe_menu/1.htm";
//			document.searchForm.submit();
//		}
//		else
//		{
//			document.searchForm.action="/htm/search_blank_menu.htm";
//			document.searchForm.submit();
//		}
//	}
//	//レシピから探すが選択された場合
//	else
//	{
//		//テキストに値が入っていない場合はエラーページに遷移する
//		if(document.searchForm.searchTxt.value != "")
//		{
//			document.searchForm.action="/cs/catalog/recipe_recipe/srt1_s1/1.htm";
//			document.searchForm.submit();
//		}
//		else
//		{
//			document.searchForm.action="/htm/search_blank_recipe.htm";
//			document.searchForm.submit();
//		}
//	}
//}

//テキストの文字色を黒に変更する
function changeTextColor() 
{
	document.getElementById('searchTxt').style.color='Black'; 

}

//セレクトボックスを「レシピから探す」に変更する
function changeSelectBox() 
{
	document.searchForm.searchItem.selectedIndex=0;

}

//テキストを空にする
function changeTextBlank() 
{
	document.searchForm.searchTxt.value='';

}

//テキスト制御
function changeTextControl() 
{
	if(document.getElementById('searchTxt').value=='例）キャベツ サラダ')document.getElementById('searchTxt').value=''; 
	document.getElementById('searchTxt').style.color='Black';

}

//AdSense for text
google_ad_client='ca-nifty_js';
google_ad_output='js';
google_max_num_ads=3;
google_language='ja';
google_encoding='sjis';
google_safe='high';
google_adtest='off';
google_ad_channel='etc';

function google_ad_request_done(){
	if(google_ads.length>0){
		var str="";
		str+='<dl>';
		for(i=0;i<google_ads.length;i++){
			str+='<dt><a href="'+google_ads[i].url+'">'+google_ads[i].line1+'</a></dt><dd><p>'+google_ads[i].line2+"&nbsp;"+google_ads[i].line3+'</p><p><a href="'+google_ads[i].url+'">'+google_ads[i].visible_url+'</a></p><dd>';
		}
		str+='</dl>';
		document.write(str);
	}
}
