$(function(){
  $(".samplemenu img").hover(
    function(e){
      $(this).css('top','0');
      $(this).css('left','-20px');
      $(this).css('z-index','5');  
      $(this).parent().css('z-index','5');  
//      $(this).attr('src', 'global/classes/phpThumb/phpThumb.php?src=../../../' + $(this).data('src') + '&w=120&h=120far=1');   
      if ($(this).hasClass('currentmenu')) {
        $(this).attr('src',  $(this).data('src') + '.120.hot.gif');
      }
      else {
        $(this).attr('src',  $(this).data('src') + '.120.cold.gif');
      }
      $(this).attr('width',  '120px');
      $(this).width(120);
    },
    function(e){
      $(this).css('top','20px');
      $(this).css('left','0');
      $(this).css('z-index','1'); 
      $(this).parent().css('z-index','1'); 
//      $(this).attr('src', 'global/classes/phpThumb/phpThumb.php?src=../../../' + $(this).data('src') + '&w=80&h=80far=1');      
      if ($(this).hasClass('currentmenu')) {
        $(this).attr('src',  $(this).data('src') + '.90.hot.gif');
      }
      else {
        $(this).attr('src',  $(this).data('src') + '.90.cold.gif');
      }
      $(this).attr('width',  '90px');
      $(this).width(90);    
    }
  );

  $(".samplemenu img").click(
    function(e){
        $('.samplesdiv').hide();
        $('#samplediv' + $(this).data('websampleid')).show();
        $('.menuimg').removeClass('currentmenu');
        $(this).addClass('currentmenu');
        $('.menuimg ').each(function(e){
            $(this).attr('src',  $(this).data('src') + '.90.cold.gif');
            }
        )
        $(this).attr('src',  $(this).data('src') + '.120.hot.gif');
    }
  );
  
  $('.menuimg').each(function(e){
      /* 08/05/2009 Tony. The source now contains the size in the name so we need to parse the file name.
        Was: $(this).data('src', $(this).attr('src'));  
      */
    
      var fullPath = $(this).attr('src');
      var filename = fullPath.replace(/^.*\\/, '')
      var sourcearray = filename.split('.');
      $(this).data('src', sourcearray[0]);   
      
      var fullName = $(this).attr('id');
      $(this).data('websampleid', fullName.substring(9));   
      
      $(this).css('top','20px');
      $(this).css('left','0');
      $(this).css('z-index','1'); 
      $(this).parent().css('z-index','1');       
//      $(this).attr('src', 'global/classes/phpThumb/phpThumb.php?src=../../../' + $(this).data('src') + '&w=80&h=80far=1');  
      if ($(this).hasClass('currentmenu')) {
        $(this).attr('src',  $(this).data('src') + '.90.hot.gif');
      }
      else {
        $(this).attr('src',  $(this).data('src') + '.90.cold.gif');
      }
      $(this).width(90);    
  });
  
});
