// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function favorite_item(item_id, type){
  new Ajax.Request('/items/' + item_id + '/' + type, {
    asynchronous:true,
    evalScripts:true,
    parameters:'authenticity_token=' + encodeURIComponent(authenticity_token),
    onLoading:function(r){$('item_' + item_id + '_fav_button').hide();},
    onFailure:function(r){alert('エラーが発生しました');}
  })
}

function favorite_comment(comment_id, type){
  new Ajax.Request('/comments/' + comment_id + '/' + type, {
    asynchronous:true,
    evalScripts:true,
    parameters:'authenticity_token=' + encodeURIComponent(authenticity_token),
    onLoading:function(r){$('comment_' + comment_id + '_fav_button').hide();},
    onFailure:function(r){alert('エラーが発生しました');}
  })
}
