$(document).ready(function(){

    // newsletter dropdown
    $("#newsletter-show-button").click(function(event){
       event.preventDefault();
       $("#newsletter-signup-form").toggle(function(){ $("#name").focus();});
       //$("#newsletter-signup-form").slideToggle({duration: 1000, easing: "easeOutQuad", complete: function(){ $("#name").focus(); }});
     }); 

    // Teaser Fader
    function formatText(index, panel) {
      return index + "";
    }
    $('.anythingSlider').anythingSlider({
      easing: "swing",                // Anything other than "linear" or "swing" requires the easing plugin
      autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
      delay: 6000,                    // How long between slide transitions in AutoPlay mode
      startStopped: false,            // If autoPlay is on, this can force it to start stopped
      animationTime: 1,               // How long the slide transition takes
      hashTags: true,                 // Should links change the hashtag in the URL?
      buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
      pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
      startText: "Play",              // Start text
      stopText: "Stop",               // Stop text
      navigationFormatter: formatText // Details at the top of the file on this use (advanced use)
    });

   var url = "http://search.twitter.com/search.json?&q=from:verve_victoria&rpp=5&callback=?";
   var cont = $("#twitter_box");
   var list = $('<ul class="tweet_list">').appendTo(cont);
    
   $.getJSON(url, function(data){
      $.each(data.results, function(i,item){
        var text = item.text;
        var results = text.replace( /(http:\/\/.+\w)/g, "<a href='$1'>link</a>" );       
        list.append('<li><span>Updates & Events:</span> ' + results + '</li>');
      });
      $('.tweet_list').cycle({ 
    timeout:       6000,  // milliseconds between slide transitions (0 to disable auto advance) 
    speed:         500,  // speed of the transition (any valid fx speed value) 
    next:          null,  // id of element to use as click trigger for next slide 
    prev:          null,  // id of element to use as click trigger for previous slide 
    before:        null,  // transition callback (scope set to element to be shown) 
    after:         null,  // transition callback (scope set to element that was shown) 
    height:       'auto', // container height 
    sync:          1,     // true if in/out transitions should occur simultaneously 
    fit:           0,     // force slides to fit container 
    pause:         0,     // true to enable "pause on hover" 
    delay:         0,     // additional delay (in ms) for first transition (hint: can be negative) 
    slideExpr:     null   // expression for selecting slides (if something other than all children is required) 
    });
   });

});
