// JavaScript Document

// gallery var
var sliderHeight = "189px";
var defHeight = "408px"; 

$(document).ready(function(){
	// gallery						   
$(".gallery").css("height", sliderHeight);
$("#carousel ul").animate({top: "-100px"}, {duration: "slow" });
$(".slider_menu").html('<div class="open"><a href="#">Visualizza gallery</a></div>');
$(".slider_menu a").click(function() { openSlider() })	
	// inizio menu
	$(".services").removeClass("sub"); 
	$('.full_hide').hide();
	$('.button_head').click(function(){
		$('.button_head').slideUp('fast');
		if ( $('.full_hide').is(":hidden"))
			$('.full_hide').slideDown("slow");
		else{
			$('.full_hide').slideUp('slow');}
		})
	$('.close').click(function(){$('.full_hide').slideUp('fast'); $('.button_head').slideDown("slow") })
	// fine menu
	

		
		// inizio gallery
		$('#carousel').infiniteCarousel();
		// fine gallery
		// main vertical scroll
$("#camere").scrollable({
 
	// basic settings
	vertical: true,
	size: 1,
	clickable: false,
 
	// up/down keys will always control this scrollable
	keyboard: 'static',
 
	// assign left/right keys to the actively viewed scrollable
	onSeek: function(event, i) {
		horizontal.scrollable(i).focus();
	}
 
// main navigator (thumbnail images)
}).navigator("#menu_camere");
 
// horizontal scrollables. each one is circular and has its own navigator instance
var horizontal = $(".scrollable").scrollable({size: 1}).circular().navigator(".navi");
 
 
// when page loads setup keyboard focus on the first horzontal scrollable
horizontal.eq(0).scrollable().focus();

// overlay
$("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_rounded'});

// scroll offerte
$("#scrolloffers").scrollable({size: 1, clickable: false}).navigator(".navig");
		
});

// funzioni slider gallery
function openSlider()
 
{
    $(".gallery").animate({"height": defHeight}, {duration: "slow" });
	$("#carousel ul").animate({top: "0"}, {duration: "slow" });
    $(".slider_menu").html('<div class="close"><a href="#">Riduci</a></div>');
    $(".slider_menu a").click(function() { closeSlider() })
}
 
function closeSlider()
 
{
    $(".gallery").animate({"height": sliderHeight}, {duration: "slow" });
    $(".slider_menu").html('<div class="open"><a href="#">Visualizza gallery</a></div>');
    $(".slider_menu a").click(function() { openSlider() })
	$("#carousel ul").animate({top: "-100px"}, {duration: "slow" });
}




