//
//  public/js/fucntions.php
//  criado por Peewee em 30/05/2011
//	modificado por Peewee em 30/05/2011
//
//
(function($){
	
	URL = "/dev/angelino/";
				
	$.fn.extend({
		//fade in imagens
		loadImageFade: function ()
		{
			return this.each(function ()
			{
				var el = $(this);
				el.load(function ()
				{
					$(this).fadeIn (200);
				});
			})
		},
		//bt voltar
		btVoltar: function ()
		{
			return this.each(function ()
			{
				var el = $(this);
				el.hover(function ()
				{
					$(this).animate({
						marginLeft	: -45
					}, 300);
				}, function ()
				{
					$(this).animate({
						marginLeft	: -33
					}, 300)
				});
			})
		},
		//moviementa as nuvens
		moveClouds: function ()
		{
			var el = $(this);
			
			el.mousemove (function (e)
			{
				var center = $(this).width()/2;
				var mouseX = e.pageX;
				var dif = center - (mouseX - center) / 10;
				$("div[id='main']").css("backgroundPosition",dif+"px 0px");
				//descomente próxima linha para verificar os valores
				// $("#main").text (center+" / "+ mouseX +" / "+dif);
			});
		},
		//limpa input
		cleanInput: function ()
		{
			return this.each(function()
			{
				var el = $(this);
				var text = el.val();
				el.focusin (function ()
				{
					var t = $(this).val();
					if (t == text)
					{
						$(this).val("");
					}
				});
				
				el.focusout (function ()
				{
					var t = $(this).val();
					if (t == "")
					{
						$(this).val(text);
					}
				});
			})
		},
	});
})(jQuery);
