/* Javascript support for displaying random Unicode characters */
var scrolling = false;
var duration = 2; // Seconds to show each character in 'scrolling' mode
var scroller = 0;

function newchar(style) {
	loadContent("http://inst.eecs.berkeley.edu/~nss/unirand/unirand.php?sty=" + style);
}
function nextchar() {
	newchar("display: none;");
	scroller = window.setTimeout("nextchar()",1000*duration);
}
function togScroll() {
	if (scrolling) {
		window.clearTimeout(scroller);
		scrolling = false;
		document.getElementById("anext").style.display = "inline";
	}
	else {
		scrolling = true;
		nextchar();
	}
}
function loadContent(file) {  // Dynamically loads a script
	var scriptTag = document.getElementById('loadScript');
	var head = document.getElementsByTagName('head').item(0)
	if(scriptTag!=null) {
		head.removeChild(scriptTag);
	}
	script = document.createElement('script');
	script.src = file;
	script.type = 'text/javascript';
	script.id = 'loadScript';
	head.appendChild(script);
}

