(function($) {
	
	$.fn.Forms = function () {
       
		return this.each(function(){
	   
			var self = $(this);
			
			function resetDefault() {
				self.find(".manageDefault").each(function(){
					$(this).val($(this).attr("title"));
				});
			}
			
			resetDefault(); 
			
			$(".btn-container .btn a").click(function(event){
				event.preventDefault();
				if ($(this).parent().is(".enviar")) {
					$("#" + $(this).attr("rel")).submit();
				} else if ($(this).parent().is(".limpar")) {
					resetDefault();
				}
			});
			
			self.find(".manageDefault").live("focusin focusout", function(event){
				
				var title = $(this).attr("title");
				
				if (event.type == "focusin") {
					if ($(this).val() == title) {
						$(this).val("");
					} 
				} else if (event.type == "focusout") {
					if ($(this).val() == "") {
						$(this).val(title);
					}
				}
				
			});
		});
	} 
	
})(jQuery);
