// progressive-enhancement.js
//
// Responsible JavaScript enhancements.
// The aim of this file is to provide functionality niceties in the event that JavaScript is enabled on the client.
// In no case should JavaScript be required for the website to work. In no case should any JavaScript be in-line or embeded in HTML.
//
// NOTES:
// This file relies upon jQuery and numerous plugins. Both the plugins and this file are loaded dynamically by lazy-loader.js
// DO NOT manually include this file in any HTML

$(document).ready(function(){
  /* Open links to external websites in a new window using Event Delegation.
       Event Delegation ensures the function will work inside AJAX loads
       REFERENCE:[http://docs.jquery.com/Tutorials:AJAX_and_Events] */
  $("body").click(function(event) {
    if ($(event.target).is("a[@href*=http://]")) {
      $(event.target).attr('target','_blank');
    }
  });

  /* lazy image load */
  $("img").lazyload({ 
			placeholder : "img/grey.gif",
			effect : "fadeIn" 
		  });
		  
  $("img").after("<img class=\"overlay\" src=\"assets/images/png-overlay.png\"/>");
  
});
