jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

var aFields = new Array();
aFields[0] = "#frmNaam";
aFields[1] = "#frmEmail";
aFields[2] = "#frmBericht";
function checkForm() {
  var r = true;
  for (var i = 0; i < aFields.length; i++) {
    if ($(aFields[i]).val().length <= 0) {
      $(aFields[i]).css("border","1px solid #C00");
      $("#error").css("visibility", "visible");
      r = false;
    } else
      $(aFields[i]).css("border","");
  }
  return r;
}

function advclick(id) {
  $.ajax({
    type: "GET",
    url: "/includes/click.asp?advid=" + id,
    success: function(returnValue) {
      xmldoc = $(returnValue);
      $(xmldoc).find("url").each(function() {
        if ($(this).text() != 'error') {
          location.href = $(this).text();
        }
      });
    }
  });
}

$(document).ready(function() {
  if (document.getElementById('huur_blog_blok_content')) {
    height = document.getElementById('huur_blog_blok_content').offsetHeight;
    //height = height - 38
    $(".huur_blog_blok_content_left").css("height", height);
    $(".huur_blog_blok_content_right").css("height", height);
    $(".huur_blog_blok_content_mid").css("height", height);
  }

  // Vang advanced clicks af.
  $('a[advclick!=""]').click(function() {
    $.ajax({
      type: "GET",
      url: "/includes/click.asp?advid=" + $(this).attr("advclick"),
      success: function(returnValue) {
      }
    });
  });
  // Vang advanced clicks af.
  //  $('div[advclick!=""]').click(function() {
  //  $.ajax({
  //    type: "GET",
  //    url: "/includes/click.asp?advid=" + $(this).attr("advclick"),
  //    success: function(returnValue) {
  //      xmldoc = $(returnValue);
  //      $(xmldoc).find("url").each(function() {
  //        if ($(this).text() != 'error') {
  //          //window.location = $(this).text();
  //        }
  //      });
  //    }
  //  });
  //  });

  // Vang normale links af.
  $('a[lclick!=""]').click(function() {
    $.ajax({
      type: "GET",
      url: "/includes/click.asp?id=" + $(this).attr("lclick"),
      success: function(returnValue) {
      }
    });
  });
  // Vang normale links af.
  $('div[lclick!=""]').click(function() {
    $.ajax({
      type: "GET",
      url: "/includes/click.asp?id=" + $(this).attr("lclick"),
      success: function(returnValue) {
      }
    });
  });
});