I recently booked online four legs of a train journey. It was less than 2 months in advance, so I don't know the time limit of advance booking. These two sites were very helpful with instructions:
http://www.seat61.com/India.htm#book...from%20outside
http://www.indiamike.com/india/showthread.php?t=4305