(function($) {
	// jQuery plugin definition
	$.fn.eduHover = function(params) {
		var settings = {
			heightOld : 0, 
			widthOld  : 0,
			heightNew  : 0,
			widthNew  : 0,
			imgHover : 'Images/etapchi_hover.gif',
			speedHover : 400,
			classHover : '',
			top	: 0,
			left :0,
			topDefalt: 0,
			leftDefault: 0
		};
		
		// merge default and user parameters
		settings = $.extend({}, settings, params);
		
		// function hover
		$.eduHover = {
			data : {top: 0, left: 0},
			img : {},
			imgOld : {}
		};
		
		// traverse all nodes
		this.each(function() {
			// express a single node as a jQuery object
			var $t = $(this);
			$t.hover(
				function(){
					$.eduHover.img = $t.find('img');
					$.eduHover.imgOld = $.eduHover.img.attr('src');
					$t.css({'z-index' : '10', 'width' : settings.widthNew+'px', 'height' : settings.heightNew+'px'}).animate({
						'top' : settings.top + 'px',
						'left' : settings.left + 'px'																									
					}, "slow");
					if(settings.classHover != ''){
						$.eduHover.img.addClass(settings.classHover);
					}
					$.eduHover.img.attr({src : settings.imgHover}).stop()
						.animate({
							marginTop: '0', 
							marginLeft: '0',
							top: '0', 
							left: '0', 
							width: settings.widthNew+'px', 
							height: settings.heightNew+'px',
							padding: '0px'
						}, settings.speedHover, function(){
							
						});				
				},
				function() {
					$t.css({'z-index' : '0', 'width' : settings.widthOld+'px', 'height' : settings.heightOld+'px'}).animate({
						'top' : settings.topDefalt, 
						'left' : settings.leftDefault																									
					}, "slow");	
					if(settings.classHover != ''){
						$.eduHover.img.removeClass(settings.classHover);
					}
					$.eduHover.img.attr({src : $.eduHover.imgOld}).stop()
						.animate({
							marginTop: '0', 
							marginLeft: '0',
							top: '0', 
							left: '0', 
							width: settings.widthOld+'px', 
							height: settings.heightOld+'px', 
							padding: '0px'
						}, settings.speedHover,function(){
							
						});
				}
			);
		});
		// allow jQuery chaining
		return this;
	};
})(jQuery);

