
function $(id)
{
	return document.getElementById(id);
}
function show(id, f)
{
	//document.getElementById(id).style.display = f ? "block" : "none";
	document.getElementById(id).style.display = f ? "" : "none";
}

function addEvent(elm, evType, fn, useCapture) {
	if (elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;
	}
	else if (elm.attachEvent) {
		var r = elm.attachEvent('on' + evType, fn);
		return r;
	}
	else {
		elm['on' + evType] = fn;
	}
}
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\s)'+searchClass+'(\s|$)');
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}
function onLoadPage()
{
	var v;
	focus();
	CerrarTodo();
	v = location.search;
	if(v && v.length > 1){
		v = $(v.substring(1));
		if(v){
			AbrirItem(v);
		}		
	}
}
function AbrirItem(v)
{
	var parrafo, hache, texto, tigre;

	parrafo = v.parentNode;
	
	texto = getElementsByClass("texto", parrafo)[0];
	texto.style.display = "block";
		
	tigre = getElementsByClass("tigre", parrafo)[0];
	tigre.innerHTML = " - ";
		
	hache = getElementsByClass("hache", parrafo)[0];
	hache["onclick"] = onClickMenos;


}
function CerrarTodo()
{
	var i, parrafos, hache, texto, tigre;
	
	parrafos = getElementsByClass("parrafo");
	for(i in parrafos){
		texto = getElementsByClass("texto", parrafos[i])[0];
		texto.style.display = "none";
		
		tigre = getElementsByClass("tigre", parrafos[i])[0];
		tigre.innerHTML = " + ";
		
		hache = getElementsByClass("hache", parrafos[i])[0];
		hache["onclick"] = onClickMas;
	}
}
function onClickMas()
{
	var parrafo, hache, texto, tigre;

	CerrarTodo();

	parrafo = this.parentNode;
	
	texto = getElementsByClass("texto", parrafo)[0];
	texto.style.display = "block";
		
	tigre = getElementsByClass("tigre", parrafo)[0];
	tigre.innerHTML = " - ";
		
	hache = getElementsByClass("hache", parrafo)[0];
	hache["onclick"] = onClickMenos;
}
function onClickMenos()
{
	var parrafo, hache, texto, tigre;

	parrafo = this.parentNode;
	
	texto = getElementsByClass("texto", parrafo)[0];
	texto.style.display = "none";
		
	tigre = getElementsByClass("tigre", parrafo)[0];
	tigre.innerHTML = " + ";
		
	hache = getElementsByClass("hache", parrafo)[0];
	hache["onclick"] = onClickMas;
}
addLoadEvent(onLoadPage);
