/*

	Copyright (C) 2004 Anton Triest

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

	(http://www.gnu.org/licenses/gpl.html)

	Anton Triest [anton@cking.be]
	http://www.cking.be/webstuff/

*/

var W3CDOM = (document.createElement && document.getElementsByTagName);

var authorName = 'Anton Triest';
var authorMail = 'anton@cking.be';

var footer = new Array();
var switcher = new Array();
var words1 = new Array('XHTML', 'CSS', 'XML', 'XSLT', 'XPath', 'JavaScript', 'DHTML');
var words2 = new Array('samples', 'tips', 'tricks', 'experiments');
var i1 = 0;
var i2 = 0;
var switching = false;

// word switcher

function initSwitcher()
{
	if (!W3CDOM) return;

	switcher = document.getElementById('switcher');

	startSwitching();
}

function startSwitching()
{
	switching = true;
	i1 = i2 = 0;

	switcher.title = 'click to stop';
	switcher.onclick = stopSwitching;

	switchWords();
}

function switchWords()
{
	if (!switching) return;

	switcher.innerHTML = '<b>' + words1[i1] + '</b>' + ' ' + words2[i2] + '<br/>&#0160;';

	if (i1 + 1 < words1.length)
		i1++;
	else
		i1 = 0;
	
	if (i2 + 1 < words2.length)
		i2++;
	else
		i2 = 0;

	setTimeout(switchWords, 1000);
}

function stopSwitching()
{
	switching = false;

	switcher.title = 'click to start';
	switcher.onclick = startSwitching;
	switcher.innerHTML = '';

	for (i1 = 0; i1 < words1.length; i1++)
	{
		switcher.innerHTML += '<b>' + words1[i1];

		if (i1 + 1 < words1.length)
			switcher.innerHTML += ' - ';
		else
			switcher.innerHTML += '</b><br/>';
	}

	for (i2 = 0; i2 < words2.length; i2++)
	{
		switcher.innerHTML += words2[i2];

		if (i2 + 1 < words2.length)
			switcher.innerHTML += ' - ';
	}
}

// footer

function generateFooter()
{
	if (!W3CDOM) return;

	footer = document.getElementById('footer');

	// TODO: get these from external file "footer.xml"
	//var footerContents = document('footer.xml').getElementsByTagName('footer');
	//footer.innerHTML = footerContents;

	footer.innerHTML = '<div class="validators">';
	footer.innerHTML += '<a href="http://validator.w3.org/check?uri=referer&amp;verbose=1" title="Validate this page">XHTML 1.0</a>';
	footer.innerHTML += '&nbsp;-&nbsp;';
	footer.innerHTML += '<a href="http://jigsaw.w3.org/css-validator/check/referer" title="Validate stylesheet">CSS 2.0</a>';
	footer.innerHTML += '</div>';
	footer.innerHTML += '<div class="author">';
	footer.innerHTML += '<span class="modified">last modified: ' + document.lastModified + '</span>';
	footer.innerHTML += authorName + ' [<a href="mailto:' + authorMail + '?subject=[webstuff] ">' + authorMail + '</a>]';
	footer.innerHTML += '</div>';
}









