$(document).ready(function(event)
{ 
  var X,Y;
  var sm1width,sm1height,sm1X,sm1Y;
  var sm2width,sm2height,sm2X,sm2Y;
  var sm3width,sm3height,sm3X,sm3Y;
  var sm4width,sm4height,sm4X,sm4Y;
  var sm5width,sm5height,sm5X,sm5Y;
  var sm1=$('#sm1');
  var sm2=$('#sm2');
  var sm3=$('#sm3');
  var sm4=$('#sm4');
  var sm5=$('#sm5');

  $(document).mousemove(function(e)
  {
    X=e.pageX;
    Y=e.pageY;
  }); 

setInterval(function() 
{                     

  if(sm1X)
  {
    if( X<sm1X || X>(sm1X+sm1width) || Y<sm1Y || Y>(sm1Y+sm1height) )
    { 
      sm1X=0;
      sm1.css("display","none");
    }
  }
  if(sm2X)
  {
    if( X<sm2X || X>(sm2X+sm2width) || Y<sm2Y || Y>(sm2Y+sm2height) )
    { 
      sm2X=0;
      sm2.css("display","none");
    }
  }
  if(sm3X)
  {
    if( X<sm3X || X>(sm3X+sm3width) || Y<sm3Y || Y>(sm3Y+sm3height) )
    { 
      sm3X=0;
      sm3.css("display","none");
    }
  }
  if(sm4X)
  {
    if( X<sm4X || X>(sm4X+sm4width) || Y<sm4Y || Y>(sm4Y+sm4height) )
    { 
      sm4X=0;
      sm4.css("display","none");
    }
  }
  if(sm5X)
  {
    if( X<sm5X || X>(sm5X+sm5width) || Y<sm5Y || Y>(sm5Y+sm5height) )
    { 
      sm5X=0;
      sm5.css("display","none");
    }
  }    
}, 100 );



  $('#b1').mouseover(function(event)
  {
    sm1.css("display","block");
    sm1width=sm1.width();   
    sm1height=sm1.height();
    sm1X=sm1.offset().left; 
    sm1Y=sm1.offset().top;
  }); 


  $('#b2').mouseover(function(event)
  {
    sm2.css("display","block");
    sm2width=sm2.width();   sm2height=sm2.height();
    sm2X=sm2.offset().left; sm2Y=sm2.offset().top;
  }); 
  
  
  $('#b3').mouseover(function(event)
  {
    sm3.css("display","block");
    sm3width=sm3.width();   sm3height=sm3.height();
    sm3X=sm3.offset().left; sm3Y=sm3.offset().top;
  });     

  
  $('#b4').mouseover(function(event)
  {
    sm4.css("display","block");
    sm4width=sm4.width();   sm4height=sm4.height();
    sm4X=sm4.offset().left; sm4Y=sm4.offset().top;
  }); 
  
  $('#b5').mouseover(function(event)
  {
    sm5.css("display","block");
    sm5width=sm5.width();   sm5height=sm5.height();
    sm5X=sm5.offset().left; sm5Y=sm5.offset().top;
  });




  $('#b0').click(function(event)
  {
      window.location = "index.php";
      event.preventDefault(); 
  });   

   
});
