
/* Smooth scroll */
$(document).ready(function(){
  $('a[href*=#]').click(function() {
 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
 && location.hostname == this.hostname) {
   var $target = $(this.hash);
   $target = $target.length && $target
   || $('[name=' + this.hash.slice(1) +']');
   if ($target.length) {
  var targetOffset = $target.offset().top;
  $('html,body')
  .animate({scrollTop: targetOffset}, 200, 'swing');
    return false;
   }
 }
  });
  
  $('#main-ref .inner-content > div').hide();
  $('#main-ref .inner-content div').first().show();
  var firstNosto = $('.nosto').first().html();
  $('#nostot').html( firstNosto );
  
});


/* Nivo slider */
$(window).load(function() {
    $('.referenssi-gallery').nivoSlider({
		effect: 'fade',
		captionOpacity:1,
		manualAdvance:true
	});
	
    $('#top-gallery').nivoSlider({
		effect: 'fade',
		captionOpacity:0.8
	});	
	
});
 
 /* Show reference */
 function setRef(refID) {
   $('#main-ref .inner-content > div').hide();
   $('#ref' + refID).show();
   
   $('#nostot').html( $('#nosto' + refID).html() );
 }
 
 
 
 /* Orbit Slideshow
 $(window).load(function() {
	 $('.referenssi-gallery').orbit({
		  bullets: true,
		  animation: 'fade' //fade, horizontal-slide, vertical-slide
	 });
	 $('#top-gallery').orbit({
		  bullets: true,
		  animation: 'fade' //fade, horizontal-slide, vertical-slide
	 });
 });
 */
