function initial_hide_time() {
  if ($('event_all_day').checked) {
    //hide the time box
    $('time_wrapper').hide();//don't blind it, just hide it.
  }
  return true;
}

//optional method called when saving form.  Model-level validation still occurs - this just gives
//a chance for friendly pre-submit notices.
function validate(form) {
//   content_length_max = 500;
//   content_length = tinyMCE.get('event_html_content').getContent().unescapeHTML().length;
//   if (content_length > content_length_max) {
//     alert("The maximum length of an event is "+content_length_max+" characters.  Your event is "+content_length+" characters.");
//     return false;
//   }
  return true;
}

function toggle_time(checkbox) {
  //we want to frob the time_wrapper id
  if (checkbox.checked) {
    Effect.SlideUp('time_wrapper', {duration: 0.25});
  } else {
    Effect.SlideDown('time_wrapper', {duration: 0.25});
  }
  return true; //always
}

function show_event_editor(event) {
	init_event_editor();
	//tinyMCE.execCommand('mceAddControl', false, 'event_html_content');
	document.stopObserving('lightview:opened', show_event_editor);
	document.observe('lightview:hidden',function() {
		try { $('event_panel').remove(); } catch(e) {}	// May not exist if Lightview loaded the panel itself via Ajax
	});
}

// Not used at the moment; whole form panel gets removed instead.
function hide_event_editor() {
	tinyMCE.execCommand('mceRemoveControl', false, 'event_html_content');
}
