Effects of nonmagnetic and magnetic impurities in the normal metal layer ofSNS junctions