function dateValue(date, month, year) {
    return (new Date(year, month - 1, date)).valueOf();
}

function dateValueError(date, month, year, mandatory) {
    if (! mandatory) {
        if (dateValueNull(date, month, year)) {
            return false;
        }
    }
    return (! dateValueValid(date, month, year));
}

function dateValueNull(date, month, year) {
    if (date == -1 && month == -1 && year == -1) {
        return true;
    }
    return false;
}

function dateValueValid(date, month, year) {
    if (date == -1 || month == -1 || year == -1) {
        return false;
    }
    if ((new Date(year, month - 1, date)).getMonth() != month - 1) {
        return false;
    }
    return true;
}

function selectValue(select) {
    return select[select.selectedIndex].value;
}

function textValueEmpty(textValue) {
    for (var i = 0; i < textValue.length; i ++) {
        if (textValue.charAt(i) != " ") {
            return false;
        }
    }
    return true;
}