managing custom javascript events