//変数宣言
var _RouteVisibleMode = 'col';
var _RouteFrom = '';
var _RouteTo = '';
var _RouteCarType = '1';
var _RoutePriority = '2';
var _RouteNum = '3';
var _RouteViwsapa = '0';
var _RoutesearchYear = 2024;
var _RoutesearchMonth = 11;
var _RoutesearchDay = 28;
var _RoutesearchHour = 3;
var _RoutesearchMinute = 40;
//フォームチェック
function RouteFormCheck() {
if(document.router_form.startPlaceKana.value == '') {
alert('出発ICを入力してください');
return false;
}
if(document.router_form.arrivePlaceKana.value == '') {
alert('到着ICのを入力してください');
return false;
}
return true;
}
//IC入れ替え
function fReplace() {
var st = '';
st = document.router_form.startPlaceKana.value;
document.router_form.startPlaceKana.value = document.router_form.arrivePlaceKana.value;
document.router_form.arrivePlaceKana.value = st;
}
// 年月最小値設定対応 2014/07以前は選択出来ないようにする
function changeMonth(){
var searchYear = document.getElementsByName('searchYear');
var optionsY = searchYear[0].options;
var selectedY = optionsY.item(searchYear[0].selectedIndex).value;
var searchMonth = document.getElementsByName('searchMonth');
var optionsM = searchMonth[0].options;
var selectedM = optionsM.item(searchMonth[0].selectedIndex).value;
if(selectedY == '2014'){
var minMonth = 7;
} else {
var minMonth = 1;
}
// option要素を削除(IE9以下ではinnerHTMLでのoption書き換えが出来ないため、削除⇒生成)
while (0 < searchMonth[0].childNodes.length) {
searchMonth[0].removeChild(searchMonth[0].childNodes[0]);
}
// option要素を生成
var option;
var text;
for(var i = minMonth; i <= 12; i++){
option = document.createElement('option');
option.value = i;
if(i == selectedM){
option.selected = true;
}
text = document.createTextNode(i);
option.appendChild(text);
// option要素を追加
searchMonth[0].appendChild(option);
}
}
//フォーム表示
function RouteFormVisible() {
if(_RouteVisibleMode == 'row'){
document.write('');
document.write('
');
document.write('');
document.write('
');
document.write('
');
document.write('
');
}
if(_RouteVisibleMode == 'col'){
document.write('');
document.write('');
document.write('');
document.write('
');
}
//初期値のセット
document.router_form.startPlaceKana.value = _RouteFrom;
document.router_form.arrivePlaceKana.value = _RouteTo;
for (var i = 0; i < document.router_form.carType.length; i++){
if(document.router_form.carType[i].value == _RouteCarType) document.router_form.carType[i].selected = true;
}
if(document.router_form.priority == null){
}else{
for (var i = 0; i < document.router_form.priority.length; i++){
if(document.router_form.priority[i].value == _RoutePriority) document.router_form.priority[i].checked = true;
}
}
if(_RouteVisibleMode != 'row' || document.router_form.routeNum == null){
}else{
for (var i = 0; i < document.router_form.routeNum.length; i++){
if(document.router_form.routeNum[i].value == _RouteNum) document.router_form.routeNum[i].selected = true;
}
}
if(_RouteVisibleMode != 'row' || document.router_form.viwsapa == null){
}else{
if( _RouteViwsapa == '1') document.router_form.viwsapa.checked = true;
}
if(_RouteVisibleMode != 'row' || document.router_form.searchYear == null){
}else{
for (var i = 0; i < document.router_form.searchYear.length; i++){
if(document.router_form.searchYear[i].value == _RoutesearchYear) document.router_form.searchYear[i].selected = true;
}
}
if(_RouteVisibleMode != 'row' || document.router_form.searchMonth == null){
}else{
for (var i = 0; i < document.router_form.searchMonth.length; i++){
if(document.router_form.searchMonth[i].value == _RoutesearchMonth) document.router_form.searchMonth[i].selected = true;
}
changeMonth();
}
if(_RouteVisibleMode != 'row' || document.router_form.searchMonth == null){
}else{
for (var i = 0; i < document.router_form.searchDay.length; i++){
if(document.router_form.searchDay[i].value == _RoutesearchDay) document.router_form.searchDay[i].selected = true;
}
}
if(_RouteVisibleMode != 'row' || document.router_form.searchHour == null){
}else{
for (var i = 0; i < document.router_form.searchHour.length; i++){
if(document.router_form.searchHour[i].value == _RoutesearchHour) document.router_form.searchHour[i].selected = true;
}
}
if(_RouteVisibleMode != 'row' || document.router_form.searchMinute == null){
}else{
for (var i = 0; i < document.router_form.searchMinute.length; i++){
if(document.router_form.searchMinute[i].value == _RoutesearchMinute) document.router_form.searchMinute[i].selected = true;
}
}
}