Map() function

Hmm, well now I'm having another dilemma. What about a potentiometer? I have a joystick controller where the potentiometer is centered at a digital reading value of 505 but the whole range is 0-1023. I want to be able to control the speed of a motor from 507 to 1023 and 503 down to 0 with 1023 and 0 being the highest speed the motor can achieve. Range from 507 - 1023 is forward while 0 - 503 is reverse, but again the speed varies with the potentiometer. Is that possible with a map function?