Serial ASCII conversion to int

Today, the Arduino arrived and my first big project for it will require serial data to flow both directions. Serial out to the computer looks relatively easy, but I'm struggling with sending serial data to the Arduino.

The first mini-project I'm trying is typing a number into the IDE serial box and dimming an LED accordingly.
I can type the numbers 0-9 and get the appropriate values, but when I type a multi-digit number, I only get those numbers individually so I can only use values from 0 to 9.
I know I need to somehow buffer the data and maybe concatenate the numbers into a char or string then convert the whole thing to int, but I'm completely unsure how to do this.

I've been searching the arduino site and Googling, but haven't found a tutorial or something that better explains the conversion process.

Here's my relevant code as of now (everything else is loop/setup definitions etc.:

char analogValue = '0';
 
   if(Serial.available()>0)
   {
     analogValue=Serial.read();
     Serial.println(analogValue);
     analogWrite(4,analogValue);
     //Serial.flush();
   }

Storing as a char seems to work , but as I said, only for single values not an entire number.
Thanks in advance for any help.
Matt

I wrote up a method earlier today:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1273230655/2#2