/*
 * jQuery UI Effects Zoom 1.8.4
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function( $, undefined ) {

$.effects.zoom = function(o) {

	return this.queue(function() {

		// Create element
		var el = $(this), props = ['position','top','left','width','height'];

		// Set options
		var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
		
		// Adjust
		$.effects.save(el, props); el.show() // Save & Show
		$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
		var primeHeight = el.outerHeight();
		var primeWidth = el.outerWidth();
		if (mode == 'show') {
			// shrink the element to zero
			el.height(0);
			el.width(0);
			el.css({top: primeHeight/2, left: primeWidth/2});
		}		
		
		// Animation
		var animation = {};
		animation["top"] = mode == 'show' ? 0 : primeHeight/2;
		animation["left"] = mode == 'show' ? 0 : primeWidth/2;
		animation["width"] = mode == 'show' ? primeWidth : 0;
		animation["height"] = mode == 'show' ? primeHeight : 0;

		// Animate
		el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
			if(mode == 'hide') el.hide(); // Hide
			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
			if(o.callback) o.callback.apply(this, arguments); // Callback
			el.dequeue();
		}});

	});

};

})(jQuery);

