function lockFields(thisField) {

    for(x=0; x<document.thisForm.elements.length; x++) {
        if(document.thisForm.elements[x].name!=thisField.name && document.thisForm.elements[x].name!='submit') {

            if(thisField.value.length>0) {
                document.thisForm.elements[x].value="";
                document.thisForm.elements[x].disabled=true;
            } else {
                document.thisForm.elements[x].disabled=false;
            }

        }
    }

}

function checkToLockField(thisField) {

    if(thisField.name=='email' && thisField.value.length > 0) {
        document.thisForm.people_id.disabled=true;
        return true;
    } else if(thisField.name=='email' && thisField.value.length == 0) {
        document.thisForm.people_id.disabled=false;
        return true;
    }
    if(thisField.name=='people_id' && thisField.value.length > 0) {
        document.thisForm.email.disabled=true;
        return true;
    } else if(thisField.name=='people_id' && thisField.value.length == 0) {
        document.thisForm.email.disabled=false;
        return true;
    }

}

function verifyForm() {

    if(typeof(document.thisForm.email_id)!='undefined') {

        if(document.thisForm.email_id.value.length < 1) {
            alert("Please Provide Either Your ID or Email Address");
            return false;
        }

    } else {

        if(document.thisForm.people_id.value.length < 1 && document.thisForm.email.value.length < 1) {
            alert("Please Provide Either Your ID or Email Address");
            return false;
        }
        if(document.thisForm.email.value.length > 0) {
            if(document.thisForm.email.value.indexOf(' ') > 0) {
                alert("Spaces are not allowed in Email Addresses");
                return false;
            } else if (document.thisForm.email.value.indexOf('@') == -1) {
                alert ("You need to put a @ in your email address.  Your email address should look like yourname@domain.com");
                return false;
            }
            else if (document.thisForm.email.value.indexOf('.') == -1) {
                alert ("You need to place a period in your email address.  Your email address should look like yourname@domain.com");
                return false;
            }
        }
        if(document.thisForm.people_id.value.length > 0) {
            if (isNaN(document.thisForm.people_id.value)) {
                document.thisForm.people_id.value=document.thisForm.people_id.value.substr(document.thisForm.people_id.value.indexOf('-')+1);
            }
        }
   }

    if(typeof(document.thisForm.password)!='undefined') {
        if(document.thisForm.password.value.length < 6) {
            alert("Please Enter Your Password (minimum 6 characters)");
            return false;
        }
    }
    
    return true;
}
