﻿

$(document).ready(function() {


  // bubble arrows
	if (jQuery.support.boxModel = true) {
  	$('#buffet ul').each(function() {
      $(this).append('<li class="tail">&nbsp;<\/li>');
    });
  }

  // winner tooltip/hover animations
  
  $('#buffet ul').css({
    'opacity' : 0,
    'top' : 120
  });
  $('#buffet li').hover(function() {
  
    var $this = $(this);
    
    var winner_img = $this.children('a.won').css('background-image');
  
    $this.children('ul').show().animate({
      'opacity' : 1,
      'top' : 144
    },150);
        
    $this.children('a.won').children('span').css({
      'background-image'    : winner_img,
      'background-repeat'   : 'no-repeat',
      'background-position' : 'left -110px'
    }).animate({
      'opacity' : 1
    },150);
  
  },function() {
  
    var $this = $(this);
  
    $this.children('ul').animate({
      'opacity' : 0,
      'top' : 130
    },150, function() {
      $(this).hide();
    });
    
    $this.children('a.won').children('span').animate({
      'opacity' : 0
    },150);
  
  });
  
  $('#buffet li').click(function(){
    var $item_url = $(this).children('a.won').attr('href');
    if ($item_url != null) {
      window.location = $winner_url;
    }
  });
  
  
});

