More productive Jscript

Hi, I have this JS, it is working, I need to set about 50 different pictures for 50 different buttons, I mean each button will show a different picture in the GUITexture. Is there a way to make only one JS to show the correct picture from the correct button touched? Instead of make 50 different scripts? Any help is welcome :slight_smile:
P.S. I am having problem to set the GUITexture to fit the full width with 50pixels height in the bottom of the iOS devices only Landscape mode.

var InfoPanel : GUITexture;

function Start(){
InfoPanel.enabled = false;
}

function OnTouchDown(){
InfoPanel.enabled = true;
}

function OnTouchUp(){
InfoPanel.enabled = false;
}

function OnTouchStay(){
InfoPanel.enabled = true;
}

function OnTouchExit(){
InfoPanel.enabled = false;
}

The typical way to do this would be using a collection. Each button will report a unique index to the collection. Then you display the single picture. Pseudo code:

GameObject[] myPanels = new GameObject[50];

public void ButtonPushed(int buttonIndex){
    myPanels[buttonIndex].setActive(true);
}

There are multiple different ways to code this, but the concept is the same.

My assumption: Even though I don’t know much JavaScript, though it is all I use, is to set variables for every picture (Or even just 0 and 1 (“Oh, if is 1 then show picture, else don’t show.”)) Assuming you wrote this script yourself, I think you should know how to do that.