function feature_box(element_id) {
    
  var fb = this;

  var source_content_host = "wwwnewswiscedu"
  //var source_content_host = "nwnewswiscedu"
  var feature_box = $(element_id);
  var feature_previews = feature_box.find(".feature_preview");
  var jquery_feature_previews = [];
  var index_of_currently_selected_feature = 0;
  var auto_rotation_is_paused = false;
  var max_rotations_before_pause = 10;
  var rotate_counter = 0;
  var time_in_between_rotations_in_ms = 7000; // 7 seconds
  var preview_click_has_been_registered = false;
  video_is_playing = false;
  var need_to_load_rest_of_features = true;
  
  //// 
  // Initial set up for each of the preview images, 
  //   including doing an initial hide of all of 
  //   the large feature divs
  fb.init = function() {
    feature_previews.each(function(index){
      var preview = $(this);
      var feature = $("#" + preview.attr("rel"));
      jquery_feature_previews.push(feature);
      if(index != 0) {
        feature.hide();
      }    
      preview.hover(function(){ // Set up hover behavior for feature previews
          fb.showLabel(preview);
        }, function(){
          fb.hideLabel(preview);
      });
      preview.click(function(){ // Set up click behavior for feature previews
        preview_click_has_been_registered = true;
        if(fb.checkIfFeatureIsReady(preview)) {
          fb.rotateFeature(preview);
        } else {
          fb.loadRemainingFeatures();
          setTimeout(function(){fb.rotateFeature(preview);}, 300);
        }
        fb.pauseAutorotation();
        return false;
      });
    }); 
    
      // Set up pause of autorotation when user hovers over main feature
    $("#feature_well").hover(function(){
        fb.pauseAutorotation();
      }, function(){
        if(preview_click_has_been_registered == false && video_is_playing == false) {
          fb.unpauseAutorotation();
        }
    });
    
    // Load the rest of the main features
    setTimeout(function(){fb.loadRemainingFeatures();}, 2000); 
    
    // Set up initial autorotation
    setInterval(function(){fb.autorotate()}, time_in_between_rotations_in_ms);  // Will run as soon as the function is called
  }
  
  fb.checkIfFeatureIsReady = function(p) {
    var preview = $(this);
    var feature = $("#" + preview.attr("rel"));
    if(feature.length > 0) {
      return true;
    } else {
      return false;
    }
  }
  
  ////
  // Fade out all the features, and fade in the one we're interested in
  fb.rotateFeature = function(f) {
    $(".feature_preview").removeClass('selected');
    var rotating_to_element = $("#" + f.attr("rel"));
    for(var i=0;i<jquery_feature_previews.length;i++) {
      if((jquery_feature_previews[i].css("display") != "none")
        &&(jquery_feature_previews[i].attr("id") != rotating_to_element.attr("id"))) {
        jquery_feature_previews[i].fadeOut();
      }
    }
    $(f).addClass('selected');
    rotating_to_element.fadeIn();
  }
  
  ////
  // If we're here, JS is certainly enabled so go get the rest of the features
  fb.loadRemainingFeatures = function() {
    if(need_to_load_rest_of_features == true) {
      var number_of_feature_previews = feature_previews.length;
      for(var i=2;i<=number_of_feature_previews;i++) { // skip the 1st one, it's already loaded
        $.ajax({
          url: "/content/features/" + source_content_host + "_feature_" + i + ".php",
          success: function(data) {
            $("#feature_well").append(data);
            jquery_feature_previews = [];
            feature_previews.each(function(index){
              var preview = $(this);
              var feature = $("#" + preview.attr("rel"));
              jquery_feature_previews.push(feature);
            });
          }
        });
      } 
    }
    need_to_load_rest_of_features = false;
  }
  
  ////
  // The next feature to be called for autorotation
  fb.nextIndex = function() {
    var next_index = index_of_currently_selected_feature + 1;
    if(next_index >= feature_previews.length) {
      next_index = 0;
    }
    return next_index;
  }
  fb.nextFeature = function() {
    var next_index = fb.nextIndex();
    var next_feature = $(feature_previews[next_index]);
    return next_feature;
  }
  
  ////
  // For all things autorotation (including pausing and unpausing) 
  fb.autorotate = function() {
    if((! fb.is_paused()) && (! fb.max_rotations_reached())) {
      var next_feature = fb.nextFeature();
      fb.rotateFeature(next_feature);
      rotate_counter = rotate_counter +1;
      //alert(rotate_counter);
      index_of_currently_selected_feature = fb.nextIndex();
    }
  }
  fb.is_paused = function() {
    return auto_rotation_is_paused;
  }
  fb.pauseAutorotation = function() {
    auto_rotation_is_paused = true;
  }
  fb.unpauseAutorotation = function() {
    auto_rotation_is_paused = false;
  }
  fb.max_rotations_reached = function() {
    if (rotate_counter >= max_rotations_before_pause) {
      fb.pauseAutorotation();
      return true;
    } else {
      return false;
    }
    //return rotate_counter >= max_rotations_before_pause;
  }
  
  //// 
  // Show / hide the label associated with the preview image 
  fb.showLabel = function(f) {
    if( $(f).find("span.complex_title").length > 0 ) {
      $(f).append('<span class="label">' + $(f).find('span.complex_title').html() + '</span>'); 
    } else {
      $(f).append('<span class="label">' + $(f).children('img').attr('title') + '</span>'); 
    }
  }
  fb.hideLabel = function(f) {
    $(f).children('span.label').remove();
  }
  
  fb.init();
  return fb;
}



