private var username:String;	//The username of the player
public var header:GUISkin;	//Used for total title
public var content:GUISkin;	//Used for the list
private var list:Array;
function Start () {
	username = "Search by nickname...";
}

function Update () {
	var db = new DBase();	//Creating a database instance
	list = db.getScoresByUsername(username);	//Getting scores from database
}

function OnGUI(){
	GUI.skin = header;	//Setting up the GUI Skin.
	
	//Title
	GUI.Label(Rect(100,70,950,100),"History");
	
	GUI.skin = content;	//Setting up the GUI Skin.
	username = GUI.TextField(Rect(100,160,280,40),username,75);
	
	var height = 200;	//Position of elements of the list
	var pos = 1;	//position
	
	//For each item inside the list: show details
	for(var item : Highscore in list)
    {
    	GUI.Label(Rect(100,height,50,30),""+pos);	//Showing position
 		GUI.Label(Rect(150,height,200,30),item.getName());	//Showing player name
 		GUI.Label(Rect(250,height,200,30),""+item.getScore());	//Showing player score
 		height+= 30;	//Increment the hight for next player
 		pos++;	//Increment the position for next player
    }
    
    
    //Clicking this button will redirect the user to the main menu.
    if(GUI.Button(Rect(100,height,270,30),"Back")){
    	Application.LoadLevel(0);
    }
}