function popup(url, options) {
	// options: name, width, height, left, top, features
	var options = Object.extend({
		width: 400, height: 400,
		left: null, top: null,
		text: '',
		name: '', features: ''
	}, options); 
	
	if (options['width'] > (screen.width - 100)) {
		options['width'] = screen.width - 100;
	}
	if (options['height'] > (screen.height - 100)) {
		options['height'] = screen.height - 100;
	}
	if (null === options['left']) {
		options['left'] = parseInt((screen.width - options['width']) / 2);
	}
	if (null === options['top']) {
		options['top'] = parseInt((screen.height - options['height']) / 2) - 100;
	}
	  
	options['features'] += options['features'].length ? ',' : '';
	options['features'] += 'width=' + options['width'] + ',height=' + options['height'] + 
							',left=' + options['left'] + ',top=' + options['top'];
	
	_popup = window.open(url, options['name'], options['features']);
	_popup.focus();

	return false;
}
