// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function setElementDimensions(elm, w, h){
	if( elm != undefined && elm.style != undefined) {
		if (elm.style.width!=w){
			elm.original_width = elm.style.width;
			elm.style.width = w;
		}
		if (elm.style.height!=h){
			elm.original_height = elm.style.height;
		 	elm.style.height = h;
		}
	}
}
function restoreElementDimensions(elm){
	if( elm != undefined && elm.style != undefined) {
		if (elm.original_width != undefined){
			elm.style.width = elm.original_width;
		}
		if (elm.original_height != undefined){
			elm.style.height = elm.original_height;
		}
	}
}
function toggleCalendarLoading(){
	['calendar_month', 'calendar_loading'].each(
		function(value, index){
			Element.toggle($(value), 'appear');
		}
	);
}

Event.observe(document, 'click', function(event) {
  var element = $(Event.element(event)).up('#map_div'); 
  var map_div = $('map_div');
  if (element == map_div){
    setElementDimensions(map_div, "334px", "274px");
  }
  else{
    restoreElementDimensions(map_div);
  }
});