(function ($) {

/**
 * Front_Schedule_Datestring
 * @constructor jQuery
 * 
 * Takes an argument:
 * DateString.Day			- Piked day
 * DateString.Month			- Piked month
 * DateString.Year			- Piked year
 * DateString.componentId	- DOM id for object
 */
//$("#datepicker").datepicker({});
$.widget('ui.Front_Schedule_Datestring', $.extend({}, $.ui.Component.prototype, {
	type: 'Front_Schedule_Datestring',
	_init: function () {
		$.ui.Component.prototype._init.call(this); // chain parent constructor
		var self = this
		DS = DateString;
		$('#'+DS.componentId+"-prev").click(function(ev){
			ev.preventDefault()
			path = "/schedule/" + DS.selected + "/" + $(this).attr("rel")
			if($(this).attr("rel") != '' ){
				self.reload({href: path})
			}
		})
		$('#'+DS.componentId+"-next").click(function(ev){
			ev.preventDefault()
			path = "/schedule/" + DS.selected + "/" + $(this).attr("rel")
			if($(this).attr("rel") != '' ){
				self.reload({href: path})
			}
		})
	}
}));

}).require('Component')(jQuery);