The maximum principle for cooperative weakly coupled elliptic systems and some applications