The default behavior when setting the euler of a bone, is to set it in its local coordinate system. Since the head bone is the child of other bones, its local coordinate system does not match up with the world coordinate system. If you want to rotate the head bone in world coordinates, try the following:
Code:
head.setEuler(euler,viz.AVATAR_WORLD)
This will rotate the bone in the avatars world coordinate frame.