add a sad image on errors
move js into a seperate file