function ventana(fichero,alto,ancho) {
posancho=(screen.width/2)-(ancho/2);
posalto=(screen.height/2)-(alto/2);
vent=window.open(fichero,'', 'toolbar=no,location=no,status=no,scrollbars=no,resizable=0,titlebar = no,top='+posalto+',left='+posancho+',width='+ancho+',height='+alto);
vent.focus();
}



function vi(fichero,titulo) {
vent=window.open('vi.php?fichero='+fichero+'&titulo='+titulo,'ventana', 'toolbar=no,location=no,status=no,scrollbars=no,width=20,height=20');
vent.focus();
}
function vir(fichero,titulo) {
vent=window.open('vi2.php?fichero='+fichero+'&titulo='+titulo,'ventana', 'toolbar=no,location=no,status=no,scrollbars=no,width=20,height=20');
vent.focus();
}


function visualizador(fichero,pagina) 
{
 vent=window.open('visuimg/visualizador.php?tam=1&direct='+fichero+'&page='+pagina,'imagen', 'toolbar=no,location=no,status=no,scrollbars=no,resizable=0,titlebar = no,top=0,left=0,width='+(screen.availWidth-10)+',height='+(screen.availHeight-29));
 vent.focus();
}

function editor(fichero)
{
w=790;
h=590;
ancho=(screen.width/2)-(w/2);
alto=(screen.height/2)-(h/2);
var vent = window.open(fichero,'editor', 'toolbar=no,location=no,status=no,scrollbars=no,resizable=0,titlebar = no,top='+alto+',left='+ancho+',width='+w+',height='+h);
 vent.focus();
}

window.name="MAIN";

function indice(url)
{
ancho=(screen.width/2)-(734/2);
alto=(screen.height/2)-(520/2);

var newWind = window.open('','indices', 'toolbar=no,location=no,status=no,scrollbars=no,resizable=0,titlebar = no,top='+alto+',left='+ancho+',width=734,height=520');
if(newWind.document.title=="")
{
   newWind.close();
   newWind=window.open(url,'indices', 'toolbar=no,location=no,status=no,scrollbars=no,resizable=0,titlebar = no,top='+alto+',left='+ancho+',width=734,height=520');
}

newWind.focus();

/*if (newWind.opener == null) {
newWind.opener = self
}*/

//ancho=(screen.width/2)-(734/2);
//alto=(screen.height/2)-(520/2);
//  ventindice=window.open(url,'indices', 'toolbar=no,location=no,status=no,scrollbars=no,resizable=0,titlebar = no,top='+alto+',left='+ancho+',width=734,height=520');
//ventindice.focus();
}


function opciontab(seleccionada,layer)
{
        document.getElementById('opcion1').className="noseleccionado";
        document.getElementById('opcion2').className="noseleccionado";
        document.getElementById('opcion3').className="noseleccionado";
        shd('ventanabuscador','none');
        shd('ventanacarrito','none');
        shd('ventanamonedero','none');
/*        if(window.opera) shd('publicacion','none');
        shd('ficha','none');
        shd('imprimir','none');
        shd('configuracion','none');*/

        document.getElementById(seleccionada).className="seleccionado";
        shd(layer,'block');
        return;
}

function shd(idlayer,visStr) { //v2.5

          if (document.getElementById)
                  { // Netscape 6 & IE 6
                document.getElementById(idlayer).style.display=visStr;

//                                document.getElementById('Layer1').style.visibility='hidden';
                  } else {
              if (navigator.appName == 'Netscape' && document.layers != null) // Netscape 4
                  {
                  document.layers[idlayer].style.display=visStr;
                  } else if (document.all != null) { //IE 4+
                  document.all[idlayer].style.display=visStr;}
                  }
}
function pos(idlayer,x,y) { //v2.5

          if (document.getElementById)
                  { // Netscape 6 & IE 6
                document.getElementById(idlayer).style.top=y;
                document.getElementById(idlayer).style.left=x;
                  } else {
              if (navigator.appName == 'Netscape' && document.layers != null) // Netscape 4
                  {
                  document.layers[idlayer].style.top=y;
                  document.layers[idlayer].style.left=x;
                  } else if (document.all != null) { //IE 4+
                  document.all[idlayer].style.top=y;
                  document.all[idlayer].style.left=x;
                  }
                  }
}
function teclanula(evt)
{
        evt = (evt) ? evt : event
        var charCode = (evt.which) ? evt.which : evt.keyCode
        return false;
}
