$(".autentication_con").ready(function(){
			
	$(".botoes:first").click(function(){
		Result = true;
		$(".resource input:password").each(function(){
			if(jQuery.trim($(this).val())==''){
				window.alert("Queira por gentileza preencher os campos em negritos!!!");
				Result = false;
				return false;
			}
		})
		if(Result){
			var new_senha = $("input#new_senha").val();
			var con_new_senha = $("input#con_senha").val();  
			
			//alert( new_senha );
			//alert( con_new_senha );
			
			if( new_senha.length < 4 || $('.resource input:first').val().length < 4 ){
				window.alert("A senha deve ser composta por 4 números!!!");
				return false;
			}
			
			
			if( new_senha > 0 && con_new_senha > 0 ){
				if( jQuery.trim(new_senha) == jQuery.trim(con_new_senha) ){
					
					$.ajax({
						type: "POST",
						url: "includes/altsenha.fnc.php?alt=1",
						data: "new_senha="+ new_senha +"&con_senha="+ con_new_senha +"&senha_atu="+ $(".resource input:first").val(),
						async: false,
						success: function(htm){
							if(jQuery.trim(htm)!=''){
								window.alert(htm);
								$(".resource input:password").each(function(){
									$(this).val('');
								})
							}
						}
					});
					
				}else{
					window.alert("As senhas informadas não conferem.\nTente novamente!!!");
					return false;
				}
			}else{
				window.alert("Parâmetro \"[new_senha][con_new_senha]\" inválido!!!");
				return false;
			}
		}
	});
	
	$("#limpar").click(function(){
		$(".resource input:password").each(function(){
			$(this).val('');
		})
	});
	
	$("#close").click(function(){
		window.open("http://www.senff.com.br/", "_parent");
	})
	
	$("#saldo").click(function(){

		$.ajax({
			type: "GET",
			url: "includes/saldo.fnc.php?grd=1",
			async: false,
			success: function(htm){
				if(jQuery.trim(htm)!=''){
					$(".resource").html(htm)
								.css("margin","3px");
				}
			}
		});
		
	});
	
	$("#ext").click(function(){
		$.ajax({
			type: "GET",
			url: "includes/extrato.fnc.php?grd=1",
			async: false,
			success: function(htm){
				if(jQuery.trim(htm)!=''){
					$(".resource").html(htm)
								.css("margin","3px");
				}
			}
		});
	})
	
	
	detalheSaldo = function(cod){
		if( jQuery.trim(cod)!='' ){
		
			$.ajax({
				type: "POST",
				url: "includes/saldo.fnc.php?det=1",
				data: "cods="+cod,
				async: false,
				success: function(htm){
					if(jQuery.trim(htm)!=''){
						//window.alert(htm);
						/*$(".resource input:password").each(function(){
							$(this).val('');
						})*/
						$(".detalhe_sald").remove();
						$(".grid_view").css("height","208px");
						$(".resource").prepend(htm)
									.css("margin","3px");
									
					}
				}
			});
		
		}else{
			window.alert("Parâmetro não encontrado, ou não definido!!!");
			return false;
		}
		
	}
	
	
	detalheExtrato = function(cod){
		if( jQuery.trim(cod)!='' ){
			$.ajax({
				type: "POST",
				url: "includes/extrato.fnc.php?det=1",
				data: "cods="+cod,
				async: false,
				success: function(htm){
					if(jQuery.trim(htm)!=''){
						//window.alert(htm);
						/*$(".resource input:password").each(function(){
							$(this).val('');
						})*/
						$(".resource").html(htm)
									.css("margin","3px");
									
					}
				}
			});
		
		}else{
			window.alert("Parâmetro não encontrado, ou não definido!!!");
			return false;
		}
		
	}
	
	
	$(".login_display").focus(function(){
		$('.mensagem_notification_condutor').hide();
		if($(this).attr('name')=='condutor'){
			$(".mensagem_notification_condutor").fadeIn(function(){
				$(this).removeClass("mensagem_notification_codemp_condutor")
						.addClass("mensagem_notification_cod_condutor");
				$(this).html("<p>Digite aqui o seu c&oacute;digo de condutor</p><a href='#'>ok</a>");
				$('a').click(function(){
					$('.mensagem_notification_condutor').hide();
				})
			})
		}
		if($(this).attr('name')=='par_codempresa'){
			$(".mensagem_notification_condutor").fadeIn(function(){
				$(this).removeClass("mensagem_notification_cod_condutor")
						.addClass("mensagem_notification_codemp_condutor");
				$(this).html("<p>Digite aqui o c&oacute;digo de sua empresa</p><a href='#'>ok</a>");
				$('a').click(function(){
					$('.mensagem_notification_condutor').hide();
				})
			})
		}
	});
	
});