// datos de los BANNERS
// id: un identificador para el banner;
// link: el enlace del banner;
// foto: el nombre de la imagen;
// ancho y alto.
// es importante que respete la estructura del array
var banners =[
{
"id":"Publicidad_01",
"link":"futbol_y_avances_de_la_jornada/index.htm",
"foto":"onlae.terra.es/banners/vista/banners_botes/quiniela.gif",
"ancho":"300",
"alto":"90"
},
{
"id":"Publicidad_02",
"link":"futbol_y_avances_de_la_jornada/index.htm",
"foto":"onlae.terra.es/banners/vista/banners_botes/quinigol.gif",
"ancho":"300",
"alto":"90"
},
{
"id":"Publicidad_03",
"link":"informacion_de_juegos_y_sorteos/index.htm",
"foto":"onlae.terra.es/banners/vista/banners_botes/Banner_pri.gif",
"ancho":"300",
"alto":"90"
},
{
"id":"Publicidad_04",
"link":"informacion_de_juegos_y_sorteos/index.htm",
"foto":"onlae.terra.es/banners/vista/banners_botes/bonoloto.gif",
"ancho":"300",
"alto":"90"
},
{
"id":"Publicidad_05",
"link":"informacion_de_juegos_y_sorteos/index.htm",
"foto":"onlae.terra.es/banners/vista/banners_botes/Banner_GordomasGordo.gif",
"ancho":"300",
"alto":"90"
},
{
"id":"Publicidad_06",
"link":"informacion_de_juegos_y_sorteos/index.htm",
"foto":"onlae.terra.es/banners/vista/banners_botes/hipica.gif",
"ancho":"300",
"alto":"90"
},
{
"id":"Publicidad_07",
"link":"informacion_de_juegos_y_sorteos/index.htm",
"foto":"onlae.terra.es/EUROMILLONES/banner_eu.gif",
"ancho":"300",
"alto":"90"
}
]

// variables modificables por el usuario.
// var carpetaBanners: ruta relativa a la carpeta de las imagenes;
// var cambiaBanner: si 1 el banner cambia cada cierto tiempo; si 0 no;
// var tiempoActualizacion: si cambiaBanner==1 este es el tiempo (en milisegundos)
// de exposición de un banner;
// var nuevaVentana: si 1 abre en una nueva ventana; si 0 en la misma;
var carpetaBanners = "http:/";
var cambiarBanner = 1;
var tiempoActualizacion = 10000;
var nuevaVentana = 1;
// variables internas del script; no modificar.
var bannerActual,bannerNuevo;
var numeroBanners = banners.length;
var texto = "";
// función que maneja el rotador de banners.
function rotaBanner()
{
// mensaje mientras cambia banner
document.getElementById("capa_banner").innerHTML = "Rotando Banner";
do
{
bannerNuevo = Math.round(Math.random()*(numeroBanners-1));
}while (bannerNuevo == bannerActual);
bannerActual = bannerNuevo;
// prepara el texto
texto += "<a href='" + banners[bannerActual]['link'] + "'";
if (nuevaVentana == 1)
{
texto += " target='flotante_centro'";
}
texto += "><img src='" + carpetaBanners + "/" + banners[bannerActual]['foto'] + "'";
texto += "width='" + banners[bannerActual]['ancho'];
texto += "' height='" + banners[bannerActual]['alto'] + "' ";
texto += "border='0'>"
texto += "</a>";
// escribe el texto
document.getElementById("capa_banner").innerHTML = texto;
texto = "";
// si cambiaBanner==1 inicia un contador setTimeout
if(cambiarBanner == 1)
{
setTimeout("rotaBanner()",tiempoActualizacion);
}
}
function rotaBanner2()
{
// mensaje mientras cambia banner
document.getElementById("capa_banner2").innerHTML = "Rotando Banner";
do
{
bannerNuevo = Math.round(Math.random()*(numeroBanners-1));
}while (bannerNuevo == bannerActual);
bannerActual = bannerNuevo;
// prepara el texto
texto += "<a href='" + banners[bannerActual]['link'] + "'";
if (nuevaVentana == 1)
{
texto += " target='flotante_centro'";
}
texto += "><img src='" + carpetaBanners + "/" + banners[bannerActual]['foto'] + "'";
texto += "width='" + banners[bannerActual]['ancho'];
texto += "' height='" + banners[bannerActual]['alto'] + "' ";
texto += "border='0'>"
texto += "</a>";
// escribe el texto
document.getElementById("capa_banner2").innerHTML = texto;
texto = "";
// si cambiaBanner==1 inicia un contador setTimeout
if(cambiarBanner == 1)
{
setTimeout("rotaBanner2()",tiempoActualizacion);
}
}