function initScript() {
  $('articles-list').hide();
  // Define data
  var phrases = [ 'Un possibile problema all’utilizzo di questi strumenti consiste nella loro flessibilità di utilizzo, i grafici possono differire molto gli uni dagli altri, di conseguenza è difficile riuscire a soddisfare tutte le necessità che...',
                  'Anche il sottoscritto quando ha acquistato la suite l\’aveva notato (grazie a LittleSnitch) e aveva contattato Adobe per chiedere delucidazioni a riguardo',
                  'We build Web services, but before that we use a lot of services around the Web. And while we believe the service itself is certainly the most important aspect, there is another critical factor: customer service.',
                  'I started with my <strong>must have</strong> applications like Textmate, Firefox, SpamSieve, iTerm, NetNewsWire, followed by others I need to develop — Ruby, Rails and MySQL. Installing the latter...',
                  'I don’t consider the Internet to be a drug I can\’t live without, I simply happen to think it\’s a very useful place where I can work, have some fun, get in touch with other people and read news, so it wasn\’t a big issue at first, but it made me realize a few things.',
                  '...but there is another kind of security breach which is impossible to plan: user stupidity.',
                  'Simplicity in Web application isn\’t just a plus, it\’s one of the most important things — if not THE most important thing –, and many Web applications have a great potential but are completely unusable.',
                  'Sinatra è uno di questi framework, caratterizzato dalle sue dimensioni ridotte, ottime prestazioni e dall\'abilità di consentire la scrittura di applicazioni web con pochissime righe di codice',
                  'Per vedere se diverrà davvero lo standard per la comunicazione online del futuro dovremo aspettarne il rilascio e magari constatarne il funzionamento al di fuori delle server farm di Google.',
                  'Col passare del tempo e con il costante raffinamento di ciò che veniva messo online gli sviluppatori hanno iniziato a sviluppare progetti complessi che richiedono un approccio più ragionato allo sviluppo'];
  var titles = ['Google Chart API',
                'Adobe e l\'indirizzo \'192.168.112.2o7.net\'',
                'Customer service isn\’t just a point on a bullet list',
                'Simple solution for an annoying issue',
                'Give desktop its dignity back',
                'Users can be dangerous',
                'Why simplicity matters',
                'Introduzione a Sinatra',
                'Google Wave, l\’evoluzione dell’email',
                'Introduzione a LessCSS'];
  var urls = ['http://stacktrace.it/2007/12/google-chart-api/',
              'http://stacktrace.it/2008/01/adobe-e-l-indirizzo-1921681122o7net-/',
              'http://blog.wonsys.net/posts/23-customer-service-isnt-just-a-point-on-a-bullet-list/',
              'http://blog.wonsys.net/posts/15-simple-solution-for-an-annoying-issue/',
              'http://blog.wonsys.net/posts/13-give-desktop-its-dignity-back/',
              'http://blog.wonsys.net/posts/10-users-can-be-dangerous/',
              'http://blog.wonsys.net/posts/8-why-simplicity-matters/',
              'http://stacktrace.it/2009/02/introduzione-a-sinatra/',
              'http://stacktrace.it/2009/06/google-wave-l-evoluzione-dell-email/',
              'http://stacktrace.it/2010/02/introduzione-a-lesscss/'];
  var sites = [ '<a href="http://stacktrace.it/">Stacktrace.it</a>',
                '<a href="http://stacktrace.it/">Stacktrace.it</a>',
                '<a href="http://blog.wonsys.net">Blog Wonsys.net</a>',
                '<a href="http://blog.wonsys.net">Blog Wonsys.net</a>',
                '<a href="http://blog.wonsys.net">Blog Wonsys.net</a>',
                '<a href="http://blog.wonsys.net">Blog Wonsys.net</a>',
                '<a href="http://blog.wonsys.net">Blog Wonsys.net</a>',
                '<a href="http://stacktrace.it/">Stacktrace.it</a>',
                '<a href="http://stacktrace.it/">Stacktrace.it</a>',
                '<a href="http://stacktrace.it/">Stacktrace.it</a>'];
  // END Define data
  // Set main phrase
  var random = Math.floor(Math.random() * phrases.length);
  var phrase = [phrases[random], '<span>Article</span> "<a href=\"' + urls[random] + '\">' + titles[random] + '</a>" <span>@</span> ' + sites[random]];
  $('phrase').innerHTML = [' ', phrase[0], ' '].join('');
  $('phrase-from').innerHTML = [' ', phrase[1], ' '].join('');
  // END Set main phrase
  
  // Set articles list
  for(i=0; i<titles.size();i++) {
    $('articles').insert('<li><a href="' + urls[i] + '">' + titles[i] + '</a></li>');
  }
  // END Set articles list
  
  saveVisit();
}
function createMail() {
  var pieces = ['<strong>', 'simobg@', 'gmail.com', '</strong>'];
  $('mail-name').innerHTML = pieces.join('');
}
function setArticlesList() {
  var container = $('articles ul');
}

function saveVisit() {
  var time = new Date().getTime();
  var last_visit = localStorage.getItem('last_visit');
  if (last_visit == null) {
    localStorage.setItem('last_visit', time);
  } else {
    writeLastVisitIntoPage();
    localStorage.setItem('last_visit', time);
  }
}

function writeLastVisitIntoPage() {
  // Relative date
  var relativeStr = ''
  var now = new Date().getTime();
  var later = new Date(parseInt(localStorage.getItem('last_visit'))).getTime();
  var offset = later - now;
  var distanceInMinutes = (offset.abs() / 60000).round();
  if (distanceInMinutes == 0) { relativeStr = 'less than a minute'; }
  else if ($R(0,1).include(distanceInMinutes)) { relativeStr = 'about a minute'; }
  else if ($R(2,44).include(distanceInMinutes)) { relativeStr = distanceInMinutes + ' minutes';}
  else if ($R(45,89).include(distanceInMinutes)) { relativeStr = 'about 1 hour';}
  else if ($R(90,1439).include(distanceInMinutes)) { relativeStr = 'about ' + (distanceInMinutes / 60).round() + ' hours'; }
  else if ($R(1440,2879).include(distanceInMinutes)) {relativeStr = '1 day'; }
  else if ($R(2880,43199).include(distanceInMinutes)) {relativeStr = 'about ' + (distanceInMinutes / 1440).round() + ' days'; }
  else if ($R( 43200,86399).include(distanceInMinutes)) {relativeStr = 'about a month' }
  else if ($R(86400,525599).include(distanceInMinutes)) {relativeStr = 'about ' + (distanceInMinutes / 43200).round() + ' months'; }
  else if ($R(525600,1051199).include(distanceInMinutes)) {relativeStr = 'about a year';}
  else relativeStr = 'over ' + (distanceInMinutes / 525600).round() + ' years';
  // END Relative date
  
  // Inserting element in page
  new Insertion.Bottom($('news'), "<p id=\"last-visit\"><strong>Last visit:</strong> " + relativeStr + " ago</p>")
  // END Inserting
}