function createXMLHttpRequest () {
    var XMLHttpObject = null;
    try {
        XMLHttpObject = new XMLHttpRequest ();
    } catch (e) {
        try {
            XMLHttpObject = new ActiveXObject ("Msxm12.XMLHTTP");
        } catch (e) {
            try {
                XMLHttpObject = new ActiveXObject ("Microsoft.XMLHTTP");
            } catch (e) {
                return null;
            }
        }
    }
    return XMLHttpObject;
}
function getUrl () {
    return '/DriveCompassPremiumForm2?'
        + '&fm01=' + document.getElementById ('fm01').value
        + '&fm011=' + document.getElementById ('fm011').value
        + '&fm02=' + document.getElementById ('fm02').value
        + '&fm021=' + document.getElementById ('fm021').value
        + '&fm03=' + document.getElementById ('fm03').value
        + '&fm04=' + document.getElementById ('fm04').value
        + '&fm07=' + document.getElementById ('fm07').value
        + '&fm07=' + document.getElementById ('fm071').value
        + '&fm15=' + document.getElementById ('fm15').value;
}
function checkValidation () {
    var url = getUrl() + '&fm00=';
    var xmlhttp = createXMLHttpRequest ();
    if (xmlhttp) {
        xmlhttp.open ("get", encodeURI(url), true); 
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                result = xmlhttp.responseText;
                if (result.length == 0) {
                    if (confirm(' \n \nお問い合わせ内容を確認しました。\nこの内容でお問い合わせを受け付けてもよろしいですか？\n \n')) {
                        registration ();
                    }
                } else {
                    alert(result);
                }
            }
        }
        xmlhttp.send (null);
    }
}
function registration () {
    var url = getUrl() + '&fm00=regist';
    var xmlhttp = createXMLHttpRequest ();
    if (xmlhttp) {
        xmlhttp.open ("get", encodeURI(url), true); 
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                xmlhttp.responseText;
                document.location = "dcpr_form_om_ok.html";
            }
        }
        xmlhttp.send (null);
    }
}

