<script>
var tooManyTries = false;

function SubmitPreStepFour()
{
    var code = document.forms['phone'].phonecode.value;
    var url = 'index.php';
    var pars = 'fuse=admin&action=Signup_VerifyPhoneCode&phonecode=' + code;
    var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars, onComplete: showResponse});
}

function BackPreStepFour()
{
    document.forms['phone'].step.value=2;
    document.forms['phone'].submit();
}

function showResponse(originalRequest)
{
    if (originalRequest.responseText == '1') {
        document.forms['phone'].submit();
    } else if (originalRequest.responseText == '-1') {
        if (!tooManyTries) {
            alert('Too many tries');
            tooManyTries = true;
        }
    } else {
        alert('Invalid Code');
    }
}
</script>

<form name='phone' action='signup.php?' method=post>
<table cellpadding=3 cellspacing=0 border=0 align=center width=450>
<!-- BEGIN DYNAMIC BLOCK: first_verification -->
    <tr>
        <td colspan="2">{verifBox1} {phoneNum} {verifBox2}</td>
    </tr>
    <tr>
        <td colspan="2" height="23" class=leftrightpadding><br>{verifBox3}</td>
    </tr>
<!-- END DYNAMIC BLOCK: first_verification -->

<!-- BEGIN DYNAMIC BLOCK: already_called -->
    <tr>
        <td colspan="2">{verifPostCall}</td>
    </tr>
<!-- END DYNAMIC BLOCK: already_called -->
<tr>
    <td colspan="2" height="23" align=center class=step3tdbg>
            {HIDDEN_INPUTS}
            <br /><br />
    </td>
<tr>
    <td colspan="2" height="23" class=leftrightpadding>{phoneCode}
        <input maxlength='10' name='phonecode' size='10' onkeypress='return noenter(event)' type='text'>
    </td>
</tr>
</table>
</form>
