/*********************************************************************************************\
*       COPYRIGHT © 2011 ENVISION INFORMATION TECHNOLOGIES, LLC.    ALL RIGHTS RESERVED.      *
*       DISTRIBUTION, UNAUTHORIZED USE AND MODIFICATION IS STRICTLY PROHIBITED                *
*       ENVISION IT, MADISON, WI    http://www.envisionitllc.com   info@envisionitllc.com     *
\*********************************************************************************************/

$(window).load(function (){
  var size_multiplier = 2; // This is the size added, so 2 = normal + (2 * size size)
  var animation_time = 1000;
  var $featured_suppliers_link = $('#featured_suppliers_link');
  var $featured_suppliers_link_image = $featured_suppliers_link.find('img');
  var featured_suppliers_width = $featured_suppliers_link_image.width();
  var featured_suppliers_height = $featured_suppliers_link_image.height();
  var $image_overlay = $featured_suppliers_link.clone();
  var $image_overlay_image = $image_overlay.find('img');
  $image_overlay
    .attr('id','featured_suppliers_overlay')
    .css('position', 'absolute')
    .offset($featured_suppliers_link_image.offset());
  $('body').append($image_overlay);
  $image_overlay.animate({
    left: '-=' + (featured_suppliers_width * size_multiplier / 2),
    top: '-=' + (featured_suppliers_height * size_multiplier / 2)
  }, animation_time, function () {
    $featured_suppliers_link_image.addClass('has_box_shadow');
    $image_overlay.animate({
      left: '+=' + (featured_suppliers_width * size_multiplier / 2),
      top: '+=' + (featured_suppliers_height * size_multiplier / 2)
    }, animation_time, function () {
      $image_overlay.remove();
    });
  });
  $image_overlay_image.animate({
    width: '+=' + (featured_suppliers_width * size_multiplier),
    height: '+=' + (featured_suppliers_height * size_multiplier)
  }, animation_time, function () {
    $image_overlay_image.animate({
      width: '-=' + (featured_suppliers_width * size_multiplier),
      height: '-=' + (featured_suppliers_height * size_multiplier)
    }, animation_time);
  });
});
