Modify javascript for IE

Another attempt at getting IE to work properly with the image cropping
javascript processing.

Also added some logging for debugging purposes, which need to be
removed before merge to master.