var saturns = new Array();
var mrlooper, speed;
var mrrunning = false;

function mouseClick() {
	if (!mrrunning)
		mrstart();
}

function mrstart() {
	var browserString = navigator.appName + " " + navigator.appVersion;
	if (browserString.match("Chrome") != null)
		speed = .25;
	else if (browserString.match("Internet Exporer") != null)
		speed = 2;
	else
		speed = 1;
	
	for (var i = 0; i < 12; i++) {
		saturns[i] = new Array();
		saturns[i][0] = Math.floor(Math.random() * (document.body.clientWidth - 32)); // x
		saturns[i][1] = 100; // y
		saturns[i][2] = 0; // stance
		saturns[i][3] = Math.floor(Math.random() * 100) + 10; // pause timer
		var newdiv = document.createElement("div");
		newdiv.setAttribute("id", "saturn" + i);
		newdiv.setAttribute("style", "position:fixed;left:" + saturns[i][0] + "px;bottom:100%;");
		newdiv.innerHTML = "<img id=\"spr" + i + "\" src=\"http://mother4.dcmsoftware.net/saturn-stand.gif\" />";
		document.body.appendChild(newdiv);
	}
	
	mrlooper = setTimeout("mrstep()",1);
	mrrunning = true;
}

function mrstep() {
	for (var i = 0; i < 12; i++) {
		if (saturns[i][3] <= 0) { // if no pause timer
			var d = document.getElementById("saturn" + i);
			var s = document.getElementById("spr"+i);
			switch (saturns[i][2]) {
				case 0: // falling
					if (saturns[i][1] - speed > 0)
						saturns[i][1] -= speed;
					else {
						saturns[i][1] = 0;
						saturns[i][2] = 1;
						saturns[i][3] = Math.floor(Math.random() * 100) + 10;
					}
				break;
				case 1: // facing forward
					if (Math.floor(Math.random()*2) == 0) {
						saturns[i][2] = 2;
						s.src = "http://mother4.dcmsoftware.net/saturn-left.gif";
					} else {
						saturns[i][2] = 3;
						s.src = "http://mother4.dcmsoftware.net/saturn-right.gif";
					}
						
				break;
				case 2: // walking left
					if (saturns[i][0] - 2 * speed > 0)
						saturns[i][0] -= 2 * speed;
					else {
						saturns[i][2] = 3;
						s.src = "http://mother4.dcmsoftware.net/saturn-right.gif";
					}
					
					if (Math.floor(Math.random()*60) == 1) {
						saturns[i][2] = 1;
						s.src = "http://mother4.dcmsoftware.net/saturn-stand.gif";
						saturns[i][3] = Math.floor(Math.random() * 100) + 10;
					}
				break;
				case 3: // walking right
					if (saturns[i][0] + 2 * speed < document.body.clientWidth - 32)
						saturns[i][0] += 2 * speed;
					else {
						saturns[i][2] = 2;
						s.src = "http://mother4.dcmsoftware.net/saturn-left.gif";
					}
					
					if (Math.floor(Math.random()*60) == 1) {
						saturns[i][2] = 1;
						s.src = "http://mother4.dcmsoftware.net/saturn-stand.gif";
						saturns[i][3] = Math.floor(Math.random() * 100) + 100;
					}
				break;
			}
			d.setAttribute("style", "position:fixed;left:" + saturns[i][0] + "px;bottom:" + saturns[i][1] + "%;");
		} else {
			saturns[i][3] -= 1; // count down
		}
	}

	mrlooper = setTimeout("mrstep()",1);
}

var keyboardString = "";
var python = new Array();
python[0] = "Your mother was a hamster and your father smelt of elderberries!";
python[1] = "It's not a question of where he grips it! It's a simple question of weight ratios! A five ounce bird could not carry a one pound coconut.";
python[2] = "Oh, king eh? Very nice. And how'd you get that, eh? By exploiting the workers? By hanging on to outdated imperialist dogma which perpetuates the economic and social differences in our society?";
python[3] = "Help! Help! I'm bein' repressed!";
python[4] = "What... is the capital of Assyria?";
python[5] = "What... is the air-speed velocity of an unladen swallow?";
python[6] = "Cut down a tree with a herring? It can't be done.";
python[7] = "Oh, what sad times are these when passing ruffians can say Ni at will to old ladies. There is a pestilence upon this land, nothing is sacred. Even those who arrange and design shrubberies are under considerable economic stress in this period in history.";
python[8] = "Follow. But. Follow only if ye be men of valour, for the entrance to this cave is guarded by a creature so foul, so cruel that no man yet has fought with it and lived. Bones of full fifty men lie strewn about its lair. So, brave knights, if you do doubt your courage or your strength, come no further, for death awaits you all with nasty, big, pointy teeth.";
python[9] = "And Saint Attila raised the hand grenade up on high, saying, 'O Lord, bless this thy hand grenade, that with it thou mayst blow thine enemies to tiny bits, in thy mercy.' And the Lord did grin. And the people did feast upon the lambs and sloths, and carp and anchovies, and orangutans and breakfast cereals, and fruit-bats and large chu...\n\nSkip a bit bother!\n\nAnd the Lord spake, saying, 'First shalt thou take out the Holy Pin. Then shalt thou count to three, no more, no less. Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who, being naughty in my sight, shall snuff it.'";
python[10] = "Who are you who can summon fire without flint or tinder?\n\nThere are some who call me... Tim. ";
python[11] = "And as the Black Beast lurched forward, escape for Arthur and his knights seemed hopeless, when suddenly, the animator suffered a fatal heart attack!\n\nThe cartoon peril was no more.";
python[12] = "Meanwhile, not more than two swallow's flights away, Arthur and Bedivere had discovered something. Oh, that's an unladen swallow's flight away, obviously. There were more than two laden swallow's flights away, four really, if they had the coconut on a line between them. I mean, if the birds were walking, and dragging the coconut...";
python[13] = "It reads, 'Here may be found the last words of Joseph of Aramathia. He who is valiant and pure of spirit may find the holy grail in the Castle of Aaauuuggghhh...'\n\nWhat?\n\n'The Castle of Aaaauuuggghhhh'\n\nWhat is that?\n\nHe must have died while carving it.";

function keyboard() {
	window.document.onkeydown = function(e) {
		keyboardString += e ? e.keyCode : event.keyCode;
		if (keyboardString.indexOf("3838404037393739666513") != -1) {
			alert(python[Math.floor(Math.random() * python.length)]);
			keyboardString = "";
		} else if (keyboardString.indexOf("83696782698413") != -1) {
			gotourlplz("http://mother4.dcmsoftware.net/supersecretdonotlookinhere/Graffiti.jpg");
			keyboardString = "";
		}
	}
}

function gotourlplz(url) {
	location.href = url;
}

 