Button to begin loop?

okay so im new to arduino i have set up a sequence of leds to turn on, now i cant seem to figure out how to make it wait for a button press to start the blinking lights and if its pressed again to stop, heres the code i have so far.

int ledPin = 2;
int ledPin2 = 7;
int ledPin3 = 5;

void setup() {

pinMode(ledPin, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);

}

void loop()
{
digitalWrite(ledPin3, HIGH);
digitalWrite(ledPin2, HIGH);
delay(500);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
digitalWrite(ledPin, LOW);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
}

can someone help me? i have tried using if, and else butno success :-/ :-/ :-/

Well one method is to insert some code in the setup function that waits for a switch input or in my example, waits for the user to type any key on the PC. In your main loop you can deal with how to stop the code.
This is just a fragment example showing a wait to start the main loop:

void setup()
{
 // normal setup code goes here 
Serial.begin(57600);
Serial.println ("Hit a key to start");     // signal initalization done
while(Serial.available() == 0){}
}

// normal loop function goes here

Lefty

int ledPin =  2;
int ledPin2 =  7;
int ledPin3 =  5;    
boolean toggle = 0;


void setup()   {                

 pinMode(ledPin, OUTPUT);
 pinMode(ledPin2, OUTPUT);    
 pinMode(ledPin3, OUTPUT); 
 Serial.begin(9600); 

}

void loop()                    
{  
if(Serial.available())
  {
    toggle = !toggle;
    Serial.flush();
  }
  if(toggle == 1)
  {

 digitalWrite(ledPin3, HIGH);
 digitalWrite(ledPin2, HIGH);
 delay(500);
 digitalWrite(ledPin3, LOW);
 digitalWrite(ledPin2, LOW);
 digitalWrite(ledPin, HIGH);
 delay(500);
 digitalWrite(ledPin, LOW);
 digitalWrite(ledPin, LOW);
 digitalWrite(ledPin2, LOW);
 digitalWrite(ledPin3, LOW);
 }
}

Here we change the state of a boolean variable based on a key press and then validate this variable to execute your instructions

Cheers,
Pracas