$(document).ready(function() {
  
  $("#aRodrigo").click(function(){
    $(".jLinks").removeClass("on");
    $(this).addClass("on");                    
    $.Juitter.start({
      searchType:"fromUser",
      searchObject:"mrjuitter,rodrigofante",
      live:"live-120" // it will be updated every 120 seconds/2 minutes
    });
  });
  $("#aIphone").click(function(){
    $(".jLinks").removeClass("on");
    $(this).addClass("on");                     
    $.Juitter.start({
      searchType:"searchWord",
      searchObject:"iPhone,apple,ipod",
      live:"live-20"  // it will be update every 20 seconds 
    });
  });
  $("#aJuitter").click(function(){
    $(".jLinks").removeClass("on");
    $(this).addClass("on");                  
    $.Juitter.start({
      searchType:"searchWord",
      searchObject:"Juitter",
      live:"live-180" // it will be updated every 180 seconds/3 minutes
    });
  });
        $("#juitterSearch").submit(function(){

                    

    $.Juitter.start({

      searchType:"searchWord",

      searchObject:$(".juitterSearch").val(),
      live:"live-20", // it will be updated every 180 seconds/3 minutes
      filter:"sex->*BAD word*,porn->*BAD word*,fuck->*BAD word*,shit->*BAD word*"
    });
                return false;

  });
        $(".juitterSearch").blur(function(){
            if($(this).val()=="") $(this).val("Type a word and press enter");
        });
        $(".juitterSearch").click(function(){
            if($(this).val()=="Type a word and press enter") $(this).val("");
        });
   
   $('p.linkDirect a').hover(
          function(){
            $(this).css('color', '#C8203B');},
          function(){
            $(this).css('color', '#4D4D4D');}
        );
        
   var win = $(window);
  // Full body scroll
  var isResizing = false;
  win.bind(
    'resize',
    function()
    {
      if (!isResizing) {
        isResizing = true;
        var container = $('#content');
        // Temporarily make the container tiny so it doesn't influence the
        // calculation of the size of the document
        container.css(
          {
            'width': 1,
            'height': 1
          }
        );
        // Now make it the size of the window...
        container.css(
          {
            'width': win.width(),
            'height': win.height()
          }
        );
        isResizing = false;
        container.jScrollPane(
          {
            'showArrows': false
          }
        );
      }
    }
  ).trigger('resize');

  // Workaround for known Opera issue which breaks demo (see
  // http://jscrollpane.kelvinluck.com/known_issues.html#opera-scrollbar )
  $('body').css('overflow', 'hidden');

  // IE calculates the width incorrectly first time round (it
  // doesn't count the space used by the native scrollbar) so
  // we re-trigger if necessary.
  if ($('#content').width() != win.width()) {
    win.trigger('resize');
  }
  
});

