/**
 * Gejat van http://www.popuptest.com/ (http://www.popuptest.com/goodpopups.html)
 *
 * @param mypage string		URL van popup
 * @param myname string		Titel van popup
 * @param w integer		Width
 * @param h integer		Height
 * @param dialog bool		bool, dialog is zonder toolbar/status/etc
 * @param pos string		random of center, default links boven
 */
function NewWindow(mypage, myname, w, h, dialog, pos)
{
	if(pos == "random") {
		LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100;
		TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
	} else if(pos == "center") {
		LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
		TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;
	} else if((pos != "center" && pos != "random") || pos == null) {
		LeftPosition = 20;
		TopPosition = 20
	}

	settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition;
	if(dialog) {
		settings = settings + ',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	} else {
		settings = settings + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
	}

	var openWindow = window.open(mypage, myname, settings);
	if (typeof openWindow == 'undefined' || openWindow == null) {
		if (toerEngineError)
			toerEngineError('Popup '+myname+' geblockt: '+mypage);
		alert("Er is een popup blocker actief, Toerkoop kan het gevraagde scherm niet openen!");
	}
	return openWindow;
}
