function removefriend(userId){
    var args = new Object();
    args.userId = userId;
    confirmSubmit(null, removefriendConfirmHandler, args );
    return false;
}

function removefriendConfirmHandler( value , args ){
    if( value == true ){
        var userId = args.userId;
        var ajax = new Ajax( removefriendhandler, ajaxError, userId );
        var uri = "/community/deletefriend!ajax.action?gen="+generateLine()+
                  "&userId="+encodeURIComponent( userId )+"&confirm=true";
        ajax.get( uri, null, false );
    }
}

function removefriendhandler( obj, jsont ){
    var json = eval( '(' + jsont + ')' );
    if(json.status == 'failure'){
        dialogAlert( json.errorMessage );
    }else{
        var userId = obj.getParams();
        var fx_in = new Fx.Morph( $('friend_'+userId), {duration: 1000, transition: Fx.Transitions.linear} );
        fx_in.start({ opacity:0 }).chain( function() { $('friend_'+userId).setStyle('display', 'none'); } );
    }
}



