$().ready(function() {
	$('input.geoautoinput').geo_autocomplete(new google.maps.Geocoder, {		
		mapkey: 'ABQIAAAANA-fGZUQYouMoFq2xw5nXxSqDrVuBWSCyRCYK0ydf8QNoqNTYBTIz6y8nIjxPXOPC8GuXgtFKxymSg', 
		selectFirst: false,
		minChars: 3,
		cacheLength: 50,
		width: 198,
		scroll: true,
		scrollHeight: 330
	}).result(function(_event, _data) {
		//alert(_data);
		datade = _data;
		//viewObj(_data.address_components)
		address = '';
		/*$.each(_data.address_components, function(index, value) { 
			alert(value.long_name);
		address += value.long_name;
		});*/
		//alert(address);
		$(this).val(_data.formatted_address);
		//document.getElementById("address1").value = _data.formatted_address;
		
		//if (_data) map.fitBounds(_data.geometry.viewport);
		//alert(map.fitBounds(_data.geometry.viewport));
	});	
	
	function viewObj(obj){
		$.each(obj, function(index, value) { 
			if(typeof(value)== 'object'){
				alert(index + ': ' + value); 
				if(confirm("View Obj : " + index)){
					viewObj(value)	   
				}
			}else{
				alert(index + ': ' + value); 
			 }
		});
	}
	
});
