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();
    });
}

function moveCloseLink(){ 
  var cb=document.getElementById('sb-nav-close'); 
  var tb=document.getElementById('sb-title'); 
  if(tb) tb.appendChild(cb); 
} 

Shadowbox.init({ onOpen: moveCloseLink });

jQuery(document).ready(function(){
  jQuery('#featured').tabs({fx:{opacity:"toggle"}}).tabs("rotate",8000);
  
    jQuery('#mycarousel').jcarousel({
      auto: 2,
      wrap: 'circular',
      scroll: 4,
      initCallback: mycarousel_initCallback
    }).css('visibility','visible');
    
  jQuery("#map").goMap({
      markers: [
        {
          latitude: 45.1782911,
          longitude: 4.8152051,
          html: {
              content: '<strong>FLAT Automobile</strong><br />RN7<br />26241 SAINT-VALLIER',
              popup: false
          }
        },
        {
          latitude: 45.1723102,
          longitude: 4.8193405,
          html: {
              content: '<strong>Garage des Collines</strong><br />15 avenue Buissonnet<br />26241 SAINT-VALLIER',
              popup: false
          }
        },
        {
          latitude: 45.1782910,
          longitude: 4.8152050,
          html: {
              content: '<strong>Garage de l\'Europe et Flat Automobile</strong><br />15 avenue Buissonnet<br />26241 SAINT-VALLIER',
              popup: false
          }
        },
        {
          latitude: 45.2869387,
          longitude: 4.8208825,
          html: {
              content: '<strong>Garage Nord Drome Automobiles</strong><br />Route d\'Anneyron<br />26140 SAINT-RAMBERT D\'ALBON',
              popup: false
          }
        }
      ],
      maptype: 'ROADMAP',
      zoom: 10
  });
});
