
  $(document).ready(function () {

      $('.slideshow').cycle({
        fx: 'fade' 
      });

  
	  $("a[href^=http://]").not("a[href^=http://www.maurocolagreco.com]").attr("target", "blank");  
	  $("a[href^=http://]").not("a[href^=http://www.maurocolagreco.com]").attr("rel", "external");
    $("a[href$=pdf]").attr("target", "blank");  
    $("a[href$=pdf]").attr("rel", "external");
  
  
  	$(function() {
      $("#accordion").accordion({
			autoHeight: false,
			navigation: true
		});
    });

  

  	$(function() {
		$("#booking_jour").datepicker({
				altField: '#booking_jour', 
				altFormat: 'yy-mm-dd',
				minDate: 0,
				maxDate: '+7M',
				showOtherMonths: true, 
				selectOtherMonths: true,
				beforeShowDay: disableDays
		});
	});
    
    
    function disableDays(date) {
    	weekday = date.getDay();
    	day = date.getDate();
    	month = date.getMonth();
    	year = date.getFullYear();

//  		console.log(year+' '+day+' '+month);
      
      /* 25 avril */
      if (day == 25 && month == 3)
	  		return [true, ""];
    	
      if ((weekday == 1) || (weekday == 2 && month < 6) || (weekday == 2 && day < 14 && month == 6) || (weekday == 2  && day > 28 && month == 7) || (weekday == 2 && month > 7))
	  		return [false, ""];
	  	else 
	  		return [true, ""];
    	
    }
    
    

  
  
 
	$(function() {
	
    $(".scrollable").scrollable().navigator();
    
    $(".items img").click(function() {
    
      // see if same thumb is being clicked
      if ($(this).hasClass("active")) { return; }
    
      // calclulate large image's URL based on the thumbnail URL (flickr specific)
      var url = $(this).attr("src").replace("-t", "");
    
      // get handle to element that wraps the image and make it semi-transparent
      var wrap = $("#image_wrap").fadeTo("medium", 0.1);
    
      // the large image from www.flickr.com
      var img = new Image();
    
    
      // call this function after it's loaded
      img.onload = function() {
    
        // make wrapper fully visible
        wrap.fadeTo("fast", 1);
    
        // change the image
        wrap.find("img").attr("src", url);
    
      };
    
      // begin loading the image from www.flickr.com
      img.src = url;
    
      // activate item
      $(".items img").removeClass("active");
      $(this).addClass("active");
    
    // when page loads simulate a "click" on the first image
    })/*.filter(":first").click()*/;
	});

 
  
  
  
  
  
  });

  

