var customcode = {
	// return the value of the selected time
	getValue: function() {
		var v = $("#BookingsTime :selected").val();
		return v;
	},

	// return the type of the application
	isLight: function() {
		var ret = false;
		if (typeof(customcode_type) == "number" && customcode_type) {
			ret = true;
		}
		return ret;
	},

	// return the length of the booking
	getLength: function() {
		var v = this.getValue();
		var t = v.split(":");
		t = parseInt(t[2]) / (this.isLight() ? 1 : 60);
		return t;
	},

	// return the start date of the booking
	getStartDate: function() {
		var t = this.getStart() * 1000;
		return new Date(t);
	},
	
	// return the end date of the booking
	getEndDate: function() {
		var t = (this.getStart() + (this.getLength() * 60)) * 1000;
		return new Date(t);
	},
	
	// return the selected language
	getLanguage: function() {
		var ret = "dan";
		if (typeof(customcode_language) == "string" && customcode_language) {
			ret = customcode_language;
		}
		return ret;
	},

	// return the selected date
	getDate: function() {
		return $("#dateselected").val();
	},

	// return the number of person of the booking
	getNumPers: function() {
		v = $("#BookingsNumPers :selected").val();
		return v;
	},

	// return the stating time of the booking
	getStart: function() {
		var v = this.getValue();
		var t = v.split(":");
		return parseInt(t[0]);
	},

	// return the stating hours of the booking fx 17
	getStartHours: function() {
		var ds = this.getStartDate();
		return ds.getUTCHours();
	},

	// return the stating minutes of the booking fx 55
	getStartMinutes: function() {
		var ds = this.getStartDate();
		return ds.getUTCMinutes();
	},

	// return the ending hours of the booking fx 17
	getEndHours: function() {
		var de = this.getEndDate();
		return de.getUTCHours();
	},

	// return the ending minutes of the booking fx 55
	getEndMinutes: function() {
		var de = this.getEndDate();
		return de.getUTCMinutes();
	},

	// return the weekday of the booking
	getWeekday: function() {
		var d = this.getStartDate();
		return d.getUTCDay();
	},

	// return the month of the booking
	getMonth: function() {
		var d = this.getStartDate();
		return d.getUTCMonth();
	},
	
	// return the day of the booking
	getDay: function() {
		var d = this.getStartDate();
		return d.getUTCDate();
	},

	// return the table of the booking
	getTable: function() {
		var ret = false;
		var v = this.getValue();
		var t = v.split(":");
		if (typeof(t[5]) != "undefined") {
			ret = t[5];
		}
		return ret;
	},
	
	// return a leading zero formatted string
	formatZero: function(aNumber) {
		return aNumber < 10 ? "0" + aNumber : aNumber;
	}
}
