$(document).ready(function(){
	
		$('#bt_login').click(function() {
			var login=$('#user').val();
			var password=$('#pass').val();
			var pagina="http://gps.samtech.cl/index.asp?b="+login+"@@@"+password
			
			if ($('#recordar').attr('checked')) 
			{recordar=1}
			else
			{recordar=0}		
			
			if (login=="" || password=="")
			{$('#msj').html("Ingrese Usuario y Password");}
			else	
			{
			$.ajax({
				url: "js/login.asp",
				async:true,
				data: "login="+login+"&password="+password+"&recordar="+recordar,
				beforeSend: function(objeto)
				{$('#msj').html("Validando Datos");},//antes de enviar
				complete: function(objeto, exito){
					if(exito=="success"){}//finalizo Proceso
				},
				contentType: "application/x-www-form-urlencoded",
				dataType: "html",
				error: function(objeto, quepaso, otroobj){
					//alert(quepaso)
				},
				global: true,
				ifModified: false,
				processData:true,
				success: function(datos){
					if (datos!='--')
					{document.location.href=pagina;}
					else
					{$('#msj').html("Ingrese Datos Válidos");}
				
				},
				timeout: 7200,
				type: "POST"
				});				
			}
		});

	})	

/*

Agrego codigo para google analitics
*/	
	
	  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-25539805-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
