var galeriaVisib=0;
var ventanaPop=0;
var ventanaImagen=0;

function abrir(theURL,winName,features) { //v2.0
  if(ventanaPop) {
    if(!ventanaPop.closed) ventanaPop.close();
  }
  ventanaPop=window.open(theURL,winName,'scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no,'+features);
}

function abrirPopUpH(theURL,winName) { //v2.0
  var estilo='width=553,height=477';
  abrir(theURL,winName,estilo);
}

function abrirPopUpV(theURL,winName) { //v2.0
  var estilo='width=477,height=553';
  abrir(theURL,winName,estilo);
}

function abrirImagenH(theURL,winName) { //v2.0
  var estilo='width=510,height=340';
  abrirImagenTam(theURL,winName,estilo);
}

function abrirImagenV(theURL,winName) { //v2.0
  var estilo='width=340,height=510';
  abrirImagenTam(theURL,winName,estilo);
}

function abrirImagenTam(theURL,winName,features) { //v2.0
  
  if(ventanaImagen) {
    if(!ventanaImagen.closed) ventanaImagen.close();
  }
  var estilo='location=no,status=no,resizable=no,scrollbars=no';
  ventanaImagen=window.open('','ventanaImagen',estilo+','+features);
  var head='<head><title>Guillermo Barbero WEB</title></head>';
  var body='<body leftmargin=0 topmargin=0 > <img src="'+theURL+'" '+features+'></body>';
  ventanaImagen.document.write(head +''+ body);
}

function TamVentana() {
     var Tamanyo = [0, 0];
     if (typeof window.innerWidth != 'undefined'){
         Tamanyo = [
         window.innerWidth,
         window.innerHeight
         ];
     }else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth !='undefined' && document.documentElement.clientWidth != 0){
     Tamanyo = [
         document.documentElement.clientWidth,
         document.documentElement.clientHeight
         ];
     }else{
         Tamanyo = [
             document.getElementsByTagName('body')[0].clientWidth,
             document.getElementsByTagName('body')[0].clientHeight
         ];
     }
     return Tamanyo;
 }

function numeroAleatorio(limit){
  return Math.floor(Math.random()*limit);
}

function activarGaleria() {
	if (galeriaVisib==0){
		ocultar('menu-Animales','visible');
		ocultar('menu-Cielos','visible');
		ocultar('menu-Cielos2','visible');
		ocultar('menu-Flores','visible');
		ocultar('menu-Paisajes','visible');
		ocultar('menu-Paisajes2','visible');
		galeriaVisib=1;
	}
	else {
		ocultar('menu-Animales','hidden');
		ocultar('menu-Cielos','hidden');
		ocultar('menu-Cielos2','hidden');
		ocultar('menu-Flores','hidden');
		ocultar('menu-Paisajes','hidden');
		ocultar('menu-Paisajes2','hidden');
		galeriaVisib=0;
	}
}

function ocultar(objName, visib) {
	//alert(objName+' - '+visib);
	obj = document.getElementById(objName);
	//alert('obj '+obj);
  	if (obj.style) {
		//alert('style=true');
		obj.style.visibility=visib;
	}
}