var updated = false;
function save_street( nid, streetview)
{
//	console.log(nid);
//	console.log(streetview);

	if(myPano != 'undefined') {
	
		$("#street-result").html('saving...');
			
		var center = streetPov;
		var loc = streetLatLng;

//        myPano.setLocationAndPOV(loc, center);
	  
	    /*
		if(updated == true || type == 'update') {
			var url = "updatestreet.php?estid=" + nid + "&streetview=" + streetview + "&type=" +type;
		//   var url = Drupal.settings.basePath + "update_street/" + nid + "/" + loc.lat() + "/" + loc.lng() + "/" + center.yaw + "/" + center.pitch + "/" + center.zoom;
		}else {
		//   var url = Drupal.settings.basePath + "insert_street/" + nid + "/" + loc.lat() + "/" + loc.lng() + "/" + center.yaw + "/" + center.pitch + "/" + center.zoom;
		}
		*/
		var url = "/updatestreet.php?estid=" + nid + "&streetview=" + streetview;
		// add check to ensure street view is loaded
		$.ajax({
			type: "GET",
			url: url,
			data: '',
			success: function(msg){
				console.log("success");
				console.log(msg);
				
				updated = true;

				// change the street-result to show status
				$("#street-result").html(msg);
				
				streetLat  = loc.lat();
				streetLong = loc.lng();
				streetYaw = center.yaw;
				streetPitch = center.pitch;
				streetZoom = center.zoom;
				
				return 0;
			}
		});	 
	}
	
	return false;
}
/*
function processReturnedData(panoData) {
  if (panoData.code != 200) {
    GLog.write('showPanoData: Server rejected with code: ' + panoData.code);
    return;
  }
  alert(panoData.location.latlng.lat() + "," + panoData.location.latlng.lat());
  // Code to actually process the GStreetviewData object is contained here
  
}  
*/
