$(document).ready(function() {  
  /* text replacement #nav a, */
  /* hover over */
    $("img.a, img.d, img.e, img.f").hover(
    function() {
      $(this).stop().animate({"opacity": "1"}, "fast");
    },
    function() {
      $(this).stop().animate({"opacity": "0"}, "slow");
    });
 
  /* Last.fm jSON */
  var lastUrl = 'http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=inspiradigital&api_key=6b874c3d576549f7d0766632fd17d2c9&limit=1&format=json&callback=?';
  $.getJSON(lastUrl, { limit: 1 }, function(data) {
    var cheque = data.recenttracks.track[0];
    if(typeof(cheque) == "undefined") {
     $('#lastfm span span.lfm_artist').text("most probably Radio 6"); 
    } else {
      $('#lastfm span span.lfm_artist').text(data.recenttracks.track[0].artist["#text"]);
      $('#lastfm span span.lfm_song').text(data.recenttracks.track[0].name);
      $('#lastfm span a').attr('href', data.recenttracks.track[0].url.replace(/\0/g, '0').replace(/\\([\\'"])/g, '$1')).attr('title', 'Listen to '+data.recenttracks.track[0].name+' on Last.FM').attr('target', '_blank');
    }
  });
});


function organicTabsNoteBlock(type, obj) { 

  /* Get an object for the container. */
  var container_str = '#' + type + '-block';

      var container = $(container_str);
  /* Get current tab being shown. */
  var current_tab = $('.' + type + '-tab.active');
  /* Get the tab id they clicked. */
  var next_tab = $(obj.attr('title'));
    
  
  
  container.height(current_tab.height());  

  /* Remove active class from current tab and animate. */
    current_tab.hide();
      current_tab.removeClass('active');

  /* Fade in the new active tab and set a new container height. */
      next_tab.fadeIn(300);
      next_tab.addClass('active'); 
  setInterval(function() {startShow(next_tab); }, 3500 );
      nHeight = next_tab.height() ;
      container.animate({
           height: nHeight
      });    
  }    
  

