//modified Anchor Slider by Cedric Dugas
//Http://www.position-absolute.com

jQuery.fn.anchorAnimate = function(settings) {
  settings = jQuery.extend({
    speed : 1100
  }, settings); 

  return this.each(function(){
    var caller = this;
    jQuery(caller).click(function (event) {  
      var locationPathName = window.location.pathname;
      var linkHref = jQuery(caller).attr("href");
      if (linkHref.indexOf('home')!=-1 && (locationPathName == "/" || locationPathName == "/home")){
        event.preventDefault();
        var elementClick = linkHref.replace('/home', '');
        var destination = jQuery(elementClick).offset().top;
        jQuery("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
          window.location.hash = elementClick;
        });
        return false;
      }
      else
        return true;
    });
  })
}

function hookUpScrollTo(){
  jQuery("#menu_portfolio, #menu_services, #menu_about, #menu_contact, .scroll_to_link").anchorAnimate();
}

function portfolioCycle(){
  jQuery('#sample_work').cycle({ 
    timeout: 0, 
    prev: '#prev',
    next: '#next'
  });
}

function hideableSections(){
  jQuery('.more_info').click(function(){
    jQuery(this).parent().find('.hideable').show('slow');
    return false;
  });
}

jQuery(function() {
  hookUpScrollTo();
  portfolioCycle();
  hideableSections();
});
