Short answer: fogging between panes, cracks, and failed seals usually mean just the glass unit needs replacing. Rot, warping, or a frame that won't open and close properly means the whole window needs attention.
Glass-only problems
Foggy or hazy glass between double panes means the seal has failed and moisture got trapped — this is a glass unit replacement, not a full window job, and considerably cheaper.
Whole-window problems
If the frame is soft, warped, or the window won't latch or seal properly regardless of the glass, that's a structural issue no glass replacement will fix.
Ask before you agree: some companies default to quoting a full window replacement because it's a bigger job. If your frame is solid, insist on getting a glass-only quote first.