<script language="JavaScript" type="text/javascript">
<!--

function attachment_check(n)
{   
    if (n.attachmentAction.value) {
        if (n.attachmentAction.value == 'add') {
<?php if (! $browser->hasQuirk('empty_file_input_value')): ?>
            if (n.<?php echo IMP_COMPOSE_UPLOAD ?>.value == '') {
                alert('<?php echo addslashes(_("You must first specify the file to attach.")) ?>');
                n.<?php echo IMP_COMPOSE_UPLOAD ?>.focus ();
                return false;
            } else {
                return true;
            }
<?php else: ?>
       return true;
<?php endif; ?>
        } else if (n.attachmentAction.value == 'update') {
            return true;
        }
    }
}

function attach(actionid, action)
{
    document.compose.actionID.value = actionid;
    document.compose.attachmentAction.value = action;
    if (attachment_check(document.compose)) {
        uniqSubmit();
    }
}

if (document.compose.to && document.compose.to.value == "") {
    document.compose.to.focus();
} else if (document.compose.subject.value == "") {
    document.compose.subject.focus();
} else {
<?php if ($useRichtext): ?>
    document.compose.editor.focus();
<?php else: ?>
    document.compose.message.focus();
<?php endif; ?>
}

// -->
</script>
