// ************************ NEROAVORIO JAVASCRIPT FUNCTION LIBRARY ******************
// ************************ v. 1.5                                 ******************

// ************************ 1) pulse_elements v 1.1
// ************************ 2) blink_elements v 1.0 (OBSOLETE - kept for possible future uses
// ************************ 3) delay jquery plugin v 1.0
// ************************ 4) simple image preloader jquery plugin v 2.0

// pulse_elements (homemade using jquery) (REQUIRES jQuery library)
// v 1.1 aggiunto parametro pausetime, che aggiunge un timeout parametrizzato prima di CIASCUN fade (sia In che Out) ovvero introduce una PAUSA
//       a piacere tra i pulse. il parametro speed continua ad essere applicato 1) al fadeIn iniziale 2) al fadeTo(0) 3) al fadeTo (1)

		function pulse_elements(speed,pausetime) {
			$(".pulse").fadeIn(speed);
			function pulse_element() {
				$(this).delay(pausetime,function(){
					$(".pulse").fadeTo(speed, 0,function(){
						$(this).delay(pausetime,function(){
							$(".pulse").fadeTo(speed, 1, pulse_element);
						});
					});
				});
			}
			pulse_element();
		}
		
// Delay Plugin 1.0 for jQuery
// - http://www.evanbot.com
// - © 2008 Evan Byrne
// USAGE:   $(this).delay(1000,function(){
//				$.......;
//			);
jQuery.fn.delay = function(time,func){
	return this.each(function(){
		setTimeout(func,time);
	});
};

// Simple Image Preloader Plugin 2.0 for jQuery (1 dec. 2009)
// - http://www.mattfarina.com
// - © 2009 Matt Farina
// USAGE: $.preLoadImages("image1.gif", "/path/to/image2.png");
//     or $.preloadImages(<?php print na_mfpreload($folders_array)?>);  // $folders_array generato da na_mfpreload (mf sta per matt farina :D)
(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preloadImages = function() {
    var args_len = arguments.length;
	var loaded   = 0;  	
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)
