function ValidateReacties(fm)
{
  var err='';
  if (fm.naam.value == '') { err += 'U dient uw naam nog in te vullen\n'; }
  if (fm.email.value == '') { err += 'U dient uw e-mail adres nog in te vullen\n'; }
  if (fm.adres.value == '') { err += 'U dient uw adres nog in te vullen\n'; }
  if (fm.postcode.value == '') { err += 'U dient uw postcode nog in te vullen\n'; }
  if (fm.plaats.value == '') { err += 'U dient uw plaats nog in te vullen\n'; }
  if (err != '')
  {
    alert (err);
    return false;
  }
  if (confirm('Heeft u alles correct ingevuld, klik dan ja'))
    return true;
  else
    return false;
}

function doCapitalize(obj) {
        val = obj.value;
        newVal = '';
        val = val.split(' ');
        for(var c=0; c < val.length; c++) {
                newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length).toLowerCase() + ' ';
        }
        obj.value = newVal;
}

function doLowerCase(obj) {
  obj.value = obj.value.toLowerCase();
}

function doUpperCase(obj) {
  obj.value = obj.value.toUpperCase();
}

function PostcodeCheck(pIn)
{
var regex = /^[1-9][0-9]{3}[A-Za-z]{2}$/;
return(regex.test(pIn));

}

function PostcodeCheckBE(pIn)
{
var regex = /^[0-9]{4}$/;
return(regex.test(pIn));

}

function PostcodeCheckDE(pIn)
{
var regex = /^[0-9]{5}$/;
return(regex.test(pIn));

}


function ValidateBrochure(fm)
{
  //alert('test');

  var err='';
  if (fm.achternaam.value == '') { err += 'U dient uw achternaam nog in te vullen\n'; }
  if (fm.voorletters.value == '') { err += 'U dient uw voorletters nog in te vullen\n'; }
  if (fm.straatnaam.value == '') { err += 'U dient uw straatnaam nog in te vullen\n'; }
  if (fm.huisnummer.value == '') { err += 'U dient uw huisnummer nog in te vullen\n'; }
  if (fm.postcode.value == '') { err += 'U dient uw postcode nog in te vullen\n'; }

  switch(fm.land.value){
    case "Netherlands (EU)":
    if (!PostcodeCheck(fm.postcode.value)) { err += 'Uw nederlandse postcode is ongeldig\n'; }
    break;
  case "Germany (EU)":
    if (!PostcodeCheckDE(fm.postcode.value)) { err += 'Uw duitse postcode is ongeldig\n'; }
    break;
  case "Belgium (EU)":
    if (!PostcodeCheckBE(fm.postcode.value)) { err += 'Uw belgische postcode is ongeldig\n'; }
    break;
  }

  if (fm.plaats.value == '') { err += 'U dient uw plaatsnaam nog in te vullen\n'; }
  if (fm.email.value == '') { err += 'U dient uw e-mail adres nog in te vullen\n'; }
  if ((fm.bron.value=='0') && (fm.medium.value=='geen')) { err += 'U dient nog aan te geven via welke bron u van ons gehoord hebt\n'; }
  if (fm.bron.value =='1') {
   if (fm.medium.value=='geen') { err += 'U dient nog aan te geven via welke bron u van ons gehoord hebt\n'; }
  }

  if (err != '')
  {
    alert (err);
    return false;
  }

  if (confirm('Heeft u alles correct ingevuld, klik dan ja.'))
    return true;
  else
    return false;
}

function ShowHideSoorten(obj){
  // if (selectbox.value=="1")
  // {
    // media.style.position = "static";
    // media.style.visibility = "visible";
  // }
  // else
  // {
    // media.style.visibility = "hidden";
  // }
  if ($(obj).val() == 1 || $(obj).val() == "Advertentie") {
	$("#media").show();
  } else {
	$("#media").hide();
  }
}

function PopupPic(sPicURL) {
  window.open("/showphoto.asp?"+sPicURL, "","resizable=1,HEIGHT=400,WIDTH=400");
}

function PopupMusic() {
  window.open("/player/ross_player.asp", "popup_music","resizable=1,HEIGHT=40,WIDTH=420");
}
