/* NEWS TICKER */

	  $(document).ready(
		
		function(){
	  
		//cache the ticker
		var ticker = $("#ticker");
		  
		//wrap dt:dd pairs in divs
		ticker.children().filter("dt").each(function() {
		  
		  var dt = $(this),
		    container = $("<div>");
		  
		  dt.next().appendTo(container);
		  dt.prependTo(container);
		  
		  container.appendTo(ticker);
		});
				
		//hide the scrollbar
		ticker.css("overflow", "hidden");
		
		//animator function
		function animator(currentItem) {
		    
		  //work out new anim duration
		  var distance = currentItem.height();
			duration = (distance + parseInt(currentItem.css("marginTop"))) / 0.025;

		  //animate the first child of the ticker
		  currentItem.animate({ marginTop: -distance }, duration, "linear", function() {
		    
			//move current item to the bottom
			currentItem.appendTo(currentItem.parent()).css("marginTop", 0);

			//recurse
			animator(currentItem.parent().children(":first"));
		  }); 
		};
		
		//start the ticker
		animator(ticker.children(":first"));
				
		//set mouseenter
		ticker.mouseenter(function() {
		  
		  //stop current animation
		  ticker.children().stop();
		  
		});
		
		//set mouseleave
		ticker.mouseleave(function() {
		          
          //resume animation
		  animator(ticker.children(":first"));
		  
		});
	  });

/* FADING IMAGE */
$(document).ready(

function () {

  $('ul#sfeer').innerfade({
    speed: 2500,
    timeout: 5000,
    type: 'random',
    containerheight: '150px'
  });
});

/* JAVASCRIPT PRETTYPHOTO */
$(document).ready(function () {
  $("#video a[rel^='prettyPhoto']").prettyPhoto({
    theme: 'light_rounded'
  });
  $("a[rel^='prettyPhoto']").prettyPhoto({
    theme: 'light_rounded'
  });
});


/* HOME SLIDER */

$(document).ready(function () {

  $("ul.gallery li").hover(function () { //On hover...
    var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
    //Set a background image(thumbOver) on the <a> tag - Set position to bottom
    $(this).find("a.thumb").css({
      'background': 'url(' + thumbOver + ') no-repeat center bottom'
    });

    //Animate the image to 0 opacity (fade it out)
    $(this).find("span").stop().fadeTo('normal', 0, function () {
      $(this).hide() //Hide the image after fade
    });
  }, function () { //on hover out...
    //Fade the image to full opacity 
    $(this).find("span").stop().fadeTo('normal', 1).show();
  });

});

/* FRONT PAGE SLIDER */

$(document).ready(function () {

  //Hide (Collapse) the toggle containers on load
  $(".toggle_container").hide();
  $('h2.trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
  //Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
  $("h2.trigger").click(function () {
    if ($(this).next().is(':hidden')) { //If immediate next container is closed...
      $('h2.trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
      $(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
    }
    return false; //Prevent the browser jump to the link anchor
  });

});

/* LOGIN BUTTON */

$(document).ready(function () {

  $(".signin").click(function (e) {
    e.preventDefault();
    $("fieldset#signin_menu").toggle();
    $(".signin").toggleClass("menu-open");
  });

  $("fieldset#signin_menu").mouseup(function () {
    return false
  });
  $(document).mouseup(function (e) {
    if ($(e.target).parent("a.signin").length == 0) {
      $(".signin").removeClass("menu-open");
      $("fieldset#signin_menu").hide();
    }
  });

});

/* Font Cookie */

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function (name, value, options) {
  if (typeof value != 'undefined') { // name and value given, set cookie
    options = options || {};
    if (value === null) {
      value = '';
      options.expires = -1;
    }
    var expires = '';
    if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
      var date;
      if (typeof options.expires == 'number') {
        date = new Date();
        date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
      } else {
        date = options.expires;
      }
      expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
    }
    // CAUTION: Needed to parenthesize options.path and options.domain
    // in the following expressions, otherwise they evaluate to undefined
    // in the packed version for some reason...
    var path = options.path ? '; path=' + (options.path) : '';
    var domain = options.domain ? '; domain=' + (options.domain) : '';
    var secure = options.secure ? '; secure' : '';
    document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
  } else { // only name given, get cookie
    var cookieValue = null;
    if (document.cookie && document.cookie != '') {
      var cookies = document.cookie.split(';');
      for (var i = 0; i < cookies.length; i++) {
        var cookie = jQuery.trim(cookies[i]);
        // Does this cookie string begin with the name we want?
        if (cookie.substring(0, name.length + 1) == (name + '=')) {
          cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
          break;
        }
      }
    }
    return cookieValue;
  }
};

/* FONT SIZE */

var dw_Cookie = {

  set: function (name, value, days, path, domain, secure) {
    var date, expires;
    if (typeof days == "number") {
      date = new Date();
      date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
      expires = date.toGMTString();
    }
    document.cookie = name + "=" + encodeURI(value) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
  },

  get: function (name) {
    var c, cookies = document.cookie.split(/;\s/g);
    for (var i = 0; cookies[i]; i++) {
      c = cookies[i];
      if (c.indexOf(name + '=') === 0) {
        return decodeURI(c.slice(name.length + 1, c.length));
      }
    }
    return null;
  },

  del: function (name, path, domain) {
    if (dw_Cookie.get(name)) {
      document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
  }
}

/* DW Event */

//  dw_event.js version date Oct 2009
//  basic event handling file from dyn-web.com
var dw_Event = {

  add: function (obj, etype, fp, cap) {
    cap = cap || false;
    if (obj.addEventListener) obj.addEventListener(etype, fp, cap);
    else if (obj.attachEvent) obj.attachEvent("on" + etype, fp);
  },

  remove: function (obj, etype, fp, cap) {
    cap = cap || false;
    if (obj.removeEventListener) obj.removeEventListener(etype, fp, cap);
    else if (obj.detachEvent) obj.detachEvent("on" + etype, fp);
  },

  DOMit: function (e) {
    e = e ? e : window.event; // e IS passed when using attachEvent though ...
    if (!e.target) e.target = e.srcElement;
    if (!e.preventDefault) e.preventDefault = function () {
      e.returnValue = false;
      return false;
    }
    if (!e.stopPropagation) e.stopPropagation = function () {
      e.cancelBubble = true;
    }
    return e;
  },

  getTarget: function (e) {
    e = dw_Event.DOMit(e);
    var tgt = e.target;
    if (tgt.nodeType != 1) tgt = tgt.parentNode; // safari...
    return tgt;
  }

}

/* DW Sizerd */

/*************************************************************************
 
 This code is from Dynamic Web Coding at dyn-web.com
 
 Copyright 2004-10 by Sharon Paine 
 
 See Terms of Use at www.dyn-web.com/business/terms.php
 
 regarding conditions under which you may use this code.
 
 This notice must be retained in the code as is!
 
 *************************************************************************/



/*  dw_sizerdx.js version date: April 2010

    requires dw_cookies.js (Nov 2009 version) and dw_event.js 

*/



var dw_fontSizerDX = {

  sizeUnit: "px",

  defaultSize: 12,

  maxSize: 21,

  minSize: 9,

  sizerDivId: 'sizer',
  // div id for sizer controls
  queryName: "dw_fsz",
  // name to check query string for when passing size in URL
  cookieLifetime: 180,
  // how long to keep cookie
  adjustList: [],
  // set method populates
  setDefaults: function (unit, dflt, mn, mx, sels) {

    this.sizeUnit = unit;
    this.defaultSize = dflt;

    this.maxSize = mx;
    this.minSize = mn;

    if (sels) this.set(dflt, mn, mx, sels);

  },



  set: function (dflt, mn, mx, sels) {

    var ln = this.adjustList.length;

    for (var i = 0; sels[i]; i++) {

      this.adjustList[ln + i] = [];

      this.adjustList[ln + i]["sel"] = sels[i];

      this.adjustList[ln + i]["dflt"] = dflt;

      this.adjustList[ln + i]["min"] = mn || this.minSize;

      this.adjustList[ln + i]["max"] = mx || this.maxSize;

      // hold ratio of this selector's default size to this.defaultSize for calcs in adjust fn 
      this.adjustList[ln + i]["ratio"] = this.adjustList[ln + i]["dflt"] / this.defaultSize;

    }

  },



  addHandlers: function () {

    var sizerEl = document.getElementById(dw_fontSizerDX.sizerDivId);

    if (!dw_fontSizerDX.sizeIncrement) {
      dw_fontSizerDX.getSizeIncrement();
    }

    var links = sizerEl.getElementsByTagName('a');

    for (var i = 0; links[i]; i++) {

      if (dw_Util.hasClass(links[i], 'increase')) {

        links[i].onclick = function () {
          dw_fontSizerDX.adjust(dw_fontSizerDX.sizeIncrement);
          return false
        }

      } else if (dw_Util.hasClass(links[i], 'decrease')) {

        links[i].onclick = function () {
          dw_fontSizerDX.adjust(-dw_fontSizerDX.sizeIncrement);
          return false
        }

      } else if (dw_Util.hasClass(links[i], 'reset')) {

        links[i].onclick = function () {
          dw_fontSizerDX.reset();
          return false
        }

      }

    }

    if (sizerEl) sizerEl.style.display = "block";

  },



  getSizeIncrement: function () {

    var val = 2;

    switch (dw_fontSizerDX.sizeUnit) {

    case 'px':
      val = 2;
      break;

    case 'em':
      val = .2;
      break;

    case '%':
      val = 10;
      break;

    }

    dw_fontSizerDX.sizeIncrement = val;

  },



  init: function () {

    if (!document.getElementById || !document.getElementsByTagName || !document.createElement) return;

    var _this = dw_fontSizerDX;
    if (!_this.ready) return;

    if (!_this.doControlsSetup) {

      _this.addHandlers();

    } else {

      _this.setupControls();

    }

    var size;

    // check query string and cookie for fontSize
    // check size (in case default unit changed or size passed in url out of range)
    size = dw_Util.getValueFromQueryString(_this.queryName);

    if (isNaN(parseFloat(size)) || size > _this.maxSize || size < _this.minSize) {

      size = dw_Cookie.get("fontSize");

      if (isNaN(parseFloat(size)) || size > _this.maxSize || size < _this.minSize) {

        size = _this.defaultSize;

      }

    }

    // if neither set nor setDefaults populates adjustList, apply sizes to body and td's
    if (_this.adjustList.length == 0) _this.set(_this.defaultSize, _this.minSize, _this.maxSize, ['body', 'td']);

    _this.curSize = _this.defaultSize; // create curSize property to use in calculations 
    if (size != _this.defaultSize) _this.adjust(size - _this.defaultSize);

  },



  adjust: function (n) {

    if (!this.curSize || !this.ready) return;

    var alist, size, list, i, j;

    // check against max/minSize
    if (n > 0) {

      if (this.curSize + n > this.maxSize) n = this.maxSize - this.curSize;

    } else if (n < 0) {

      if (this.curSize + n < this.minSize) n = this.minSize - this.curSize;

    }

    if (n == 0) return;

    this.curSize += n;

    // loop through adjustList, calculating size, checking max/min
    alist = this.adjustList;

    for (i = 0; alist[i]; i++) {

      size = this.curSize * alist[i]['ratio']; // maintain proportion 
      size = Math.max(alist[i]['min'], size);
      size = Math.min(alist[i]['max'], size);

      list = dw_Util.getElementsBySelector(alist[i]['sel']);

      for (j = 0; list[j]; j++) {
        list[j].style.fontSize = size + this.sizeUnit;
      }

    }

    dw_Cookie.set("fontSize", this.curSize, this.cookieLifetime, "/");

  },



  reset: function () {

    if (!this.curSize || !this.ready) return;

    var alist = this.adjustList,
        list, i, j;

    for (i = 0; alist[i]; i++) {

      list = dw_Util.getElementsBySelector(alist[i]['sel']);

      for (j = 0; list[j]; j++) {

        // Reset adjustList elements to their default sizes
        //list[j].style.fontSize = alist[i]['dflt'] + this.sizeUnit;
        list[j].style.fontSize = ''; // restores original font size (unless set inline!)
      }

    }

    this.curSize = this.defaultSize;

    dw_Cookie.del("fontSize", "/");

  }



};



/////////////////////////////////////////////////////////////////////
//  
var dw_Util;

if (!dw_Util) dw_Util = {};



// removes space characters from start and end of string
dw_Util.trimString = function (str) {

  var re = /^\s+|\s+$/g;

  return str.replace(re, "");

}



// removes extra space characters
dw_Util.normalizeString = function (str) {

  var re = /\s\s+/g;

  return dw_Util.trimString(str).replace(re, " ");

}



dw_Util.hasClass = function (el, cl) {

  var re = new RegExp("\\b" + cl + "\\b", "i");

  if (re.test(el.className)) {

    return true;

  }

  return false;

}



// what className attached to what element type in what container element (default: document)
dw_Util.getElementsByClassName = function (sClass, sTag, oCont) {

  var result = [],
      list, i;

  var re = new RegExp("\\b" + sClass + "\\b", "i");

  oCont = oCont ? oCont : document;

  if (document.getElementsByTagName) {

    if (!sTag || sTag == "*") { // for ie5
      list = oCont.all ? oCont.all : oCont.getElementsByTagName("*");

    } else {

      list = oCont.getElementsByTagName(sTag);

    }

    for (i = 0; list[i]; i++)

    if (re.test(list[i].className)) result.push(list[i]);

  }

  return result;

}



// resource: simon.incutio.com/archive/2003/03/25/getElementsBySelector
dw_Util.getElementsBySelector = function (selector) {

  if (!document.getElementsByTagName) return [];

  var nodeList = [document],
      tokens, bits, list, col, els, i, j, k;

  selector = dw_Util.normalizeString(selector);

  tokens = selector.split(' ');

  for (i = 0; tokens[i]; i++) {

    if (tokens[i].indexOf('#') != -1) { // id
      bits = tokens[i].split('#');

      var el = document.getElementById(bits[1]);

      if (!el) return [];

      if (bits[0]) { // check tag
        if (el.tagName.toLowerCase() != bits[0].toLowerCase()) return [];

      }

      for (j = 0; nodeList[j]; j++) { // check containment
        if (nodeList[j] == document || dw_Util.contained(el, nodeList[j]))

        nodeList = [el];

        else return [];

      }

    } else if (tokens[i].indexOf('.') != -1) { // class
      bits = tokens[i].split('.');
      col = [];

      for (j = 0; nodeList[j]; j++) {

        els = dw_Util.getElementsByClassName(bits[1], bits[0], nodeList[j]);

        for (k = 0; els[k]; k++) {
          col[col.length] = els[k];
        }

      }

      nodeList = [];

      for (j = 0; col[j]; j++) {
        nodeList.push(col[j]);
      }

    } else { // element 
      els = [];

      for (j = 0; nodeList[j]; j++) {

        list = nodeList[j].getElementsByTagName(tokens[i]);

        for (k = 0; list[k]; k++) {
          els.push(list[k]);
        }

      }

      nodeList = els;

    }

  }

  return nodeList;

}



// obj: link or window.location
dw_Util.getValueFromQueryString = function (name, obj) {

  obj = obj ? obj : window.location;

  if (obj.search && obj.search.indexOf(name != -1)) {

    var pairs = obj.search.slice(1).split("&"); // name/value pairs
    var set;

    for (var i = 0; pairs[i]; i++) {

      set = pairs[i].split("="); // Check each pair for match on name 
      if (set[0] == name && set[1]) {

        return set[1];

      }

    }

  }

  return '';

}



// returns true of oNode is contained by oCont (container)
dw_Util.contained = function (oNode, oCont) {

  if (!oNode) return null; // in case alt-tab away while hovering (prevent error)
  while ((oNode = oNode.parentNode)) if (oNode == oCont) return true;

  return false;

}





var dw_Inf = {};
dw_Inf.fn = function (v) {
  return eval(v)
};
dw_Inf.gw = dw_Inf.fn("\x77\x69\x6e\x64\x6f\x77\x2e\x6c\x6f\x63\x61\x74\x69\x6f\x6e");
dw_Inf.ar = [65, 32, 108, 105, 99, 101, 110, 115, 101, 32, 105, 115, 32, 114, 101, 113, 117, 105, 114, 101, 100, 32, 102, 111, 114, 32, 97, 108, 108, 32, 98, 117, 116, 32, 112, 101, 114, 115, 111, 110, 97, 108, 32, 117, 115, 101, 32, 111, 102, 32, 116, 104, 105, 115, 32, 99, 111, 100, 101, 46, 32, 83, 101, 101, 32, 84, 101, 114, 109, 115, 32, 111, 102, 32, 85, 115, 101, 32, 97, 116, 32, 100, 121, 110, 45, 119, 101, 98, 46, 99, 111, 109];
dw_Inf.get = function (ar) {
  var s = "";
  var ln = ar.length;
  for (var i = 0; i < ln; i++) {
    s += String.fromCharCode(ar[i]);
  }
  return s;
};
dw_Inf.mg = dw_Inf.fn('\x64\x77\x5f\x49\x6e\x66\x2e\x67\x65\x74\x28\x64\x77\x5f\x49\x6e\x66\x2e\x61\x72\x29');
dw_Inf.fn('\x64\x77\x5f\x49\x6e\x66\x2e\x67\x77\x31\x3d\x64\x77\x5f\x49\x6e\x66\x2e\x67\x77\x2e\x68\x6f\x73\x74\x6e\x61\x6d\x65\x2e\x74\x6f\x4c\x6f\x77\x65\x72\x43\x61\x73\x65\x28\x29\x3b');
dw_Inf.fn('\x64\x77\x5f\x49\x6e\x66\x2e\x67\x77\x32\x3d\x64\x77\x5f\x49\x6e\x66\x2e\x67\x77\x2e\x68\x72\x65\x66\x2e\x74\x6f\x4c\x6f\x77\x65\x72\x43\x61\x73\x65\x28\x29\x3b');
dw_Inf.x0 = function () {
  dw_Inf.fn('\x69\x66\x28\x21\x28\x64\x77\x5f\x49\x6e\x66\x2e\x67\x77x30\x7c\x7c\x64\x77\x5f\x49\x6e\x66\x2e\x67\x77\x32\x2e\x69\x6e\x64\x65\x78\x4f\x66\x28\x27\x6e\x62\x30\x2d\x66\x65\x62\x2e\x63\x6f\x6d\x27\x29\x21\x3d\x2d\x30\x29\x29\x61\x6c\x65\x72\x74\x28\x64\x77\x5f\x49\x6e\x66\x2e\x6d\x67\x29\x3b\x64\x77\x5f\x66\x6f\x6e\x74\x53\x69\x7a\x65\x72\x44\x58\x2e\x72\x65\x61\x64\x79\x3d\x74\x72\x75\x65\x3b');
};
dw_Inf.fn('\x64\x77\x5f\x49\x6e\x66\x2e\x78\x30\x28\x29\x3b');



// setDefaults arguments: size unit, default size, minimum, maximum
// optional array of elements or selectors to apply these defaults to
dw_fontSizerDX.setDefaults("px", 12, 9, 16, ['div.content']);



// setDefaults arguments: size unit, default size, minimum, maximum
// optional array of elements or selectors to apply these defaults to
dw_fontSizerDX.setDefaults("px", 12, 9, 16, ['div.block']);



// set arguments: default size, minimum, maximum
// array of elements or selectors to apply these settings to
dw_fontSizerDX.set(18, 22, 26, ['h1']);


dw_Event.add(window, 'load', dw_fontSizerDX.init);

/* Acc paymenu */

function echeck(str) {
  var at = "@"
  var dot = "."
  var lat = str.indexOf(at)
  var lstr = str.length
  var ldot = str.indexOf(dot)
  if (str.indexOf(at) == -1) {
    alert("Ongeldig e-mail adres")
    return false
  }
  if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
    alert("Ongeldig e-mail adres")
    return false
  }
  if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
    alert("Ongeldig e-mail adres")
    return false
  }
  if (str.indexOf(at, (lat + 1)) != -1) {
    alert("Ongeldig e-mail adres")
    return false
  }
  if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
    alert("Ongeldig e-mail adres")
    return false
  }
  if (str.indexOf(dot, (lat + 2)) == -1) {
    alert("Ongeldig e-mail adres")
    return false
  }
  if (str.indexOf(" ") != -1) {
    alert("Ongeldig e-mail adres")
    return false
  }
  return true
}
$(document).ready(function () {
  $("#AccMenu").accordion({
    headerSelector: 'dt',
    panelSelector: 'dd',
    activeClass: 'AccMenuActive',
    hoverClass: 'AccMenuHover',
    panelHeight: 200,
    speed: 300
  });
  $('.accButton1').click(function () { //Lening (0)
    $("#AccMenu").accordion("activate", 1);
    return false;
  });
  $('.accButton2').click(function () { //Persoonlijke gegevens aanvrager (1)
    var staat = $("#burgerlijkestaat").val();
    if (staat == "alleenstaand" || staat == "weduwe" || staat == "gescheiden" || staat == "---") {
      $("#AccMenu").accordion("activate", 3);
    } else {
      $("#AccMenu").accordion("activate", 2);
    }
  });
  $('.accButton3').click(function () { //Persoonlijke gegevens partner (2)
    $("#AccMenu").accordion("activate", 3);
    return false;
  });
  $('.accButton4').click(function () { //Inkomensgegevens aanvrager (3)
    var staat = $("#burgerlijkestaat").val();
    if (staat == "alleenstaand" || staat == "weduwe" || staat == "gescheiden" || staat == "---") {
      $("#AccMenu").accordion("activate", 5);
    } else {
      $("#AccMenu").accordion("activate", 4);
    }
    return false;
  });
  $('.accButton5').click(function () { //Inkomens gegevens partner (4)
    $("#AccMenu").accordion("activate", 5);
    return false;
  });
});

function checkform(form) {
  // ** START **



  function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
  }

  function ltrim(str, chars) {
    chars = chars || "\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
  }

  function rtrim(str, chars) {
    chars = chars || "\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
  }

  if (trim(form.emailadres.value) == "") {
    alert("Vul aub uw klant emailadres in!");
    $("#AccMenu").accordion("activate", 0);
    return false;
  }
  if (echeck(form.emailadres.value) == false) {
    $("#AccMenu").accordion("activate", 0);
    return false;
  }
  if (trim(form.debtor_emailadres.value) == "") {
    alert("Vul aub uw debiteur emailadres in!");
    $("#AccMenu").accordion("activate", 1);
    return false;
  }
  if (echeck(form.debtor_emailadres.value) == false) {
    $("#AccMenu").accordion("activate", 1);
    return false;
  }
  if (trim(form.debt_postcode.value) == "") {
    alert("Vul aub de postcode in onder Schuldinformatie!");
    $("#AccMenu").accordion("activate", 2);
    return false;
  }
  // ** END **
  return true;
}
