function submit_search() {
	document.search.grade.value = get_hidden_val( "grade" );
	document.search.character.value = get_hidden_val( "character" );
	document.search.format.value = get_hidden_val( "format" );
	document.search.submit();
	return false;
}

function get_hidden_val( itm ) {
	chk_all = document.getElementsByClassName(itm);
	chk_cnt = 0;
	chk_arr = new Array();
	for( i = 0; i < chk_all.length; i++ ) {
		if( chk_all[i].checked && chk_all[i].value != "" ) {
			chk_arr.push( chk_all[i].value );
			chk_cnt++;
		}
	}
	if( chk_cnt == 0 ) {
		return "";
	}
	return chk_arr.join(",");
}

function get_hidden_val_2() {
	class_name = 'a_cl01_on';
	chk_all = document.getElementsByClassName(class_name);
	chk_cnt = 0;
	chk_arr = new Array();
	for( i = 0; i < chk_all.length; i++ ) {
		if( chk_all[i].style.display == "none" ) {
			continue;
		}
		id = "";
		if( chk_all[i].id.match(/^chk_kousha_([0-9]+)$/) ) {
			id = chk_all[i].id.match(/^chk_kousha_([0-9]+)$/)[1];
		}
		if( id != "" ) {
			chk_arr.push( id );
			chk_cnt++;
		}
	}
	if( chk_cnt == 0 ) {
		return "";
	}
	return chk_arr.join(",");
}

function chg_chk_kousha( itm ) {
	chk_all = document.getElementsByClassName('chk_kousha');
	chk_cnt = 0;
	chk_flg = false;
	if( $(itm).checked ) {
		chk_flg = true;
	}
	chk_arr = new Array();
	for( i = 0; i < chk_all.length; i++ ) {
		if( chk_all[i].disabled ) continue;
		chk_all[i].checked = chk_flg;
	}
	if( chk_flg ) {
		class_name = 'a_cl01_of';
		chg_class_name = "a_cl01_on";
	} else {
		class_name = 'a_cl01_on';
		chg_class_name = "a_cl01_of";
	}
	chk_all_img = document.getElementsByClassName(class_name);
	var img_len = chk_all_img.length + 0;
	var a = new Array();
	for( i = 0; i < img_len; i++ ) {
		a[i] = chk_all_img[i].id;
	}
	for( i = 0; i < img_len; i++ ) {
		if( $(a[i]).style.display == "none" ) continue;
		$(a[i]).className = chg_class_name;
	}

	return true;
}

function submit_cart() {
	ids = get_hidden_val_2();
	location.href = '/cart/cart.php?kousha_id=' + ids;
	return false;
}

function chg_chk_box( itm ) {
	if( $(itm).className == "a_cl01_on_checked" ) {
		return true;
	}
	if( $(itm).className == "a_cl01_on" ) {
		$(itm).className = "a_cl01_of";
	} else {
		$(itm).className = "a_cl01_on";
	}
	return true;
}

function character_window_open() {
	if( $('character_dt_show').style.display != "none" ) {
		$('character_dd_hide').show();
		$('character_dt_show').hide();
		$('character_dd_show').hide();
	}else{
		$('character_dd_hide').hide();
		$('character_dt_show').show();
		$('character_dd_show').show();
	}
	return false;
}

