var hb_interval = 2; // delay between rotating images (in seconds)
var hb_random_display = 0; // 0 = no, 1 = yes
hb_interval *= 1000;
var hb_image_index = 0;
hb_image_list = new Array();
hb_link_list = new Array();
hb_image_list[hb_image_index++] = new hb_imageItem("http://www.secretsof.com/embroiderytips/images/sales.jpg")
hb_link_list[hb_image_index-1]="http://www.secretsof.com/content/1286";
hb_image_list[hb_image_index++] = new hb_imageItem("http://www.secretsof.com/embroiderytips/images/SOEbonus.jpg")
hb_link_list[hb_image_index-1]="http://www.secretsof.com/content/836";
hb_image_list[hb_image_index++] = new hb_imageItem("http://www.secretsof.com/embroiderytips/images/points.jpg")
hb_link_list[hb_image_index-1]="http://www.secretsof.com/content/1770";
var hb_number_of_image = hb_image_list.length;
function hb_imageItem(hb_image_location) {
	this.hb_image_item = new Image();
	this.hb_image_item.src = hb_image_location;
}
function hb_get_ImageItemLocation(imageObj) {
	return(imageObj.hb_image_item.src)
}
function hb_generate(x, y) {	var range = y - x + 1;
	return Math.floor(Math.random() * range) + x;
}
function hb_getNextImage() {
	if (hb_random_display) {
		hb_image_index = hb_generate(0, hb_number_of_image-1);
	}
	else {
		hb_image_index = (hb_image_index+1) % hb_number_of_image;
	}
	var new_image = hb_get_ImageItemLocation(hb_image_list[hb_image_index]);
	return(new_image);
}
function hb_rotateImage(place) {
	var new_image = hb_getNextImage();
	document[place].src = new_image;
	var recur_call = "hb_rotateImage('"+place+"')";
	setTimeout(recur_call, hb_interval);
	document.getElementById('hb_link').href=hb_link_list[hb_image_index]	
}