Progress Bar Parallel To Game Progress - HELP

I would like to make a game progress bar that reads the values of 0% - 100%

I want the progress bar to fill with green (or any colour) on 100%, but is empty at 0% (eg: if game progress = 50%, then only half the progress bar will be green).

Can someone help me out here. I have no where to start.

I was thinking of using a green image that is 1px width by, say 20px height. And use a script that would 'stretch' the value of the width apparent to the percent of game complete (var GameComplete = 0;)

In JavaScript Please

In unity you have a choice of doing it in 2D or 3D

Of Course 2D is easier here.

1) Create 2 textures (Could be any image file format, jpg, png, psd etc) One can be green(the color of a filled bar) the other can be say white(the color of an empty bar)

2) use the bellow script:

(This is in C#)

float curScore = 0f;
public float maxScore = 100f;  // The maximium 

public Texture2D whiteTexture;
public Texture2D greenTexture;

void OnGUI (){
    GUI.drawTexture( new Rect(0,0, 200, 20), whiteTexture );
    GUI.drawTexture( new Rect(0,0, 200 * (currentScore/maxScore) , 20), greenTexture );
}

// Resets the score to 0
public void resetScore(){
 currentScore = 0f;
}

// Increments the score by one unit
public void AddScore(){
 if (currentScore < maxScore)
     currentScore++;
}