Conitionaly include sources and destinations using JavaScript