var bugRiddenCrashPronePieceOfJunk = (
	navigator.userAgent.indexOf('MSIE 5') != -1
	&&
	navigator.userAgent.indexOf('Mac') != -1
);

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


window.onload = initialize; 

// Checkin link types
function 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 */


	if (!W3CDOM) return;

/* Go through all links. If any has a type="popup" write the popup function into its onclick
   Any external link gets a target='ppk'. */
	
	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="smaller"> (popup)</span>';
		}
		if (x[i].className == 'external')
			x[i].target = 'ppk';
		if (x[i].className == 'outoforder')
		{
			x[i].title = 'OUT OF ORDER';
			x[i].onclick = function ()
			{
				return confirm('This link is out of order. Continue anyway?');
			}
		}
	}
}

// PopUp Script
		var popUp = null;

		function pop(url)
		{
			if (popUp && !popUp.closed)
				popUp.location.href = url;
			else
				popUp = window.open(url,'popUp','height=223,width=226,scrollbars=no,resizable=no,toolbar=no,location=no');
			popUp.focus();
			return false;
		}
		
		function pop2(url) {
	if (popUp && !popUp.closed)
		popUp.location.href = url;
	else
		self.name = "asiakastieto";
		popUp = window.open(url,'popUp','width=450,height=450,scrollbars=yes,resizable=yes,toolbar=no,location=no');
	popUp.focus();
	return false;
}