function validateTitle() {
	return validateFormField(trim(document.registrationForm.titleId.options[document.registrationForm.titleId.selectedIndex].value), 1, document.getElementById('titleError'));
}

function validateFirstname () {
	return validateFormField(trim(document.registrationForm.firstName.value), 1, document.getElementById('firstnameError'));
}

function validateCountry () {
	return validateFormField(trim(document.registrationForm.countryId.options[document.registrationForm.countryId.selectedIndex].value), 1, document.getElementById('countryError'));
}

function validateProfession () {
	return validateFormField(trim(document.registrationForm.profession.options[document.registrationForm.profession.selectedIndex].value), 1, document.getElementById('primaryProfessionError'));
}

function getLastnameErrorDiv() {
	return document.getElementById("lastnameError");
}


function getStreetAddress1ErrorDiv() {
    return document.getElementById("streetAddress1Error");
}

function getCityErrorDiv() {
    return document.getElementById("cityError");
}

function getZipCodeErrorDiv() {
    return document.getElementById("zipCodeError");
}

function displayFields() {
    var temp = document.getElementById("profession");
    var selectedOption = temp.value;
    hideAllDiv();
    resetFields();
    
    if (selectedOption == "1120") {
        showStudentsFields();
    } else if(selectedOption == "1119") {
        showResidentFields();
    }else if (selectedOption == "1117"){
        showPhysicianFields();
    }

}

function displayFieldsOnProfile() {
    var temp = document.getElementById("profession");
    var selectedOption = temp.value;

    if (selectedOption == "1120") {
        showStudentsFields();
    } else if(selectedOption == "1119") {
        showResidentFields();
    }else if (selectedOption == "1117"){
        showPhysicianFields();
    }

}

function showStudentsFields() {
    document.getElementById("specialty-div").style.display = "block";
    document.getElementById("yearOfGraduation-div").style.display = "block";
    document.getElementById("yearOfStudy-div").style.display = "block";
}

function showResidentFields() {
	document.getElementById("specialty-div").style.display = "block";
	document.getElementById("yearOfResidency-div").style.display = "block";
	document.getElementById("yearOfCompletion-div").style.display = "block";
}

function showPhysicianFields() {
     document.getElementById("highestDegreeReceived-div").style.display = "block";
     document.getElementById("workplace-div").style.display = "block";
     document.getElementById("specialty-div").style.display = "block";
}

function hideAllDiv() {
    document.getElementById("highestDegreeReceived-div").style.display = "none";
    document.getElementById("workplace-div").style.display = "none";
    document.getElementById("specialty-div").style.display = "none";
    document.getElementById("yearOfGraduation-div").style.display = "none";
    document.getElementById("yearOfStudy-div").style.display = "none";
    document.getElementById("yearOfResidency-div").style.display = "none";
    document.getElementById("yearOfCompletion-div").style.display = "none";
}

function resetFields() {
        document.getElementById("yearOfStudy").value = "";
        document.getElementById("yearOfGraduation").value = "";
        document.getElementById("yearOfResidency").value = "";
        document.getElementById("yearOfCompletion").value = "";
        document.getElementById("highestDegreeReceived").value = "";
        document.getElementById("workplace").value = " ";
}