	function MascaraCEP(campo, teclaPress) { if (window.event){ var tecla = teclaPress.keyCode; } else { tecla = teclaPress.which; } var s = new String(campo.value); s = s.replace(/(\.|\(|\)|\/|\-| )+/g,''); tam = s.length + 1; if (tam > 5 && tam < 7) campo.value = s.substr(0,5) + '-' + s.substr(5, tam); }
	function digitos(event){ if (window.event) { key = event.keyCode; } else if (event.which) { key = event.which; } if( key == 13 ) { buscaCep(); } if (key != 8 || key != 13 || key < 48 || key > 57) return (((key > 47) && (key < 58)) || (key == 8 ) || (key == 13)); return true; }
	function buscaCEP(){
		var maisProximo = 999999999999999999999999999;
		var ponteiro = 0;
		if( jQuery("#cep").val() ) {
			if ( geocoder ) {
				geocoder.getLatLng(jQuery("#cep").val()+", Brasil",
					function(point){
						if ( !point ) {
							alert(endereco + "\nCEP nao localizado");
						} else {
							var bo = new GLatLngBounds();
							var dist = "";
							for(i=1;i<=totalCampos;i++){
								var distancia = parseInt(point.distanceFrom(window["point" + i]).toFixed(0));
								dist += i + "=>"+distancia+"=>"+maisProximo+"\n";
								if( parseInt(distancia) <= maisProximo ) {
									maisProximo = parseInt(distancia);
									ponteiro = i;
								}
							}
							bo.extend(point);
							bo.extend(window["point" + ponteiro]); 
							map.setCenter(bo.getCenter(), (map.getBoundsZoomLevel(bo)-1))
							var msgMapa = "CEP: "+jQuery("#cep").val();
							var marca = new GMarker(point);
							map.addOverlay(marca);
							
							var verdade = true;
							var over = GEvent.addListener(marca, "mouseover", function() {
								marca.openInfoWindowHtml(msgMapa);
								verdade = true;
							});
							var cli = GEvent.addListener(marca, "click", function() {
								marca.openInfoWindowHtml(msgMapa);
								verdade = false;
							});
							marca.openInfoWindowHtml(msgMapa);
							interatividadeUsuario();
						}
				});
			}
		} 
	}
	function makeLatLngsFromArray(a_el){
	  var res=[];
	  for(var i=0;i<a_el.length;i++){res[i]=new GLatLng(a_el[i][0],a_el[i][1])};
	  return res;
	}
	function exibeMapa(latitude, longitude, local, texto){ 
		if (GBrowserIsCompatible()) { 
			var map = new GMap2(document.getElementById("mapa_"+local)); 
			var point = new GLatLng(latitude, longitude); 
			var marca = new GMarker(point); 
			map.addOverlay(marca); 
			var verdade = true; 
			var over = GEvent.addListener(marca, "mouseover", function() { 
				marca.openInfoWindowHtml(texto); verdade = true; 
			}); 
			var cli = GEvent.addListener(marca, "click", function() { 
				marca.openInfoWindowHtml(texto); verdade = false; 
			}); 
			marca.openInfoWindowHtml(texto); 
			map.addControl( new GLargeMapControl3D() ); 
			map.setCenter(point, 13, custommap); 
		} 
	}
		
	function mostraMapa(elemento, latitude, longitude, local, texto){ 
		var campo = "#scroll_"+local; 
		var elemento = "#link_"+local;
		var mapa = "#mapa_"+local;
		if (jQuery(campo).is(":hidden")) {
			var t = setTimeout("exibeMapa("+latitude+", "+longitude+", "+local+", \""+texto+"\")", "300"); 
			jQuery(campo).slideDown(); 
			jQuery(elemento).text("Fechar mapa");
		} else { 
			jQuery(campo).slideUp("fast"); 
			jQuery(campo).html("<div id=\"mapa_"+local+"\" class=\"map estado sub_mapa\"></div>");
			jQuery(elemento).text("Mostrar laboratório no mapa");
		} 
	}
	
	function XMLHTTPRequest() { 
		var xmlhttp = 0;
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		} else {
			try { 
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try { 
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) { 
					xmlhttp = false; 
				} 
			}
		} 
		return xmlhttp; 
	}

	function ajaxExibirMapas() {
		var http = XMLHTTPRequest();
		var opt = jQuery("#form_cep").html();
		if (http) {
			http.onreadystatechange = function() {
				if (http.readyState == 1) {
					jQuery("#form_cep").html("<div class='map_carregando'><img src=\"/wp-content/themes/v1/images/ajax-loader.gif\" alt='Carregando'>Carregando os laboratórios. <br />Por favor aguarde...</div>");
				}if (http.readyState == 4) {
					if (http.status == 200) {
					    var novo = document.createElement("script");
						novo.text = http.responseText;
						document.body.appendChild(novo);
						mostraLocais();
						jQuery("#form_cep").html(opt);	
					}
				}		
			}
			http.open("GET", "/wp-content/themes/v1/pj_mapas_sessao.php", true);
			http.send(null);
		}
		else {
			alert('Erro seu navegador nao suporta ajax');
		}
	}
	
	function removerInteratividade(){
	}
	function interatividadeUsuario(){ 
	}
