/* JS Document */

/************************************************************************
*   
*   S I T E  W I D E  J A V A S C R I P T S
*   
*   Author:  Daniel Stondin
*   Date:    5 July 2010
*   Web:     http://highflyingfoods.com
*   Version: 1.0
* 
*************************************************************************/

/*-----------------------------------------------------------------------
Init
------------------------------------------------------------------------*/

/* -------------------- Step Carousel */

function initStepCarousel(){
  stepcarousel.setup({
  	galleryid: 'galleryc',   //id of carousel DIV
  	beltclass: 'belt',       //class of inner "belt" DIV containing all the panel DIVs
  	panelclass: 'panel',     //class of panel DIVs each holding content
  	panelbehavior: {speed:1000, wraparound:true, persist:false},
  	defaultbuttons: {enable: false},
  	contenttype: ['inline']  //content setting ['inline'] or ['external', 'path_to_external_file']
  })
}

/*-----------------------------------------------------------------------
Step Carousel - Controls
------------------------------------------------------------------------*/

function bindStepControls(){
  
  $('#navigation a').click(function() {
    $('#navigation a').removeClass('active');
    $(this).addClass('active');
  });
  
  $('#logo a').click(function() {
    $('#navigation a').removeClass('active')
    $('a#home').addClass('active');
    stepcarousel.stepTo('galleryc', 1);
    return false;
  });
  
  $('a#home').click(function() {
    stepcarousel.stepTo('galleryc', 1);
    return false;
  });
  
  $('a#services').click(function() {
    stepcarousel.stepTo('galleryc', 2);
    return false;
  });
  
  $('a#people').click(function() {
    stepcarousel.stepTo('galleryc', 3);
    return false;
  });
  
  $('a#portfolio').click(function() {
    stepcarousel.stepTo('galleryc', 4);
    return false;
  });
  
  $('a#company_expansion').click(function() {
    stepcarousel.stepTo('galleryc', 5);
    return false;
  });
   
  $('a#contact').click(function() {
    stepcarousel.stepTo('galleryc', 6);
    return false;
  });
  
}

/*-----------------------------------------------------------------------
Cycle Carousel
------------------------------------------------------------------------*/

function initCycle(){

  $('#info_panel, #graphic_panel').cycle({
    fx:     'cover',
    prev:   '#prev',
    next:   '#next',
    speed:  500,
    after:   onAfter,
    timeout: 0
  });
  
}

function onAfter(curr, next, opts) {

  var index = opts.currSlide;
  
  $('#prev')[index == 0 ? 'hide' : 'show']();
  $('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
 
  if(index == 0){
    $('#next').html('Our Locations');
  } else {
    $('#next').html('Next');
  }
}


function bindLocationsTrigger(){

  $('#locations_trigger').click(function() {
    $('.porfolio_panel').index('#portfolio_1').fadeOut();
  });
  
}


/*-----------------------------------------------------------------------
Helpers
------------------------------------------------------------------------*/
