/*
Interactive Banner 
2009 Bartosz Lewandowski
bartek@leniwce.com
*/

var x,y;

jQuery(document).ready(function(){
   $().mousemove(function(e){
      x = e.pageX;
      y = e.pageY;
   }); 
})

$(document).ready(function() 
{
  $("#banner-images").children().hide();
  $("#banner-preview").hide();
  var first = $("#banner-images").children(':first');
  $(first).fadeIn();
  var active = first;
  function anim()
  {   
     $(active).fadeOut("normal",
      function () 
      { 
        var next = $(active).next();
        if  (next.attr('id')!=null) active=next; else active=first;
        $(active).fadeIn("normal"); 
      });
   setTimeout(anim,5000);
  }
  setTimeout(anim,5000);
  
  $(".banner-li").mouseover( 
    function() 
    {
        var pos = $("#banner").offset();
       //$("#banner-preview").css( { "left": (pos.left + 320) + "px", "top":(pos.top+1) + "px" } );
        $("#banner-preview").css( { "left": (x) + "px", "top":(y) + "px" } );
       
       $("#banner-preview").html($(this).attr("info"));
       $("#banner-preview").show();
    }
  ).mouseout(function() {$("#banner-preview").hide();} );

  
});
