module jSlider {
	export class Options {
		private options:Object = {
			"delay": 4000,
			"duration": 200,
			"effect": jSlider.Effect.SLIDE,
			"button": {
				"next": null,
				"prev": null,
				"stop": null,
				"start": null
			},
			"on": {
				"slide": [],
				"next": [],
				"prev": [],
				"start": [],
				"stop": []
			}
		};

		constructor(options:Object = {}) {
			var option:string;
			for (option in this.options) {
				if (!this.options.hasOwnProperty(option)) continue;
				this.options[option] = options[option] || this.options[option];
			}

			//Change event listeners to [function(){}] if function(){}
			var eventListeners = this.options['on'];
			var key:string;
			for (key in eventListeners) {
				if (!eventListeners.hasOwnProperty(key)) continue;
				if (typeof eventListeners[key] === 'function') {
					this.options['on'][key] = Array(eventListeners[key]);
				}
			}
		}

		/**
		 * Get an option
		 * @param optionName
		 * @returns {string}
		 */
		public get(optionName:string):any {
			return this.options[optionName];
		}
	}
}
module jSlider {
	export class Options {
		private options:Object = {
			"delay": 4000,
			"duration": 200,
			"effect": jSlider.Effect.SLIDE,
			"button": {
				"next": null,
				"prev": null,
				"stop": null,
				"start": null
			},
			"on": {
				"slide": [],
				"next": [],
				"prev": [],
				"start": [],
				"stop": []
			}
		};

		constructor(options:Object = {}) {
			jQuery.extend(true, this.options, options);
			console.log(this.options['on']);

			//Change event listeners to [function(){}] if function(){}
			var eventListeners = this.options['on'];
			var key:string;
			for (key in eventListeners) {
				if (!eventListeners.hasOwnProperty(key)) continue;
				if (typeof eventListeners[key] === 'function') {
					this.options['on'][key] = Array(eventListeners[key]);
				}
			}
		}

		/**
		 * Get an option
		 * @param optionName
		 * @returns {string}
		 */
		public get(optionName:string):any {
			return this.options[optionName];
		}
	}
}
Fix second level options. options like on->someOption and button->option did not work as the loop was just asking if, for example "on" is set in the user defined option array. and even though the user might not have spesified a, for example "next" event, but has spesified the "slide" event. The entire "on" will be replaced by the user spesified one, and this array does not contain the proper default, causing in, amongst other things a "property does not exist" error when trying to trigger events.
Fix second level options.
options like on->someOption and button->option
did not work as the loop was just asking if, for example
"on" is set in the user defined option array.
and even though the user might not have spesified a, for example
"next" event, but has spesified the "slide" event. The entire
"on" will be replaced by the user spesified one, and this array
does not contain the proper default, causing in, amongst other things
a "property does not exist" error when trying to trigger events.
