function new_window_attributes (attributes) {
	var attributes_str = '';
	var width = 0;
	var height = 0;
	
	// width & height must be defined before left & top (for centering)
	if (attributes['width'] != null) {
		if (attributes['width'] == 'max') {
			width = attributes['width'];
			attributes_str += 'width=' + screen.availWidth + ',';
		} else {
			attributes_str += 'width=' + attributes['width'] + ',';
			width = attributes['width'];
		}
	}
	if (attributes['height'] != null) {
		if (attributes['height'] == 'max') {
			height = attributes['height'];
			attributes_str += 'height=' + screen.availHeight + ',';
		} else {
			height = attributes['height'];
			attributes_str += 'height=' + attributes['height'] + ',';
		}
	}
	
	if (attributes['channelmode'] != null) {
		attributes_str += 'channelmode=' + attributes['channelmode'] + ',';
	}
	if (attributes['directories'] != null) {
		attributes_str += 'directories=' + attributes['directories'] + ',';
	}
	if (attributes['fullscreen'] != null) {
		attributes_str += 'fullscreen=' + attributes['fullscreen'] + ',';
	}
	if (attributes['left'] != null) {
		if (attributes['left'] == 'center') {
			attributes_str += 'left=' + Math.abs ((screen.availWidth - width) / 2) + ',';
		} else {
			attributes_str += 'left=' + attributes['left'] + ',';
		}
	}
	if (attributes['location'] != null) {
		attributes_str += 'location=' + attributes['location'] + ',';
	}
	if (attributes['menubar'] != null) {
		attributes_str += 'menubar=' + attributes['menubar'] + ',';
	}
	if (attributes['resizable'] != null) {
		attributes_str += 'resizable=' + attributes['resizable'] + ',';
	}
	if (attributes['scrollbars'] != null) {
		attributes_str += 'scrollbars=' + attributes['scrollbars'] + ',';
	}
	if (attributes['status'] != null) {
		attributes_str += 'status=' + attributes['status'] + ',';
	}
	if (attributes['titlebar'] != null) {
		attributes_str += 'titlebar=' + attributes['titlebar'] + ',';
	}
	if (attributes['toolbar'] != null) {
		attributes_str += 'toolbar=' + attributes['toolbar'] + ',';
	}
	if (attributes['top'] != null) {
		if (attributes['top'] == 'center') {
			attributes_str += 'top=' + ((screen.availHeight - height) / 2) + ',';
		} else {
			attributes_str += 'top=' + attributes['top'] + ',';
		}
	}
	
	// remove last comma
	attributes_str = attributes_str.substr (0, attributes_str.length - 1);
	
	if (attributes['debug'] == true) {
		alert (attributes_str);
	}
	
	return attributes_str;
}