When I put my iBook back together last night, I ended up with an extra piece that I'd forgotten to put back in: a small but powerful magnet. Today I figured out where it goes and what it's for. It goes just underneath the top case, directly below the right arrow key on the keyboard. At the corresponding position on the lid, just to the right of the screen, there's a reed switch. When the lid is closed, the switch turns on because of the nearby magnet, and the computer knows it's time to go to sleep.
I considered doing exactly the same thing when I made an alarm for my freezer door (it's gotten left ajar more than once, and if not discovered very quickly, that's a disaster). I opted for a simple contact switch instead, because I don't want the switch activated if the freezer door is only almost closed. With a laptop, if the lid is almost closed, it's fine to go to sleep anyway.
The other option I'd considered for the freezer was an LED and a photocell. I chose not to do that just because it would have been complicated (I'd have to construct something to make sure the light from the LED didn't bleed over to the photocell and could only get there by reflecting off the freezer door, and of course I'd have to buy the right kind of photocell with the right voltage or resistance or however photocells are measured...).
Anyway, my laptop is back up and running. So far, though, the old hard drive isn't.
Have you backed up your important data this week?