How could there be an infinite number of perpendicular vectors?
To get vector A, I think you'd take the cross product of B and the vertical vector. I think you're getting those two vectors the wrong way, though, looking over %currentNormal and %targetNormal. You'd get B by subtracting the start position from the end position (final - initial), then normalizing it to get a unit vector. The one you're crossing it with would be a vertical unit vector, "0 0 1." I think the amount you'd need to rotate would be based on the dot product of those same vectors. Not sure exactly how you get from that product to the 4th axis rotation value, because I never actually read up on that system. mAcos may be it, looking over your code.