// ページング用
function submit_sort_form(key)
{
	document.paging_form.sp.value=1;
	document.paging_form.sort_key.value=key;
	document.paging_form.submit();
	return false;
}

// ページング用
function submit_paging_form(reqid, linkname, sp)
{
	document.paging_form.reqid.value=reqid;
	document.paging_form.sp.value=sp;
	document.paging_form.action=linkname;
	document.paging_form.submit();
}

// さくっと検索　投資先分類制御
function check_invest(act){
	if(act == 1){
		chk = document.getElementById("invest_0").checked;
		if(chk){
			for(row = 1; row <= 14; row++){
				document.getElementById("invest_"+row).checked = false;
			}
		}
	}
	if(act == 2){
		for(row = 1; row <= 14; row++){
			chk = document.getElementById("invest_"+row).checked;
			if(chk){
				document.getElementById("invest_0").checked = false;
				break;
			}
		}
	}
}

// さくっと検索　絞り込み制限
//  だけを押されたら、他のオプションは消して、さらに他のオプションを
// 選択出来ないようにする。
function check_focust_etf(num){
	if(num == 2)
	{
		set_radio_disabled("srch_index_focus");
		set_radio_disabled("srch_every_focus");
		set_radio_disabled("srch_bullbear_focus");
	}
	else
	{
		set_radio_enabled("srch_index_focus");
		set_radio_enabled("srch_every_focus");
		set_radio_enabled("srch_bullbear_focus");
	}
}
function check_focust_index(num){
	if(num == 2)
	{
		set_radio_disabled("srch_etf_focus");
		set_radio_disabled("srch_every_focus");
		set_radio_disabled("srch_bullbear_focus");
	}
	else
	{
		set_radio_enabled("srch_etf_focus");
		set_radio_enabled("srch_every_focus");
		set_radio_enabled("srch_bullbear_focus");
	}
}
function check_focust_every(num){
	if(num == 2)
	{
		set_radio_disabled("srch_index_focus");
		set_radio_disabled("srch_etf_focus");
		set_radio_disabled("srch_bullbear_focus");
	}
	else
	{
		set_radio_enabled("srch_index_focus");
		set_radio_enabled("srch_etf_focus");
		set_radio_enabled("srch_bullbear_focus");
	}
}

function check_focust_bullbear(num){
	if(num == 2)
	{
		set_radio_disabled("srch_index_focus");
		set_radio_disabled("srch_etf_focus");
		set_radio_disabled("srch_every_focus");
	}
	else
	{
		set_radio_enabled("srch_index_focus");
		set_radio_enabled("srch_etf_focus");
		set_radio_enabled("srch_every_focus");
	}
}

// 販売　絞り込み制限
//  だけを押されたら、他のオプションは消して、さらに他のオプションを
// 選択出来ないようにする。
function check_focust_index_sales(num){
	if(num == 2)
	{
//		set_radio_disabled("srch_etf_focus");
		set_radio_disabled("srch_every_focus");
		set_radio_disabled("srch_bullbear_focus");
	}
	else
	{
//		set_radio_enabled("srch_etf_focus");
		set_radio_enabled("srch_every_focus");
		set_radio_enabled("srch_bullbear_focus");
	}
}
function check_focust_every_sales(num){
	if(num == 2)
	{
		set_radio_disabled("srch_index_focus");
//		set_radio_disabled("srch_etf_focus");
		set_radio_disabled("srch_bullbear_focus");
	}
	else
	{
		set_radio_enabled("srch_index_focus");
//		set_radio_enabled("srch_etf_focus");
		set_radio_enabled("srch_bullbear_focus");
	}
}

function check_focust_bullbear_sales(num){
	if(num == 2)
	{
		set_radio_disabled("srch_index_focus");
//		set_radio_disabled("srch_etf_focus");
		set_radio_disabled("srch_every_focus");
	}
	else
	{
		set_radio_enabled("srch_index_focus");
//		set_radio_enabled("srch_etf_focus");
		set_radio_enabled("srch_every_focus");
	}
}

// nameのラジオボタンをdisabledにする
function set_radio_disabled(name){
	
	radio = document.getElementsByName(name);
	for (i=0 ; i<radio.length ; i++ )
	{
		radio[i].disabled = true;
	}
	
}

// nameのラジオボタンをenabledにする
function set_radio_enabled(name){
	
	radio = document.getElementsByName(name);
	cnt=0;
	for (i=0 ; i<radio.length ; i++ )
	{
		if ( radio[i].checked )
		{
			cnt++;
		}
		radio[i].disabled = false;
	}
	
	if ( cnt == 0 )
	{
		radio[0].checked = true;
	}
	
}

// 絞り込みラジオボタンのonLoad処理
function set_srch_radio(){
	if ( document.getElementById("focus_etf_2").checked )
	{
		check_focust_etf(2);
	}
	else if ( document.getElementById("focus_index_2").checked )
	{
		check_focust_index(2);
	}
	else if ( document.getElementById("focus_every_2").checked )
	{
		check_focust_every(2);
	}
}


// 分配金制御
function check_distrib(act){
	if(act == 1){
		chk = document.getElementById("distrib_0").checked;
		if(chk){
			for(row = 1; row <= 6; row++){
				document.getElementById("distrib_"+row).checked = false;
			}
		}
	}
	if(act == 2){
		for(row = 1; row <= 6; row++){
			chk = document.getElementById("distrib_"+row).checked;
			if(chk){
				document.getElementById("distrib_0").checked = false;
				break;
			}
		}
	}
}

// さくっと検索　submit
function check_easy_form()
{
	invest  = false;
	distrib = false;
	for(row = 0; row <= 14; row++){
		if(document.getElementById("invest_"+row).checked){
			invest = true;
		}
	}
	for(row = 0; row <= 6; row++){
		if(document.getElementById("distrib_"+row).checked){
			distrib = true;
		}
	}

	if(invest == false || distrib == false){
		alert("投資先分類または分配金の条件が選択されていません。");
		return false;
	}

	document.srchForm.submit();
	return true;
}

// 詳細検索　submit
function check_detail_form()
{
	distrib = false;
	for(row = 0; row <= 6; row++){
		if(document.getElementById("distrib_"+row).checked){
			distrib = true;
		}
	}

	if(distrib == false){
		alert("分配金の条件が選択されていません。");
		return false;
	}

	document.srchForm.submit();
	return true;
}

//販社一覧 表示切替
function BuyList_Change(val){
	document.BuyList_Change.act.value = val;
	document.BuyList_Change.submit();
}
