move the onpaste event handler to javascript

otherwise the code doesn't validate.