function submit_search() {
//	document.search.character.value = get_hidden_val( "character" );
	document.search.action += get_character_url();
	document.search.action += get_is_request_doc_url();
	document.search.action += ".html";
	document.search.submit();
	return false;
}

function get_character_url() {
	chk_all = document.getElementsByClassName( "character" );
	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 "";
	}
	all_bin_str = "";
	for(i=0;i<32;i++){
		bin_str = "0";
		for(j=0;j<chk_arr.length;j++) {
			if( (32 - chk_arr[j]) == i ) {
				bin_str = "1";
				break;
			}
		}
		all_bin_str = all_bin_str.concat(bin_str);
	}

	all_bin_str = parseInt(all_bin_str,2);

	if( all_bin_str > 0 ) {
		return "k" + all_bin_str;
	}
	return "";
}

function get_is_request_doc_url() {
	if( $("is_request_doc").checked ) {
		return "i1";
	}

	return "";
}

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 get_hidden_val_k() {
	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(/^k_chk_kousha_([0-9]+)$/) ) {
			id = chk_all[i].innerHTML;
		}
		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();
	k_ids = get_hidden_val_k();
	var url = '/cart/cart.php?kousha_id=' + ids;
	if( k_ids != "" ) {
		url += "&area_call_id=" + k_ids;
	}
	location.href = url;
	return false;
}

//-------------------------------------
//#7663 Start Edit t.kasuga　リスト変更
//-------------------------------------
function chg_chk_box_map( itm, pref_cd, id ) {
	if( pref_cd < 0 ) {
	if( $(itm).className == "a_cl01_on_checked" ) {
			$(itm).className = "a_cl01_of"
			$("sumicart_" + id).style.display = 'block'
			return delCart(id);
			
		}
		if( $(itm).className == "a_cl01_of" ) {
			$(itm).className = "a_cl01_on_checked"
			$("sumicart_" + id).style.display = 'none'
			return addCart(id);
	}
	} else {
		if( $(itm).className == "a_cl01_on_checked" ) {
			return k_delCart(pref_cd, id);
		}
		if( $(itm).className == "a_cl01_of" ) {

			return k_addCart(pref_cd, id);
		}
	}
	return true;
}
//-------------------------------------
//#7663 End Edit t.kasuga　リスト変更
//-------------------------------------

function chg_chk_box( itm, pref_cd, id ) {

	if( pref_cd < 0 ) {
		if( $(itm).className == "a_cl01_on_checked" ) {
			return delCart(id);
		}
		if( $(itm).className == "a_cl01_of" ) {
			pageTracker._trackEvent('/search_click/check_box.html','k_' + id);	
			return addCart(id);
		}
	}else{
		if( $(itm).className == "a_cl01_on_checked" ) {
			return k_delCart(pref_cd, id);
		}
		if( $(itm).className == "a_cl01_of" ) {
			pageTracker._trackEvent('/search_click/check_box.html','t_' + id);
			return k_addCart(pref_cd, id);
		}
	}
	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;
}

