	Cufon.replace('h1', { fontFamily: 'clarendon-bold' });
	Cufon.replace('h2', { fontFamily: 'clarendon' });
	Cufon.replace('h3', { fontFamily: 'clarendon' });
	Cufon.replace('h4', { fontFamily: 'clarendon' });
	Cufon.replace('h5', { fontFamily: 'clarendon' });
	Cufon.replace('#navi', { fontFamily: 'baskerville' });



function buildTwitter(twitters) {
  var statusHTML = [];
  for (var i=0; i<twitters.length; i++){
    var username = twitters[i].user.screen_name;
    var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) {
      return '<a href="'+url+'">'+url+'</a>';
    }).replace(/\B@([_a-z0-9]+)/ig, function(reply) {
      return  reply.charAt(0)+'<a href="http://twitter.com/'+reply.substring(1)+'">'+reply.substring(1)+'</a>';
    });
    
    
    /*statusHTML.push('<p class="tweet'+i+'">'+status+' <a href="http://twitter.com/'+username+'/statuses/'+twitters[i].id+'">Julkaistu '+relative_time(twitters[i].created_at)+'</a> <a href="http://twitter.com/uniqueartfi" class="follow">Seuraa Twitterissä</a></p>');*/
    
    
    statusHTML.push('<p class="tweet'+i+'">'+status+' <em>Julkaistu '+relative_time(twitters[i].created_at)+'</em> <a href="http://twitter.com/uniqueartfi" class="follow">Seuraa Twitterissä</a></p>');
   
    
  }
  document.getElementById('twitter_update_list').innerHTML = statusHTML.join('');
}
 
function relative_time(time_value) {
  var values = time_value.split(" ");
  time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
  var parsed_date = Date.parse(time_value);
  var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
  var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
  delta = delta + (relative_to.getTimezoneOffset() * 60);
 
  if (delta < 60) {
    return 'alle minuutti sitten';
  } else if(delta < 120) {
    return 'noin minuutti sitten';
  } else if(delta < (60*60)) {
    return (parseInt(delta / 60)).toString() + ' minuuttia sitten';
  } else if(delta < (120*60)) {
    return 'noin tunti sitten';
  } else if(delta < (24*60*60)) {
    return 'noin ' + (parseInt(delta / 3600)).toString() + ' tuntia sitten';
  } else if(delta < (48*60*60)) {
    return 'eilen';
  } else {
    return (parseInt(delta / 86400)).toString() + ' päivää sitten';
  }
}





    var tabLinks = new Array();
    var contentDivs = new Array();
 
    function initTabs() {
 
      // Grab the tab links and content divs from the page
      var tabListItems = document.getElementById('tabs').childNodes;
      for ( var i = 0; i < tabListItems.length; i++ ) {
        if ( tabListItems[i].nodeName == "LI" ) {
          var tabLink = getFirstChildWithTagName( tabListItems[i], 'A' );
          var id = getHash( tabLink.getAttribute('href') );
          tabLinks[id] = tabLink;
          contentDivs[id] = document.getElementById( id );
        }
      }
 
      // Assign onclick events to the tab links, and
      // highlight the first tab
      var i = 0;
 
      for ( var id in tabLinks ) {
        tabLinks[id].onclick = showTab;
        tabLinks[id].onfocus = function() { this.blur() };
        if ( i == 0 ) tabLinks[id].className = 'selected';
        i++;
      }
 
      // Hide all content divs except the first
      var i = 0;
 
      for ( var id in contentDivs ) {
        if ( i != 0 ) contentDivs[id].className = 'tabContent hide';
        i++;
      }
    }
 
    function showTab() {
      var selectedId = getHash( this.getAttribute('href') );
 
      // Highlight the selected tab, and dim all others.
      // Also show the selected content div, and hide all others.
      for ( var id in contentDivs ) {
        if ( id == selectedId ) {
          tabLinks[id].className = 'selected';
          contentDivs[id].className = 'tabContent';
        } else {
          tabLinks[id].className = '';
          contentDivs[id].className = 'tabContent hide';
        }
      }
 
      // Stop the browser following the link
      return false;
    }
 
    function getFirstChildWithTagName( element, tagName ) {
      for ( var i = 0; i < element.childNodes.length; i++ ) {
        if ( element.childNodes[i].nodeName == tagName ) return element.childNodes[i];
      }
    }
 
    function getHash( url ) {
      var hashPos = url.lastIndexOf ( '#' );
      return url.substring( hashPos + 1 );
    }
