Zoom and map

Hi all

I have a map. i want to add a zoom in/out and feature to it , i am able to zoom in and out .

I am having problem in paning the map. Instance name for the MC is map.

Here is the function that i m using for zooming the map
function zoom(amount) {
xoffset = startWidth*(map._x-startx)/(100/amountmap._width);
yoffset = startHeight
(map._y-starty)/(100/amount*map._height);
map._xscale = map._xscale+amount;
map._yscale = map._yscale+amount;
map._x = map._x+xoffset;
map._y = map._y+yoffset;
y_coord = map._y;
x_coord = map._x;
scale = int(map._xscale)+"% view";
if (map._xscale<=50) {
map._xscale = 50;
map._yscale = 50;
scale = int(map._xscale)+"% view";
}
// end if
}

Thanks