To recover media from the iPod see Recover your iTunes library from your iPod or iOS device.
To switch which library iTunes is connected to hold down shift as you start iTunes and keep holding until asked to choose or create a library...
"Online" suggests the library is stored out on the web somewhere which, as diesel says, doesn't make sense. If your library popped up empty, but the media is all still in the same place then the most likely problem is a missing/corrupt library file. That can normally be fixed with the following approach...
Empty/corrupt library after upgrade/crash
Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps you shouldn't lose a thing or need to do any further housekeeping. In the Previous iTunes Libraries folder should be a number of dated iTunes Library files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library.itl as iTunes Library (Corrupt).itl and then rename the restored file as iTunes Library.itl. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
See iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
Though if you've managed to get iTunes connected to the "wrong" library file you may need use the shift-start-iTunes method to connect to the "right" one.
When you get it all working make a backup!
I think I may be confusing things by using the wrong terminology. Situation I find myself in is as follows.
My iPod has 8832 songs on it.
When I plug the iPod into my laptop and open up iTunes, a total of 4 albums / 75 songs appear - including 1 album / 22 songs I copied from a CD yesterday.
On the iTunes tool bar, thers is a button "iPod". When I double click this button, my summary page (Capacity, Serial Number etc) opens up. On the toolbar there is a button "On This Ipod". When I click this, I get a full list of items on my iPod, with the header indicating 8832 items.
To the bottom right ofmy screen there is a button "Sync". When I click this button, the header bar momentarily shows "Syncing iPod. Do not disconnect".
Once I get the OK to disconnect message, my iPod still has 8832 items and excludes the 1 album / 22 songs copied in to iTunes yesterday.
Okay, there is no second library. What you describe above is merely seeing the media on the iPod.
Syncing is one way, computer to iDevice.
The only exception being iTunes purchases which can be transferred from the iDevice to the iTunes library.
Following the instructions in the link Tim provided should allow for recovering the library from the iPod to the computer.
Sounds as if you are manually managing the iPod. This means you need to actively drag new content to the device. You will find this easier to do using iTunes 11 if you enable the sidebar with Ctrl-S.
See also Recover your iTunes library from your iPod or iOS device for tips on getting all your media into your iTunes library. Once everything is in the library you can set up the device for "syncing" so that new content can be automatically added to the device.