/**
*** image_rotate.js
*** rotates the image and link in a timely fashion
**/

adImages = new Array();
img_index = 0;

adImages[img_index++] = "images/rotation/image1a.jpg";
adImages[img_index++] = "images/rotation/image1a.jpg";
adImages[img_index++] = "images/rotation/image2a.jpg";
adImages[img_index++] = "images/rotation/image3a.jpg";
adImages[img_index++] = "images/rotation/image4a.jpg";
adImages[img_index++] = "images/rotation/image5a.jpg";
adImages[img_index++] = "images/rotation/image6a.jpg";
adImages[img_index++] = "images/rotation/image7a.jpg";
adImages[img_index++] = "images/rotation/image8a.jpg";
adImages[img_index++] = "images/rotation/image9a.jpg";
adImages[img_index++] = "images/rotation/image10a.jpg";
adImages[img_index++] = "images/rotation/image11a.jpg";
adImages[img_index++] = "images/rotation/image12a.jpg";
adImages[img_index++] = "images/rotation/image13a.jpg";

adLinks = new Array();
link_index = 0;

adLinks[link_index++] = "collection/accessories/rings/index.html";
adLinks[link_index++] = "collection/accessories/rings/index.html";
adLinks[link_index++] = "collection/accessories/rings/index.html";
adLinks[link_index++] = "collection/accessories/rings/index.html";
adLinks[link_index++] = "#";
adLinks[link_index++] = "#";
adLinks[link_index++] = "#";
adLinks[link_index++] = "#";
adLinks[link_index++] = "#";
adLinks[link_index++] = "#";
adLinks[link_index++] = "#";
adLinks[link_index++] = "#";
adLinks[link_index++] = "#";
adLinks[link_index++] = "#";

var thisImg = 0; 

function choosepic(x){
	document.getElementById("banner").src = adImages[x];	
	rotate();
}

function rotate(){
	thisImg++;
		
	if (thisImg >= adImages.length){				
		thisImg = 0;
	}
	document.getElementById("banner").src = adImages[thisImg];
	document.getElementById("bannerlink").href = adLinks[thisImg];
	setTimeout(rotate, 4 * 1000);
}




// imgArraySize = 8;

/**var timer = null;
var counter = 0;**/

//thisImg = Math.floor((Math.random() * adImages.length));
//alert(thisImg);

/*
for (i=0; i<imgArraySize; i++){
    adImages[img_index++] = "images/rotation/image" + img_index + "a.jpg";
    //alert ("adImages = " + adImages[img_index-1]);
}
*/

/**
 * Banner
 
 *
 * Banner code 
 
function banner(){
	if(counter >= adImages.length){
		counter = 0;
	}
	document.getElementById("banner").src = adImages[counter];
	counter++;
	timer=setTimeout("banner()", 4000);
} 
**/