window.onload = GetPlaatsenEnStreekIFrame

function OnCheck()
{
	if (document.Zoeken.land.value == "Geen voorkeur") {
		alert("U dient minimaal een land  te kiezen.");
		return false;
	}

	return true;
}

function GetPlaatsenEnStreekIFrame()
{
	GetStreekIFrame();
	GetPlaatsenVoorStreekIframe();
}

function GetPlaatsenIFrame()
{
	GetPlaatsenVoorStreekIframe();
}

function GetStreekIFrame()
{
	GetStreekVoorLandIframe();
}

function GetPlaatsenVoorStreekIframe()
{
  land = document.Zoeken.land.options[document.Zoeken.land.selectedIndex].value;
  streek = document.Zoeken.streek.options[document.Zoeken.streek.selectedIndex].value;
  formname = 'Zoeken';
  
  // -- remove all options except the first (we use this for displaying what we are doing
  document.getElementById('stad').options.length = 1;

  // -- change iframe src
  if (streek != "Kies een provincie" && streek != "Geen voorkeur" && streek != "")
  {
    document.getElementById('stad').options[0].value = '';
    document.getElementById('stad').options[0].text = 'bezig met ophalen...';

    if (document.getElementById('plaatseniframe'))
      document.getElementById('plaatseniframe').src = 'aanbod_getplaatsen.php?streek='+streek+'&land='+land;
    else
        plaatseniframe.location = 'aanbod_getplaatsen.php?streek='+streek+'&land='+land+'&formname='+formname
  }
else if (streek == "Geen voorkeur")
{
    document.getElementById('stad').options[0].value = '';
    document.getElementById('stad').options[0].text = 'bezig met ophalen...';

    if (document.getElementById('plaatseniframe'))
      document.getElementById('plaatseniframe').src = 'aanbod_getplaatsen.php?land='+land;
    else
        plaatseniframe.location = 'aanbod_getplaatsen.php?land='+land+'&formname='+formname
	}
  else
  {
    document.getElementById('stad').options[0].value = '';
    document.getElementById('stad').options[0].text = '- selecteer eerst een land -';
  }
}

function GetStreekVoorLandIframe()
{
  land = document.Zoeken.land.options[document.Zoeken.land.selectedIndex].value;
  formname = 'Zoeken';
  
  // -- remove all options except the first (we use this for displaying what we are doing
  document.getElementById('streek').options.length = 1;

  // -- change iframe src
  if (land != "Kies een land" && land != "Geen voorkeur")
  {
    document.getElementById('streek').options[0].value = '';
    document.getElementById('streek').options[0].text = 'bezig met ophalen...';

    if (document.getElementById('streekiframe'))
      document.getElementById('streekiframe').src = 'aanbod_getstreek.php?land='+land;
    else
        plaatseniframe.location = 'aanbod_getstreek.php?land='+land+'&formname='+formname
  }
  else
  {
    document.getElementById('streek').options[0].value = '';
    document.getElementById('streek').options[0].text = '- selecteer eerst een land -';
  }

}
