The XP installation CD cannot alter partition ID from NTFS to native Linux. You must use Linux, either from a boot-up Ubuntu or any Linux Live CD.
The XP installation CD can restore Windows MBR. Check the Task B2 of the last link in my signature.
You can mess around the partition table without damaging the partition's interior. If you want to keep the partition interior do not
do any formatting or writing if system doesn't boot correctly.
My advice is to salavge you Winodws first before rescuing the Linux. However your Ubuntu will boots OK if you alter sda8 back to partition Type 0x82 (or just 82). This you can actually do with Grub as follow (if you still has the booting screen from Grub)
(1) When you see a Grub screen press "c" to drop into a Grub prompt
(2) Check the disk geometry by command
Grub counts from 0 so your partition (hd0,0),(hd0,4) and (hd0,5) for sda1, sda4 and sda6 should be Type 0x7. As no damage was indicated on Ubuntu so partition (hd0,2) or sda3 should remain 0x83. Your target is to make sure partition (hd0,7) or sda8 is the swap partition and is type 0x82. If your information was accurate in Post #1 then it should be type 0x83 now.
(3) ALter partition sda8 back to swap by command
parttype (hd0,7) 0x82
(4) After a reboot Unbuntu should be back to normal and your Windows should be intact as well if you haven't done any damage to it.
Good luck to your recovery.