/*
$Id: fixes.js,v 1.1 2008/11/18 11:23:32 max Exp $
vim: set ts=2 sw=2 sts=2 et:
*/

/*
  Position:absolute elements will not move when window is resized if a sibling contains float elements and a clear:both element
  https://bugzilla.mozilla.org/show_bug.cgi?id=442542
  FireFox 3.0+
*/
if (navigator.userAgent.toLowerCase().search(/firefox\/(3\.\d+)/i) != -1 && typeof(window.$) != 'undefined') {
  $.event.add(
    window,
    'resize',
    function() {
      var h = document.getElementById('header');
      if (!h || $(h).css('position') != 'absolute')
        return;

      document.getElementById('header').style.position = 'static';

      setTimeout(
        function() {
          document.getElementById('header').style.position = 'absolute';
        },
      20);
    }
  );
}


$(document).ready(function() {

  var document_href = document.location.href;
  var location;
  if (document_href.match('/home.php')) {
    location = '/home.php';
  } else if (document_href.match('/radioshows')) {
    location = '/radioshow';
  } else if (document_href.match('/information')) {
    location = '/information';
  } else if (document_href.match('/aboutus')) {
    location = '/aboutus';
  } else if (document_href.match('/contact')) {
    location = '/help.php'; //matches contact us
  } else if (document_href.match('/search.php')) {
    location = '/search.php';
  } else if (document_href.match(/[^-]*-[^-]*-[^-]*-[^-]*\.html/)) {
    location = '/search.php';
  } else if (document_href.match('/help.php')) {
    location = '/help.php';
  } else {
    location = 'not_matched';
  }
  
  
  $(".tabs ul li a").each(function() {
    if (this.href.match(location)) {
      $(this).css('font-weight','bold');
      $(this).css('color','#ffffff');
    } 
  });


  if (document_href.match('/radioshows')) {
    location = '/radioshow';
  } else if (document_href.match('/information/whats-new')) {
    location = '/information/whats-new';
  } else if (document_href.match('/information/tips')) {
    location = '/information/tips';
  } else if (document_href.match('/information/tip')) {
    location = '/information/tips';
  } else if (document_href.match('/information/science/tip')) {
    location = '/information/tips';
  } else if (document_href.match('/information/recipes')) {
    location = '/information/recipes';
  } else if (document_href.match('/information/science')) {
    location = '/information/science';
  } else if (document_href.match('/aboutus/sponsors')) {
    location = '/aboutus/sponsors';
  } else if (document_href.match('/aboutus/press-room')) {
    location = '/aboutus/press-room';
  } else if (document_href.match('/aboutus/contest')) {
    location = '/aboutus/contest';
  } else if (document_href.match('/aboutus')) {
    location = '/aboutus';
  } else if (document_href.match('/contact/appearances')) {
    location = '/contact/appearances';
  } else if (document_href.match('/contact/events')) {
    location = '/contact/events';
  } else if (document_href.match('/search.php')) {
    location = '/search.php';
  } else if (document_href.match('/help.php')) {
    location = '/help.php';
  } else {
    location = 'not_matched';
  }

  $(".info_menus ul li a").each(function() {
    if (this.href.match(location)) {
      $(this).css('font-weight','bold');
    } 
  });
});
