// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

$(function(){
  
  // Screensaver
  $('#screensaver').cycle({
    autostopCount: 2,
    pager: '#dots',
    prev: '#prev', 
    next: '#next',
    timeout: 8000
  });
  
  // Tumblr
  $.getJSON("http://blog.7geeks.com/api/read/json?callback=?",
    function(data) {
      $(".tumblr").html("");
      
      for (i=0;i<1;i++) {
        $(".tumblr").append("<h4><a href=\"" + data.posts[i]['url-with-slug'] + "\">" + data.posts[i]['regular-title'] + "</a></h4><p>Posted on " + data.posts[i]['date'].split(", ")[1].substring(0, 11) +  "</p>")
      }
    });
  
  // Tweets
  $.getJSON("http://twitter.com/status/user_timeline/7geeks.json?count=3&callback=?",
    function(data) {
      $(".twitter").html("");
      
      for (i=0;i<1;i++) {
        $(".twitter").append("<h4><a href=\"http://twitter.com/7geeks/status/" + data[i]['id'] + "\">" + data[i]['text'] + "</a></h4><p>Posted on " + data[i]['created_at'].substring(4, 11) +  "</p>")
      }
    })
  
});