Well here's one js library to do that:
http://chrisbateman.github.io/spherical/
The only thing you'll need to use it is a full 360x180 panorama, broken up into the six sides of a cubic projection. Generating a cubic projection isn't too tricky with Hugin.
Include the JS and CSS, make a <div> for it to live in, and instantiate it:
new Spherical({
container: '#pano',
front: 'images/front.jpg',
back: 'images/back.jpg',
left: 'images/left.jpg',
right: 'images/right.jpg',
top: 'images/top.jpg',
bottom: 'images/bottom.jpg'
});