function flightStatus() {
	this.FORM_NAME = "formName";
	this.FORM = "formNode"
	this.ACTION = "action";
	this.METHOD = "method";
	this.TARGET = "target";
	
	this.formNode = {};
	
	this.setupParams = {};
	this.setupParams[this.FORM_NAME] = "flightStatusFrm";
	this.setupParams[this.FORM] = {};
	this.setupParams[this.FORM][this.ACTION] = "//www.5931.jal.co.jp/rsvInter/ArrivalAndDepartureInfoResult.do";	
	this.setupParams[this.FORM][this.METHOD] = "post";
	this.setupParams[this.FORM][this.TARGET] = "_blank";
	
	this.DEP_DATECODE = "dateCode0";
	this.ARR_DATECODE = "dateCode1";
	this.DATE = "date";
}

flightStatus.prototype = {
	init : function() {
		
		this.formNode = document.forms[this.setupParams[this.FORM_NAME]];
		
	},
	
	setup : function() {		
		this.initSetupParams(arguments[0]);
		this.init();
		this.setEvent();
	},
	
	initSetupParams : function(args) {
		for (var key1 in args) {
			for (var key2 in args[key1]) {
				this.setupParams[key1][key2] = args[key1][key2];
			}
		}
	},
	
	setEvent : function() {
		this.formNode._FS_instance_ = this;
		var formParams = this.setupParams[this.FORM];
		this.formNode.action = formParams[this.ACTION];
		this.formNode.method = formParams[this.METHOD];
		this.formNode.target = formParams[this.TARGET];
		
		JLJS.addEvent(this.formNode, "submit", function(e) {
			if( !e.currentTarget._FS_instance_.submitForm(e.currentTarget)) e.preventDefault();
		});
	},
	
	submitForm : function(e_frm) {
		var e = e_frm.elements;	
		var isDep = e[this.DEP_DATECODE].checked;
		var isArr = e[this.ARR_DATECODE].checked;
		var value = e[this.DATE][e[this.DATE].selectedIndex].value;
		
		if(isDep){
			e["depDateCode"].value = value;
		}else{
			e["depDateCode"].value = 0;
		}
		
		if(isArr){
			e["arrDateCode"].value = value;
		}else{
			e["arrDateCode"].value = 0;
		}
		
		this.formNode.submit();
		
		return false;
	}
};

var JLJS_FS = new flightStatus;
JLJS.addOnload(function(){JLJS_FS.setup();});
