added javascript to prevent double clicks to fix #1479