function popuper_popup()
{
	// Wycięcie z nazwy klasy szerokości okienka
	i = this.className.indexOf('popuper_')+8; j = i;
	while (this.className.charAt(j)!='_') j++;
	width = this.className.substring(i,j);

	// Wycięcie z nazwy klasy wysokości okienka
	i = ++j;
	while (this.className.charAt(j)>='0' && this.className.charAt(j)<='9') j++;
	height = this.className.substring(i,j);

	// Okreslenie położenia okienka tak by było wycentrowane
	var left = (screen.width-width) / 2;
	var top  = (screen.height-height) / 2;

	window.open(this.href,'','screenx='+left+',screeny='+top+',width='+width+',height='+height+'');
	return false;
}

function popuper_updateLinks() 
{
	// Check that the browser is DOM compliant
	if (document.getElementsByTagName && document.createElement && document.appendChild) 
	{
		// Find all links
		var alinks = document.getElementsByTagName('a');

		for (var i = 0; i < alinks.length; i++) 
		{
			alink = alinks[i];

			//if (/\bpopuper\b/.test(alink.className)) 
			if(alink.className.match(/\bpopuper/))
			{
				// określenie szerokości i wysokości otwieranego okienka
				alink.onclick = popuper_popup;
				alink.style.display = 'block';
			}
		}
	}
}

function popuper_addEvent( obj, type, fn )
{
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function popuper_removeEvent( obj, type, fn )
{
	if (obj.removeEventListener)
		obj.removeEventListener( type, fn, false );
	else if (obj.detachEvent)
	{
		obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
		obj["e"+type+fn] = null;
	}
}

popuper_addEvent(window, 'load', popuper_updateLinks);