/******************************************************************************/
function permutImage(flag,img){
    if (document.images){
        if (document.images[img].permloaded){
            if (flag==1){
                document.images[img].src = document.images[img].perm.src;
            }else{
                document.images[img].src = document.images[img].perm.oldsrc;
            }
        }
    }
}
/******************************************************************************/
function preLoadPermut(img,adresse){
    if (document.images){
        img.onload = null;
        img.perm = new Image();
        img.perm.oldsrc = img.src;
        img.perm.src = adresse;
        img.permloaded = true;
    }
}
/******************************************************************************/
function popUp(desktopURL,ancho,alto,resizeable,scrollbars,target){
    x = parseInt(window.screen.width) / 2 - ancho / 2;
    y = parseInt(window.screen.height) / 2 - alto / 2;
    var desktop = window.open(desktopURL,target, "width="+ancho+",height="+alto+",scrollbars="+scrollbars+",resizable="+resizeable+"");
    desktop.moveTo(x,y);
}
/******************************************************************************/
function askYesNo(url,msg){
    if (confirm(msg)){
        location.href=url;
    }
}
/******************************************************************************/
var T=1;
function galeriaFotos(path, arr, maxFoto){
    if(arr == 'izquierda'){
        document.images['image1'].src = "images/galeria_parajes/"+path+"/"+(((T+1)%maxFoto)+1)+".gif";
        document.images['image2'].src = "images/galeria_parajes/"+path+"/"+(((T+2)%maxFoto)+1)+".gif";
        document.images['image3'].src = "images/galeria_parajes/"+path+"/"+(((T+3)%maxFoto)+1)+".gif";
        T = ((T%maxFoto)+1);
    }
    else{
        document.images['image2'].src = "images/galeria_parajes/"+path+"/"+T+".gif";
        document.images['image3'].src = "images/galeria_parajes/"+path+"/"+((T%maxFoto)+1)+".gif";
        if(T-1 == 0){T = maxFoto;}
        else{T = T-1;}
    	document.images['image1'].src = "images/galeria_parajes/"+path+"/"+T+".gif";
    }
}
/******************************************************************************/
function changeCenter(path, nro){
    var dir= document.images['image'+nro].src;
    var nroGif= dir.split("/");
    document.images['image4'].src = "images/galeria_parajes/"+path+"/zoom/"+nroGif[(nroGif.length)-1];
}
/******************************************************************************/
function right(e) {
    if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false;
    else{
        if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
             alert("Lo sentimos, el botón derecho del ratón está inhabilitado");
             return false;
        }
    }
    return true;
}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
/******************************************************************************/
function getDiaDeSemana(dia){
  if(dia == 0) return "Domingo";
  if(dia == 1) return "Lunes";
  if(dia == 2) return "Martes";
  if(dia == 3) return "Miércoles";
  if(dia == 4) return "Jueves";
  if(dia == 5) return "Viernes";
  return "Sábado";
}

function getMes(mes){
  if(mes == 0) return "Enero";
  if(mes == 1) return "Febrero";
  if(mes == 2) return "Marzo";
  if(mes == 3) return "Abril";
  if(mes == 4) return "Mayo";
  if(mes == 5) return "Junio";
  if(mes == 6) return "Julio";
  if(mes == 7) return "Agosto";
  if(mes == 8) return "Septiembre";
  if(mes == 9) return "Octubre";
  if(mes == 10) return "Noviembre";
  return "Diciembre";
}

function getFecha(){
  var now = new Date();
  var dia = getDiaDeSemana(now.getDay());
  var mes = getMes(now.getMonth());
  document.getElementById('fecha').innerHTML = now.getDate()+" de "+mes+" de "+now.getFullYear();
}
/******************************************************************************/