﻿$(document).ready(function () {
  $('#medlemstype').change(function () {
    alert("Test!");
    $.ajax({
      async: false,
      url: jQuery.query.set("medlemstype", $('#brugerid').val())
    });
  });
  $('#FOD').change(function () {
    $.ajax({
      async: false,
      url: jQuery.query.set("FOD", $('#FOD').val())
    });
  });
  $('#ROD').change(function () {
    $.ajax({
      async: false,
      url: jQuery.query.set("ROD", $('#ROD').val())
    });
  });
  $('.filter').keypress(function (e) {
    var key = e.which ? e.which : e.keyCode;
    if (e.which == 13) {
      var qstring = window.location;
      if ($(this).attr("id") == "navn") {
        if ($('#navn').val()) {
          qstring = $.query.set("navn", escape($('#navn').val()));
        } else {
          qstring = $.query.remove("navn");
        }
        window.location = "http://fms-net.dk/".concat(qstring);
      }
      if ($(this).attr("id") == "adresse") {
        if ($('#adresse').val()) {
          qstring = $.query.set("adresse", escape($('#adresse').val()));
        } else {
          qstring = $.query.remove("adresse");
        }
        window.location = "http://fms-net.dk/".concat(qstring);
      }
      if ($(this).attr("id") == "postnummer") {
        if ($('#postnummer').val()) {
          qstring = $.query.set("postnummer", escape($('#postnummer').val()));
        } else {
          qstring = $.query.remove("postnummer");
        }
        window.location = "http://fms-net.dk/".concat(qstring);
      }
      if ($(this).attr("id") == "by") {
        if ($('#by').val()) {
          qstring = $.query.set("by", escape($('#by').val()));
        } else {
          qstring = $.query.remove("by");
        }
        window.location = "http://fms-net.dk/".concat(qstring);
      }
      if ($(this).attr("id") == "sidst_betalt") {
        if ($('#sidst_betalt').val()) {
          qstring = $.query.set("sidst_betalt", escape($('#sidst_betalt').val()));
        } else {
          qstring = $.query.remove("sidst_betalt");
        }
        window.location = "http://fms-net.dk/".concat(qstring);
      }
    }
  });
});

