theCompatPopupWidth = max(
	zstring_width(zstring: '$$$IDS_ACRO3_SECURITY_COMPAT'),
	zstring_width(zstring: '$$$IDS_ACRO5_SECURITY_COMPAT'),
	zstring_width(zstring: '$$$IDS_ACRO6_SECURITY_COMPAT'),
	zstring_width(zstring: '$$$IDS_ACRO7_SECURITY_COMPAT')) + gGap;

theBitsTextWidth = max(
	zstring_width(zstring: '$$$IDS_SECURITY_40BIT_RC4'),
	zstring_width(zstring: '$$$IDS_SECURITY_128BIT_RC4'),
	zstring_width(zstring: '$$$IDS_SECURITY_128BIT_AES'));

thePromptTextWidth = max(
	zstring_width(zstring: '$$$/Dialogs/STD_Permissions/PermPassword'),
	zstring_width(zstring: '$$$/Dialogs/STD_Permissions/Printing'),
	zstring_width(zstring: '$$$/Dialogs/STD_Permissions/Changes'));

thePermsPopupsWidth = max(
	zstring_width(zstring: '$$$IDS_USER_PERMS_VARIES'),
	zstring_width(zstring: '$$$IDS_USER_PERMS_CHANGE_NONE'),
	zstring_width(zstring: '$$$IDS_USER_PERMS_CHANGE_DOC_ASSEMBLY'),
	zstring_width(zstring: '$$$IDS_USER_PERMS_CHANGE_FORM_FILL'),
	zstring_width(zstring: '$$$IDS_USER_PERMS_CHANGE_ANNOT_FILL'),
	zstring_width(zstring: '$$$IDS_USER_PERMS_CHANGE_ALL'),
	zstring_width(zstring: '$$$IDS_USER_PERMS_PRINT_NONE'),
	zstring_width(zstring: '$$$IDS_USER_PERMS_PRINT_BASIC'),
	zstring_width(zstring: '$$$IDS_USER_PERMS_PRINT_PS')) + gGap;

gMaxPasswordCheckWidth = max( 
	zstring_width(zstring: '$$$IDS_SP_STD_OPEN_CHECK'),
	zstring_width(zstring: '$$$IDS_SP_STD_ATTACH_CHECK') )+ 2*max_char_width();
	
gMaxPasswordLabelWidth = max(
	zstring_width(zstring: '$$$IDS_SP_STD_OPEN_LABEL'),
	zstring_width(zstring: '$$$IDS_SP_STD_OPEN_LABEL') )+ 2*max_char_width();

thePasswordWidth = 10 * max_char_width();

gEncryptionTextHeight = gStaticTextHeight * 2;

gEncryptionTextWidth = max(
	zstring_width(zstring: '$$$/Dialogs/Encryption/WholeDocument'),
	zstring_width(zstring: '$$$/Dialogs/Encryption/NotMetadata'),
	zstring_width(zstring: '$$$/Dialogs/Encryption/JustAttachments') );

gGapHeight = 2;

dialog(margin_height: 0, margin_width: 0)
{
    view(alignment: align_fill, align_children: align_left)
    {
		gap(height: gGap);
		
		view(align_children: align_row, alignment: align_fill) 
		{
			static_text(name: '$$$/Dialogs/STD_Permissions/Compatibility');
			popup(item_id: 'cmpt', width: theCompatPopupWidth);
		}
		
		view(align_children: align_row, alignment: align_row) 
		{
			static_text(name: '$$$/Dialogs/STD_Permissions/BitsLabel', alignment: align_fill);
			static_text(item_id: 'bits', width: theBitsTextWidth);
		}
	
		cluster(name: '$$$/Dialogs/Encryption/ClusterLabel', align_children: align_row)
		{
			group()
			{
				radio( item_id: 'eDoc', group_id: 'encp', name: '$$$/Dialogs/Encryption/WholeDocument');
				radio( item_id: 'eMet', group_id: 'encp', name: '$$$/Dialogs/Encryption/NotMetadata');
				radio( item_id: 'eAtt', group_id: 'encp', name: '$$$/Dialogs/Encryption/JustAttachments');

				view(align_children: align_top)
				{
					picture(item_id: 'eIcn', width: 16, height: 16);
					static_text(item_id: 'eTxt', height: gEncryptionTextHeight, width: gEncryptionTextWidth);
				}
				
				gap(height: gGapHeight * 2);
				
				view(align_children: align_row)
				{
					check_box(item_id: 'oyes', width: gMaxPasswordCheckWidth);
				}
			
				view(align_children: align_row)
				{
					gap();
					static_text(item_id: 'plb1', width: gMaxPasswordLabelWidth );
					edit_text(item_id: 'UsPs', width: thePasswordWidth, password: true);
				}
					
				view(align_children: align_top)
				{
					gap();
					picture(item_id: 'icon', width: 16, height: 16);
					static_text(item_id: 'UsPt', height: gEncryptionTextHeight, width: gEncryptionTextWidth);
				}
			}
		}
		
		cluster(name: '$$$/Dialogs/STD_Permissions/Permissions', alignment: align_fill)
		{
			check_box(item_id: 'perm', name: '$$$/Dialogs/STD_Permissions/PermissionsCheckbox');
			
			view(align_children: align_row, alignment: align_fill)
			{
				view(align_children: align_right, width: thePromptTextWidth)
				{
					static_text(name: '$$$/Dialogs/STD_Permissions/PermPassword');
				}
				
				edit_text(item_id: 'OPwd', password: true, width: thePasswordWidth);
			}
			
			view(align_children: align_row, alignment: align_fill)
			{
				view(align_children: align_right, width: thePromptTextWidth)
				{
					static_text(name: '$$$/Dialogs/STD_Permissions/Printing');
				}
				
				popup(item_id: 'Prnt', width: thePermsPopupsWidth);
			}
			
			view(align_children: align_row, alignment: align_fill)
			{
				view(align_children: align_right, width: thePromptTextWidth)
				{
					static_text(name: '$$$/Dialogs/STD_Permissions/Changes');
				}
				
				popup(item_id: 'Chng',width: thePermsPopupsWidth);
			}
			
			view(align_children: align_row, alignment: align_fill)
			{
				gap(width: gGap);
				
				view(align_children: align_left, alignment: align_fill)
				{
					check_box(item_id: 'copy', name: '$$$/Dialogs/STD_Permissions/EnableCopy', alignment: align_fill);
					check_box(item_id: 'acss', name: '$$$/Dialogs/STD_Permissions/EnableAccess', alignment: align_fill);
				}
			}
		}
                gap();
	}
}
