$(document).ready(function() {

// homepage getting started tabs
  $('div.gs-panel:not(:first)').hide();
  var $tabLinks = $('#gs-tabs a');
  $tabLinks.append('<span></span>')
    .click(function() {
      var panel = '#' + this.href.split('#')[1];
      if ( !$(panel).is(':visible') ) {
        $tabLinks.removeClass('active');
        $(this).addClass('active');
        $('div.gs-panel:visible').fadeOut(200, function() {
          $(panel).fadeIn();          
        });
      }
      return false;
    }).filter(':first').addClass('active');


  $('#slideshow-vid').show();

// CYCLE IMAGES  
  var $gallery = $('#gallery .images');
  $gallery.after('<ul id="gallery-pager" class="nav"></ul>');
  $gallery.cycle({
    pause: 1,
    timeout: 6800,
    pager:  '#gallery-pager', 
    pagerAnchorBuilder: function(idx, slide) { 
      return '<li><a href="#">' + (+idx+1) + '</a></li>'; 
    }  
  });

  var $features = $('#feature .images');
  $features.prev().append('<ul id="feature-prev-next" class="nav"><li><a href="#" id="feature-next" class="replace">&raquo;</a></li><li class="counter"><span class="index">1</span> <span class="of">of</span> ' + $features.children().length + '</li><li><a href="#" id="feature-prev" class="replace">&laquo;</a></li></ul>');
  $features.cycle({
    pause: 1,
    timeout: 6800,
    delay: 4000, // additional delay before the first transition.
    prev: '#feature-prev',
    next: '#feature-next',
    after: function() {
      var thisIndex = $features.children().index(this) + 1;
      $('#feature span.index').text(thisIndex);
    }
  });    
  // rounded corners
	$('#home #feature').append('<b class="tl"></b><b class="tr"></b><b class="bl"></b><b class="br"></b>');
	$('#home #gallery').append('<b class="tl"></b><b class="tr"></b>');
	
});

