cityspk.moderation = {};
cityspk.moderation.flagContent = function(type, slug)
{
  if(type == 'photo')
  {
    cityspk.api.photos.flag(cityspk.moderation.flagResult, { slug: slug});
  }
  else
  {
    cityspk.api.message.flag(cityspk.moderation.flagResult, { slug: slug});
  }
  return false;
};

cityspk.moderation.moderateContent = function(type, slug, action)
{
  var editor_mask = 0;
  $('.editor_flags').each(function()
  {
    if($(this).attr('checked'))
    editor_mask += parseInt($(this).val());
  });
  
  var mod_params = new Object();
  mod_params['slug'] = slug;
  mod_params['action'] = action;
  mod_params['editor_flags'] = editor_mask;
	
	if(arguments.length > 3){
		mod_params['editor_flags'] = 10;
	}
	
  if(type == 'photo')
    cityspk.api.photos.moderate(cityspk.moderation.flagResult, mod_params);
  else
    cityspk.api.message.moderate(cityspk.moderation.flagResult, mod_params);

  return false;
};

cityspk.moderation.flagResult = function(result)
{
  window.location.reload();
};

