hat java script and rename hat images