function toggleCode() {
	var els = ['html','js','c_code'];
	for(var i = 0; i < els.length; i++) {
		el = document.getElementById('toggle_' + els[i]);
		if (el) el.onclick = switchDisplay.apply(els[i]);
	}
}
function resetStyle() {
	var els = ['html','js','c_code'];
	for(var i = 0; i < els.length; i++) {
		el = document.getElementById('toggle_' + els[i]);
		if (el && el.parentNode) {
			if (el.parentNode) var new_el = el.parentNode;
			else var new_el = el.parentNode;
			new_el.setAttribute('class','sourcecode_btn')
			new_el.setAttribute('className','sourcecode_btn')
			el.onclick = theClickFunction(els[i]);
		}
	}
}
function theClickFunction(el) {
	return function() { return switchDisplay(el)};
}
function hideCode() {
	var els = ['html','js','c_code'];
	for(var i = 0; i < els.length; i++) {
		el = document.getElementById(els[i]);
		if(el) el.style.display = 'none';
	}
}
function switchDisplay(id,noAnchor) {
	hideCode();
	resetStyle();
	var el = document.getElementById(id);
	if (el) {
		el.style.display = 'block';
		var new_el = document.getElementById('toggle_' + id).parentNode;
		if (new_el[0]) new_el = new_el[0]
		new_el.setAttribute('class','sourcecode_btn sc_selected')
		new_el.setAttribute('className','sourcecode_btn sc_selected')
	}
	return false;
}
resetStyle();
hideCode();
toggleCode();
switchDisplay('html', true);
