(function($){

$.fn.extend({

toonelOut:function(d,e,c){

	var th=this,

		w,h,l,t,k

	w=th.prop('offsetWidth')

	h=th.prop('offsetHeight')

	l=th.prop('offsetLeft')

	t=th.prop('offsetTop')

	k=h/w

	

	th

		.stop()

		.animate({

			width:0

		},{

			step:function(now){

				th

					.css({

						height:now*k,

						left:(w-now)/2+l,

						top:(h-now*k)/2+t

					})

			},

			duration:d,

			easing:e,

			complete:function(){

				if(c)

					c.call(th)

				th

					.hide()

					.css({

						width:w,

						height:h,

						left:l,

						top:t

					})

			}

		})

	return th

},

toonelIn:function(d,e,c){

	var th=this,

		w,h,l,t,k

	th

		.css({visibility:'hidden'})

		.show()

	w=th.prop('offsetWidth')

	h=th.prop('offsetHeight')

	l=th.prop('offsetLeft')

	t=th.prop('offsetTop')

	k=h/w



	th

		.stop()

		.css({width:0,height:0,visibility:'visible'})

		.animate({

			width:w

		},{

			step:function(now){

				th

					.css({

						height:now*k,

						left:(w-now)/2+l,

						top:(h-now*k)/2+t

					})

			},

			duration:d,

			easing:e,

			complete:function(){

				if(c)

					c.call(th)

			}

		})



	return th

}})

})(jQuery)
