// Begin Lazy Loading. Lazy Loading allows us to load JS files and CSS only when the page requires them,
// saving bandwidth and decreasing load times.

$(document).ready(function(){
	if($(".form").length) {
		$.requireJs('../assets/validator/jquery.validate.js'); // form validation library		
	}
	
	if($(".datepicker").length) {
		$.requireJs('../assets/datepicker/ui.datepicker.js'); // form validation library
		$.requireCss('../assets/datepicker/ui.datepicker.css');  		
	}
	
	// if we want a fancybox images on our site
	if($("a.fancybox").length) {
		$.requireJs('../assets/fancybox/jquery.fancybox-1.0.0.js');
		$.requireJs('../assets/fancybox/jquery.pngFix.pack.js'); 
		$.requireCss('../assets/fancybox/fancy.css');		
	}  
  
  // we always want to load progressive enhancements at the end of the load queue
  $.requireJs('../assets/javascript/progressive-enhancement.js');
  
});