	function popupWindow(url,name,W,H)
	{
		if (!name) name = "default";

		if (!H) heightVar = 400;
		else if (H < 1) heightVar = 1;
		else heightVar = H;

		if (!W) widthVar = 400;
		else if (W < 1) widthVar = 1;
		else widthVar = W;

		Xpos = (screen.width / 2);
		Ypos = (screen.height / 2);

		Xwin = widthVar / 2;
		Ywin = heightVar / 2;

		X = Xpos - Xwin;
		Y = Ypos - Ywin - 50;

		newWin = window.open(url,name,"width="+widthVar+",height="+heightVar+",top="+Y+",left="+X+",location=0,resizable=0,status=1,titlebar=1,directories=0,toolbar=0,menubar=0,scrollbars=1");
		newWin.focus();
		onscreen = true;
	}

	function obtenerProvincia(dominio)
	{
		var form = document.publicacion;
		var indice = form.lugar.selectedIndex;

		if (indice==0){
       			alert("Debe seleccionar un lugar.")
	       		form.lugar.focus()
       			return 0;
    		} else {
			var id = form.lugar.options[indice].value;
			popupWindow(dominio + 'mapa/mapa.php?id='+ id,'','1100','700');
		}
	}

	function obtenerProvinciaupdate(dominio, id)
        {
                popupWindow(dominio + 'mapa/mapa.php?id='+ id,'','1100','700');
        }

	function eliminarMapa()
	{
		document.getElementById("textLoadedMap").style["display"] = "none";
		if (document.getElementById("textLoadedMap1")) document.getElementById("textLoadedMap1").style["display"] = "none";
	        document.getElementById("linkNewMap").style["display"] = "block";
		document.publicacion.coordenada_x.value = "";
		document.publicacion.coordenada_y.value = "";
	        var url = "/coordinates";
	        if (typeof XMLHttpRequest != "undefined") {
    		    req = new XMLHttpRequest();
	        } else if (window.ActiveXObject) {
        		req = new ActiveXObject("Microsoft.XMLHTTP");
	        }

        	req.open("GET", url, false);
	        req.send(null);
	}

