var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type){
	
	
	if (type == "popup") newWindow = window.open('http://www.magnumszauna.hu/link.php?link='+url, '_blank');
	newWindow.focus();
}

function doPopUp(e)
{
//call the popup script
popUpWin(this.href,this.rel);
//cancel the default link action if pop-up activated
if (window.event) 
	{
	window.event.returnValue = false;
	window.event.cancelBubble = true;
	} 
else if (e) 
	{
	e.stopPropagation();
	e.preventDefault();
	}
}

function findPopUps()
{
var popups = document.getElementsByTagName("a");
for (i=0;i<popups.length;i++)
	{
	if (popups[i].rel.indexOf("popup")!=-1)
		{
		// attach popup behaviour
		popups[i].onclick = doPopUp;
		}
	if (popups[i].rel.indexOf("banner")!=-1)
		{
		// attach popup behaviour
		popups[i].onclick = doPopUp;
		}
	}
}

addEvent(window, 'load', findPopUps, false);

