Purpose and determining when to use hidden layers
A hidden layer is used to increase the expressiveness of the network.  It allows the network to represent more complex models than possible without the hidden layer.

Choosing the number of hidden layers, or more generally choosing your network architecture including the number of hidden units in hidden layers as well, are decisions that should be based on your training and cross-validation data.  You should train the network with a set amount of nodes (to start, try one hidden layer, with one unit per input unit) and test the model.

See this link for more help:  http://www.faqs.org/faqs/ai-faq/neural-nets/part3/section-10.html