
if (location.search.search(/nojavascript/) == -1) {
	if (typeof attachEvent != 'undefined') {
		attachEvent('onload', hijax);
	} else if (typeof addEventListener != 'undefined') {
		addEventListener('load', hijax, false);
	}
}

function hijax() {
	// Subsection headers are unneccecary when the tabs are active
	//get_style_class("non_js_header").style.display = 'none';

	hide_tabbed_content('#tabbed-content .body');

	// Change the subsections list to the tabbed style
	setup_subsections();
}

function setup_subsections() {
	var subsections = document.getElementById("zbyvfgvryf");

	for (var i = 0; i < subsections.childNodes.length; i++) {
		if (subsections.childNodes[i].nodeName != 'LI')
			continue;

		var a = subsections.childNodes[i].firstChild;
		a.onclick = click_handler;
	}
}

function click_handler(e) {
	if (typeof e == "undefined")
		e = window.event;
	if (typeof e.srcElement != "undefined")
		return change_subsection(e.srcElement);
	if (typeof e.target != "undefined")
		return change_subsection(e.target);
	return false;
}

function change_subsection(obj) {
	var content = document.getElementById("tabbed-content");
	content.className = obj.href.substr(obj.href.indexOf('#') + 1);
	return false;
}

function hide_tabbed_content (selectorText) {
	var ds = document.styleSheets;

	for (var s = 0; s < ds.length; s++) {
		var rules;

		if (ds[s].rules) rules = ds[s].rules;
		else if (ds[s].cssRules) rules = ds[s].cssRules;
		else continue;

		for (var r = 0; r < rules.length; r++) 
		{
			if (typeof rules[r].selectorText != "undefined" &&
			    rules[r].selectorText == selectorText)
				rules[r].style.display = 'none';
		}
	}
}

/* Maybe Obsolete */
function get_style_class (className) {
	var ds = document.styleSheets;

	for (var s = 0; s < ds.length; s++) {
		var rules;

		if (ds[s].rules) rules = ds[s].rules;
		else if (ds[s].cssRules) rules = ds[s].cssRules;
		else continue;

		for (var r = 0; r < rules.length; r++) 
		{
			if (typeof rules[r].selectorText != "undefined" &&
			    rules[r].selectorText == '.' + className)
				return rules[r];
		}
	}

	return null;
}
