// 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":"http://www.xinxetamultimedia.com",
"foto":"xinxeta-multimedia.gif",
"ancho":"250",
"alto":"100"
},
{
"id":"Publicidad_02",
"link":"http://www.fallasanmarcelino.com/contacto",
"foto":"aqui-su-publi.gif",
"ancho":"250",
"alto":"100"
},
{
"id":"Publicidad_03",
"link":"http://www.caixapopular.es",
"foto":"caixa-popular.gif",
"ancho":"250",
"alto":"100"
},
{
"id":"Publicidad_04",
"link":"http://maps.google.es/maps?hl=es&ie=UTF-8&q=ferrauto+aldaia&fb=1&split=1&gl=es&cid=16580538033085599218&li=lmd",
"foto":"ferrauto.gif",
"ancho":"250",
"alto":"100"
}
]
// 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://www.fallasanmarcelino.com/images/banners-publicidad";
var cambiarBanner = 1;
var tiempoActualizacion = 6000;
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);
}
}