/**
 * Arquivo Javascript padrão do site.
 */

$j(function() {
	Site.popfloat();
	
	$j('#requerimentos :input').each(function() {
		$j(this).Watermark($j(this).attr('value'), '#333');
		
		var size = $j(this).get(0).value.length;
		var classe = $(this).attr('class');
		
		$j(this).after('<span></span>'); //&nbsp;
		
		if(classe != 'x') {
			$j(this).textGrow({pad:35});
			$j(this).attr('size', (size > 0 ? (size+10) : 15));
		}
	});
});

var Site = {
	popfloat:function(acao) {
		if(acao == 0) {
			$j('.banner-flutuante').fadeOut();	
		} else if(location.href.indexOf('?') == -1) {
			$j('.banner-flutuante').fadeIn();
			setTimeout(function() { $j('.banner-flutuante').fadeOut(); }, 40000);
		}
	}
}

var Requerimento = {
	gerar:function(botao) {
		$('.imp-requerimento, .edit-requerimento').css({display:'inline'}).show();
		$(botao).hide();
		
		$('#requerimentos :input[type=text]').each(function() {
			var value = $(this).val();
			
			$(this).hide();
			$(this).next().html(value);
		});
		
		$('#requerimentos :input[type=radio]').each(function() {
			var value = $(this).val();
			
			if($(this).is(':checked')) {
				$(this).parent().prev().html(value);
			}
			
			$(this).parent().hide();
		});
	},
	editar:function(botao) {
		$(botao).fadeOut().prev().show();
		$('.imp-requerimento').hide();
		
		$('#requerimentos :input').each(function() {
			var value = $j(this).val();
			
			$(this).show();
			$(this).next().html('');
		});
		
		$('#requerimentos :input[type=radio]').each(function() {
			$(this).parent().show();
			
			if($(this).is(':checked') ) {
				$(this).parent().prev().html('');
			}
		});
	}
}

