Fixed issue with javascript errors - reverted back to do while loop for loading scripts.