iPhoto:
Go into HDD/users/yourname/pictures/
Copy the "iphoto library" file, which should contain all your photos, organization, and everything. If you right click (or command+click) and select "show package contents", the photos should be in there.
When you get the new or reformatted computer, drop the iphoto library file back into the pictures directory where you got it. Delete the one that is there, if there is already one present. iPhoto will open and check it's default location for the library file, and use that.
iTunes:
Same thing. go to
HDD/users/yourname/music/iTunes/
copy the entire "iTunes" folder to an external HDD, and replace it when you get the new computer.
if you backup to DVD, burn the music folders first. They take up the most space and may take several DVDs to copy, depending on the size of your library. After that, go back and copy the iTunes folder itself, but exclude the large "iTunes music" folder which you have previously copied. Simply copy the rest of the files and replace everything on the new computer with the saved files.
just to clarify:
HDD/users/yourname/music/iTunes/iTunes Music/Artist/Album/song.mp3
That bolded folder is the one to copy. It contains the library file, and other files needed. Inside that folder is "iTunes Music" which contains all the actual music and movie files.