var popup = null;

function devarana_popup( link, width, height )
{
	var maxWidth = window.screen.availWidth;
	var maxHeight = window.screen.availHeight;
	width = parseInt(width);
	width = (width<0)?0:width;
	width = (width>maxWidth)?maxWidth:width;
	height = parseInt(height);
	height = (height<0)?0:height;
	height = (height>maxHeight)?maxHeight:height;
	var top = 0;
	var left = 0;
	if( width > 0 ){
		left = Math.floor((maxWidth-width)/2);
	}
	if( height > 0 ){
		top = Math.floor((maxHeight-height)/2);
	}
	var options  = 'channelmode=no';
		options += ',modal=yes';
		options += ',directories=no';
		options += ',fullscreen=no';
		options += ',location=no';
		options += ',menubar=no';
		options += ',resizable=yes';
		options += ',scrollbars=yes';
		options += ',status=no';
		options += ',titlebar=no';
		options += ',toolbar=no';
		options += ',height='+height;
		options += ',width='+width;
		options += ',top='+top;
		options += ',left='+left;
	if( popup && popup.closed ){
		popup = null;
	}
	if( !popup ){
		popup = window.open( '', 'popupWin', options, false );
	}
	if( !popup ){
		alert( 'Schakel uw popup-blocker uit als u deze functie wilt gebruiken.' );
		return false;
	}
	popup.location = link;
}

