
jQuery.noConflict();

/*LS-9: Chrome issue Fix:wait till the images are loaded
 * Call the function on window load instead of document ready to fix
 * jQuery(document).ready(function() {
     unifyHeights();
   });
 */
jQuery(window).load(
  function() {
    unifyHeights();
  }
);

function unifyHeights()
{
  var maxHeight = 0;
  jQuery('div.list').each(function(){
    var height = jQuery(this).outerHeight();
    if ( height > maxHeight ) { maxHeight = height; }
  });
  jQuery('div.list').css('height', maxHeight);
}



//LANS-331
function recordOutboundLink(link, category, action) {
  var hostname = window.location.hostname;
  if (hostname.indexOf('lansinoh.com') > -1) {
    try {
      _gat._getTrackerByName()._trackEvent(category, action);
      //setTimeout('document.location = "' + link + '"', 100);
      setTimeout(dummyFunction, 100);
    } catch (err) {
    //silently catch the error
    //console.log('Error doing GA tracking: ' + err);
    }
  }
  //if not in production, nothing should happen here.
  return true;
}

$(function() {
  //LANS-331
  $('a[href^=http]').not('a[href*="lansinoh"]').addClass('external');
  $('a.external').attr('target', '_blank');
  //$('a.external').removeAttr('target');
  $('a.external').click(function() {
    var link = $(this).attr('href');
    return recordOutboundLink(link, 'leave-site', 'click');
  });
});
