// JavaScript Document
//-------------------------------SLIDESHOW FUNCTIONS
//Slideshow images destinazione mese
function slideSwitch() {
    var $active = $('#slideshow DIV.active');
    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow DIV:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 400, function() {
            $active.removeClass('active last-active');
        });
}
$(function() {
    setInterval( "slideSwitch()", 5000 );
});
//Slideshow descrizioni
function slideSwitch0() {
    var $active = $('#slideshow0 DIV.active');
    if ( $active.length == 0 ) $active = $('#slideshow0 DIV:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow0 DIV:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 400, function() {
            $active.removeClass('active last-active');
        });
}
$(function() {
    setInterval( "slideSwitch0()", 5000 );
});
//--------------------------Slideshow offerte
function slideSwitch1() {
    var $active = $('#slideshow1 DIV.active');
    if ( $active.length == 0 ) $active = $('#slideshow1 DIV:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow1 DIV:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 400, function() {
            $active.removeClass('active last-active');
        });
}
$(function() {
    setInterval( "slideSwitch1()", 7500 );
});
//--------------------------gallery jquery lightbox
    $(function() {
        $('#gallery a').lightBox();
    });
//--------------------------SIMPLE DROP DOWN MENU
// Copyright 2006-2007 javascript-array.com
var timeout	= 400;
var closetimer	= 0;
var ddmenuitem	= 0;
// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();
	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';
}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}
// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}
// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
// close layer when click-out
document.onclick = mclose;