// ************************ NEROAVORIO JAVASCRIPT FUNCTION LIBRARY ******************
// ************************ v. 1.4                                 ******************

// ************************ 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 1.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();
		}

// blink_elements v1.0 (REQUIRES jQuery library) ******** OBSOLETE **********
// v 1.0 accepts speed (duration of the fadein or fadeout in milliseconds) as parameter

/*		function blink_elements(speed) {
			var blinkCount = 2;//2*2;// two blinks, 4*2 for four blinks
			do {
			   $('.blinking')['fade'+(blinkCount%2==0?'Out':'In')](speed);
			} 
			while (--blinkCount);
			setTimeout("blink_elements(" + speed + ")",2000);
		}*/


// 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 1.0 for jQuery
// - http://www.mattfarina.com
// - © 2007 Matt Farina
// USAGE:   $(this).delay(1000,function(){
//				$.......;
//			);

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
	jQuery("<img>").attr("src", arguments[i]);
  }
};

