function checkSecurityCode() {
    var myfunc = function() {
        generalAjaxHandler("seccode","Invalid security code",null, submitForm);
    }
    req = CreateXmlHttpReq(myfunc);
    req.open("GET", "scode.php?seccode="+document.f.seccode.value+"&rand="+escape(Math.random()));
    req.send(null);
}
function securityCodeCheckHandler() {
    if (req.readyState == 4 && req.status == 200) {
        var res = req.responseText;
        if (res.indexOf("OK") != -1) {
            document.f.submit();
        } else {
            alert("Invalid security code");
            warnField("seccode");
        }
    }
}
function generalAjaxHandler(field,message,onErrorFunction,onSuccessFunction) {
    if (req.readyState == 4 && req.status == 200) {
        var res = req.responseText;
        if (res.indexOf("OK") != -1) {
            onSuccessFunction();
        } else {
            if (onErrorFunction == null) {
                alert(message);
                warnField(field);
            } else {
                onErrorFunction();
            }
        }
    }
}
function generalAjaxHandler(field,message,onErrorFunction,onSuccessFunction) {
    if (req.readyState == 4 && req.status == 200) {
        var res = req.responseText;
        if (res.indexOf("OK") != -1) {
            onSuccessFunction();
        } else {
            if (onErrorFunction == null) {
                alert(message);
                warnField(field);
            } else {
                onErrorFunction();
            }
        }
    }
}
function submitForm() {
    document.f.submit();
}


