var tabsId=new Array();
tabsId['tab1']='leida';
tabsId['tab2']='recomendada';
var contenedor='tabContenido';
function nuevoAjax()
{ 	var xmlhttp=false; 
	try 
	{ 				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 		try
		{ 						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 
	return xmlhttp; 
}
function cargaContenido1()
{
	this.className='tabOn';	
	seccion=tabsId[this.id];
	seccion='seccion1';	
	tabContenedor.innerHTML='<img src="loading2.gif"> Cargando, por favor espere...';	
	var ajax=nuevoAjax();
	ajax.open("POST", "tabs_o_pestanas_con_javascript_no_intrusivo_proceso.php", true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send('seccion='+seccion);	
	ajax.onreadystatechange=function()
	{
		if(ajax.readyState==4)		{			
			tabContenedor.innerHTML=ajax.responseText;
		}
	}
}
function cargaContenido()
{
	if(this.id=='tab2'){
	  this.className='tabOn';	  
	    key='tab1';
			elemento1=document.getElementById(key);		
						elemento1.className='tabOff1';	}
	else {
	  this.className='tabOn1';	  
	  key='tab2';
			elemento1=document.getElementById(key);			
			elemento1.className='tabOff';	}	
	seccion=tabsId[this.id];	
	tabContenedor.innerHTML='<img src="loading2.gif"> Cargando, por favor espere...';	
	var ajax=nuevoAjax();
	ajax.open("POST", "tabs_o_pestanas_con_javascript_no_intrusivo_proceso.php", true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send('seccion='+seccion);	
	ajax.onreadystatechange=function()
	{
		if(ajax.readyState==4)
		{				tabContenedor.innerHTML=ajax.responseText;
		}
	}
}
function mouseSobre()
{		if(this.className!='tabOn')
	{				this.className='tabHover';
	}
}
function mouseFuera()
{		if(this.className!='tabOn')
	{				this.className='tabOff';
	}
}
function mouseSobre1()
{		if(this.className!='tabOn1')
	{				this.className='tabHover1';
	}
}
function mouseFuera1()
{		if(this.className!='tabOn1')
	{				this.className='tabOff1';
	}
}
function traerDatos(tipoDato)
{		var capa=document.getElementById("tabContenido");
		var ajax=nuevoAjax();
		capa.innerHTML="Cargando...";
		ajax.open("POST", "tabs_o_pestanas_con_javascript_no_intrusivo_proceso.php", true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send('seccion='+tipoDato);
	ajax.onreadystatechange=function()
	{		if (ajax.readyState==4)
		{
					capa.innerHTML=ajax.responseText;
		}
	}
}
onload=function()
{
	traerDatos('leida');			
	for(key in tabsId)
	{				elemento=document.getElementById(key);		
		elemento.onclick=cargaContenido;	
		if(key=='tab2'){
			elemento=document.getElementById(key);
			elemento.onmouseover=mouseSobre;
			elemento.onmouseout=mouseFuera;
		}
		else {
			elemento=document.getElementById(key);
			elemento.onmouseover=mouseSobre1;
			elemento.onmouseout=mouseFuera1;		}
		
	}	
	tabContenedor=document.getElementById(contenedor);
}