public static function download($output, $content_type='text/plain', $filename=null) {
	$filename_postfix = ($filename) ? '; filename="'.$filename.'"' : '';
	
	// force download
	header('Content-Type: '.$content_type.'; charset=utf-8');
	header('Content-Disposition: attachment'.$filename_postfix);
	
	// write to browser
	echo $output;
}