/**
 * Application-Wide Javascript
 */

/**
 * Unobtrusive Javascript
 * - Keep the views clear of javascripts by 
 *   working on the DOM when ready
 */ 
$(document).ready(function() {

  // create hover effect for image submit buttons
  $('.submit-button').hover(
    function() {
      $(this).fadeTo(1, 0.5);
    },
    function() {
      $(this).fadeTo(250, 1);
    }
  );
});
 
/**
 * Country With States
 * - tests the country id and shows the 
 *   canadian provinces or american states
 *
 * @param integer : based on the country id from the drop down in the form.
 */ 
function countryWithStates(countryID) {
  // 38   => Canada
  // 221  => United-States
  
  // ensure we can access the element
  if ($('FormCountryStates')) {
    if (countryID == '38' || countryID == '221') {
      if ($('FormCountryStates').visible() == false) {
        Effect.Appear($('FormCountryStates'), {duration: 0.75});
      }
    } else {
      if ($('FormCountryStates').visible() == true) {
        Effect.Fade($('FormCountryStates'), {duration: 0.75});
      }
    }
  }
}