Careful, be sure to select a foam with minimal expansion. The garden variety expands too much and may cause problems, including windows that wont move. You may also void any warrantee from the window manufacturer.
Yeah, I have the minimally expanding foam. Thanks for the warning though :)