/* Author: 

*/

$(document).ready(function(){
    /* This code is executed after the DOM has been completely loaded */
    
         $(window).scroll(function () {
     	
     	// This sends the page scrolling back to the top and fades the back to top button out if back to top
     	
          if ($(this).scrollTop() != 0) {
             $('.totop').fadeIn();
         } else {
            $('.totop').fadeOut();
         }
    });
    
    function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

    jQuery('#mygallery').jcarousel({
        auto: 4,
        wrap: 'circular',
        initCallback: mycarousel_initCallback
    });

    jQuery('#mygallery2').jcarousel({
        auto: 4,
        wrap: 'circular',
        initCallback: mycarousel_initCallback
    });

   

    
    
    $('nav a,footer a.up, contact a').click(function(e){
                                          
        // If a link has been clicked, scroll the page to the link's hash target:
        
        $.scrollTo( this.hash || 0, 1500, {offset: {top:-180, left:0} });
        e.preventDefault();



     $('.totop').click(function () {
         $('body,html').animate({
             scrollTop: 0
          },
          800);
      });
  });
});
















