var aRotator;
function imgRotator( id )
{
  oldSrc = $("#"+id).attr("src");
  actSrc = oldSrc.split("/");

  oldSrc = oldSrc.replace( "/"+actSrc[ actSrc.length-1 ], "" );
  
  actSrc = actSrc[ actSrc.length-1 ].replace(".jpg");
  
  intImg = parseInt( actSrc );
  
  if ( intImg == 6 )
    newSrc = 1;
  else
    newSrc = intImg + 1;
    
  $("#"+id).attr("src", oldSrc+"/"+newSrc+".jpg");
}

function resetRotator( id )
{
  oldSrc = $("#"+id).attr("src");
  actSrc = oldSrc.split("/");

  oldSrc = oldSrc.replace( "/"+actSrc[ actSrc.length-1 ], "" );
  
  actSrc = actSrc[ actSrc.length-1 ].replace(".jpg");
  
  $("#"+id).attr("src", oldSrc+"/2.jpg");
}

$(document).ready( function()
{
  $(".rotator").mouseover( function()
  {
    aRotator = window.setInterval("imgRotator(\'"+$(this).attr("id")+"\');", 1500);
  }).mouseout( function()
  {
    window.clearInterval(aRotator);
    resetRotator( $(this).attr("id") );
  });
});
