function disableRightClick(e)
{
  var message = "Si necesita alguna información póngase en contacto con nosotros\nsin ningún compromiso.\nMuchas Gracias";
  
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers) 
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
      alert(message);
      return false;
    }
  }
  else
  {
    alert(message);
    return false;
  }
}
//disableRightClick();




// JavaScript Document
function Abrir_ventana(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function makeArray(n){
    this.length = n;
    for (i=1;i<=n;i++){
        thisi=0;
    }
    return this;
}

function displayDate(){
    var this_month = new makeArray(12);
    this_month0  = "Enero";
    this_month1  = "Febrero";
    this_month2  = "Marzo";
    this_month3  = "Abril";
    this_month4  = "Mayo";
    this_month5  = "Junio";
    this_month6  = "Julio";
    this_month7  = "Agosto";
    this_month8  = "Septiembre";
    this_month9  = "Octubre";
    this_month10 = "Noviembre";
    this_month11 = "Diciembre";
    var today = new Date();
    var day   = today.getDate();
    var month = today.getMonth();
    var year  = today.getYear();
    if (year < 1900){
        year += 1900;
    }
    return(day+" de "+this_monthmonth+" de "+year);
}

// compruebo los navegadores

ns5 = (document.layers)? true:false //(netscape 4.7)
ie5 = (document.all)? true:false  // explorer 4.* y 5
dom = document.getElementById ? true:false;  // navegadores que utilizan DOM: ie. 6.* / ns 6.* y 7 / mozilla 1.* o superior

// función de estandarización de variables para manejar las capas en los distintos navegadores
function init(){
	if (ns5) {
                layerStyleRef="document.todo.layer.";
                layerRef="document.todo.document.layers";
                styleSwitch="";
				
        }else if (ie5){
                layerStyleRef="layer.style.";
                layerRef="document.all";
                styleSwitch=".style";
				
        }
		else if (dom){
				layerRef="document.getElementById";
				styleSwitch=".style";
		}
}


//función estandar para mostrar capas: hay que pasar layerName: string con el nombre de la capa a mostrar
function muestra(layerName){
	alert("dentro");
		if (dom){
	        	document.getElementById(layerName).style.visibility="visible"
				}
		else 
				{
				eval(layerRef+'"'+layerName+'"'+styleSwitch+'.visibility="visible"');
				}
	}

//función estandar para ocultar capas: hay que pasar layerName: string con el nombre de la capa a ocultar
function oculta(layerName){
		if (dom){
        		document.getElementById(layerName).style.visibility="hidden"
				}
		else 
				{
		        eval(layerRef+'"'+layerName+'"'+styleSwitch+'.visibility="hidden"');
				}
	}

	
/*
Función para abrir una ventana nueva en el navegador, situándola en el centro de la pantalla del usuario

Parámetros:
	- direccion: url a abrir en la nueva ventana
	- nombre: nombre de la ventana por si se quiere referenciar más tarde
	- tamw: ancho de la ventan a abrir
	- tamh: alto de la ventana a abrir

*/

var CWIN = false;
var miURL;
var altura=screen.height;
var anchura=screen.width;
var desplazamiento = 1;

function abre(direccion, nombre, tamw, tamh){
	var alto = (altura / 2) - (tamh/2);
	var ancho = (anchura / 2) - (tamw/2);
	url= direccion;
	myname = nombre;
	win="fullscreen=0,directories=0,resizable=0,width=" + tamw + ",height=" + tamh +",location=0,status=0,scrollbars=0,toolbar=0,menubar=0,titlebar=0,left ="+ ancho +",top="+ alto +"";
	my_local = window.open(url,myname,win);
}



// * Dependencies * 
// this function requires the following snippets:
// JavaScript/images/switchImage
//
// BODY Example:
// <body onLoad="mySlideShow1.play(); mySlideShow2.play();">
// <img src="originalImage1.gif" name="slide1">
// <img src="originalImage2.gif" name="slide2">
//
// SCRIPT Example:
// var mySlideList1 = './fotos/1.gif', './fotos/2.gif', './fotos/3.gif';
 //var mySlideShow1 = new SlideShow(mySlideList1, 'slide1', 2000, "mySlideShow1");
// var mySlideList2 = 'image4.gif', 'image5.gif', 'image6.gif';
// var mySlideShow2 = new SlideShow(mySlideList2, 'slide2', 1000, "mySlideShow2");
function SlideShow(slideList, image, speed, name)          
{
  this.slideList = slideList;
  this.image = image;
  this.speed = speed;
  this.name = name;
  this.current = 0;
  this.timer = 0;
}
SlideShow.prototype.play = SlideShow_play;  
function SlideShow_play()       
{
  with(this)
  {
    if(current++ == slideList.length-1) current = 0;
    switchImage(image, slideListcurrent);
    clearTimeout(timer);
    timer = setTimeout(name+'.play()', speed);
  }
}


function switchImage(imgName, imgSrc,txtName,txtSrc) 
{
/*	alert("imgName: " + imgName + "\nimgSrc: " + imgSrc );
	alert("txtName: " + txtName + "\ntxtSrc: " + txtSrc );	
*/
  if (document.images)
  {
    if (imgSrc != "none")
    {
		// Esto cambia la foto y al ALT de la imagen
      	var imagen = document.images[imgName];
		imagen.src = imgSrc;
		imagen.alt = txtSrc;
		
		// Esto cambia el texto de la foto
		var txt=document.getElementById(txtName);
		txt.innerHTML=txtSrc;
    }
  }
  return false;
}



