jQuery.noConflict()

jQuery(document).ready(function() {
  
  postFoodEntry();
  initDatePicker();
  
  jQuery('.edit_link').live('click', function(e) {
      e.preventDefault();
      jQuery.get('/diary/entry/edit', {id: this.id}, null, "script");
  });

 
  jQuery('.photo-thumbnail').click(function(e) {
    var photoID = 'photo-'+this.id
    var $dialog = jQuery('#'+photoID)
    	.dialog({
    		autoOpen: false,
    		width: 'auto',
    		height: 'auto',
    		modal: true,
    		title: this.alt
    	});

    	$dialog.dialog('open');
  });

});

function postFoodEntry() {
  jQuery('form#add_entry').submit(function(e) {
    e.preventDefault();
    jQuery.post(this.action, jQuery(this).serialize(), null, "script");
    // return this
  });
}

function closeEdit () {
  jQuery('.close_edit').click(function(e) {
    e.preventDefault();
    jQuery('.entry_edit_container').remove();
    jQuery("#entry_" + this.id).show();
  });
}
function updateDiaryEntry() {
  jQuery('.edit_entry_form').submit(function(e) {
    e.preventDefault();
    jQuery.post(this.action, $(this).serialize(), null, "script");
    
  });
}
function initDatePicker() {
  jQuery("#date, #edit_date").datepicker();
};