// JavaScript Document

// Funciones para mostrar Imágenes
//Crea la Ubicación de la Imágen
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
} 
// Devuelve la Ubicación
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}

// Número aleatorio
function randNum(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
} 

// Siguiente Imagen Volviendo al Principio
function getNextImage() {
if (random_display) {
imageNum = randNum(0, totalImages-1);
} else {
imageNum = (imageNum+1) % totalImages;
}
//devolviendo el valor de la imágen
var new_image = get_ImageItemLocation(imageArray[imageNum]);
return(new_image);
} 

// Imágen Anterior
function getPrevImage() {
if (imageNum == 0) {imageNum = totalImages -1 }
else
{imageNum = Math.abs((imageNum-1) % totalImages)} ;
var new_image = get_ImageItemLocation(imageArray[imageNum]);
return(new_image);
}
//devolviendo el valor de la imágen
function prevImage(place) {
var new_image = getPrevImage();
document[place].src = new_image;
document[place].alt = textoArray[imageNum];
}

// Cambiamos de imágen 
function switchImage(place) {
var new_image = getNextImage();
// random_display = 1;
document[place].src = new_image;
document[place].alt = textoArray[imageNum];
var recur_call = "switchImage('"+place+"')";
timerID = setTimeout(recur_call, 1800); 
}
//devolviendo el valor de la imágen
function GetImageNum(i,Texto) {
var new_image = get_ImageItemLocation(imageArray[i]);
document['slideImg'].src = new_image;
document['slideImg'].alt = Texto;
}

// Para mostrar Página en el Frame de Navegación Horizontal
function CargarFrame(Pagina) {
parent.NavegaFrame.location.href=Pagina;
}

//-->   Funciones para hacer sonar los sonidos

function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
document.body.insertAdjacentHTML("BeforeEnd",Str);
}
var Str = '';
for (i=0;i<aySound.length;i++)
Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auEmb.document.open();
auEmb.document.write(Str);
auEmb.document.close();
}
auCon = IE? document.all.auIEContainer:auEmb;
auCon.control = auCtrl;
}
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:'';
else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
}
function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); }
function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }
//-->

