//function to get random number upto m
function randomXToY(minVal,maxVal,floatVal) {
    var randVal = minVal+(Math.random()*(maxVal-minVal));
    return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);
} // function

var delay = 3500; // rotation delay (in milliseconds)
var randomize = 1;

// :%s/old/new/g
// old: BUREAU.bbb.org\/Storage\/47\/images\/sponsorimages
// new: BUREAU.bbb.org\/Storage\/47\/images\/sponsorimages

rotationImage = new Array();
rotationImage[0] = new Image(255, 100);
rotationImage[0].src = "http://www.nebraska.bbb.org/storage/135/images/sponsoredcontent/ketv09.gif";
rotationImage[1] = new Image(255, 100);
rotationImage[1].src = "http://www.nebraska.bbb.org/storage/135/images/sponsoredcontent/aplus09.gif";
rotationImage[2] = new Image(255, 100);
rotationImage[2].src = "http://www.nebraska.bbb.org/storage/135/images/sponsoredcontent/KLKNLogo09.gif";
rotationImage[3] = new Image(255, 100);
rotationImage[3].src = "http://www.nebraska.bbb.org/storage/135/images/sponsoredcontent/paypal09.gif";
rotationImage[4] = new Image(255, 100);
rotationImage[4].src = "http://www.nebraska.bbb.org/storage/135/images/sponsoredcontent/pinnacle_09.gif";
rotationImage[5] = new Image(255, 100);
rotationImage[5].src = "http://www.nebraska.bbb.org/storage/135/images/sponsoredcontent/sponsor_coxcomm.gif";
rotationImage[6] = new Image(255, 100);
rotationImage[6].src = "http://www.nebraska.bbb.org/storage/135/images/sponsors/sponsor_McKinnisRoofing2.jpg";

rotationUrl = new Array();
rotationUrl[0] = "http://www.ketv7.com";
rotationUrl[1] = "http://www.aplusnightlife.com";
rotationUrl[2] = "http://www.klkntv.com";
rotationUrl[3] = "http://www.paypal.com";
rotationUrl[4] = "http://www.pinnbank.com";
rotationUrl[5] = "http://omaha.cox.net/cci/home";
rotationUrl[6] = "http://www.mckinnisroofing.com";

rotationTracker = new Array();
rotationTracker[0] = "/bannerclicks/sponsor_ID";
rotationTracker[1] = "/bannerclicks/sponsor_ID";
rotationTracker[2] = "/bannerclicks/sponsor_ID";
rotationTracker[3] = "/bannerclicks/sponsor_ID";
rotationTracker[4] = "/bannerclicks/sponsor_ID";
rotationTracker[5] = "/bannerclicks/sponsor_ID";
rotationTracker[6] = "/bannerclicks/sponsor_ID";

var totalImgNumber = rotationImage.length;
var imgNumber = randomXToY(0, totalImgNumber-1);

function rotateImg() {
	var content = "";
	if (rotationImage[imgNumber].src) {
		content = getImg();
	} else {
		content = getFlash();
	} // if
	document.getElementById("sponsor_div").innerHTML = content;
	
	imgNumber++;
	
	if (imgNumber >= totalImgNumber) {
		imgNumber=0;
	} // if
} // function

function getImg() {
	return '<a href="' + rotationUrl[imgNumber] + '" onclick="javascript:pageTracker._trackPageview(\'' + rotationTracker[imgNumber] + '\');" target="_blank" id="sponsor_link"><img src="'+rotationImage[imgNumber].src+'" name="rotationImg" style="border: #000000 0px solid;" /></a>';
} // function

function getFlash() {
	return '<embed src="' + rotationImage[imgNumber] + '" quality="high" width="468" height="60" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
} // function

function rotate() {
      rotateImg();
      setTimeout("rotate()", delay);
} // function

rotate();