/* add this code within the page to create a make appt link - 
   <a href="/appointments" id="make_appt_tab">Make an appointment</a>
*/

jQuery.fn.makeApptTab = function(settings) {
  settings = jQuery.extend({
    min: 1,
    fadeSpeed: 200,
    ieOffset: 50
  }, settings);
  return this.each(function() {
    //listen for scroll
    var el = $(this);
    el.css('display','none'); //in case the user forgot
    $(window).scroll(function() {
/*
      if(!jQuery.support.hrefNormalized) {
        el.css({
          'position': 'absolute',
          'top': $(window).scrollTop() + $(window).height() - settings.ieOffset
        });
        return;
      }
*/
      if(!jQuery.support.hrefNormalized) {
        el.css({
          'display': 'none'
        });
        return;
      }
      if($(window).scrollTop() >= settings.min) {
        el.fadeIn(settings.fadeSpeed);
      } else {
        el.fadeOut(settings.fadeSpeed);
      }
    });
  });
};

$(document).ready(function() {
  $('#make_appt_tab').makeApptTab({
    fadeSpeed: 500
  });
});

