// ==UserScript==
// @name Randomize The Naviation Links Even More
// @namespace http://webonastick.com/
// @author Darren Stuart Embry http://webonastick.com/
// @include http://www.*mojo.com/*
// ==/UserScript==

(function(){

	var seed = new Date().getTime();
	var random2 = function () {
		seed = (seed * 9301 + 49297) % 233280;
		return seed / 233280.0;
	};
	var shuffle = function (a) {
		var i = a.length, j, t;
		while (i) {
			j = Math.floor( (i--) * random2() );
			t = a[i];
			a[i] = a[j];
			a[j] = t;
		}
	};

	var linktopnav = document.getElementById("linktopnav");
	if (!linktopnav) return;

	var shuffle_links = function () {
		var tag_rx = /<\s*a\b.*?<\s*\/\s*a\s*>/gi;
		var html = linktopnav.innerHTML;
		var matches = html.match(tag_rx);
		shuffle(matches);
		html = html.replace(tag_rx,
			function () { return matches.pop(); }
		);
		linktopnav.innerHTML = html;
	};

	window.setInterval(shuffle_links, 5000);

})();

