Formidable.Classes.Date = Formidable.Classes.RdtBaseClass.extend({
	constructor: function(oConfig) {
		this.base(oConfig);
		if(this.domNode()) {
			Calendar.setup(this.config.calendarconf);
			if(this.domNode().value != "") {
				this.replaceData(this.domNode().value);
			}
		}
	},
	replaceData: function(sTstamp) {
		if(this.domNode()) {
			iTstamp = parseInt(sTstamp);
			if(iTstamp == 0) {
				this.clearData();
			} else {
				this.setValue(iTstamp);
				if(this.getDisplayArea()) {
					oDate = new Date();
					oDate.setTime((parseInt(sTstamp) * 1000));
					this.getDisplayArea().innerHTML = oDate.print(this.config.calendarconf.daFormat);
				}
			}
		}
	},
	getDisplayArea: function() {
		oDisplay = $("showspan_" + this.config.id);
		if(oDisplay) {
			return oDisplay;
		}

		return false;
	},
	clearData: function() {
		if(this.getDisplayArea()) {
			this.getDisplayArea().innerHTML = "...";
		}
		this.domNode().value="";
	},
	clearValue: function() {
		this.clearData();
	}
});
