// JavaScript Document
	$(document).ready(function() { 
    	// bind form using ajaxForm 
    	$('#f_areacli').ajaxForm({ 
        	// dataType identifies the expected content type of the server response 
        	dataType:  'json', 
         	// success identifies the function to invoke when the server response 
        	// has been received 
        	success:   processJson 
    	});
	    
		$('<div id="busy">comprobando...</div>')
        .ajaxStart(function() {$(this).show();})
        .ajaxStop(function() {$(this).hide();})
        .appendTo('#zonauser');
		$('#busy').hide();
		
		function processJson(data) { 
    	// 'data' is the json object returned from the server 
    	//alert(data.message);
			if (data.usuario == "ok") { window.location="zona-usuario.asp"; }
			if (data.usuario == "fusuario") {
				$("#usuario").css({ "background":"#ffbdbc", "border":"1px solid #cf2b28" });
				$("#pass").css({ "background":"#FFFFFF", "border":"solid 1px #cacaca;" });
			}
			if (data.usuario == "fpass") { 
				$("#pass").css({ "background":"#ffbdbc", "border":"1px solid #cf2b28" });
				$("#usuario").css({ "background":"#FFFFFF", "border":"solid 1px #cacaca;" });
			}
			if (data.usuario == "fusuariofpass") { 
				$("#usuario").css({ "background":"#ffbdbc", "border":"1px solid #cf2b28" });
				$("#pass").css({ "background":"#ffbdbc", "border":"1px solid #cf2b28" });
			}
			if (data.usuario == "errdatos") {
				$("#errordatos").hide();
				$('<div id="errordatos">datos no correctos</div>').appendTo('#f_areacli');
				$("#usuario").css({ "background":"#ffbdbc", "border":"1px solid #cf2b28" });
				$("#pass").css({ "background":"#ffbdbc", "border":"1px solid #cf2b28" });
			}else { $("#errordatos").hide(); }
			//else {
			//	alert(data.usuario);
			//};
		}

	});