Code:
// banner rotate in JS
var currentdate = 0;
var core = 0;
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
function getRandomNum(lbound, ubound) {
return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}
rand = getRandomNum(10000,999999);
// Array of links and images
link = new initArray(
"/cgi-bin/ads.pl?banner=NonSSI;page="+rand+"",
"/cgi-bin/ads.pl?banner=NonSSI;page="+rand+"",
"http://kansas.valueclick.com/redirect?host=XXXXXXX&size=468x60&b="+rand+"&v=0");
image = new initArray(
"/cgi-bin/ads.pl?page="+rand+"",
"/cgi-bin/ads.pl?page="+rand+"",
"http://kansas.valueclick.com/cycle?host=XXXXXXX&size=468x60&b="+rand+"&noscript=1");
var currentdate = new Date();
var secs = currentdate.getSeconds();
var core = secs % image.length;
var ranlink = link[core];
var ranimage = image[core];
var text = "Click to visit advertiser (a new window will open)";
document.write('<center><a href=\"' +ranlink+ '\" target=\"_blank\">');
document.write('<img src=\"'+ranimage+'\" border=0 width=468 height=60 alt=\"'+text+'\"></a></center>');