function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function abrirventana(id) {
     var myWindow=window.open('http://www.libroseducativos.com/recomienda.php?id='+id,'primeraventana','width=280,height=280,left=120,top=240');
     myWindow.location.href = 'http://www.libroseducativos.com/recomienda.php?id='+id;
     if (!myWindow.opener)
         myWindow.opener = self;
 }
 function presupuesto(numpedido) {
     var myWindow=window.open('presupuesto.php?numpedido='+numpedido,'ventanapresupuesto','width=600,height=675,left=120,top=10');
     myWindow.location.href = 'presupuesto.php?numpedido='+numpedido;
     if (!myWindow.opener)
         myWindow.opener = self;
 }

function abrirvotos(id) {
     var myWindow=window.open('http://www.libroseducativos.com/votos.php?id='+id,'ventanavotos','width=650,height=300,left=120,top=240');
     myWindow.location.href = 'http://www.libroseducativos.com/votos.php?id='+id;
     if (!myWindow.opener)
         myWindow.opener = self;
}
function abrirvotosprop(id) {
     var myWindow=window.open('http://www.libroseducativos.com/votospropuesta.php?id='+id,'ventanavotos','width=650,height=600,left=120,top=140');
     myWindow.location.href = 'http://www.libroseducativos.com/votospropuesta.php?id='+id;
     if (!myWindow.opener)
         myWindow.opener = self;
 }

function seleccion(sitio) { if (sitio!="0") window.location.href=sitio; }

function OnReadyStateChangeRegisterShopGenericLog()
			{
			}
			
			function RegisterSessionLog(){
				var ajax;
				if (window.XMLHttpRequest) 
					ajax = new XMLHttpRequest();
				else
					ajax = new ActiveXObject("Msxml2.XMLHTTP"); 
				ajax.onreadystatechange = OnReadyStateChangeRegisterShopGenericLog;	
				var sURL;
				var sQuery;
				sURL="/tools/register_shop_session_log.aspx";
				var d = new Date();
				var curr_msec = d.getMilliseconds()
				sQuery="rnd=" + curr_msec;
				ajax.open("POST", sURL, false);
				ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				ajax.send(sQuery); 
				ajax = null;
			}
			
			
			

function OnReadyStateChangeRegisterShopGenericLog(){

}

function RegisterShopGenericLog(affiliate,shop,customer,type,code,p1,p2,p3){

var ajax;
if (window.XMLHttpRequest) 
        ajax = new XMLHttpRequest();
else
	ajax = new ActiveXObject("Msxml2.XMLHTTP"); 
	
ajax.onreadystatechange = OnReadyStateChangeRegisterShopGenericLog;	

var sURL;
var sQuery;

sURL="/tools/register_shop_generic_log.aspx";
sQuery = "affiliate=" + affiliate;
sQuery+="&shop=" + shop;
sQuery+="&customer=" + customer;
sQuery+="&type=" + type;
sQuery+="&code=" + code;
sQuery+="&p1=" + p1;
sQuery+="&p2=" + p2;
sQuery+="&p3=" + p3;
var d = new Date();
var curr_msec = d.getMilliseconds()
sQuery+="&rnd=" + curr_msec;
ajax.open("POST", sURL, false);
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send(sQuery); 

ajax = null;

}

// Funciones para pestañas más votados y más comprados
capaActual = "introduccion";
function esActivo(elemento)	{
	return;
}

function selecciona(elemento)	{
	if (elemento.split("_")[1] == capaActual)	esActivo(elemento);
	else	{
		document.getElementById("pesta_" + capaActual).className = "pesta inactiva";
		document.getElementById("capa_" + capaActual).className = "capa invisible";
		capaActual = elemento.split("_")[1];
		document.getElementById("pesta_" + capaActual).className = "pesta activa";
		document.getElementById("capa_" + capaActual).className = "capa visible";
	}
	document.getElementById('pestas').focus();
}

function alturaContenido()	{
	var altura = document.body.offsetHeight;
	var alturaPestas = document.getElementById("pestas").offsetTop;
	var tamPestas = document.getElementById("pestas").offsetHeight;
	document.getElementById("contenido").style.height =  "0 px";
}

capaActual2 = "introduccion2";
function esActivo2(elemento2)	{
	return;
}

function selecciona2(elemento2)	{
	if (elemento2.split("_")[1] == capaActual2)	esActivo2(elemento2);
	else	{
		document.getElementById("pesta2_" + capaActual2).className = "pesta2 inactiva2";
		document.getElementById("capa2_" + capaActual2).className = "capa2 invisible2";
		capaActual2 = elemento2.split("_")[1];
		document.getElementById("pesta2_" + capaActual2).className = "pesta2 activa2";
		document.getElementById("capa2_" + capaActual2).className = "capa2 visible2";
	}
	document.getElementById('pestas2').focus();
}

function alturaContenido2()	{
	var altura = document.body.offsetHeight;
	var alturaPestas = document.getElementById("pestas2").offsetTop;
	var tamPestas = document.getElementById("pestas2").offsetHeight;
	document.getElementById("contenido2").style.height =  "0 px";
}

// Fin js pestañas más votados y más comprados 