function gotoZoom(lat,lng,zoom) {
	map.setCenter(new GLatLng(lat, lng),zoom);
}

function zoomtopoint(lat,lng,zoom) {
	map.setCenter(GLatLng(lat, lng),zoom);
}

function MostraPostos(path) {
		var menu = 10;
		if (path>19) {var menu = path}
		
		new Ajax.Updater('postos','/mapa/includes/menu_postos.php', 
		{ 
		method:'get',
		parameters: {m: menu, p: path},
		onSuccess: function(transport){	var response = transport.responseText || "Ocorreu um Erro! (Nenhuma Resposta)";}, 
		onFailure: function(){ alert('Ocorreu um Erro!...') }
		}); 
		
		Element.show('postos');
		Element.hide('showeditcoord')
		Element.hide('form_preco');
		Element.hide('form_erro');
		Element.hide('pub');
		Element.hide('instaladores');
		Element.hide('login');
		var urlstr="/mapa/zero.php";
		var objFrame=document.getElementById("form_preco_i");
		objFrame.src=urlstr;
		var objFrame=document.getElementById("form_erro_i");
		objFrame.src=urlstr;
}

function EscondePostos() {
		Element.show('pub');
		Element.hide('showeditcoord')
		Element.hide('postos');
		Element.hide('instaladores');
		Element.hide('login');
		Element.hide('form_preco');
		Element.hide('form_erro');
}

function MostraInstaladores() {
		Element.show('instaladores');
		Element.hide('showeditcoord')
		Element.hide('form_preco');
		Element.hide('form_erro');
		Element.hide('postos');
		Element.hide('pub');
		Element.hide('login');
}

function MostraLogin() {
		Element.show('login');
		Element.hide('showeditcoord')
		Element.hide('form_preco');
		Element.hide('form_erro');
		Element.hide('instaladores');
		Element.hide('postos');
		Element.hide('pub');
}

function MostraForm_preco(id) {
		var objFrame=document.getElementById('form_preco_i');
		var urlstr="/mapa/form_preco.php?id="+id;
		objFrame.src=urlstr; 
		
		Element.show('form_preco');
		Element.hide('form_erro');
		Element.hide('showeditcoord')
		Element.hide('login');
		Element.hide('instaladores');
		Element.hide('postos');
		Element.hide('pub');
		
}

function MostraForm_erro(id) {
		var objFrame=document.getElementById('form_erro_i');
		var urlstr="/mapa/form_erro.php?id="+id;
		objFrame.src=urlstr;
		 
		Element.show('form_erro');
		Element.hide('showeditcoord')
		Element.hide('form_preco');
		Element.hide('login');
		Element.hide('instaladores');
		Element.hide('postos');
		Element.hide('pub');
		
}

function ShowEditCord(id) {
		releaseMarkers();
		var objFrame=document.getElementById('showeditcoord_i');
		var urlstr="/mapa/form_edit_coord.php?id="+id;
		objFrame.src=urlstr;
		
		Element.show('showeditcoord');
		Element.hide('form_erro'); 
		Element.hide('form_preco');
		Element.hide('login');
		Element.hide('instaladores');
		Element.hide('postos');
		Element.hide('pub');
		
}

function createpop(id,html,title,Xid) {
		var newdiv = document.createElement('div');
		newdiv.id = id;
		if (title) {
			var titulo= title;
		} else {
			var titulo="Bem vindo ao Mapa.Autogas.Pt";
		}
		if (html) {
			newdiv.innerHTML = "<div id=\"ifr_header\"><div class=\"bl\"><div class=\"br\"><div class=\"tl\"><div class=\"tr\"><div class=\"rbox\"><table width=\"100%\" border=0 cellpading=0 cellspacing=0><tr><td>"+titulo+"</td><td align=\"right\"><a href=\"#\" onclick=\"javascript:deletepop(\'"+id+"\');\"><img src=\"images/but_close.png\" alt=\"close\" width=\"84\" height=\"20\" border=\"0\" /></a></td></tr></table></div></div></div></div><div class=\"clear\">&nbsp;</div></div><iframe name=\"ifr_content\" id=\"ifr_content\" width=\"100%\" height=\"295\" scrolling=\"auto\" frameborder=\"0\" src =\""+html+".php?Xid="+Xid+"\"></iframe>";
		} else {
       		newdiv.innerHTML = "<iframe name=\"ifr_content\" id=\"ifr_content\" width=\"100%\" height=\"295\" scrolling=\"auto\" frameborder=\"0\" src =\"zero.php\"></iframe>";
		}
		document.body.appendChild(newdiv);
		new Draggable(newdiv, {});

}

function deletepop(id) {
  var d = document.getElementById(id);
  document.body.removeChild(d)
}