function cambiar(capa){	
nombre=capa+"_plegado";
nombre2=capa+"_desplegado";
	if (document.getElementById(capa).style.visibility=="hidden"){
		document.getElementById(capa).style.visibility='visible';
		document.getElementById(capa).style.height='auto';	
		document.getElementById(capa).style.margin='2px 0px 10px 0px';
	document.getElementById(capa).style.padding='5px 10px 10px 10px';
	document.getElementById(nombre).style.visibility='hidden';
	document.getElementById(nombre).style.margin='0 0 0 0';
	document.getElementById(nombre2).style.visibility='visible';
	document.getElementById(nombre2).style.width="10px";
	
		}
	else{
		document.getElementById(capa).style.visibility='hidden';
		document.getElementById(capa).style.height='0';
		document.getElementById(capa).style.margin='0px 0px 0px 0px';
	document.getElementById(capa).style.padding='0px 0px 0px 0px';
	document.getElementById(nombre).style.visibility='visible';
	document.getElementById(nombre).style.margin='0 10px 0 0';
	document.getElementById(nombre2).style.visibility='hidden';
	document.getElementById(nombre2).style.width="0px";
		}
}

		function collapse()
		{
			if(!document.createTextNode){return;}
			var p=document.createElement('p');
			p.appendChild(document.createTextNode('Click on the headlines to collapse and expand the section'));
			var heads=document.getElementsByTagName('h2');
			for(var i=0;i<heads.length;i++)
			{
					var tohide=heads[i].nextSibling;
					while(tohide.nodeType!=1)
					{
						tohide=tohide.nextSibling;
					}
					cssjs('add',tohide,'hidden')
					cssjs('add',heads[i],'trigger')
					heads[i].tohide=tohide;
					heads[i].onmouseover=function()
					{
						cssjs('add',this,'hover');
					}
					heads[i].onmouseout=function()
					{
						cssjs('remove',this,'hover');
					}
					heads[i].onclick=function()
					{
						if(cssjs('check',this.tohide,'hidden'))
						{
							cssjs('swap',this,'trigger','opened');			
							cssjs('swap',this.tohide,'hidden','shown');			
						} else {
							cssjs('swap',this,'opened','trigger');			
							cssjs('swap',this.tohide,'shown','hidden');			
						}
					}
			/*document.body.insertBefore(p,document.getElementsByTagName('h2'));*/
			}
			function cssjs(a,o,c1,c2)
			{
				switch (a){
					case 'swap':
						o.className=!cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
					break;
					case 'add':
						if(!cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;}
					break;
					case 'remove':
						var rep=o.className.match(' '+c1)?' '+c1:c1;
						o.className=o.className.replace(rep,'');
					break;
					case 'check':
						return new RegExp('\\b'+c1+'\\b').test(o.className)
					break;
				}
			}
		}
