// Set up the image files to be used.
var theRandomImages = new Array() // do not change this

// To add more image files, continue with the
// pattern below, adding to the array.
 
theRandomImages[0]  = 'Cabecera_00.png';
theRandomImages[1]  = 'Cabecera_01.png';
theRandomImages[2]  = 'Cabecera_02.png';
theRandomImages[3]  = 'Cabecera_03.png';
theRandomImages[4]  = 'Cabecera_04.png';
theRandomImages[5]  = 'Cabecera_05.png';
theRandomImages[6]  = 'Cabecera_06.png';
theRandomImages[7]  = 'Cabecera_07.png';
theRandomImages[8]  = 'Cabecera_08.png';
theRandomImages[9]  = 'Cabecera_09.png';
theRandomImages[10] = 'Cabecera_10.png';
theRandomImages[11] = 'Cabecera_11.png';
theRandomImages[12] = 'Cabecera_12.png';

/*
theRandomImages[0]  = 'Tronos1.png';
theRandomImages[1]  = 'Tronos2.png';
theRandomImages[2]  = 'Tronos3.png';
theRandomImages[3]  = 'Tronos4.png';
theRandomImages[4]  = 'Tronos5.png';
theRandomImages[5]  = 'Tronos6.png';
theRandomImages[6]  = 'Tronos7.png';
*/

// do not edit anything below this line


// Pre-buffer de las imagenes
var j = 0;
var p = theRandomImages.length;
var preBuffer = new Array();
for (i = 0; i < p; i++){
   preBuffer[i] = new Image();
   preBuffer[i].src = theRandomImages[i];
}

// seleccion de la imagen aleatoria
var whichImage = Math.round(Math.random()*(p-1));

// Funcion que hace el cambio de imagen de fondo
function showImage(ruta){
	element = document.getElementById('formbox');
	if (element == null){
		element = document.getElementById('header-search-box');
	}
	if (element != null) {
		element.style.backgroundImage = "url(" + ruta.substring(2) + theRandomImages[whichImage] + ")";
		element.style.height = "112px";
		element.style.backgroundRepeat = "no-repeat";
		// element.style.backgroundPosition = "412px 0px"; // requerido con el no-repeat
		if (navigator.appName == "Microsoft Internet Explorer"){
			element.style.backgroundPosition = "0px 0px";
		}else{
			element.style.backgroundPosition = "412px 0px";
		}
	}

} // showImage

