Locate your Senators and Representative
var geocoder112825100, map112825100, marker112825100, congressInitialized112825100 = false; function congressInitialize112825100(){ var latlng = new google.maps.LatLng(38.8987149, -77.03765550000003); var options = { zoom: 15, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; map112825100 = new google.maps.Map(document.getElementById("map_canvas112825100"), options); // GEOCODER geocoder112825100 = new google.maps.Geocoder(); // Marker marker112825100 = new google.maps.Marker({ map: map112825100, draggable: true }); marker112825100.setPosition(latlng); //Change to other address var address_center = "1600 Pennsylvania Ave, Washington, DC 20500"; geocoder112825100.geocode({"address": address_center}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { marker112825100.setPosition( results[0].geometry.location ); map112825100.panTo( results[0].geometry.location ); } } }); //Add listener to marker for reverse geocoding google.maps.event.addListener(marker112825100, "dragend", function (event) { jQuery("#jloader112825100").show(); geocoder112825100.geocode({"latLng": marker112825100.getPosition()}, function(results, status) { jQuery("#jloader112825100").hide(); if (status == google.maps.GeocoderStatus.OK) { if (results[0]) { jQuery("#congress_address112825100").val(results[0].formatted_address); getCongressData(results[0].formatted_address, 0, 112825100); } } }); }); jQuery("congress_address112825100").keyup(function(){ jQuery("congress_address112825100").removeClass(); }); } function getCongressFromAddress(f, atts_id, id){ var address = jQuery("#congress_address" + id).val(); var showon = jQuery("#congress_showon" + id).val(); if(!address || address == "" || address.length == 0) { jQuery("#congress_address" + id).addClass( "error" ); jQuery("#congress_holder" + id).html( "Missing Address!" ); return false; } jQuery("#jloader" + id).show(); window["geocoder" + id].geocode( { "address": address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { window["marker" + id].setPosition(results[0].geometry.location); window["map" + id].setCenter(results[0].geometry.location); getCongressData(address, atts_id, id); jQuery("#jloader" + id).hide(); } else { jQuery("#congress_holder" + id).html( "Couldn't find the address" ); jQuery("#jloader" + id).hide(); } }); return false; } function getCongressData(address, atts_id, id){ jQuery("#congress_holder" + id).html( jQuery("",{id:"jloader_"+id,src: jQuery("#jloader" + id).attr("src") }) ); var showon = jQuery("#congress_showon" + id).val(); var data = { action: "congress_get_api_data", security : security, atts_id: atts_id, showon: showon, address: address }; jQuery.post(ajaxurl, data, function(response) { if(response != "Error1" && response != "Error2"){ jQuery("#congress_holder" + id).html( response ); }else{ jQuery("#congress_holder" + id).html( "Address or zip code not found. Please try again.." ); } }); } jQuery(document).ready(function(){congressInitialize112825100();});