function validarArea()
{
	var login = document.getElementById("area_cliente").value;
	var pass = document.getElementById("area_password").value;
	
	if (login == ""){	
		alert("Faltan datos por rellenar");
	}else{
		if (pass == ""){
			alert("Faltan datos por rellenar");
		}else{
			$.ajax({
				async:true,
				type: "post",
				dataType: "xml",
				contentType: "application/x-www-form-urlencoded",
				url:"http://www.estudiocode.com/web/include-area_conectar.php",
				data:"login=" + login + "&pass=" + pass,
				success:validarAreaSubmit,
				timeout:10000,
				error:ajaxError
			});
		}
	}
	return false;
}

function validarAreaSubmit(t)
{
	var html = $("html", t).text();
	if (html == "ok"){
		//var server = $("server", t).text();		
		//document.location.href = server + "area/";
		var id = $("id", t).text();
		document.location.href = "http://www.estudiocode.com/area/?id=" + id;
	}else{
		alert(html);
	}
	return false;
}

function areaDesconectar()
{	
	$.ajax({
		async:true,
	   	contentType: "application/x-www-form-urlencoded",
	   	url:"../web/include-area_desconectar.php",
	   	success:areaDesconectarComplete,
	   	timeout:10000,
	   	error:ajaxError
	});
	return false;
}

function areaDesconectarComplete(t)
{
	var html = $("html", t).text();
	var server = $("server", t).text();
	document.location.href = server;
}






function areaVerTrabajo(id)
{
	var datos = "id=" + id;
	$.ajax({
		async:true,
		type: "post",
		dataType: "xml",
		contentType: "application/x-www-form-urlencoded",
		url:"include-area_trabajo.php",
		data:datos,
		success:areaPonerTrabajo,
		timeout:10000,
		error:ajaxError
	});
	return false;
}

function areaPonerTrabajo(t)
{
	var html = $("html", t).text();
	$("#area_contenido").css("display","none");	
	$("#area_contenido").html ($("html", t).text());		// pone el texto
	$("#area_contenido").fadeIn(500);	// y lo anima
}






function areaVerDoc(id)
{
	var datos = "id=" + id;
	$.ajax({
		async:true,
		type: "post",
		dataType: "xml",
		contentType: "application/x-www-form-urlencoded",
		url:"include-area_documento.php",
		data:datos,
		success:areaPonerDoc,
		timeout:10000,
		error:ajaxError
	});
	return false;
}

function areaPonerDoc(t)
{
	var html = $("html", t).text();
	$("#area_documentos_marco").css("display","none");	
	$("#area_documentos_marco").html ($("html", t).text());		// pone el texto
	$("#area_documentos_marco").fadeIn(500);	// y lo anima
}