// @auth ghunt
// @name brand.js
// @desc sets up the branding at the top
// @change
//   2011-10-19 ghunt
//     initial file creation

jQuery(document).ready(function() {
  if(jQuery('title').html()) {
    if(jQuery('title').html().match(/American.Tourister/) != null)
      switchBrands();
  }
});

function switchBrands() {
  // switches over to AT branding
  var j = jQuery.noConflict();
  j('body').addClass('at');  

  // update samsonite
  j('#brandSamsonite').removeClass('active');
  var sm_old = j('#brandSamsonite img').attr('src');
  var sm_new = sm_old.replace('.jpg', '_off.jpg');
  j('#brandSamsonite img').attr('src', sm_new);
  
  // update american tourister
  var at_old = j('#brandAT img').attr('src');
  var at_new = at_old.replace('_off.jpg', '.jpg');
  j('#brandAT img').attr('src', at_new);
  
  // update logo images
  j('#brandLogo a').attr('href', '/info/American_Tourister');
  var oldSrc = j('#brandLogo img').attr('src');
  var newSrc = oldSrc.replace('/common/Samsonite_Logo.jpg', '/icons/logo_american_tourister.png');
  j('#brandLogo img').attr('src', newSrc);
}
