$(function(){
  
  // Initialize the nav... delay a bit then fade in
  $('#region_map_nav').delay(600).fadeIn(400);
  
  // map list toggle
  $('span#region_map_toggle').click(function(){
    $('span#region_map_toggle').toggleClass('expanded');
    $('ul#region_map_list').toggle();
  });
  
  // map link/area hover behavior
  $('ul#region_map_list a, #region_imagemap area').each(function(){
    
    // map #id is in rel attribute
    // And no, area tags with rel do not validate but they make the most sense
    var rel = $(this).attr('rel');
    
    if(rel) {
      
      var regionSelector = '#'+rel;
      
      $(this).hover(
        function(){ // hover in
          try {
            $(regionSelector).fadeIn('fast');
          } catch(e) {}
        },
        function(){ // hover out
          try {
            $(regionSelector).fadeOut('fast');
          } catch(e) {}
        }
      );
    }
  });
  
  // Initialize the starbox
  $('#home_box_4 .star-box').starBox();
  
});