$(function(){ 
   hacer_ampliables();
});

function hacer_ampliables() {
  var t;
  var tiempo=500;
  var idampliado;
  $(".minificha").bind("mouseenter", 
    function (e) { 
        var mf = $(this);
        var mfid=mf.attr('id');
        var pos = mf.children().position();
        //alert($(this).children().height()+"x"+$(this).children().width()+":"+pos.top+"x"+pos.left);
        var pos_top = pos.top+10;//-$(this).children().height()+125; 
        var pos_left = pos.left-250;//-$(this).children().width()+75;
        //var pos_top = e.pageY+1;
        //var pos_left= e.pageX+1;
        if (idampliado!=mfid) {
              if (idampliado) {  
                   $(idampliado).hide();
              }
        }
        clearTimeout(t);
        var ampliacion=$("#amp_"+mfid);
        idampliado=ampliacion;
         ampliacion.css({"position":"absolute","z-index":"100","display":"block"}); 
       ampliacion.css({   
                    left: pos_left + 'px',   
                    top: pos_top + 'px'   
                });  
        ampliacion.show();
    }); 
  $(".minificha").bind("mouseleave", 
    function (e) { 
        var mf = $(this);
        var mfid=mf.attr('id');
        var pos = mf.offset();
        var ampliacion=$("#amp_"+mfid);
        t = setTimeout(function(){   
            if (ampliacion){ 
                ampliacion.hide();
                idampliado='';
            } 
        },tiempo); 
    });
   $(".minificha_ampliada").bind("mouseenter", 
     function (e) {
        clearTimeout(t);
   });
   $(".minificha_ampliada").bind("mouseleave", 
     function (e) {
        var ampliacion=$("#"+$(this).attr('id'));
        if ($(idampliado).attr('id')==$(ampliacion).attr('id')) {
         t = setTimeout(function(){
                ampliacion.hide();
                idampliado='';
         },tiempo);
        }
   });

}
 






// funciones 
            $(function() {

                $('#container-1').tabs();
                $('#container-2').tabs(2);
                $('#container-3').tabs({ fxSlide: true });
                $('#container-4').tabs({ fxFade: true, fxSpeed: 'fast' });
                $('#container-5').tabs({ fxSlide: true, fxFade: true, fxSpeed: 'normal' });
                $('#container-6').tabs({
                    fxFade: true,
                    fxSpeed: 'fast',
                    onClick: function() {
                        alert('onClick');
                    },
                    onHide: function() {
                        alert('onHide');
                    },
                    onShow: function() {
                        alert('onShow');
                    }
                });
                $('#container-7').tabs({ fxAutoHeight: true });
                $('#container-8').tabs({ fxShow: { height: 'show', opacity: 'show' }, fxSpeed: 'normal' });
                $('#container-9').tabs({ remote: true });
                $('#container-10').tabs();
                $('#container-11').tabs({ disabled: [3] });

                $('<p><a href="#">Disable third tab<\/a><\/p>').prependTo('#fragment-28').find('a').click(function() {
                    $(this).parents('div').eq(1).disableTab(3);
                    return false;
                });
                $('<p><a href="#">Activate third tab<\/a><\/p>').prependTo('#fragment-28').find('a').click(function() {
                    $(this).parents('div').eq(1).triggerTab(3);
                    return false;
                });
                $('<p><a href="#">Enable third tab<\/a><\/p>').prependTo('#fragment-28').find('a').click(function() {
                    $(this).parents('div').eq(1).enableTab(3);
                    return false;
                });

            });


obligatorio=["q"]; 
textoObligatorio=["termino de busqueda"]; 
function comprobar(este){ 
for(a=0;a<obligatorio.length;a++){ 
if(este.elements[obligatorio[a]].value==""){ 
alert("Por favor, escribe al menos un "+textoObligatorio[a]); 
este.elements[obligatorio[a]].focus(); 
return false; 
} 
} 
return true; 
} 
function comprobar2(este){ 
  for(a=0;a<obligatorio.length;a++){ 
    if(este.elements[obligatorio[a]].value==""){ 
      alert("Por favor, escribe al menos un "+textoObligatorio[a]); 
      este.elements[obligatorio[a]].focus(); 
      return false; 
   } else {
     $('#centro').html('<div align=center><img src="img/cargando.gif" vspace=20></div>');$('#centro').load('index.php?pag=modulo&IdModulo=87&q='+este.elements[obligatorio[a]].value);
  }
 } 
 return false; 
} 

function showDiv(numDiv) {
var cuadro = document.getElementById("capa"+numDiv);
with (cuadro.style) {
top = document.body.scrollTop + 40;
left = 400;
visibility = "visible";
}
}

function hideDiv(numDiv) {
var cuadro = document.getElementById("capa"+numDiv);
cuadro.style.visibility = "hidden";
}

 function cargarmasvendidos(tipo) {
   $('#masvendidos').html('<div align=center><img src="img/cargando.gif" vspace=20></div>');
   if (tipo=='f') {
$('#masvendidos').load('index.php?pag=modulo&IdModulo=87&solocontenido=si',{},function(){
   tb_init('#masvendidos a.thickbox, #masvendidos area.thickbox, #masvendidos input.thickbox');
   hacer_ampliables();
 });
   $('#mv_ficcion').addClass('activo');
   $('#mv_noficcion').addClass('inactivo');
   $('#mv_ficcion').removeClass('inactivo');
   $('#mv_noficcion').removeClass('activo');

   } else {
$('#masvendidos').load('index.php?pag=modulo&IdModulo=87&solocontenido=si',{},function(){
   tb_init('#masvendidos a.thickbox, #masvendidos area.thickbox, #masvendidos input.thickbox');
   hacer_ampliables();
 });
   $('#mv_noficcion').addClass('activo');
   $('#mv_ficcion').addClass('inactivo');
   $('#mv_noficcion').removeClass('inactivo');
   $('#mv_ficcion').removeClass('activo');

   }
}

$(document).ready(function(){
cargarmasvendidos('f');
});
