document.write('<div id="yabbContainer">yabb</div>');

var YabbWidget = {
  renderConversations: function(convs) {
    var container = document.getElementById('yabbContainer');
    if(convs.error) {
      container.innerHTML = ('Service unavailable');
    } else {
      var contents = "";
      for(var i = 0; i < convs.length; i++) {
        contents += "<a href='" + convs[i].url + "'>" + convs[i].title + "</a><br/>";
      }
      container.innerHTML = contents;
    }        
  }
};

YabbWidget.renderConversations([{title: "My password hell", url: "http://yabb.com/conversations/27-my_password_hell?user_id=234"}, {title: "Is the idea of key influencers and heroic leaders deeply flawed?", url: "http://yabb.com/conversations/109-is_the_idea_of_key_influencers_and_heroic_leaders_deeply_flawed?user_id=234"}, {title: "Does the iPhone mark the first mobile platorm really worth developing for?", url: "http://yabb.com/conversations/104-does_the_iphone_mark_the_first_mobile_platorm_really_worth_developing_for?user_id=234"}, {title: "Does Merb really offer anything more than Ruby on Rails?", url: "http://yabb.com/conversations/103-does_merb_really_offer_anything_more_than_ruby_on_rails?user_id=234"}, {title: "the phrase \"Stranger Danger\"", url: "http://yabb.com/conversations/96-the_phrase_stranger_danger?user_id=234"}, {title: "new features for Yabb...", url: "http://yabb.com/conversations/41-new_features_for_yabb?user_id=234"}, {title: "What do you think of Microsoft development tools?", url: "http://yabb.com/conversations/58-what_do_you_think_of_microsoft_development_tools?user_id=234"}, {title: "Which will be the best tech conferences and events to go to in 2008?", url: "http://yabb.com/conversations/79-which_will_be_the_best_tech_conferences_and_events_to_go_to_in_2008?user_id=234"}, {title: "How to create a topic on yabb that lots of people then join?", url: "http://yabb.com/conversations/80-how_to_create_a_topic_on_yabb_that_lots_of_people_then_join?user_id=234"}, {title: "What can be done to speed up the adoption of Ruby on Rails?", url: "http://yabb.com/conversations/2-what_can_be_done_to_speed_up_the_adoption_of_ruby_on_rails?user_id=234"}]);
