Trouble with code can someone help

Hi all I am having a small problemcontrolling a Safy Lighttower the tower is conected to a Arduino Unoand a Seedsrudio Relay shield what i would like to do is have a computer sending commands via usb toca control the Arduino attach is the code i am tring to configur can some one help me

Also i am getting the Arduino is resetting when it recive a comand from the usb

#include <arduino.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial (10, 11);

char serialin;

const byte Relay1 = 7;
const byte Relay2 = 6;
const byte Relay3 = 5;
const byte Relay4 = 4;
void setup() {

//Begin Serial Comunication(configured for 9600baud)
Serial.begin(9600);
//pin relay as OUTPUT
pinMode(Relay1, OUTPUT); //Red Light
pinMode(Relay2, OUTPUT); //Yellow Light
pinMode(Relay3, OUTPUT); //Green Light
pinMode(Relay4, OUTPUT); //Spare Relay
//Relay
digitalWrite(Relay1, LOW); //Red Light
digitalWrite(Relay2, LOW); //Yellow Light
digitalWrite(Relay3, HIGH); //Green Light
digitalWrite(Relay4, LOW);} //Spare Relay

void loop() {
//Verify connection by serial
while (Serial.available() > 0) {
//Read Serial data and alocate on serialin
serialin = Serial.read();
if (serialin == 'O'){ // No timer Green light on all other off
digitalWrite(Relay1, LOW); //Red Light
digitalWrite(Relay2, LOW); //Yellow Light
digitalWrite(Relay3, HIGH); //Green Light
digitalWrite(Relay4, LOW); //Spare Relay
}
else if (serialin == '1'){
// green light with timer to turn on Red Light if no input to rest timer
digitalWrite(Relay1, LOW); //Red Light
digitalWrite(Relay2, LOW); //Yellow Light
digitalWrite(Relay3, HIGH); //Green Light
digitalWrite(Relay4, LOW); //Spare Relay
delay(1000);
// Red light ON Green Light Off timed out
digitalWrite(Relay2, LOW); //Green Light
digitalWrite(Relay1, HIGH);} //Red Light

else if (serialin == '2'){
// the yellow light end of cycle
digitalWrite(Relay1, LOW); //Red Light
digitalWrite(Relay2, HIGH); //Yellow Light
digitalWrite(Relay3, LOW); //Green Light
digitalWrite(Relay4, LOW);} //Spare Relay

else if (serialin == '3'){
// the Red Light Mainence Needed cycle
digitalWrite(Relay1, HIGH); //Spare Light
digitalWrite(Relay2, LOW); //Yellow Light
digitalWrite(Relay3, LOW); //Green Light
digitalWrite(Relay4, LOW); } //Red Light

Serial.println(serialin);
}
}

At the first, edit the code in your post - put it into required form to be better readable, please (use icon "#" or read this: Read this before posting a programming question ... - Programming Questions - Arduino Forum how to).

I don't understand what you do want to help with in the first part of your question. You have some code, it means you are on good way to reach the goal. Which kind of help you need?

Also i am getting the Arduino is resetting when it recive a comand from the usb

Specify more detailed info about this problem. Arduino UNO has a feature which it reboots every time whenever you are connecting it to PC via USB port.

delay blocks execution of the main program so while you do the delay(1000); you will not be able to act on any input to reset timer.

  // green light with timer to turn on Red Light if no input to rest timer
    digitalWrite(Relay1, LOW);    //Red Light
    digitalWrite(Relay2, LOW);     //Yellow Light
    digitalWrite(Relay3, HIGH);    //Green Light
    digitalWrite(Relay4, LOW);     //Spare Relay
    delay(1000);
    // Red light ON Green Light Off timed out
    digitalWrite(Relay2, LOW);     //Green Light
    digitalWrite(Relay1, HIGH);}   //Red Light