function actor_search_onSuccess(t, frm) {
  var result = t.responseJSON;
  
  if(result.success)
  {
    var actor = {};
    
    // remove previous elements
    $$('#friend-list .mini-profile').each(function(elm){
      elm.remove();
    });
    
		result.search.each(function(actor){
      // create a new actor div
      var new_actor = $('dummy_actor').cloneNode(true);
      
      var to_replace = [
        { change:'ACTOR_NAME',      to:actor.name },
        { change:'ACTOR_TOWN',      to:actor.town },
        { change:'ACTOR_ID',        to:actor.actor_id },
        { change:'ACTOR_COUNTRY',   to:actor.country },
        { change:'ACTOR_TYPE',      to:actor.actor_type },
        { change:'ACTOR_ALIAS',     to:actor.alias },
        { change:'LINK_TYPE', 			to:actor.LINK_TYPE },
        { change:'LINK_LOCATION', 	to:actor.LINK_LOCATION },
        { change:'PROFILE_IMAGE',   to:actor.IMAGE_PATH }
      ];

      to_replace.each(function(rep){
        new_actor.innerHTML = new_actor.innerHTML.replace(new RegExp(rep.change, "g"), rep.to);
      });
      
      // add element to list
      $('friend-list').appendChild(new_actor);
      new_actor.show();
		});
  }
  else
  {
    switch(result.error_code)
    {
      case 'no_rights':
        display_notification('You do not have permission to do this. You need to be a friend before you can do this.');
        break;
      default:
        display_notification('There was performing your search.');
        break;
    }
  }
}

function actor_search_onFailure(t, frm) {
  display_notification('There was a problem performing your search, please try again.')
}
