Cannot receive IR codes using IRRemote.

Hello, I'm new to this forum and this is my first post, so please excuse any mistakes. My problem is that I am using a switch on an ATmega328 which I want to use as a remote. I am using a switch to do this, toggleing receive and send mode. Now, my problem is that i have a series of codes I want to send, and when i want to receive some code while also having the codes written down, it just hangs. I cannot receive any code. Here is a detailed example:

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(2,OUTPUT);
  pinMode(4,INPUT);
  digitalWrite(2,HIGH);
  state = digitalRead(4);

}
void loop()
{

  if (state==LOW)
  {
    
    if (irrecv.decode(&results)) 
    {
      dump(&results);
      irrecv.resume(); // Receive the next value
    }
  }
  else
  {

    send_code0();
    send_code1();
    send_code2();
    send_code3();
    send_code4();
    send_code5();
    send_code6();
    send_code7();
    send_code8();
}

That part of the code works just fine. The switch starts in the receive position (LOW) and i can receive codes. When i switch to send, it sends those 8 codes. Now here is my problem. If i write down all the 33 functions (for all the codes) it just hangs and i can't receive anything, even though it is the receive mode and not entering the send one first. Any ideas would be appreciated.

It sounds very much as though you may be running out of memory.
Please post the whole program that does not work and not just part of it.

The code is over 9500 characters, so too much to paste here. Here's on pastebin http://pastebin.com/QtQjrYnr

Arduino 1.5.x will show your SRAM usage, for older versions use this script: http://forum.arduino.cc/index.php?topic=196101.0

Remember, AVR is a stack based processor, you must leave some SRAM for proper operation.

Ray