jQuery(document).ready(function(){
			jQuery( "#event_start" ).datepicker({
				dateFormat:'MM d, yy',
				minDate: 0,
				onClose: function( selectedDate ) {
					jQuery( "#repeat_end" ).datepicker( "option", "minDate", selectedDate );
					jQuery( "#event_end" ).datepicker( "option", "minDate", selectedDate );
				}
			});
			jQuery( "#event_end" ).datepicker({
				dateFormat:'MM d, yy',
				minDate: 0,
				onClose: function( selectedDate ) {
					if (jQuery( "#event_start" ).val()) {
						jQuery( "#repeat_end" ).datepicker( "option", "minDate", selectedDate );
						jQuery( "#event_end" ).datepicker( "option", "minDate", jQuery( "#event_start" ).val() );
					}
				}
			});
			jQuery('#all_day').change(function() {
				gd_on_all_day();
			});
						jQuery( "#repeat_end" ).datepicker({
				dateFormat:'MM d, yy',
				minDate: 0,
				onClose: function( selectedDate ) {
					if (jQuery( "#event_start" ).val()) {
						jQuery( "#repeat_end" ).datepicker( "option", "minDate", jQuery( "#event_start" ).val() );
					}
				}
			});

			jQuery('input[name=is_recurring]').click(function() {
				jQuery('input[name=is_recurring]').each(function() {
					if (jQuery(this).is(':checked') == true) {
						if (jQuery(this).val() == '1') {
							gd_on_recurring(this);
						} else {
							gd_on_norecurring(this);
						}
					}
				});
			});
			jQuery('input[name=is_recurring]').each(function() {
				if (jQuery(this).is(':checked') == true) {
					jQuery(this).click();
				}
			});
			jQuery('#repeat_type').change(function() {
				gd_on_repeat_type();
			});
						
			jQuery('.different_times').change(function() {
				if (jQuery(this).is(':checked') == false) {
					jQuery('.show_times_div').hide();
				} else {
					jQuery('.show_times_div').show();
				}
				var event_dates = jQuery('#dates').val();
				if (event_dates != '') {
					var spdates = event_dates.split(",");
					var total_dates = spdates.length;
					var total_dates_selected = '';
					for (i = 0; i < total_dates; i++) {
						total_dates_selected += '<div class="event-multiple-times clearfix"><label class="event-multiple-dateto">' + spdates[i] + '</label><label class="event-multiple-start">Start </label><div class="event-multiple-dateto-inner"><select option-ajaxChosen="false" name="starttimes[]" class="chosen_select"><option  value="00:00">00:00 AM</option><option  value="00:15">00:15 AM</option><option  value="00:30">00:30 AM</option><option  value="00:45">00:45 AM</option><option  value="01:00">01:00 AM</option><option  value="01:15">01:15 AM</option><option  value="01:30">01:30 AM</option><option  value="01:45">01:45 AM</option><option  value="02:00">02:00 AM</option><option  value="02:15">02:15 AM</option><option  value="02:30">02:30 AM</option><option  value="02:45">02:45 AM</option><option  value="03:00">03:00 AM</option><option  value="03:15">03:15 AM</option><option  value="03:30">03:30 AM</option><option  value="03:45">03:45 AM</option><option  value="04:00">04:00 AM</option><option  value="04:15">04:15 AM</option><option  value="04:30">04:30 AM</option><option  value="04:45">04:45 AM</option><option  value="05:00">05:00 AM</option><option  value="05:15">05:15 AM</option><option  value="05:30">05:30 AM</option><option  value="05:45">05:45 AM</option><option  value="06:00">06:00 AM</option><option  value="06:15">06:15 AM</option><option  value="06:30">06:30 AM</option><option  value="06:45">06:45 AM</option><option  value="07:00">07:00 AM</option><option  value="07:15">07:15 AM</option><option  value="07:30">07:30 AM</option><option  value="07:45">07:45 AM</option><option  value="08:00">08:00 AM</option><option  value="08:15">08:15 AM</option><option  value="08:30">08:30 AM</option><option  value="08:45">08:45 AM</option><option  value="09:00">09:00 AM</option><option  value="09:15">09:15 AM</option><option  value="09:30">09:30 AM</option><option  value="09:45">09:45 AM</option><option  value="10:00">10:00 AM</option><option  value="10:15">10:15 AM</option><option  value="10:30">10:30 AM</option><option  value="10:45">10:45 AM</option><option  value="11:00">11:00 AM</option><option  value="11:15">11:15 AM</option><option  value="11:30">11:30 AM</option><option  value="11:45">11:45 AM</option><option  value="12:00">12:00 PM</option><option  value="12:15">12:15 PM</option><option  value="12:30">12:30 PM</option><option  value="12:45">12:45 PM</option><option  value="13:00">01:00 PM</option><option  value="13:15">01:15 PM</option><option  value="13:30">01:30 PM</option><option  value="13:45">01:45 PM</option><option  value="14:00">02:00 PM</option><option  value="14:15">02:15 PM</option><option  value="14:30">02:30 PM</option><option  value="14:45">02:45 PM</option><option  value="15:00">03:00 PM</option><option  value="15:15">03:15 PM</option><option  value="15:30">03:30 PM</option><option  value="15:45">03:45 PM</option><option  value="16:00">04:00 PM</option><option  value="16:15">04:15 PM</option><option  value="16:30">04:30 PM</option><option  value="16:45">04:45 PM</option><option  value="17:00">05:00 PM</option><option  value="17:15">05:15 PM</option><option  value="17:30">05:30 PM</option><option  value="17:45">05:45 PM</option><option  value="18:00">06:00 PM</option><option  value="18:15">06:15 PM</option><option  value="18:30">06:30 PM</option><option  value="18:45">06:45 PM</option><option  value="19:00">07:00 PM</option><option  value="19:15">07:15 PM</option><option  value="19:30">07:30 PM</option><option  value="19:45">07:45 PM</option><option  value="20:00">08:00 PM</option><option  value="20:15">08:15 PM</option><option  value="20:30">08:30 PM</option><option  value="20:45">08:45 PM</option><option  value="21:00">09:00 PM</option><option  value="21:15">09:15 PM</option><option  value="21:30">09:30 PM</option><option  value="21:45">09:45 PM</option><option  value="22:00">10:00 PM</option><option  value="22:15">10:15 PM</option><option  value="22:30">10:30 PM</option><option  value="22:45">10:45 PM</option><option  value="23:00">11:00 PM</option><option  value="23:15">11:15 PM</option><option  value="23:30">11:30 PM</option><option  value="23:45">11:45 PM</option></select></div><label class="event-multiple-end">End </label><div class="event-multiple-dateto-inner"><select option-ajaxChosen="false" name="endtimes[]" class="chosen_select" style="width:90px;"><option  value="00:00">00:00 AM</option><option  value="00:15">00:15 AM</option><option  value="00:30">00:30 AM</option><option  value="00:45">00:45 AM</option><option  value="01:00">01:00 AM</option><option  value="01:15">01:15 AM</option><option  value="01:30">01:30 AM</option><option  value="01:45">01:45 AM</option><option  value="02:00">02:00 AM</option><option  value="02:15">02:15 AM</option><option  value="02:30">02:30 AM</option><option  value="02:45">02:45 AM</option><option  value="03:00">03:00 AM</option><option  value="03:15">03:15 AM</option><option  value="03:30">03:30 AM</option><option  value="03:45">03:45 AM</option><option  value="04:00">04:00 AM</option><option  value="04:15">04:15 AM</option><option  value="04:30">04:30 AM</option><option  value="04:45">04:45 AM</option><option  value="05:00">05:00 AM</option><option  value="05:15">05:15 AM</option><option  value="05:30">05:30 AM</option><option  value="05:45">05:45 AM</option><option  value="06:00">06:00 AM</option><option  value="06:15">06:15 AM</option><option  value="06:30">06:30 AM</option><option  value="06:45">06:45 AM</option><option  value="07:00">07:00 AM</option><option  value="07:15">07:15 AM</option><option  value="07:30">07:30 AM</option><option  value="07:45">07:45 AM</option><option  value="08:00">08:00 AM</option><option  value="08:15">08:15 AM</option><option  value="08:30">08:30 AM</option><option  value="08:45">08:45 AM</option><option  value="09:00">09:00 AM</option><option  value="09:15">09:15 AM</option><option  value="09:30">09:30 AM</option><option  value="09:45">09:45 AM</option><option  value="10:00">10:00 AM</option><option  value="10:15">10:15 AM</option><option  value="10:30">10:30 AM</option><option  value="10:45">10:45 AM</option><option  value="11:00">11:00 AM</option><option  value="11:15">11:15 AM</option><option  value="11:30">11:30 AM</option><option  value="11:45">11:45 AM</option><option  value="12:00">12:00 PM</option><option  value="12:15">12:15 PM</option><option  value="12:30">12:30 PM</option><option  value="12:45">12:45 PM</option><option  value="13:00">01:00 PM</option><option  value="13:15">01:15 PM</option><option  value="13:30">01:30 PM</option><option  value="13:45">01:45 PM</option><option  value="14:00">02:00 PM</option><option  value="14:15">02:15 PM</option><option  value="14:30">02:30 PM</option><option  value="14:45">02:45 PM</option><option  value="15:00">03:00 PM</option><option  value="15:15">03:15 PM</option><option  value="15:30">03:30 PM</option><option  value="15:45">03:45 PM</option><option  value="16:00">04:00 PM</option><option  value="16:15">04:15 PM</option><option  value="16:30">04:30 PM</option><option  value="16:45">04:45 PM</option><option  value="17:00">05:00 PM</option><option  value="17:15">05:15 PM</option><option  value="17:30">05:30 PM</option><option  value="17:45">05:45 PM</option><option  value="18:00">06:00 PM</option><option  value="18:15">06:15 PM</option><option  value="18:30">06:30 PM</option><option  value="18:45">06:45 PM</option><option  value="19:00">07:00 PM</option><option  value="19:15">07:15 PM</option><option  value="19:30">07:30 PM</option><option  value="19:45">07:45 PM</option><option  value="20:00">08:00 PM</option><option  value="20:15">08:15 PM</option><option  value="20:30">08:30 PM</option><option  value="20:45">08:45 PM</option><option  value="21:00">09:00 PM</option><option  value="21:15">09:15 PM</option><option  value="21:30">09:30 PM</option><option  value="21:45">09:45 PM</option><option  value="22:00">10:00 PM</option><option  value="22:15">10:15 PM</option><option  value="22:30">10:30 PM</option><option  value="22:45">10:45 PM</option><option  value="23:00">11:00 PM</option><option  value="23:15">11:15 PM</option><option  value="23:30">11:30 PM</option><option  value="23:45">11:45 PM</option></select></div></div>';
					}
					jQuery('.show_different_times_div').html('');
					jQuery('.show_different_times_div').append(total_dates_selected);
					jQuery(".show_different_times_div .chosen_select").chosen();
				} else {
					jQuery('.show_different_times_div').html('');
				}
			});
		});
		
		function gd_event_date_format(date) {
			var format = 'F j, Y';
			var formatted_date = format;
			var monthNames = [
			"January",
			"February",
			"March",
			"April",
			"May",
			"June",
			"July",
			"August",
			"September",
			"October",
			"November",
			"December"
			];
			formatted_date = formatted_date.replace("Y", date.getFullYear());
			formatted_date = formatted_date.replace("m", (date.getMonth() + 1));
			formatted_date = formatted_date.replace("d", date.getDate());
			formatted_date = formatted_date.replace("j", date.getDate());
			formatted_date = formatted_date.replace("F", monthNames[date.getMonth()]);
			return formatted_date;
		}

    jQuery(function() {
		multicalInit1 = function() {
			cal = new YAHOO.widget.CalendarGroup("multiCal1", "multiCalContainer1", {
				pages: 2,
				MULTI_SELECT: true ,
				start_weekday: 0			});
			cal.render();
			var updated = function() {
				var selectedDates = cal.getSelectedDates();
				var txt = "";
				var val = "";
				for (var ii = 0; ii < selectedDates.length; ii++) {
					var date = selectedDates[ii];
					var current = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
					var current_display = gd_event_date_format(date);
					if (ii > 0) {
						val += ",";
					}
					val += current;
					txt += "<span>" + current_display + "</span>";
				}
				if (txt == '') {
					jQuery('#help1').hide();
										jQuery('.event_recurring_dates').closest('.required_field').find('.geodir_message_error').show();
					jQuery('.event_recurring_dates').closest('.required_field').find('.geodir_message_error').html(error_message);
									} else {
					jQuery('#help1').show();
					jQuery('.event_recurring_dates').closest('.required_field').find('.geodir_message_error').hide();
				}
				document.getElementById('multiDisplay1').innerHTML = txt;
				document.getElementById('dates').value = val;
				if (jQuery('.different_times').is(':checked') == true) {
					jQuery('.different_times').change();
				}
				calChanged(cal);
			}
			cal.selectEvent.subscribe(updated, cal, true);
			cal.deselectEvent.subscribe(updated, cal, true);
		}
		YAHOO.util.Event.onDOMReady(multicalInit1);
    });
		
		function gd_on_all_day(custom) {
			if (jQuery('select[name=repeat_type]').val() == 'custom') {
				jQuery('#gd_diff_times').show();
				jQuery('.show_times_div').show();
			} else {
				jQuery('#gd_diff_times').hide();
				jQuery('.show_times_div').hide();
			}
				
			if(jQuery('input[name=all_day]').is(":checked")) {
				jQuery('.gd-event-time-row').hide();
				jQuery('#gd_diff_times').hide();
				jQuery('.show_times_div').hide();
			} else {
				jQuery('.gd-event-time-row').show();
			}
		}
				function gd_on_repeat_type() {
			var repeat_type = jQuery('select[name=repeat_type]').val();
			if(repeat_type == 'custom') {
				jQuery('.gd-repeat-x').hide();
				jQuery('.gd-event-duration').hide();
				jQuery('.gd-recurring-for').hide();
				jQuery('.gd-start-edate').hide();
				jQuery('.gd-repeat-days').hide();
				jQuery('.gd-repeat-weeks').hide();
				
				jQuery('#gd_custom_recurring').show();
				jQuery('#gd_diff_times').show();
				jQuery('#show_times_div').show();
				jQuery('.gd-all-day').show();
				jQuery('.gd-event-time-row').show();
				if(jQuery('input[name=all_day]').is(":checked")) {
					jQuery('.gd-event-time-row').hide();
				} else {
					jQuery('.gd-event-time-row').show();
				}
			} else if(repeat_type == 'year' || repeat_type == 'month' || repeat_type == 'week' || repeat_type == 'day') {
				jQuery('.gd-repeat-x').show();
				jQuery('.gd-event-duration').show();
				jQuery('.gd-recurring-for').show();
				jQuery('.gd-start-edate').show();
				jQuery('.gd-all-day').show();
				if(jQuery('input[name=all_day]').is(":checked")) {
					jQuery('.gd-event-time-row').hide();
				} else {
					jQuery('.gd-event-time-row').show();
				}
				
				if (repeat_type == 'month' || repeat_type == 'week' ) {
					jQuery('.gd-repeat-weeks').show();
					jQuery('.gd-repeat-days').show();
					if (repeat_type == 'week') {
						jQuery('.gd-repeat-weeks').hide();
					}					
				} else {
					jQuery('.gd-repeat-days').hide();
					jQuery('.gd-repeat-weeks').hide();
				}
				
				jQuery('#gd_custom_recurring').hide();
				jQuery('#gd_diff_times').hide();
				jQuery('#show_times_div').hide();
			} else {
				jQuery('.gd-repeat-x').hide();
				jQuery('.gd-recurring-for').hide();
				jQuery('#gd_custom_recurring').hide();
				jQuery('.gd-all-day').hide();
				jQuery('.gd-event-time-row').hide();
				jQuery('#gd_diff_times').hide();
				jQuery('.show_times_div').hide();
			}
			var repeat_text = jQuery('#repeat_type').find('option:selected').attr('data-title');
						
			if (repeat_type!='') {
				gd_on_all_day(true);
			}
		}
		function gd_on_recurring(el) {
			jQuery('.gd-event-duration').show();
			jQuery('.gd-repeat-type').show();
			jQuery('.gd-repeat-x').show();
			jQuery('.gd-recurring-for').show();
			
			jQuery('.gd-event-end-div').hide();
			
			gd_on_repeat_type();		
			
			jQuery("select.chosen_select").chosen().trigger("chosen:updated");
			
			gd_onchange_recurring(el, 'on');
		}
		
		function gd_on_norecurring(el) {
			jQuery('.gd-event-duration').hide();
			jQuery('.gd-repeat-type').hide();
			jQuery('.gd-repeat-x').hide();
			jQuery('.gd-recurring-for').hide();
			
			jQuery('.gd-repeat-days').hide();
			jQuery('.gd-repeat-weeks').hide();
			
			jQuery('#gd_custom_recurring').hide();
			jQuery('#gd_diff_times').hide();
			jQuery('#show_times_div').hide();
			
			jQuery('.gd-start-edate').show();
			jQuery('.gd-event-end-div').show();
			jQuery('.gd-all-day').show();
			if(jQuery('input[name=all_day]').is(":checked")) {
				jQuery('.gd-event-time-row').hide();
			} else {
				jQuery('.gd-event-time-row').show();
			}
						
			gd_onchange_recurring(el, 'off');
		}
		
		function gd_onchange_recurring(el, type) {
		}