//define the variables
var myFirst = 0;
var thisAd = 0;
var make_rand = 0;

//create the image array
myPix = new Array("partners/cypress.gif","partners/health_trust_logo.gif","partners/woodland_park.jpg","partners/amtrak.gif","partners/vta.gif","partners/outnow.gif","partners/elcamino.gif","partners/partyfiesta.jpg");

//create the array with the links
myLix = new Array("http://www.cypress.com","http://www.healthtrust.org","http://www.wpapts.com/","http://www.amtrak.com","http://www.vta.org/","http://www.outnowmagazine.com","http://www.elcaminohospital.org/","http://balloonssanjoseca.com/");

//variable to represent current image variable
var currentPic = new Image();
currentPic.src = myPix[thisAd];

//this variable represents the number of images in the image array
var imgCt = myPix.length;

//create an array that randomizes the order of the images and links.
var randomize_it = new Array();

for (i=0; i<imgCt;i++){
randomize_it[i] = i;
}

function randOrd(){
return (Math.round(Math.random())-0.5); }

randomize_it.sort(randOrd);

//function to cycle the images
function cyclePic(){
	if (document.images){
		thisAd = randomize_it[make_rand];
		currentPic.src = myPix[thisAd];
		document.myPicture.src=currentPic.src
		myFirst = 1;
		setTimeout("cyclePic()", 3 * 1000)
		make_rand++
		if (make_rand == imgCt) {
			make_rand = 0
		}
	}}
	
//function to be called by the link tag
function newLocation(){
	if (myFirst == 1){
	window.open (myLix[thisAd])
	//document.location.href="" + myLix[thisAd]
	}else{
	document.location.href=""
	}}