//pro-agent サーチメソッド
//フォームのsubmitボタンに割り当てる
//2010.6.2 STREAMingJapan古内　フォーム内のエレメント名をサイトにあわせて変更

function JobSearch () {
	var url = 'https://www.pro-agent.com/data/website/AGJ00/job_list.php';

	var frm = document.getElementById('jobSearchBox');
	var select_job_type = document.getElementById('send_job_type');
	var select_biz_type = document.getElementById('send_biz_type');
	var temp_job_type = document.getElementById('temp_job_type');
	var temp_biz_type = document.getElementById('temp_biz_type');

	//現在選ばれてる「職種」の値を取得
	var current_job_type = temp_job_type.value;

	//現在選ばれてる「職種」の値の数を取得
	var how_many_job_type;
	if (current_job_type.length == 0 ) {
		how_many_job_type = 1;
	} else {
		var temp = current_job_type.split(',');
		how_many_job_type = temp.length;
	}

	//現在選ばれてる「業種」の値の数を取得
	var current_biz_type = temp_biz_type.value;
	var how_many_biz_type;
	if (current_biz_type.length == 0 ) {
		how_many_biz_type = 1;
	} else {
		var temp = current_biz_type.split(',');
		how_many_biz_type = temp.length;
	}

	//「業種」の数にあわせて「職種」を同じ数だけ増やしてセット
	var send_job_type_value = '';
	for (var i=0; i < how_many_biz_type; i++) {
		if (send_job_type_value.length > 0) {
			send_job_type_value = send_job_type_value + ',';
		}
		send_job_type_value = send_job_type_value + current_job_type;
	}
 arr_job_type = send_job_type_value.split(',');
 select_job_type.value = arr_job_type.sort();

	//「職種」の数にあわせて「業種」を同じ数だけ増やしてセット
	var send_biz_type_value = '';
	for (i=0; i < how_many_job_type; i++) {
		if (send_biz_type_value.length > 0) {
			send_biz_type_value = send_biz_type_value + ',';
		}
		send_biz_type_value = send_biz_type_value + current_biz_type;
	}
	select_biz_type.value = send_biz_type_value;

	frm.action = url;
	frm.submit();
}

