if($!=$$)
{
  $(window).load(function()
  {
    $('#news a').click(function()
    {
      $(this).parent().children('div').toggle('slow', function()
      {
        var r = $(this).parent().children('.readmore').get(0);
        if (r)
        {
          r.innerHTML = /meer/i.test(r.innerHTML) ? 'Minder' : 'Meer';
          r.style.backgroundImage = /meer/i.test(r.innerHTML) ? 'url(/lib/_layouts/arrow.gif)' : 'url(/lib/_layouts/arrow-h.gif)';
        }
      });
    });
  });
  $(document).ready(function()
  {
    $('a[target=_blank]').each(function()
    {
      if(!/\.pdf/.test(this.href) && /wentzel\.nl\/([a-z]+)(\/|$)/.test(this.href))
      {
        this.href += document.location.search;
        $(this).addClass('iframe');
        $(this).fancybox({width: Math.min($(window).width() - 75, 1000), height: Math.min($(window).height() - 75, 700)});
        $(this).click();
      }
      else
      {
        $(this).click(function()
        {
          return loadPopup(this.href);
        });
      }
    });
    $('#navigation a:not(.selected)').mouseover(function()
    {
      $(this).children('span.hover').fadeIn(200);
    });
    $('#navigation a:not(.selected) span.hover').mouseout(function()
    {
      $(this).fadeOut(200);
    });
  });
  /*window.onresize = function()
  {
    if(!CCL.IE || CCL.IEVersion > 7)
    {
      $('a.iframe').fancybox.close();
      $('a.iframe').fancybox({'frameWidth': Math.min($(window).width() - 75, 1000), 'frameHeight': Math.min($(window).height() - 75, 700)});
      $('a.iframe').click();
    }
  }*/
}

function loadProjects(iMaterialId)
{
  loadPopup('https://www.wentzel.nl/projecten/?materiaal=' + iMaterialId);
  //window.top.location.href = window.top.location.href.replace(/\/[^\/]+$/, '/Gallery--Referentieprojecten.html?materiaal=' + iMaterialId);
}

function loadPopup(sUrl)
{
  var iWidth = Math.min(screen.width, 1000);
  var iHeight = Math.min(screen.height, 700);
  var iTop = (screen.height - iHeight) / 2 - 50;
  var iLeft = (screen.width - iWidth) / 2;
  var sName = 'popup';
  if(window[sName] && !window[sName].closed)
    window[sName].close();
  window[sName] = window.open(sUrl, sName, 'width=' + iWidth + ', height=' + iHeight + ', top=' + iTop + ', left=' + iLeft + ', toolbar=0, location=0, directories=0, menubar=0, resizable=0, scrollbars=1');
  return false;
}