/*********************************************************************
* Changing Panels
* Created by: Christian Snodgrass
* http://www.arwebdesign.net
* http://www.arwebdesign.net/csnodgrass
**********************************************************************
* This script allows you to create panels which can easily swap out
* with others, in a method that can gracefully degrade.
**********************************************************************
* These may be used for any purpose, free of charge.
* The only condition is that this header must remain intact in it's
* entirety.
*********************************************************************/
function ChangingPanels(var_name) {
	this.name = var_name;
}
ChangingPanels.prototype.name = "";
ChangingPanels.prototype.panels = Array();
ChangingPanels.prototype.links = Array();
ChangingPanels.prototype.addPanel = function(id, link_id) {
	this.panels.push(id);
	this.links.push(link_id);
	document.getElementById(id).style.display = "none";
	document.getElementById(link_id).onclick = this.togglePanel;
	document.getElementById(link_id).var_name = this.name;
	document.getElementById(link_id).panel = id;
}
ChangingPanels.prototype.displayPanel = function(id) {
	// Hide any visible panels.
	for(var i=0; i < this.panels.length; i++)
		document.getElementById(this.panels[i]).style.display = "none";
	// Show the one we want.
	document.getElementById(id).style.display = "block";
}
ChangingPanels.prototype.togglePanel = function() {
	var panels = window[this.var_name];
	panels.displayPanel(this.panel);
}
var panels = new ChangingPanels("panels"); 
panels.addPanel("panel1","panel1_link"); 
panels.addPanel("panel2","panel2_link"); 
panels.addPanel("panel3","panel3_link"); 
panels.addPanel("panel4","panel4_link"); 
panels.addPanel("panel5","panel5_link"); 
panels.addPanel("panel6","panel6_link"); 
panels.addPanel("panel7","panel7_link"); 
panels.displayPanel("panel1");