Electronic and magnetic properties of nanographite ribbons