/* New PopUp function */
/**
 *	Example Usage:
 *	PopUp({
 *		href: 'http://www.example.com',
 *		winName: '_new',
 *		width: 500,
 *		height: 300,
 *		top: 0,
 *		left: 0,
 *		menubar: false
 *	}); 
 */
function PopUp(options) 
{
	// set required options
	var href = options.href || "about:blank";
	var winName = options.winName || "_blank";
	var width = options.width || 640;
	var height = options.height || 480;
	var left = options.left || ((screen.width - width) / 2);
	var top = options.top || ((screen.height - height) / 2);
	
	// properties array
	var winPropsArray = [
		'width=' + width
		, 'height=' + height
		, 'top=' + top
		, 'left=' + left
	];
	if (options.location !== false) winPropsArray.push('location=yes');
	if (options.scrollbar !== false) winPropsArray.push('scrollbars=yes');
	if (options.resizable !== false) winPropsArray.push('resizable=yes');
	if (options.status !== false) winPropsArray.push('status=yes');
	if (options.toolbar !== false) winPropsArray.push('toolbar=yes');
	if (options.menubar !== false) winPropsArray.push('menubar=yes');
		
	// open and focus new window
	var winOpen = window.open(href, winName, winPropsArray.join(','));
	winOpen.window.focus();
}