/*
	Module to get Height by latitude / longitude
	Use:
	ClientHeightRequest.GetHeight( 52.40, 5.66, function( Height ){ alert( 'Height is: ' + Height ) } );
	@in2sports jan 2008
*/

function ClientHeightRequest( lat, lng, callback ){
	this.Lat = lat;
	this.Lng = lng;
	this.Callback = callback;
	this.Url = 'HoogteBepaling.php?lat=[lat]&lng=[lng]';

	this.Url = this.Url.replace( '[lat]', this.Lat );
	this.Url = this.Url.replace( '[lng]', this.Lng );
	this.Height = null;
}

ClientHeightRequest.prototype.Execute = function(){
	var self = this;
	jQuery.getJSON( this.Url, {}, function( json ){
		try {
			self.Height = json.Height;			
		} catch (e) {
			//alert(e); 
		}
    self.Callback( self.Height );
	});
}

ClientHeightRequest.GetHeight = function( lat, lng, callback ){
	var requester = new ClientHeightRequest( lat, lng, callback );
	requester.Execute();
}
