// this page contains the javascript functions to validate the form values inside adressen form
 

function IsPostcode(pc)
			{
				//return pc.match(/[0-9]{4} {0,1}[a-z]{2}/i);
        //check of postcode uit 4 cijfers bestaat
        return pc.match(/[0-9]{4}/i);
			}

function checkVestigingAdresForm(poForm)
{
	var strError = "Het volgende veld is niet korrekt ingevuld.\n\n";
	var error = "0";
  // clear all previous errormsg
	document.getElementById('postcodediv').style.display = "none";
	document.getElementById('plaatsdiv').style.display = "none";
  // check if radiobutton Postcode is selected
  if (poForm.input[0].checked)
  {

    if (!IsPostcode(poForm.pc.value))
    //if (poForm.pc.value== "")
    {
      // show error field
			document.getElementById('postcodediv').style.display = "block";
      // highlight field which contains error
			document.getElementById('pc').className='regular fielderror';
			error="1";
    }
  }
  // check if radiobutton plaatsnaam is selected
  if (poForm.input[1].checked)
  {
   if (poForm.pn.value== "")
    {
      // show error field
			document.getElementById('plaatsdiv').style.display = "block";
      // highlight field which contains error
			document.getElementById('pn').className='regular fielderror';
			error="1";
    }
  }
	if (error=="1")
		return false;
	else
    poForm.blnProcess.value = "1";
    poForm.blnPlaats.value = "0";
    poForm.submit();
    return true;
}

function submitSelectedPlaats(poForm)
{
    poForm.blnPlaats.value = "1";
    poForm.submit();
    return true;
}

function submitSelectedSpecialty(poForm, pmSpecialty)
{
    poForm.sSpecialty.value = pmSpecialty ;
    poForm.submit();
    return true;
}
