/*
 * jQuery zoomEvent
 * http://solar-logos.appspot.com
 * 
 * Copyright (c) 2011 "Argo" Mauro Colella
 * Dual licensed under the MIT and GPL licenses.
 * See LICENSE.txt
 */
 
(function($)
{
	$.fn.zoomListener=function()
	{
		var data = this.data("zoomEvent");
		if (!data)
		{
			this.data("zoomEvent", data = {
					interval:200, 
					lastWidth:0, 
					lastHeight:0, 
					lastFontSize:0});
			data = this.data("zoomEvent");
		}
		this.animate({opacity:"1.0"}, data.interval, function()
		{
			$(this).toggle().zoomListener();
			var widthNow = $(window).width(), heightNow = $(window).height();
			var c = $("div:last-child").height();
			if (data.lastWidth != widthNow || data.lastFontSize != c)
			{
				$(this).data("zoomEvent", {
					interval:data.interval, lastWidth:widthNow, lastHeight:heightNow, lastFontSize:c
				});
				if (data.lastWidth)
				{
					$.event.trigger("documentzoom",$(this).data("zoomEvent"));	
				}
			}
			return $(this);
		});
	};
	$(document).ready(function()
	{
		$("body").append("<div>&nbsp;</div>");
		var b=$("<div>&nbsp</div>").zoomListener();
		$("body").append(b)
	})
})(jQuery);

