
$(document).ready(function () {

  $('#primary a').each(function () {
    var hreflink = $(this).attr("href");
    if (hreflink.substr(hreflink.lastIndexOf("/")+1,hreflink.length)==location.href.substr(location.href.lastIndexOf("/")+1,location.href.length)) {
      $(this).parent("li").addClass("active");
    }
  });
  
  $('.side-nav a').each(function () {
    var hreflink = $(this).attr("href");
    if (hreflink.substr(hreflink.lastIndexOf("/")+1,hreflink.length)==location.href.substr(location.href.lastIndexOf("/")+1,location.href.length)) {
      $(this).parent("li").addClass("active");
    }
  });

  var os = [
    'iphone',
    'ipad',
    'windows',
    'mac',
    'linux'
  ];

  var match = navigator.appVersion.toLowerCase().match(new RegExp(os.join('|')));
  if (match) {
    $('body').addClass(match[0]);
  };

  $.each($.browser, function(b) {
    $('body').addClass(b);
    //$('body').addClass($.browser.version);
    return false;  
  });
  
  //var offer = $(".hello-offer a.offer-item").get().sort(function(){ 
  //  return Math.round(Math.random())-0.5; //random so we get the right +/- combo
  //}).slice(0,1)
  //$(offer).css("display", "block");
  
  $('.hello-offer #offerlist').innerfade({
    speed: 2000,
    timeout: 6000,
    type: 'sequence',
    containerheight: '38px'
  });

});

