function changeImpression(s, sLarge) {
  document.getElementById('impression').style.backgroundImage = 'url("'+s+'")';
  document.getElementById('impression').style.backgroundRepeat = 'no-repeat';
  currentLargeImage = sLarge;
}

function enable_output_escaping()
{
   if (navigator.product == 'Gecko')
   {
      var fieldsToCheck = new Array('description', 'details_description');
      for(var i = 0; i < fieldsToCheck.length; i++)
      {
         try
         {
            var htmlToDecode = document.getElementById(fieldsToCheck[i]).innerHTML;
            htmlToDecode = htmlDecode(htmlToDecode);
            document.getElementById(fieldsToCheck[i]).innerHTML = htmlToDecode;
         }
         catch(e)
         {}
      }
   }
}

function htmlDecode(htmlToDecode)
{
   htmlToDecode = htmlToDecode.replace(/&lt;/g, '<');
   htmlToDecode = htmlToDecode.replace(/&gt;/g, '>');
   htmlToDecode = htmlToDecode.replace(/&amp;/g, '&');
   return htmlToDecode;
}

function zoom(io) {
  document.getElementById('zoom').className ='zoom '+io;
}

function showLarge(searchType)
{
   jQuery.fancybox(
   {
      'type': 'image',
      'href': currentLargeImage,
      'hideOnContentClick' : true,
      'transitionIn': 'elastic',
      'transitionOut': 'elastic',
      'padding': 1,
      'margin': 0
   });
}

var prev_info = '';

function showInfo(info) {
  if (prev_info != '') {
    document.getElementById(prev_info).style.display = 'none';
  }
  document.getElementById(info).style.display = 'block';
  prev_info = info;
}

function hideInfo(s) {
  document.getElementById(s).style.display = 'none';
}

function showCriteria() {
  if (document.getElementById('searchcriteria_long').style.display && document.getElementById('searchcriteria_long').style.display == 'block') {
    document.getElementById('searchcriteria_long').style.display = 'none';
    document.getElementById('scl_toonknop').innerHTML = 'Toon zoekcriteria';
  } else {
    document.getElementById('searchcriteria_long').style.display = 'block';
    document.getElementById('scl_toonknop').innerHTML = 'Verberg zoekcriteria';
  }
}

/**
 * adds a facebook 'i like' button inside the detailresult_footer
 */
function addLikeThis()
{
   if (jQuery(".detailresult_footer").length)
   {
      var url = encodeURIComponent(document.location);
      var div = jQuery('<div class="footer_likethis"><iframe src="http://www.facebook.com/plugins/like.php?href=' + url + '&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe></div>');
      jQuery(".detailresult_footer").append(div);
   }
}

/**
 * adds a 'add this' button inside the detailresult_footer
 * @param username addthis username
 */
function addAddThis(username)
{
   if (jQuery(".detailresult_footer").length)
   {
      var div = jQuery('<div class="footer_addthis"><a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;username=' + username + '"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="delen met anderen" style="border:0"/></a></div>');
      jQuery(".detailresult_footer").append(div);

      jQuery.getScript("http://s7.addthis.com/js/250/addthis_widget.js#username=" + username + "&domready=1&async=1", function(){
         addthis.init();
         addthis.button(".addthis_button");
      });
   }
}

jQuery(document).ready(function()
{
   if(!document.body)
   {
     document.body = document.getElementById('body');
   }
});
