var currentPanel;
var panelTimer;
var delay = 7.5;

function panelTick() {
	currentPanel++;
	if (currentPanel > 3) { currentPanel = 1; }
	choosePanel(currentPanel);
	panelTimer = setTimeout('panelTick()',delay * 1000);
}

function deactivatePanel(panel) {
	//document.getElementById('panelLink_'+panel).innerHTML = '<a href="" onclick="choosePanel('+panel+');return false;"><img src="_images/marker.png" width="6" height="6" alt="Choose this panel" style="margin-bottom:1px" /></a>';
	document.getElementById('pagePanel'+panel).style.opacity = '0';
	document.getElementById('pagePanel'+panel).style.visibility = 'hidden';
}

function choosePanel(panel) {
	var i;
	for (i = 1; i <= 3; i++) {
		deactivatePanel(i);
	}
	if (panel < 1) { panel = 1; }
	if (panel > 3) { panel = 3; }
	//document.getElementById('panelLink_'+panel).innerHTML = '<img src="_images/marker_selected.png" width="6" height="6" alt="This is the current panel" style="margin-bottom:1px" />';
	document.getElementById('pagePanel'+panel).style.opacity = '1';
	document.getElementById('pagePanel'+panel).style.visibility = 'visible';
	currentPanel = panel;
}

function clickPanel(panel) {
	clearTimeout(panelTimer);
	choosePanel(panel);
	clearTimeout(panelTimer);
}

function initPanel() {
	currentPanel = 1;
	/*
	html = '';
	html += '<table align="center" class="commentTable">';
	html += '<tr>';
	html += '<td><a href="" onclick="clickPanel(currentPanel-1);return false;"><img src="_images/pointer_back.png" width="8" height="9" alt="Previous panel" /></a></td>';
	for (i = 1; i <= 3; i++) {
		html += '<td id="panelLink_'+i+'"><a href="" onclick="clickPanel('+i+');return false;"><img src="_images/marker.png" width="6" height="6" alt="Choose this panel" style="margin-bottom:1px" /></a></td>';
	}
	html += '<td><a href="" onclick="clickPanel(currentPanel+1);return false;"><img src="_images/pointer.png" width="8" height="9" alt="Next panel" /></a></td>';
	html += '</tr>';
	html += '</table>';
	document.getElementById('panelNavigator').innerHTML = html;
	*/
	choosePanel(currentPanel);
	panelTimer = setTimeout('panelTick()',delay * 1000);
}
