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

// Generates a jQuery datepicker for any DOM
// element that has an id and class of datepicker
// so long as the jQuery and jQuery datepicker are
// available.
if (typeof jQuery != 'undefined' && typeof jQuery.datepicker != 'undefined') {
  $(window).load(function() {
    jQuery.datepicker.setDefaults({ 
      "buttonImage" : "/images/calendar-icon.png",
      "constrainInput": false ,
      "dateFormat" : "yy-mm-dd", 
      "showAnim" : "slideDown", 
      "showOn" : "button"
      });
    jQuery(".datepicker[id]").map(function(i) { jQuery("#"+this.id).datepicker(); });
  });
};

// Attach a carousel but only if the jQuery and jQuery carousel is loaded.
if (typeof jQuery != 'undefined' && typeof jQuery().tinycarousel != 'undefined') {
  jQuery(document).ready(function(){
    jQuery('#slider-code').tinycarousel({ pager: false });	
  });
};
