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


// will_paginate ajaxification
// mislav gives this as the right way to ajaxify will_paginate
// http://wiki.github.com/mislav/will_paginate/ajax-pagination
document.observe("dom:loaded", function() {
  // the element in which we will observe all clicks and capture
  // ones originating from pagination links
  var container = $(document.body)

  if (container) {
/*
    var img = new Image
    img.src = '/images/spinner.gif'

    function createSpinner() {
      new Element('img', { src: img.src, 'class': 'spinner2' })
    }
*/
    container.observe('click', function(e) {
      var el = e.element()	  
      if (el.match('.pagination a')) {
//        el.up('.pagination').insert(createSpinner())
		$('spinner').show()
		addToAjaxHistory(el.href)
        new Ajax.Request(el.href, { method: 'get' })
        e.stop()
//		$('spinner').hide()
      }
	  return false
    })
  }
})


function calculateSiteAnnouncementsHeight(){
	finalHeight = $('site_announcements_inner').getHeight();
	$('site_announcements_inner').setStyle( { height: finalHeight + 'px' });
}
