// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
  window.onload = func;
  } else {
  window.onload = function() {
    oldonload();
    if (typeof func == "function") {
      func();
      }
    }
  }
}

function showGmap(element_id, lat,lon) {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById(element_id));
    map.setCenter(new GLatLng(lat,lon), 13);
    var point = new GLatLng(lat, lon);
    map.addOverlay(new GMarker(point));
  }
}

function updateToUserId(element, selectedUser) {
  $('message_to_user_id').value = selectedUser.id;
}

function updateContents(element, contents) {
  $(element).update(contents)
}

