var bugRiddenCrashPronePieceOfJunk = (
	navigator.userAgent.indexOf('MSIE 5') != -1
	&&
	navigator.userAgent.indexOf('Mac') != -1
);

var W3CDOM = (!bugRiddenCrashPronePieceOfJunk && 
	document.getElementsByTagName && document.createElement);

if ((top != self.parent) && !self.disabled)
	top.location.href = '/index.html';

if (top.navi && top.navi.setNav) top.navi.setNav(location.href,'currentPage');
top.setNav = location.href;


window.onload = initialize; 

/* Why no window.onload = function () {} ? Because NN3 doesn't support the function
	constructor and gives an error message. This site must be accessible to NN3 */

function initialize () {

	
/* Hide nifty stuff from old browsers */

	if (W3CDOM)
	
	{

/* Go through all links. If any has a type="popup" write the popup function into its onclick
   Any external link gets a target='ppk'. 
   Any link with a hreflang attribute gets an extra note with its value.   
   */
	var langspan = document.createElement('span');
	langspan.className = 'smaller lang';
	
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].getAttribute('type') == 'popup')
		{
			x[i].onclick = function () {
				return pop(this.href)
			}
			x[i].innerHTML += '<span class="hide"> (popup)</span>';
		}
		if (x[i].className == 'external')
			x[i].target = 'ppk';
		if (x[i].className == 'outoforder')
		{
			x[i].title = 'OUT OF ORDER';
			x[i].target = 'ppk';
			x[i].onclick = function ()
			{
				return confirm('This link is out of order. Continue anyway?');
			}
		}
		var hreflang = x[i].getAttribute('hreflang');
		if (hreflang)
		{
			var newspan = langspan.cloneNode(true);
			newspan.appendChild(document.createTextNode(' (lang=' + hreflang + ')'));
			x[i].parentNode.insertBefore(newspan,x[i].nextSibling);
			
		}
	}
	




/* End hide. This is for all browsers 
 If the page has an init() function, execute it */

	}

	
	if (self.init) self.init();
}

window.onunload = remove;

function remove () {
	if (top.navi && top.navi.setNav) top.navi.setNav(location.href,'');
	top.setNav = '';
	if (self.exit) self.exit();
}


// Popup

var popUp = null;

function pop(url)
{
	if (popUp && !popUp.closed)
		popUp.location.href = url;
	else
		popUp = window.open(url,'popUp','height=500,width=530,scrollbars=yes,resizable=no,toolbar=no,location=no');
	popUp.focus();
	return false;
}

