//	Removes GM 36,000 mile odometer limit - Luke McReynolds, luke@lukemcreynolds.com, 4/16/09. Also done for Nissan.
// $(document).ready(function() {
//   
//   $('#Quote').submit(function() {
//     var $form = $(this),
//         $odometer = $form.find('#odometer'),
//         mileage = parseInt($odometer.val(),10) || 0,
//         make = $form.find('#make_model').val().toLowerCase();
// 
//     var fifty = /buick|saab|hummer|cadillac/.test(make),
//         threesix = /chevrolet|pontiac|saturn|gmc/.test(make);
//     
//     
//     if ((mileage > 50000 && fifty) || (mileage > 36000 && threesix)) {
//       $form.html('<p class="note"><strong>Your odometer reading indicates that your new-car warranty from the factory has expired.</strong><br>Fortunately, your vehicle still qualifies for complete protection through one of our A+ superior affiliate companies.<br>Call <strong>1-866-255-5546</strong> now for your free price quote.</p>').find('p').slideDown();
//     }
// 
//   });
// });



//hide link to current 
$(document).ready(function() {
  var url = location.hostname;
  $('#links a').each(function(index) {
    var link = this.href;
    if (link.slice(7,-1) == url) {
      $(this).parent('li').hide();
    }
  });
});

// play media files on page load


$(document).ready(function() {
  if ($('a.media').length) {
    if (jQuery.cookie) {
      var c = location.pathname.slice(1) || 'index';
    
      if ($.cookie(c) == 'userplay') {
        $('a.media').media({mp3Player:'mediaplayer.swf', height:'36px',width: '300px'}); 
      } else {
        $('a.media').media({autoplay: true, mp3Player:'mediaplayer.swf', height:'36px',width: '300px',flashvars: {autostart: true} }); 
        $.cookie(c, 'userplay', {expires: 30, path: '/'});
      }
    } else {
      $('a.media').media({autoplay: true, mp3Player:'mediaplayer.swf', height:'36px',width: '300px',flashvars: {autostart: true} }); 
    }
  }
});

// open popup links in new window
$(document).ready(function() {
  $('a.popup').click(function() {
    var thisHref= this.href;
    window.open(thisHref,'popup','width=480,height=580');
    return false;
  });
});

$(document).ready(function() {

// make content column as tall as nav column
  var alphaHeight = $('#alpha').height();
  if (alphaHeight > $('#content').height() ) {
    // $('#content').height(alphaHeight-20);
  }
// NEWS FEED
  $('#news-feed a:not(.rw)').each(function(index) {
    var titleText = $(this).text();
    if (/(police|fail|cut|loss|dead|stole|steal|accident|falls|stall)/gi.test(titleText)) {
      $(this).parents('div.news-item').remove();
    }
    var linkText = titleText.slice(0,titleText.lastIndexOf('-')-1);
    linkText = linkText.replace('&quot;','\"','g');
    var source = titleText.slice(titleText.lastIndexOf('-'));
    $(this).text(linkText);
    $(this).after('<br />' + source);
  });
  $('#news-feed').find('div.news-item:gt(4)').remove();
});