I was running out of digital inputs on the Duemilanove and was trying to solve this by using resistors and analog inputs to get a true/false solution..
Most of my solutions did not not work because the value was different if the neighbor pin was high or low..
Today I found that the analog pins are also capable to work as digital pins..(here)
The pins are accessible as pin 14 (a0) through 19 (a5)
This problem solved..