Add image type check to fix IE8 image handling.

See https://github.com/DmitryBaranovskiy/raphael/issues/468#issuecomment-6587004