function popup(url,name,width,height,wplus,hplus,focus,left,top,menubar,status,toolbar,scrollbar,resizable,scrx,scry,directories,loc) {
	if ( !url ) return false;
	if ( !name ) name = 'popupWin';
	if ( !width ) width = '';
	if ( !height ) height = '';
	if ( !directories ) directories = 'no';
	if ( !loc ) loc = 'no';
	if ( !menubar ) menubar = 'no';
	if ( !status ) status = 'no';
	if ( !toolbar ) toolbar = 'no';
	if ( !scrollbar ) scrollbar = 'no';
	if ( !resizable ) resizable = 'no';
	if ( !scrx ) scrx = '100';
	if ( !scry ) scry = '100';
	if ( !left ) left = '100';
	if ( !top ) top = '100';
	if ( wplus ) width  += wplus;
	if ( hplus ) height += hplus;

    var popupWin = window.open(url,name,'width='+width+'px,height='+height+'px,left='+left+',top='+top+',menubar='+menubar+',status='+status+',toolbar='+toolbar+',scrollbars='+scrollbar+',resizable='+resizable+',screenX='+scrx+',screenY='+scry+'directories='+directories+',location='+loc);

	if ( focus ) popupWin.focus();
}

function openNewWindow(URLtoOpen, popwidth, popheight) {
	var Macit = detect();
	var screenWidth = screen.availWidth;
	var screenHeight = screen.availHeight;
	var x = (screenWidth/2)-(popwidth/2);
	var y = (screenHeight/2)-(popheight/2);
	if (Macit == 1) {
		popwidth2 = popwidth - 16;
		popheight2 = popheight - 16;
	} else {
		popwidth2 = popwidth;
		popheight2 = popheight;
	}
	var winParams = "height=" + popheight2 + ",width=" + popwidth2 +",scrollbars=no,status=no,location=no,toolbar=no,resizable=no,screenX=" + x + ",screenY=" + y + ",left=" + x + ",top=" + y;
	newWindow = window.open(URLtoOpen,'_blank', winParams);

}
