/*
* hoverAnim (1.0) // 2008.02.10 // <http://plugins.jquery.com/project/hoverAnim>
* 
* REQUIRES jQuery 1.2.3+ <http://jquery.com/>, hoverIntent <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* Copyright (c) 2008 TrafficBroker <http://www.trafficbroker.co.uk>
* Licensed under GPL and MIT licenses
*
* hoverAnim make an animation on over, and return to the original position on out.
*
* Sample Configuration:
* $('#element').hoverAnim({width: 500},{speed: 500});
* 
* More Config Options:
* speed: Speed for the animation // default: 150
* easing: "swing", // By default jQuery only provide linear and swing easing. 
* sensitivity: Sensitivity threshold (must be 1 or higher) // default: 3
* interval: Milliseconds for onMouseOver polling interval // default: 200
* timeout: Milliseconds delay before onMouseOut // default: 300
* 
* We can override the defaults with:
* $.fn.hoverAnim.defaults.speed = 500;
* 
* @param properties  An object with the animation parameters
* @param settings  An object with configuration options
* @author    Jesus Carrera <jesus.carrera@trafficbroker.co.uk>
*/
(function($) {
$.fn.hoverAnim = function(properties, settings) {
	// override default settings
	settings = $.extend({}, $.fn.hoverAnim.defaults, settings);
	// for each element
	return this.each(function() {
		// save the properties before the animation
		var propertiesBefore = {};
		for (var key in properties) {
			propertiesBefore[key] = $(this).css(key);
		}
		// animate on over
		var over = function(){
			$(this).stop();
			$(this).animate(properties, settings.speed, settings.easing);
		};
		// animate on out
		var out = function(){
			$(this).stop();
			$(this).animate(propertiesBefore, settings.speed, settings.easing);
		};
		// hoverIntent config
		var configHover = {
			sensitivity: settings.sensitivity,
			interval: settings.interval,
			over: over,
			timeout: settings.timeout,
			out: out
		}
		$(this).hoverIntent(configHover);
	});
};
// default settings
$.fn.hoverAnim.defaults = {
	speed: 150,
	easing: "swing",
	sensitivity: 3,
	interval: 1,
	timeout: 1
};
})(jQuery);;