/* Copyright (c) 2006-2007 Mateusz Heleniak @ www.iws.pl */

var regexp = [/ new /i, / popup(?:\-(\d+)x(\d+))? /i];

function checkLinks(x,i)
{
	for(i in x = document.links)
	{
		if(x[i].href && (regexp[0].test(' ' + x[i].rel + ' ') || regexp[0].test(' ' + x[i].className + ' ')))
		{
			x[i].target = '_blank';
		}
		else if(x[i].href && (regexp[1].test(' ' + x[i].rel + ' ') || regexp[1].test(' ' + x[i].className + ' ')))
		{
			x[i].onclick = function()
			{
				var m = new String(' ' + (regexp[1].test(' ' + this.rel + ' ') ? this.rel : this.className) + ' ').match(regexp[1]);
				window.open(this.href, '_blank', 'toolbar=0,location=0,directories=0,resizable=0,status=0,menubar=0,scrollbars=1,width=' + (m[1] || '450') + ',height=' + (m[2] || '300'));
				return false;
			}
		}
	}
}

addEvent(window, 'load', checkLinks);
