	var map;
	var myConn = new XHConn();
	var last_elmid = "";
	if (!myConn) alert("XMLHTTP not available. Please try a newer/better browser, we recommend FireFox");

	var fnWhenDone = function (oXML) {
		eval(oXML.responseText);
	};

	function loadMap() {

		var latlon = new LatLon(39.707186656827, -94.5703125);
		map = new Map("mapContainer", "phonebackr", latlon, 15);

		map.enableKeyboardShortcuts( true );

		map.addTool( new PanTool(), true );

		map.addWidget(new NavigatorWidget());
		map.addWidget(new SatelliteControlWidget());



	}

	function plotLocation(lat, lon, phone, title, body) {

		mlatlon = new LatLon(lat, lon);
		marker = new CustomPOIMarker( (phone), (' '+title), (body), '0xFF0000', '0xFFFFFF' );
		map.addMarkerByLatLon( marker, mlatlon);

	}

	function reverseLookup(phone) {


		if (check_usphone(phone) == false || !phone) {

			if (!phone)
				alert("Please enter a valid US telephone number into the search field.");
			else
				alert("The telephone number you've\r\nsubmitted does not appear to be \r\na valid US telephone number.");

		} else {
			document.getElementById('status').innerHTML = "<center><img src=http://www.phonebackr.com/images/ajax-loader.gif> Reverse Telephone Lookup for  "+phone+"</center>";
			myConn.connect("http://www.phonebackr.com/reverse-lookup.php", "GET", "p="+escape(phone), fnWhenDone);
		}
	}

	function resetMap() {

		if(confirm('Are you sure want to reset the map?')){

			normalize();
					
		}
	}

	function clearMap() {

		if(confirm('Are you sure want to clear the map of all marked locations?')){

			map.removeAllMarkers();
			normalize();
		
		}
	}

	function check_usphone(phonenumber,useareacode)
	{
		if(!useareacode)useareacode=1;
		if((phonenumber.match(/^[ ]*[(]{0,1}[ ]*[0-9]{3,3}[ ]*[)]{0,1}[-]{0,1}[ ]*[0-9]{3,3}[ ]*[-]{0,1}[ ]*[0-9]{4,4}[ ]*$/)==null) && ((useareacode!=1) && (phonenumber.match(/^[ ]*[0-9]{3,3}[ ]*[-]{0,1}[ ]*[0-9]{4,4}[ ]*$/)==null))) return false;
		return true;
	}
	
	function normalize() {
	
		mlatlon = new LatLon(39.707186656827, -94.5703125);
		map.setCenterByLatLonAndZoom(mlatlon, 15, 15);	
		
		map.enableKeyboardShortcuts( true );
		
		map.addTool( new PanTool(), true );

		map.addWidget(new NavigatorWidget());
		map.addWidget(new SatelliteControlWidget());
	}