﻿var arrImage = new Array;
var arrUrl = new Array;
var i=-1;
var imgPath = "/images/Navigation/";
var numSponsers = 0;
var rotateInterval = 9000; // interval in milliseconds between rotation
var currentSponser = 0;
var timeRefresh = 0;

//build array of images and their web site
i++;
arrImage[i] = imgPath + "h1.jpg";
//arrUrl[i]="www.kcbs.us";

i++;
arrImage[i] = imgPath + "h2.jpg";
//arrUrl[i]="www.pepsiamericas.com";

i++;
arrImage[i] = imgPath + "h3.jpg";
//arrUrl[i]="www.millerbrewing.com";

i++;
arrImage[i] = imgPath + "h4.jpg";
//arrUrl[i]="www.cookiesbbq.com";

i++;
arrImage[i] = imgPath + "h5.jpg";
//arrUrl[i]="www.connectingyou.com";

i++;
arrImage[i] = imgPath + "h6.jpg";
//arrUrl[i]="www.hawgeyesbbq.com";

i++;
arrImage[i] = imgPath + "h7.jpg";
//arrUrl[i]="www.wgmarketing.com";

i++;
arrImage[i] = imgPath + "h8.jpg";
//arrUrl[i]="www.horizonbbqsmokers.com";

i++;
arrImage[i] = imgPath + "h9.jpg";
//arrUrl[i]="www.pepsiamericas.com";

i++;
arrImage[i] = imgPath + "h11.jpg";
//arrUrl[i]="www.truevalue.com";

i++;
arrImage[i] = imgPath + "h12.jpg";
//arrUrl[i]="www.worldpork.org";

i++;
arrImage[i] = imgPath + "h13.jpg";
//arrUrl[i]="www.edys.com";

//i++;
//arrImage[i] = imgPath + "biggreenegg.jpg";
//arrUrl[i]="www.biggreenegg.com";


numSponsers = i;
//pick a random sponser to be the current sponser
currentSponser=Math.floor(Math.random()*(numSponsers+1))

function rotateSponsers() {
currentSponser +=1;
if (currentSponser > numSponsers) {currentSponser=0};
document.headerImage.src = arrImage[currentSponser];
//alert(currentSponser);
//window.setTimeout('rotateSponsers()',rotateInterval);
    }
    
function startRotation(){
timeRefresh=setInterval("rotateSponsers()", rotateInterval);
}

function stopRotation(){
clearInterval(timeRefresh)
}
    
function goToIt(){
    window.open("http://" + arrUrl[currentSponser]);
    } 
	
function swap_img(img_name,img_src) {
	document[img_name].src=img_src;
	}
	
function leftNav(url){
location.href = url
}

function openWindow(url){
window.open(url)
}
