  function displayLayer(displayValue, hideValue){
        document.getElementById(displayValue).style.display = "";
        document.getElementById(hideValue).style.display = "none";
        document.getElementById('default_checkboxes').style.display = "none";

  }

function chooseCountry(selectedCountry){
      if ( selectedCountry == "United States" ){
              document.getElementById("statelayer").style.display = "";
      }else{
              document.getElementById("statelayer").style.display = "none";
      }
}

function checkFieldsStep1() {
         missinginfo = "";
         if (document.form.sex.value == "") {
         missinginfo += "\n     -  you must specify a gender.";
         }
         if (document.form.displayname.value == "") {
         missinginfo += "\n     -  you must choose a display name containing only letters and/or numbers.";
         }
         if (document.form.password.value == "") {
         missinginfo += "\n     -  you must choose a password containing only letters and/or numbers.";
         }
         if (document.form.password2.value == "") {
         missinginfo += "\n     -  you must confirm your password by typing it a second time.";
         }
         if ((document.form.email.value == "") ||
         (document.form.email.value.indexOf('@') == -1) ||
         (document.form.email.value.indexOf('.') == -1)) {
         missinginfo += "\n     -  you must enter a VALID email address.";
         }
         if (document.form.country.value == "") {
         missinginfo += "\n     -  you must specify a country.";
         }
         if (document.form.religion.value == "") {
         missinginfo += "\n     -  you must specify observance level.";
         }
         if (document.form.eda.value == "") {
         missinginfo += "\n     -  you must specify eda (ethnicity).";
         }

         if (missinginfo != "") {
                missinginfo ="Your form was invalid because:\n" +
                missinginfo;
                alert(missinginfo);
                return false;
         }else{
                  return true;
         }
}


function checkFieldsStep2() {
         missinginfo = "";
         if (document.form.day.value == "") {
             missinginfo += "\n     -  You must enter your day of birth.";
         }
         if (document.form.month.value == "") {
             missinginfo += "\n     -  You must enter your month of birth.";
         }
         if (document.form.year.value == "") {
             missinginfo += "\n     -  You must enter your year of birth.";
         }
         if (document.form.status.value == "") {
             missinginfo += "\n     -  you must specify marital status.";
         }
         if (document.form.children.value == "") {
             missinginfo += "\n     -  you must specify with/without children.";
         }
         if (document.form.relocate.value == "") {
             missinginfo += "\n     -  you must specify willingness to relocate";
         }
         if (document.form.aliya.value == "") {
             missinginfo += "\n     -  you must specify interest in aliya.";
         }
         if (document.form.bt.value == "") {
             missinginfo += "\n     -  you must specify religious background.";
         }
         if (document.form.torah.value == "") {
             missinginfo += "\n     -  you must specify frequency of Torah learning.";
         }
         if (document.form.tefilah.value == "") {
             missinginfo += "\n     -  you must specify frequency of tefilah (prayer).";
         }
         if (document.form.jewed.value == "") {
             missinginfo += "\n     -  you must specify Jewish education level.";
         }
         if (document.form.seced.value == "") {
             missinginfo += "\n     -  you must specify secular education level.";
         }
         if (document.form.politics.value == "") {
             missinginfo += "\n     -  you must specify political views.";
         }
         if (document.form.height.value == "") {
             missinginfo += "\n     -  you must specify height.";
         }
         if (document.form.build.value == "") {
             missinginfo += "\n     -  you must specify physical build.";
         }
         if (document.form.smoke.value == "") {
             missinginfo += "\n     -  you must specify smoker/non-smoker.";
         }
         if (document.form.how_heard.value == "") {
             missinginfo += "\n     -  you must specify how you heard about Frumster";
         }
         if (document.form.comments.value == "") {
             missinginfo += "\n     -  Personal description is missing.";
         }


         if (document.form.tribe.value == "") {
             missinginfo += "\n     -  you must specify tribal affiliation.";
         }
         if (document.form.tzitzit.value == "") {
             missinginfo += "\n     -  you must specify wearing of tzitzit.";
         }
         if (document.form.kippa.value == "") {
             missinginfo += "\n     -  you must specify type of head covering.";
         }
         if (document.form.city.value == "") {
             missinginfo += "\n     -  you must specify a city/region.";
         }
         if (missinginfo != "") {
                missinginfo ="Your form was invalid because:\n" +
                missinginfo;
                alert(missinginfo);
                return false;
         }else{
                return true;
         }
}


function changeCheckbox(o_checkbox){
	var doCheck=false;
	if (o_checkbox.checked){
		doCheck=true;
	}else{
		doCheck=false;	
	}
	if (o_checkbox.name=='jew'){
		document.getElementById('observe_jew').value='';
		document.getElementById('traditional_jew').value='';
		document.getElementById('observe_jew').checked=false;
		document.getElementById('traditional_jew').checked=false;
	}
	if (o_checkbox.name=='terms'){
		document.getElementById('observe_terms').value='';
		document.getElementById('traditional_terms').value='';
		document.getElementById('observe_terms').checked=false;
		document.getElementById('traditional_terms').checked=false;
	}

	if (doCheck){
		o_checkbox.value='1';
		o_checkbox.checked=true;	
	}else{
		o_checkbox.value='';
		o_checkbox.checked=false;
	}

}