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


// added by sr (from "Rails Cookbook" p.319)
Ajax.Responders.register({
  onCreate: function() {
    if($('ajax_processing') && Ajax.activeRequestCount>0)
      Effect.Appear('ajax_processing',{duration:0.5,queue:'end'});
  },
  onComplete: function() {
    if($('ajax_processing') && Ajax.activeRequestCount==0)
      Effect.Fade('ajax_processing',{duration:0.5,queue:'end'});
  }
});

// work around for showing non ajax animation gif in IE7
function show_progress(type, spinner_id){

    var pg = document.getElementById(spinner_id);
    
    if(pg) {
      pg.style.display = 'block';
    }
    if(type == 'decode_csr'){
      var image = "/images/decode_csr.gif"
    }
    else if(type == 'bar'){
      var image = "/images/spinner_bar.gif"
    }
    else if(type == 'circle'){
      var image = "/images/spinner_circle.gif"
    }
    //var image = "/images/processing_bar2.gif";
    setTimeout('document.images["' + spinner_id + '"].src = src="' + image + '"', 200);

}
