second problem solved with Javascript