var tabHighlightClass='tabon'; 

function iniciaPestanas()
{
	var navElement='mainnav1';
	var navElementTabbedId='mainnavtabbed1';
	
	var backToMenu=/#pestanas2/;
	var n,as,id,i,cid,re;
	if(document.getElementById && document.createTextNode)
	{
		cid=window.location.toString().match(/#(\w.+)/);
		if (cid && cid[1])
		{
			cid=cid[1];
		}
		if ((cid != 'relacionados') && (cid != 'links') && (cid != 'comentarios')) {
		cid = 'relacionados';
		}
		var n=document.getElementById(navElement);
		n.id=navElementTabbedId;
		n=document.getElementById(navElementTabbedId)
		var as=n.getElementsByTagName('a');
		for (i=0;i<as.length;i++)
		{
			id=as[i].href.match(/#(\w.+)/)[1];
			if (i==0) { as[i].onclick=function(){abrePestana('relacionados');return false}; }
			else if (i==1) { as[i].onclick=function(){abrePestana('links');return false}; }
			else if (i==2) { as[i].onclick=function(){abrePestana('comentarios');return false}; }
			
			// if(cid){window.location.hash='pestanas2';}
		}		
		abrePestana(cid);
	}
}  

function abrePestana(o)
{
	if (o=='relacionados') {
		document.getElementById('links').style.display='none';
		document.getElementById('#links').className=' ';
		document.getElementById('comentarios').style.display='none';
		document.getElementById('#comentarios').className=' ';
		document.getElementById('relacionados').style.display='block';
		document.getElementById('#relacionados').className=tabHighlightClass;
	} else if (o=='links') {
		document.getElementById('relacionados').style.display='none';
		document.getElementById('#relacionados').className=' ';
		document.getElementById('comentarios').style.display='none';
		document.getElementById('#comentarios').className=' ';
		document.getElementById('links').style.display='block';
		document.getElementById('#links').className=tabHighlightClass;
	} else if (o=='comentarios') {
		document.getElementById('relacionados').style.display='none';
		document.getElementById('#relacionados').className=' ';
		document.getElementById('links').style.display='none';
		document.getElementById('#links').className=' ';
		document.getElementById('comentarios').style.display='block';
		document.getElementById('#comentarios').className=tabHighlightClass;
	}
}
