// 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":"BusClass Profesional",
"link":"http://www.tecnicasmarketing.com/busclass.htm",
"foto":"\imagen/banner/busclass.jpg",
"ancho":"125",
"alto":"125"
},
{
"id":"Email Marketing Stats",
"link":"http://www.tecnicasmarketing.com/productos/ems",
"foto":"\imagen/banner/email-marketing.jpg",
"ancho":"125",
"alto":"125"
},
{
"id":"ListMail Express",
"link":"http://www.tecnicasmarketing.com/listmail.htm",
"foto":"\imagen/banner/listmail.gif",
"ancho":"125",
"alto":"125"
},
{
"id":"Claves del éxito",
"link":"http://www.tecnicasmarketing.com/libro.htm",
"foto":"\imagen/banner/negocio-internet.jpg",
"ancho":"125",
"alto":"125"
},
{
"id":"Impact web Audio",
"link":"http://www.tecnicasmarketing.com/productos/webaudio",
"foto":"\imagen/banner/web-audio.jpg",
"ancho":"125",
"alto":"125"
}
]

// 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 = "";
var cambiarBanner = 1;
var tiempoActualizacion = 500000;
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 = "Cargando...";
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='_blank'";
}
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); 
}
}