var mySkin : GUISkin;
var nextLevel : String;

private var nextLevelTime = 30.0;

function Update () {
	nextLevelTime -= Time.deltaTime;
	if (nextLevelTime < 0.0 || Input.GetButtonDown("Jump")) {
		 Application.LoadLevel(nextLevel); 
	}
}

function Start() {
}

function OnGUI () {
	GUI.skin = mySkin;
	
	var w = Screen.width;
	var h = Screen.height;
	if (w < 1024 && h < 768) {
		GUI.matrix = Matrix4x4.TRS (Vector3.zero, Quaternion.identity, Vector3(w / 1024.0, h / 768.0, 1)); 
		w = 1024;
		h = 768;
	} else if (w < 1024) {
		GUI.matrix = Matrix4x4.TRS (Vector3.zero, Quaternion.identity, Vector3(w / 1024.0, 1, 1)); 
		w = 1024;
	} else if (h < 768) {
		GUI.matrix = Matrix4x4.TRS (Vector3.zero, Quaternion.identity, Vector3(1, h / 768.0, 1)); 
		h = 768;
	}  
  
	GUI.Label (Rect (w / 2 - 200, h / 2  - 50, 400, 1000), "CONGRATULATION!");
	GUI.Label (Rect (w / 2 - 200, h / 2 , 400, 1000), "You beat the game!");
	GUI.Label (Rect (w / 2 - 200, h / 2 + 30, 400, 1000), "Press JUMP / SPACEBAR to restart!");
}
