// JavaScript Document
// =======================================
// set the following variables
// =======================================

// Set speed (milliseconds)
var speed = 5000

// Specify the image files
var Pic = new Array() // don't touch this

// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = '../imagenes/Image 171.jpg'
Pic[1] = '../imagenes/Image 174.jpg'


/*var Tex = new Array() 

Tex[0] = 'esp1'
Tex[1] = 'esp2'
Tex[2] = 'esp3'*/
/*Pic[3] = 'slideshow1_4.jpg'
Pic[4] = 'slideshow1_5.jpg'
*/


// Crear nodo de tipo Text
var contenido = new Array()
//document.createTextNode("Hola Mundo!");

contenido[0] = document.createTextNode("Ubicación JMC.");
contenido[1] = document.createTextNode("Herramientas de control.");

// Crear nodo de tipo Text
var contingut = new Array()
//document.createTextNode("Hola Mundo!");

contingut[0] = document.createTextNode("Ubicació JMC.");
contingut[1] = document.createTextNode("Eines de control.");

// Crear nodo de tipo Text
var content = new Array()
//document.createTextNode("Hola Mundo!");

content[0] = document.createTextNode("JMC ubication.");
content[1] = document.createTextNode("Control tools.");

// Añadir el nodo Text como hijo del nodo Element
//parrafo.appendChild(contenido);
// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 0
var k = Pic.length - 1
var p = Pic.length

//var 

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}


  if (document.images) {
      var activado=new Image();
      activado.src="../imagenes/b_idiomas2.jpg";
      var desactivado= new Image();
      desactivado.src="../imagenes/b_idiomas.jpg";
	  var activado1=new Image();
      activado1.src="../imagenes/legal2.jpg";
      var desactivado1= new Image();
      desactivado1.src="../imagenes/legal1.jpg";
}

function activar(nombreImagen) {
      if (document.images) {
        document[nombreImagen].src=activado.src; 
		}
}
    
function desactivar(nombreImagen) {
      if (document.images) {
        document[nombreImagen].src=desactivado.src; 
		}
}

function activar1(nombreImagen) {
      if (document.images) {
        document[nombreImagen].src=activado1.src; 
		}
}
    
function desactivar1(nombreImagen) {
      if (document.images) {
        document[nombreImagen].src=desactivado1.src; 
		}
}

function runBGSlideShow(){
   if (document.images['im1']){
	   document.images['im1'].src = Pic[j];
	   
	   //document.getElementById("p1").appendChild(contenido[j]);
	   if (document.getElementById("pImg1cat")){
			document.getElementById("pImg1cat").appendChild(contingut[k]);
	   		document.getElementById("pImg1cat").replaceChild(contingut[j],contingut[k]);
	   }
	   
	    if (document.getElementById("pImg1cas")){
			document.getElementById("pImg1cas").appendChild(contenido[k]);
	   		document.getElementById("pImg1cas").replaceChild(contenido[j],contenido[k]);
	   }
	   
	    if (document.getElementById("pImg1eng")){
			document.getElementById("pImg1eng").appendChild(content[k]);
	   		document.getElementById("pImg1eng").replaceChild(content[j],content[k]);
	   }//var parrafo = document.getElementById("p1");
//parrafo.parentNode.removeChild(parrafo);

	 //  document.getElementById("p1").removeChild(contenido[k]);
//document.getElementById("p1").Child = contenido[j];
	  //document.getElementById("p1").appendChild(contenido[j]);
	  //document.p["p1"]; //.write(Tex[j]);
	  // document.getElementById("p1") = document.write("adios");
   /*document.body.background = Pic[j];*/
   k = j
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runBGSlideShow()', speed)
  }
}
