if (document.getElementById && document.getElementsByTagName)
{

var css = '<style type="text/css">';
//css += '.home #page { background-position: -997px -368px; }';
css += '.home #page { background-position: -1072px -368px; }';
//css += '.home #identity { left: 238px; }';
css += '.home #identity { left: 163px; }';
//css += '#languages { display: none; }';
css += '#languages { display: block; }';
css += '</style>';
document.write(css);

var HTMLColl = new Object();
window.addListener(HTMLColl);
HTMLColl.onload = function()
{
	this.body = document.getElementsByTagName('body')[0];
	this.logo = document.getElementById('logo');
	this.languages = document.getElementById('languages');
	this.page = document.getElementById('page');
	this.identity = document.getElementById('identity');
	this.headline = this.identity.getElementsByTagName('h1')[0].getElementsByTagName('img')[0];
	this.quotes = document.getElementById('quotes');

	this.broadcastMessage('onload');
};
EventBroadcaster.init(HTMLColl);

var logo = new Object();
HTMLColl.addListener(logo);
logo.onload = function()
{
	this.element = HTMLColl.logo;
	this.img = this.element.getElementsByTagName('img')[0];

	if (this.img)
	{
		this.img.obj = this;

		var out = new Image();
		this._outSrc = this.img.src;
		out.src = this._outSrc;

		var over = new Image();
		this._overSrc = this._outSrc.replace(/(\.gif)/, 'on$1');
		over.src = this._overSrc;

		this.activate();

		this.img.onclick = function()
		{
			languages.activate();

			return false;
		};
		this.img.onclick();
	}
};
logo.deactivate = function()
{
	this.img.onmouseout();
	this.img.onmouseover = null;
	this.img.onmouseout = null;
	this.img.onclick = null;

	this.img.style.cursor = 'default';
};
logo.activate = function()
{
	this.img.onmouseover = function()
	{
		this.src = this.obj._overSrc;
	};

	this.img.onmouseout = function()
	{
		this.src = this.obj._outSrc;
	};
};
logo.reactivate = function(lang)
{
	this.img.style.cursor = 'hand';
	if (this.img.style.cursor != 'hand')
	{
		this.img.style.cursor = 'pointer';
	}

	this.lang = lang;
	this.activate();

	this.img.onclick = function()
	{
		window.location.href = './' + this.obj.lang + '/index.html';

		return false;
	};
};

var languages = new Object();
HTMLColl.addListener(languages);
languages.onload = function()
{
	this.element = HTMLColl.languages;

	var items = this.element.getElementsByTagName('a');

	for (var i = 0, ii = items.length; i < ii; i++)
	{
		var item = items[i];
		item.element = this.element;

		item.img = item.getElementsByTagName('img')[0];

		var out = new Image();
		item._outSrc = item.img.src;
		out.src = item._outSrc;

		var over = new Image();
		item._overSrc = item._outSrc.replace(/(\.gif)/, 'on$1');
		over.src = item._overSrc;

		item.onmouseover = function()
		{
			this.img.src = this._overSrc;
		}

		item.onmouseout = function()
		{
			this.img.src = this._outSrc;
		}

		item.onclick = function()
		{
			var lang = this.parentNode.id;

			quotes.activate(lang);
			logo.reactivate(lang);

			return false;
		};
	}
};
languages.activate = function()
{
	HTMLColl.body.className = 'languages';

	logo.deactivate();
};

var quotes = new Object();
HTMLColl.addListener(quotes);
quotes.onload = function()
{
	this.element = HTMLColl.quotes;
};
quotes.activate = function(lang)
{
	var headlineSrc = HTMLColl.headline.src;
	HTMLColl.headline.src = headlineSrc.replace(/(\.gif)/, '2$1');

	this.quote = document.getElementsByClassName(lang)[0];

	HTMLColl.body.className = 'quotes';

	logo.reactivate();
};

} // end if (document.getElementById && document.getElementsByTagName)
