I programmed a camera like this a few days ago, but I deleted the file... so it's not tested, sry ^^

Code:
var distance = 100; //distance between the player and the camera

function players_camera()
{
  camera.x = my.x - distance*cos(20+my.pan);
  camera.y = my.y - distance*sin(20+my.pan);
  camera.z = my.z;
}



The idea was to change the angle used for the position to move the camera around the player a little bit, til it's on the right side of him.
But this is A7 and when I look at your codes it seems there is no "normal" sinus-Function anymore... grin Maybe you have to change it a little bit, shouldn't be a problem, if you understand my explanation although it is not good xD (if not, feel free to ask)
Just play with the 100 and 20 til the position is ok.