added javascript replace function