
function checkZip(zip1, zip2) {
    var result1 = zip1.match(/^\d\d\d$/);
    var result2 = zip2.match(/^\d\d\d\d$/);
    if(!result1) return false;
    if(!result2) return false;
    return (result1[0] == zip1 && result2[0] == zip2);
}

function checkUrl(url) {
    return (url.match(/(http|ftp):\/\/[!#-9A-~]+\.+[a-z0-9]/i));
}

function chekcMailAddress(mailaddress) {
    var result = mailaddress.match(/^\S+@\S+\.\S+$/);
    if(!result) return false;
    return (result[0] == mailaddress);
}

function checkTelephone(tel1, tel2, tel3) {
    var result1 = tel1.match(/^\d{2,4}$/);
    var result2 = tel2.match(/^\d{1,4}$/);    
    var result3 = tel3.match(/^\d{4}$/);
    if(!result1) return false;
    if(!result2) return false;
    if(!result3) return false;
    return (result1[0] == tel1 && result2[0] == tel2 && result3[0] == tel3);
}

function checkDate(year, month, day) {
    var date = new Date(year, month - 1 ,day);
    if(date.getFullYear() == year && 
        (date.getMonth() == month - 1) && 
        date.getDate() == day) {
            return true;
    }

}

function checkNumeric(numeric) {
    return !isNaN(numeric);
}
