/*Some small ubiquitous shortcuts*/
function each(a, f) {for(var i=0; i<a.length; i++) f(a[i])};
function $a(num) {return Math.abs(num)}
function $f(num) {return parseFloat(num||0)}
function $r(name) {return readCookie(name)}
function $n(el, tx, css) { /*new node*/
	var n = document.createElement(el);
	if(tx) {n.innerHTML=tx};
	return n;
}
function fold(plus, content, force) { 
	if(plus) $(plus).innerHTML = force ? force : ($(plus).innerHTML == '+' ? '-': '+')
	force? ($(content).style.display=force=='+'?'none':'block') : Toggle.display(content)
	if(force) write_location('#'+content)
}
function object(o) {
	function f() {}
	f.prototype = o;
	return new f();
}
/*DOM manipulation*/
function prepend(p, c) {p.firstChild ? p.insertBefore(c, p.firstChild) : p.appendChild(c); return p};

/*GUI gimmicks*/
function flourish() {
	var fl = '|';
	var stage = $('fl').stage||0;
	switch(stage%4) {
		case 1: fl = '/'; break;
		case 2: fl = '&mdash;'; break;
		case 3: fl = '\\'; break;
	}				
	$('fl').stage = stage+1;
	return fl;
}
function flourisher(md) {
	var ing = $('ing')
	if(md=='unload') {
		ing.style.display='none'
		clearInterval(ing.interval)
	}
	else {
		ing.style.display='block'
		ing.interval = setInterval("$('fl').innerHTML=flourish()", 500)
	}
}
function disable_select(md) {
	if(md) {
		document.onmousedown=document.onselectstart=function() {return false};
		document.onclick=function() {return true};
	}
	else document.onclick=document.onmousedown=document.onselectstart=null
}

