function showContent(d,coordinates){
	let formData = new FormData();
	for (let key in d){
		var value = d[key];
		if(value===null){value="";}
		formData.append(key, value);
	}
	formData.append("x",coordinates[0]);
	formData.append("y",coordinates[1]);
	let url = "/pl/inmueble.vinculacion.r.pl";
	let r = new XMLHttpRequest();
	r.open("POST",url, true);
	r.setRequestHeader("Content-Type", "multipart/form-data");
	r.send(formData);
	r.onreadystatechange = function () {
		if (r.readyState != 4 || r.status != 200) return;
		content.innerHTML = r.responseText;
	};
}
function saveVinculacion(){
	let valid = 0;
	if(document.getElementById("expediente_id").value != ""){valid = 1;}
	//if(document.getElementById("medidor").value != ""){valid = 1;}
	if(valid==0){alert("Ingrese el ID del Inmueble, NIS, NIC, Medidor ó Sector-Parcela");return;}	
	let data = {};
	data.app = "LaHerradura";
	let elements = document.getElementById("inmueble_vinculacion").elements;
	for (let i = 0; i<elements.length;i++) {
		let element = elements[i];
		if(element.tagName==="INPUT" || element.tagName==="SELECT" || element.tagName==="TEXTAREA" ){
			if(element.id!==""){
				data[element.id]=element.value;	
			}
		}
	}
	console.log(data);
	let url = "http://209.126.9.107:5434/map.vinculacion";
	let r = new XMLHttpRequest();
	r.open("POST",url, true);
	r.setRequestHeader("Content-Type", "application/json");
	r.send(JSON.stringify(data));
	r.onreadystatechange = function () {
		if (r.readyState != 4 || r.status != 200) return;
		wmsLayer.getSource().updateParams({CQL_FILTER:"1=1"});
		document.getElementById('popup-closer').click();
	};
}
var openwindow	= new Array(50);
function GetBack(component,clase,getback,opener_form,left,top,id_field,field_focus,winame,properties){
	var id_value= "";
	var bn		= "";
	var componente	= component.split("__");
	if(componente.length>1){
		bn = componente[1];
		component=componente[0]+"."+componente[1];
	}else{
		bn = "bin";
		component=component+".pl";
	}
	if(id_field!=""){
		if(componente=="LIST"){
			id_field	 = parent.list.document.linkl.id_field.value;
			var id_value = eval("parent.form.document.linkf."+id_field+".value");
			if(id_value==""){
				alert('Please Choose ID Firts');
				return;
			}
		}else{
			id_value = eval("parent.form.document.form."+id_field+".value");
			if(id_value==""){
				alert('Please Choose ID Firts');
				return;
			}
		}
	}
	if (!openwindow[winame] || openwindow[winame].closed){
		win ="window.open('../"+bn+"/"+component+"?clase="+clase+"&id="+id_value+"&getback="+getback+"&opener_form="+opener_form+"&field_focus="+field_focus+"','"+componente[0]+clase+"','left="+left+",top="+top+",width=100,height=100,"+properties+"')";
		openwindow[winame]=eval(win);
	}else{openwindow[winame].focus()}
}