function search_station(pos) {
	var from_station = encodeURI($("from_station"+pos).value);
	if( from_station == "" ) {
		alert( "駅名を入力してください。" );
		return;
	}

	var to_station = "";
	if( $("station"+pos).type == 'select-one' ) {
		to_station = encodeURI($("station"+pos).value);
	} else {
		to_station = encodeURI($("station"+pos).innerHTML);
	}

	var url = 'http://transit.yahoo.co.jp/search/result?from=' + from_station + '&to=' + to_station + '&ei=utf-8';
	window.open(url,'');

	return;
}

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 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();
	var url = '/cart/cart.php?kousha_id=' + ids;
	location.href = url;
	return false;
}

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(",");
}


