
//	Make a list of the info boxes
	the_boxes = new Array("","info_box_1","info_box_2","info_box_3");	// the empty slot at the beginning just makes it easier to work with the numbers

	the_current_box = 1;


function switch_info_boxes (the_new_box) {

	var the_current_box_id = the_boxes[the_current_box];
	var the_new_box_id 	= the_boxes[the_new_box];
	
	document.getElementById(the_current_box_id).style.display = 'none';
	document.getElementById(the_new_box_id).style.display = 'block';

	var the_current_controller_button = 	'info_box_controller_button_' + the_current_box;
	var the_current_controller_graphic = 	'/site-media/images/info_box_controller_button_' + the_current_box+'.gif';

	var the_new_controller_button = 		'info_box_controller_button_' + the_new_box;
	var the_new_controller_graphic = 		'/site-media/images/info_box_controller_button_' + the_new_box+'_over.gif';
	
	document.getElementById(the_current_controller_button).setAttribute('src', the_current_controller_graphic);
	document.getElementById(the_new_controller_button).setAttribute('src', the_new_controller_graphic);
	
	the_current_box = the_new_box;
}

function bump_info_box (the_direction) {
		
	if (the_direction == "up") {
		var the_new_box = the_current_box + 1;
		
		if (the_new_box == the_boxes.length) {
			the_new_box = 1;
		}

	} else  {
	
		var the_new_box = the_current_box - 1;
		if (the_new_box <= 0) {
			the_new_box = 3;
		}
	}
	
	switch_info_boxes (the_new_box);
}



function prepare_elements () {

//	Add event handlers to the info box controller buttons (ie: id="info_box_controller_blahblahblah").
//	Yes, this is tedious...
	
	var lft_arrow 	= document.getElementById("info_box_controller_arrow_lft");
	var rgt_arrow 	= document.getElementById("info_box_controller_arrow_rgt");
	
	var box1 		= document.getElementById("info_box_controller_button_1");
	var box2		= document.getElementById("info_box_controller_button_2");
	var box3		= document.getElementById("info_box_controller_button_3");
	
	if (lft_arrow) {
	    lft_arrow.onmouseover = function () {this.setAttribute("src", "/site-media/images/info_box_controller_arrow_lft_over.gif");}
	    lft_arrow.onmouseout = function () {this.setAttribute("src", "/site-media/images/info_box_controller_arrow_lft.gif");}
	    
	    lft_arrow.onclick = function () {
		bump_info_box ('down');
		return false;
	    }
	}

	if (box1) {
	    box1.onmouseover = function () {this.setAttribute("src", "/site-media/images/info_box_controller_button_1_over.gif");}
	    box1.onmouseout = function () {
		if (the_boxes[the_current_box] != 'info_box_1') { this.setAttribute("src", "/site-media/images/info_box_controller_button_1.gif");}
	    }
	    box1.onclick = function () {
		switch_info_boxes (1);
		return false;
	    }
	}
	
	if (box2) {
	    box2.onmouseover = function () {this.setAttribute("src", "/site-media/images/info_box_controller_button_2_over.gif");}
	    box2.onmouseout = function () {
		if (the_boxes[the_current_box] != 'info_box_2') { this.setAttribute("src", "/site-media/images/info_box_controller_button_2.gif");}
	    }
	    box2.onclick = function () {
		switch_info_boxes (2);
		return false;
	    }
	}

	if (box3) {
	    box3.onmouseover = function () {this.setAttribute("src", "/site-media/images/info_box_controller_button_3_over.gif");}
	    box3.onmouseout = function () {
		if (the_boxes[the_current_box] != 'info_box_3') { this.setAttribute("src", "/site-media/images/info_box_controller_button_3.gif");}
	    }
	    box3.onclick = function () {
		switch_info_boxes (3);
		return false;
	    }
	}

	
	if (rgt_arrow) {
	    rgt_arrow.onmouseover = function () {this.setAttribute("src", "/site-media/images/info_box_controller_arrow_rgt_over.gif");}
	    rgt_arrow.onmouseout = function () {
		this.setAttribute("src", "/site-media/images/info_box_controller_arrow_rgt.gif");
	    }
	    rgt_arrow.onclick = function () {
		bump_info_box ('up');
		return false;
	    }
	}
	
	
	//	Engage the rollover state on the default info box controller button..
	if (box1) {
	    box1.setAttribute("src", "/site-media/images/info_box_controller_button_1_over.gif");
	}
}



addOnloadEvent(prepare_elements);
