
  /* Helper functions, courtesy of
     http://www.movable-type.co.uk/scripts/latlong.html */

	// Keep an angle in [0,360]
	function fixAngle(a) {
	  while (a < 0) {
	    a += 360;
	  }
	  while (a >= 360) {
	    a -= 360;
	  }
	  return a;
	}

  function distance(lat1, lng1, lat2, lng2) {
    var a = Math.sin(lat1 * Math.PI / 180) * Math.sin(lat2 * Math.PI / 180);
    var b = Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) *
        Math.cos((lng2 - lng1) * Math.PI / 180);
    return 6371000 * Math.acos(a + b);
  }
  
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}


function logger(logentry) {
	
	return;

	if(window.console && window.console.firebug)
	{
	console.log(logentry);
	}
}
