Counting up timer

Hi i am trying to make a count-up timer that starts at 0 and stops at 5mins. However the code will not stop and keeps going, im new at javascript(well programming in general) and i would appreciated it if anyone could give me a hand in making the time stop at the maxTime int. Thanks

var maxTime: int;
private var startTime: int = 0;
private var roundedRestSeconds : int;
private var displaySeconds : int;
private var displayMinutes : int;
private var countUpSeconds : int;


function Start()
	{
		
		startTime = Time.time;//timer

	}
	


function OnGUI () {
//timer
    var guiStart = Time.time + startTime;
  
    restSeconds = countUpSeconds + (guiStart);

    if (restSeconds == 240) {
        print ("One Minute Left");
    }
    
    if (restSeconds == 300) {
        print ("Time is Over");
   
        var guiStop = Time.time - maxTime;
   
    }
     
    //display the timer
    roundedRestSeconds = Mathf.CeilToInt(restSeconds);
    displaySeconds = roundedRestSeconds % 60;
    displayMinutes = roundedRestSeconds / 60; 

    text = String.Format ("{0:00}:{1:00}", displayMinutes, displaySeconds); 
    GUI.Label (Rect (200, 10, 100, 30),text);
//
    }

http://forum.unity3d.com/threads/62534-Timer-issues

I had tried that but then as soon as i run the game it prints “time over” and the timer keeps counting up.

I can’t understand you.

public var limitTime : float = 300.0;
private var elapsedTime : float = 0.0;

function Update ()
{
	TimeRunning ();
	
	if (limitTime <= elapsedTime)
	{
		// ...
	}
}

function TimeRunning ()
{
	if (elapsedTime < limitTime)
		elapsedTime += Time.deltaTime;
}