define(['mootools'], function () {

var ClnDatePeriod = new Class({
	initialize: function(prefix){
		this.prefix = prefix;
		if (!$defined(document.cln_date_period)) document.cln_date_period = {};
		document.cln_date_period[this.prefix] = this;
		document.cln_get_period = function(context){ return document.cln_date_period[context];};
	},
	repToggle: function(checked){
		if (checked){
			$('cln_'+this.prefix+'_rep_block').setStyle("display", 'block');
		}else{
			$('cln_'+this.prefix+'_rep_block').setStyle("display", 'none');
		}
	},
	repTypeSelection: function(type, obj){
		if (type == 'week'){
			$('cln_'+this.prefix+'_week_days').removeClass('d-none');
			$('cln_'+this.prefix+'_week_days_repeat_on').removeClass('d-none');
		}else{
			$('cln_'+this.prefix+'_week_days').addClass('d-none');
			$('cln_'+this.prefix+'_week_days_repeat_on').addClass('d-none');
		}
	},
	fullDayToggle: function(status){
		if (status){
			$('cln_'+this.prefix+'_from_row').getElements('input.time_field').setStyle('display', 'none');
			$('cln_'+this.prefix+'_to_row').getElements('input.time_field').setStyle('display', 'none');
		}else{
			$('cln_'+this.prefix+'_from_row').getElements('input.time_field').setStyle('display', 'inline');
			$('cln_'+this.prefix+'_to_row').getElements('input.time_field').setStyle('display', 'inline');
		}
	}
});

return ClnDatePeriod;
});
