function formFocus(theForm, theCurrent, theDesired) {
	if (theForm.value == theCurrent) {
		theForm.value = theDesired;
	}
}

function open_window(fileName, windowName, windowWidth, windowHeight, scrollbars, resizable) {
	window.open(fileName, windowName, 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=' + scrollbars + ', resizable=' + resizable + ', left=' + centre(windowWidth, screen.availWidth) + ', top=' + centre(windowHeight, screen.availHeight) + ', width=' + windowWidth + ', height=' + windowHeight);
}

function centre(size,area) {
	return (area/2)-(size/2);
}

var showHide = Class.create();
showHide.prototype = {
	initialize : function() {
		var loc = document.location.href.match(/#(\w+)/) ? RegExp.$1 : "spec";
		this.links = $$("ul.specs a");
		this.spec = $$("div.spec-holder");
		this.spec.without(loc).each(this.hide.bind(this));
		this.show(loc);
		this.links.each(function(el) {
			var element = el.match(/#(\w.+)/) ? RegExp.$1 : "spec";
			if (loc == element) el.addClassName('selected');
		});
		this.links.each(this.setup.bind(this));
	},
	setup : function(elm) {
		Event.observe(elm, 'click', this.activate.bindAsEventListener(this), false)
	},
	activate : function(ev) {
		var elm = Event.findElement(ev, "a");
		this.spec.without(elm).each(this.hide.bind(this));
		this.show(this.hash(elm));
		elm.addClassName('selected');
		this.links.without(elm).each(function(el) {
			el.removeClassName('selected');
		});
		ev.stop();
	},
	hash : function(elm) {
		return elm.href.match(/#(\w.+)/)[1];
	},
	hide : function(elm) {
		$(elm).hide();
		//this.links.without(elm).each(removeClassName('selected'));
	},
	show : function(elm) {
		$(elm).show();
	}
}
