// COOKIE POLICY
$( document ).ready(function() {
//$('.menu-social').prepend('
');
if (window.location.href.indexOf("it") > -1){
$('.menu-social').prepend('');
} else{
$('.menu-social').prepend('');
}
});
var caneaseizampe_timeline_element = "#nav1953";
var caneaseizampe_element = "#1953";
var caneaseizampe_element_id = 1953;
var increment = 11;
var Browser = {
Version : function() {
var version = 999; // we assume a sane browser
if (navigator.appVersion.indexOf("MSIE") != -1)
// bah, IE again, lets downgrade version number
version = parseFloat(navigator.appVersion.split("MSIE")[1]);
return version;
}
};
//shareBox
var openShareBox = function(event) {
$(this).addClass('visible');
$(event.data.div).fadeIn(100);
};
var closeShareBox = function(event) {
$(this).removeClass('visible');
$(event.data.div).hide();
};
$(function() {
if ($('.page-inizia-il-viaggio').length || $('.page-tempi-moderni').length || $('.page-node-51').length || $('.page-node-107').length) {
}else{
$("#page-loading").css({'top' : -$(window).height() +'px'});
}
if ($('.page-inizia-il-viaggio').length) {
caneaseizampe_timeline_element = "#nav1953";
caneaseizampe_element = "#1953";
caneaseizampe_element_id = 1953;
}else if ($('.page-tempi-moderni').length) {
caneaseizampe_timeline_element = "#nav1986";
caneaseizampe_element = "#1986";
caneaseizampe_element_id = 1986;
}
$(".fancybox-inner").css({'margin-top' : -$(this).height() / 2 + 'px'});
$("#bgStoria img").load(function() {$(this).wrap(function() {return '';
});
$(this).css("opacity", "0");
});
$("#imgCovering img").load(function() {
$(this).wrap(function() {return '';
});
$(this).css("opacity", "0");
});
$('#dotted').height($(window).height() - 164);
$('.post').width($('.column').width() - 100);
$('.oldSection').height($(window).height());
$('.newSection').height($(window).height());
$(".bgWhite").height($(window).height() - 137);
$('.wrapStoria').height($(window).height());
$('.wrapStoriaFirst').height($(window).height());
// $('.wrapStoriaFirst').height($(window).height()-257);
$('.page-tempi-moderni .wrapStoria').height($(window).height());
$('.page-tempi-moderni .wrapStoriaFirst').height($(window).height());
// $('.page-tempi-moderni .wrapStoriaFirst').height($(window).height()-137);
if ($('body .page-inizia-il-viaggio')) {
caneaseizampe_timeline_element = "#nav1953";
caneaseizampe_element = "#1953";
caneaseizampe_element_id = 1953;
}else if ($('body .page-tempi-moderni')) {
caneaseizampe_timeline_element = "#nav1986";
caneaseizampe_element = "#1986";
caneaseizampe_element_id = 1986;
}
if ($('.wrapStoria').length) {
moveTimeline(caneaseizampe_timeline_element);
}
if ($('.wrapStoria').length) {
// $('.wrapStoriaFirst').scrollParallax({
// 'speed' : -0.2
// });
// $('.wrapStoria').scrollParallax({
// 'speed' : -0.2
// });
// $(".image-wrap").css("background",$(".wrapStoria:first").css("background"));
var position = $(".wrapStoriaFirst").css('backgroundPosition').split(
' ');
pos_x = position[0].replace("px", "");
pos_y = position[1].replace("px", "");
if (Browser.Version() < 8) {
// $("#bgStoria img").css({ "margin-top":
// $(".wrapStoriaFirst").css("background-position-y").replace("px",
// "")});
$("#bgStoria img").css({"margin-top" : pos_y - 46});
} else {
$(".image-wrap").css("background", $(".wrapStoriaFirst").css("background"));
$(".image-wrap").css("background-position", pos_x + "px " + ((pos_y) - 46) + "px");
}
}
// position for current item and bullet
if (caneaseizampe_element_id != 1953 && caneaseizampe_element_id != 1986){
$(caneaseizampe_element+' .articleStoria').css('top',((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2)));
$(caneaseizampe_element+' .bullet-link').css('top',((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2)));
}else{
$(caneaseizampe_element+' .articleStoria').css('top',((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))+increment);
$(caneaseizampe_element+' .bullet-link').css('top',(($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight()/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2)));
}
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').css('top',-($("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').outerHeight()/2)-110+increment);
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').css('top',-($("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').outerHeight()/2)-110+increment);
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .bullet-link').css('top',-146);
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .bullet-link').css('top',-146);
$('.wrapListaGallery').height($('.listaGallery').height());
$('.wrapListaGallery').height($('.listaGallery_nofancyy').height());
$('.wrapListaGallery .listaGallery_nofancy').width($('.column').width());
$('.wrapListaGallery .listaGallery').width($('.column').width());
$('.wrapListaGallery .listaGallery_nofancy').width($('.column').width());
$('.column').height($(window).height() - 137);
// $('.wrapInternalNav').height($(window).height() - 320);
// $('.scrollListaGallery').height($(window).height() - 137);
$('.wrapSubNav').height($(window).height() - 137);
// resize
$(window).resize(function() {
$('.post').width($('.column').width() - 100);
$('#imgCovering span').height($(window).height());
// alert($('#bgStoria .image-wrap').css('background-size'));
// $('.image-wrap').css({'background-size':''});
$('#dotted').height($(window).height() - 164);
$(".fancybox-inner").css({'margin-top' : -parseInt($(".fancybox-inner img").height() / 2) + 'px'});
// $('.wrapInternalNav').height($(window).height() - 320);
$(".bgWhite").height($(window).height() - 117);
$('.newSection').height($(window).height());
$('.oldSection').height($(window).height());
// $('.scrollListaGallery').height($(window).height() - 137);
$('.wrapSubNav').height($(window).height() - 137);
$('.column').height($(window).height() - 137);
$('.wrapListaGallery').height($('.listaGallery').height());
$('.wrapListaGallery').height($('.listaGallery_nofancy').height());
$('.wrapListaGallery .listaGallery').width($('.column').width());
$('.wrapListaGallery .listaGallery_nofancy').width($('.column').width());
$('.newSection img.imgPartial, .oldSection img.imgPartial').width($(window).width());
$('.wrapStoria').height($(window).height());
$('.wrapStoriaFirst').height($(window).height());
// $('.wrapStoriaFirst').height($(window).height()-257);
// $('.page-tempi-moderni .wrapStoriaFirst').height($(window).height() - 137);
$('.articleStoria').css({opacity : 0.8});
$("#" + (parseInt(caneaseizampe_element_id)) +' .articleStoria').css({opacity : 1});
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').css({opacity : 0.8});
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').css({opacity : 0.8});
if ($('.newSection').width() / $('.newSection').height() > 0.885) {
$('.imgPartial').css({'width' : $(window).width() + 'px','height' : 'auto'});
} else {
$('.imgPartial').css({'width' : 'auto','height' : '100%'});
}
if ($('.wrapStoria').length) {
if($(caneaseizampe_element).length){
$('html,body').scrollTop($(caneaseizampe_element).offset().top);
}
// position for current item and bullet
if (caneaseizampe_element_id != 1953 && caneaseizampe_element_id != 1986){
$(caneaseizampe_element+' .articleStoria').css('top',((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2)));
$(caneaseizampe_element+' .bullet-link').css('top',((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2)));
}else{
$(caneaseizampe_element+' .articleStoria').css('top',((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))+increment);
$(caneaseizampe_element+' .bullet-link').css('top',(($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight()/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2)));
}
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').css('top',-($("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').outerHeight()/2)-110+increment);
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').css('top',-($("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').outerHeight()/2)-110+increment);
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .bullet-link').css('top',-146);
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .bullet-link').css('top',-146);
increment = 0;
}
// $(".videoWrapperFancy .video-js").height($(window).height());
// $(".videoWrapperFancy .video-js").width($(window).width());
// poster_left = ($(".video-js").width() - $(".vjs-poster").clientWidth)/2;
// poster_top = ($(".video-js").heigth() - $(".vjs-poster").clientHeight)/2;
// $(".vjs-poster").offset({ top: poster_top, left: poster_left });
//
// console.log(poster_left);
// console.log(poster_top);
});
$(".wrapStoria:nth-child(even)").addClass("textRight");
});
function roundNumber(rnum, rlength) { // Arguments: number to round, number of
// decimal places
var newnumber = Math.round(rnum * Math.pow(10, rlength))
/ Math.pow(10, rlength);
return newnumber;
}
function detectOrientation() {
if (typeof window.onorientationchange != 'undefined') {
if (orientation == 0) {
$('#portraitAlert').css({
"display" : "block"
});
} else if (orientation == 90) {
$('#portraitAlert').css({
"display" : "none"
});
} else if (orientation == -90) {
$('#portraitAlert').css({
"display" : "none"
});
} else if (orientation == 180) {
$('#portraitAlert').css({
"display" : "block"
});
}
}
}
function popup(url, options)
{
options = "top=50, left=50, width=800, height=500, status=no, menubar=no, toolbar=no";
window.open(url, "", options);
}
function redirectPage(link) {
if (link != undefined)
window.location = link;
}
$(document).ready(function() {
if ($('.page-inizia-il-viaggio').length || $('.page-tempi-moderni').length || $('.page-node-51').length || $('.page-node-107').length) {
}else{
$("#page-loading").css({'top' : -$(window).height() +'px'});
}
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$('.bullet-link').hover(function(){
$(this).find('span').stop().animate({opacity : 1}, 600);
}, function(){
$(this).find('span').stop().animate({opacity : 0}, 600);
});
};
// aggiunge la freccia nel menu blackMenu
var navBlack = $('.blackMenu');
navBlack.find('li.menu-447').each(function(){
if($(this).hasClass('active')) {
$('').addClass('arrowNav').appendTo($(this));
}
});
// aggiunge la freccia nel menu blackMenu
var navYellow = $('.yellowMenu');
navYellow.find('li.menu-508').each(function(){
if($(this).hasClass('active')) {
$('').addClass('arrowNav').appendTo($(this));
}
});
$(".fancybox-inner").css({'margin-top' : -$(this).height() / 2 + 'px'});
// lightbox
// $("#page-loading").css("display", "none");
// $("#page-loading").stop().animate({"top":-$(window).height()+"px"},{duration:
// 1000, specialEasing: {width: 'linear'}}, function() {});
// $("#page-loading").fadeIn(500);
// $("a").not(".listaGallery a, .canopen a, .btnNews, .wrapNextPrev a, .selectorTorino a, .dates a, .arrowTimline, .arrowTimlineInterno").click(function(event) {
// event.preventDefault();
// linkLocation = this.href;
// $("#page-loading").css("display", "block");
// $("#page-loading").stop().animate({
// "top" : 0
// }, {
// duration : 700,
// specialEasing : {
// width : 'easeInCubic'
// },
// complete : function() {
// redirectPage(linkLocation);
// }
// }, function() {
// });
// // $("#page-loading").fadeOut(250,
// // redirectPage);
// });
// $(".subNav a, .navInterno").click(function(event) {
// event.preventDefault();
// linkLocation = this.href;
// $("#page-loading").css("display", "block");
// $("#page-loading").stop().animate({
// "top" : 0
// }, {
// duration : 700,
// specialEasing : {
// width : 'easeInCubic'
// },
// complete : function() {
// redirectPage(linkLocation);
// }
// }, function() {
// });
// // $("#page-loading").fadeOut(250, redirectPage);
// });
$(".wrapNav a").not(".facebook, .twitter, .eniSmall, .noLoading, .share a").click(function(event) {
event.preventDefault();
linkLocation = this.href;
$("#page-loading").css("display", "block");
$("#page-loading").stop().animate({
"top" : 0
}, {
duration : 700,
specialEasing : {
width : 'easeInCubic'
},
complete : function() {
redirectPage(linkLocation);
}
}, function() {
});
// $("#page-loading").fadeOut(250,
// redirectPage);
});
// $("#page-wrapper").css("display", "none");
//
// $("#page-wrapper").fadeIn(500);
//
// $("a").not(".listaGallery a, .canopen a, .btnNews,
// .wrapNextPrev a").click(function(event){
// event.preventDefault();
// linkLocation = this.href;
// $("#page-wrapper").fadeOut(250, redirectPage);
// });
$(".listaGallery a").fancybox({
// maxWidth : "100%",
// width : "100%",
autoSize : true,
// margin : 0,
// padding : 0,
openEffect : 'fade',
openEasing : 'easeOutBack',
closeEffect : 'fade',
closeEasing : 'easeInBack',
nextEffect : 'fade',
nextEasing : 'easeInBack',
prevEffect : 'fade',
prevEasing : 'easeOutBack',
helpers : {
title : {
type : 'over'
}
}
});
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$('.blackMenu li a').hover(function() {
// animatione img
$('.oldSection').stop().animate({
"width" : "100%"
}, {
duration : 1100,
specialEasing : {
width : 'easeOutQuint'
}
}, function() {
});
$('.newSection').stop().animate({
"width" : "0%"
}, {
duration : 1100,
specialEasing : {
width : 'easeOutQuint'
}
}, function() {
});
$('.oldSection img').stop().animate({
"left" : "0%"
}, {
duration : 450,
specialEasing : {
width : 'easeOutQuint'
}
}, function() {
});
}, function() {
// animatione img
$('.oldSection img').stop().animate({
"left" : "-70%"
// "left" : "-50%"
}, {
duration : 450,
specialEasing : {
width : 'easeOutQuint'
}
}, function() {
});
$('.oldSection').stop().animate({
"width" : "50%"
}, {
duration : 1100,
specialEasing : {
width : 'easeOutQuint'
}
}, function() {
});
$('.newSection').stop().animate({
"width" : "50%"
}, {
duration : 1100,
specialEasing : {
width : 'easeOutQuint'
},
complete : function() {
// if
// ($('.oldSection').width()+$('.newSection').width()
// < $(window).width()){
// $('.oldSection').width($('.oldSection').width()
// + 1);
// }
// if
// ($('.blackLeft').width()+$('.yellowRight').width()
// < $(window).width()){
// $('.blackLeft').width($('.blackLeft').width()
// + 1);
// }
}
}, function() {
});
});
$('.yellowMenu li a').hover(function() {
// animatione img
$('.newSection').stop().animate({
"width" : "100%"
}, {
duration : 1100,
specialEasing : {
width : 'easeOutQuint'
}
}, function() {
});
// $('.oldSection').stop().animate({"width":"0%"},{duration:
// 900, specialEasing: {width: 'easeOutQuint'}},
// function() {});
$('.newSection img').stop().animate({
"right" : "0%"
}, {
duration : 450,
specialEasing : {
width : 'easeOutQuint'
}
}, function() {
});
$('.oldSection img').stop().animate({
"left" : "-75%"
}, {
duration : 450,
specialEasing : {
width : 'easeOutQuint'
}
}, function() {
});
}, function() {
// animatione img
if (Browser.Version() < 8) {
$('.newSection img').stop().animate({"right" : "50%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
} else {
// $('.newSection img').stop().animate({"right" : "-50%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.newSection img').stop().animate({"right" : "-40%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
}
// $('.oldSection img').stop().animate({"left" : "-50%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.oldSection img').stop().animate({"left" : "-70%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.newSection').stop().animate({"width" : "50%"}, {duration : 1100,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.oldSection').stop().animate({"width" : "50%"}, {duration : 1100,specialEasing : {width : 'easeOutQuint'},complete : function() {}}, function() {});
});
};
// sub nav
$('.vittoriott').width(0);
$('.vittoriott').hide();
$('.arrowBlack').hide();
var currentLi = $('.internalNav li.active');
var offsetLi = currentLi.offset();
if (!offsetLi) {
offsetLi = 0;
}
$('.arrowBlack').css({'top' : (roundNumber(offsetLi.top, 0) - 135)+ 'px','height' : roundNumber(currentLi.height(), 0)- 1 + 'px'});
$('.canopen').not(".subNav a").click(function(event) {
// animatione img
event.preventDefault();
$('.vittoriott').stop().animate({"width" : "0"},{duration : 900,specialEasing : {width : 'easeOutQuint'}}, function() {$(this).hide()});
$('.arrowBlack').stop().fadeTo(100, 0);
$('.subNav').stop().fadeTo(10, 0);
$('.canopen').removeClass('active');
if ($(this).find('.vittoriott').width() == 0) {
var currentLi = $(this);
var offsetLi = currentLi.offset();
if (!offsetLi) {
offsetLi = 0;
}
$('.arrowBlack').css({'top' : (roundNumber(offsetLi.top-$(window).scrollTop(),0) - 135)+ 'px','height' : roundNumber(currentLi.height(),0)- 1+ 'px'});
$(this).find('.arrowBlack').stop().fadeTo(100, 1);
$(this).find('.vittoriott').show();
$(this).find('.vittoriott').stop().animate({"width" : "25%"},{duration : 900,specialEasing : {width : 'easeOutQuint'}}, function() {});
$(this).find('.subNav').stop().fadeTo(2000, 1);
$(this).addClass('active');
} else {
$(this).find('.vittoriott').stop().animate({"width" : "0"},{duration : 900,specialEasing : {width : 'easeOutQuint'}}, function() {$(this).hide()});
$(this).find('.arrowBlack').stop().fadeTo(500, 0);
$(this).find('.subNav').stop().fadeTo(10, 0);
$(this).removeClass('active');
}
});
$('.subNav a').click(function() {
linkLocation = this.href;
redirectPage(linkLocation);
return false;
});
$('.opened').find('.vittoriott').show();
$('.opened').find('.vittoriott').width("25%");
if($('.opened').find('.vittoriott').length){
$(".arrowBlack").css({"display":"block"});
}
// CAROUSEL NEWS
$(window).resize(function() {
$('.oldSection').width($(window).width() / 2);
$('.newSection').width($(window).width()- $('.oldSection').width());
$('.carouselNews li').css({'padding' : '0 '+ ((($(window).width() - 640) / 4) - 20)+ 'px'});
$('.wrapCarouselNews').offset({left : (($(window).width() - 640) / 4) + 20});
if (Browser.Version() < 8) {
$('.wrapCarouselNews').offset({left : (($(window).width() - 640) / 4)+ 20- ((($(window).width() - 640) / 4) * 2)});
}
mite_prepareCarousel();
if ($("#page-loading").position().top < -1)
$("#page-loading").css({"top" : -$(window).height()+ "px"});
}).resize();
$('.carouselNews li').css({'padding' : '0 '+ ((($(window).width() - 640) / 4) - 20)+ 'px'});
$('.wrapCarouselNews').offset({left : (($(window).width() - 640) / 4) + 20});
if (Browser.Version() < 8) {
$('.wrapCarouselNews').offset({left : (($(window).width() - 640) / 4)+ 20- ((($(window).width() - 640) / 4) * 2)});
}
// $('.wrapCarouselNews').hide();
$('.wrapCarouselNewsContainer').hide();
$('.wrapNextPrev').hide();
$('.btnNews').click(function() {
$(this).toggleClass('active');
$('.wrapCarouselNewsContainer').slideToggle(
400, 'easeInOutCubic');
$('.wrapNextPrev').toggle();
});
$(document).keyup(function(e) {
if (e.keyCode == 27 && $('.wrapCarouselNewsContainer').css('display') == 'block') {
$('.btnNews').click();
}
});
$(".oldSection").touchwipe({
wipeLeft : function() {
$('.oldSection img').stop().animate({"left" : "-70%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.oldSection').stop().animate({"width" : "50%"}, {duration : 1100,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.newSection').stop().animate({"width" : "50%"}, {duration : 1100,specialEasing : {width : 'easeOutQuint'}}, function() {});
},
wipeRight : function() {
$('.oldSection').stop().animate({"width" : "100%"}, {duration : 1100,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.newSection').stop().animate({"width" : "0%"}, {duration : 1100,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.oldSection img').stop().animate({"left" : "0%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
},
wipeUp : function() {
},
wipeDown : function() {
},
min_move_x : 20,
min_move_y : 20,
preventDefaultEvents : true
});
$(".newSection").touchwipe({
wipeLeft : function() {
$('.newSection').stop().animate({"width" : "100%"}, {duration : 1100,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.newSection img').stop().animate({"right" : "0%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.oldSection img').stop().animate({"left" : "-75%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
},
wipeRight : function() {
// $('.newSection img').stop().animate({"right" : "-50%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.newSection img').stop().animate({"right" : "-40%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
// $('.oldSection img').stop().animate({"left" : "-50%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.oldSection img').stop().animate({"left" : "-70%"}, {duration : 450,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.newSection').stop().animate({"width" : "50%"}, {duration : 1100,specialEasing : {width : 'easeOutQuint'}}, function() {});
$('.oldSection').stop().animate({"width" : "50%"}, {duration : 1100,specialEasing : {width : 'easeOutQuint'}}, function() {});
},
wipeUp : function() {
},
wipeDown : function() {
},
min_move_x : 20,
min_move_y : 20,
preventDefaultEvents : true
});
$(".news").touchwipe({
wipeLeft : function() {
$('.btnNextNews').click();
},
wipeRight : function() {
$('.btnPrevNews').click();
},
wipeUp : function() {
},
wipeDown : function() {
},
min_move_x : 20,
min_move_y : 20,
preventDefaultEvents : true
});
// hover sul box con attivazione di .black
$('.black').hide();
$('.yellow').hide();
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$('.listaGallery a').hover(function() {
$(this).find('.black').show();
$(this).find('.yellow').show();
$(this).find('.black').stop().animate({"height" : "100%"}, {duration : 300,specialEasing : {width : 'linear'}}, function() {});
$(this).find('.yellow').stop().animate({"height" : "100%"}, {duration : 300,specialEasing : {width : 'linear'}}, function() {});
$(this).find('.textHover').stop().animate({"bottom" : "10px"}, {duration : 500,specialEasing : {width : 'linear'}}, function() {});
}, function() {
$(this).find('.black').stop().animate({"height" : "0%"}, {duration : 300,specialEasing : {width : 'linear'}}, function() {$(this).hide();});
$(this).find('.yellow').stop().animate({"height" : "0%"}, {duration : 300,specialEasing : {width : 'linear'}}, function() {$(this).hide();});
$(this).find('.textHover').stop().animate({"bottom" : "-100px"}, {duration : 100,specialEasing : {width : 'linear'}}, function() {});
});
// listaGallery_nofancy
$('.listaGallery_nofancy a').hover(function() {
$(this).find('.whitetext').hide();
$(this).find('.yellow').show();
$(this).find('.yellow').stop().animate({"height" : "100%"}, {duration : 300,specialEasing : {width : 'linear'}}, function() {});
$(this).find('.textHover').stop().animate({"bottom" : "50%"}, {duration : 500,specialEasing : {width : 'linear'}}, function() {});
}, function() {
$(this).find('.yellow').stop().animate({"height" : "0%"}, {duration : 300,specialEasing : {width : 'linear'}}, function() {$(this).hide();});
$(this).find('.textHover').stop().animate({"bottom" : "-100px"}, {duration : 100,specialEasing : {width : 'linear'}}, function() {});
$(this).find('.whitetext').show();
});
$('.more').hover(function() {
$(this).find('span').css('backgroundPosition','-259px -54px');
},
function() {
$(this).find('span').css('backgroundPosition','-276px -2px');
});
$('.right .more').hover(function() {
$(this).find('span').css('backgroundPosition','-227px -54px');
},function() {
$(this).find('span').css('backgroundPosition','-246px -2px');
});
$('.news .more').hover(function() {
$(this).find('span').css('backgroundPosition','-227px -54px');
},
function() {
$(this).find('span').css('backgroundPosition','-246px -2px');
});
};
$('.oldSection').width($(window).width() / 2);
$('.newSection').width($(window).width() - $('.oldSection').width());
$(window).scroll(function() {
if ($('.wrapStoria').length) {
// $(".image-wrap").css("background-position",$(".wrapStoria:first").css("background-position"));
var position = $(".wrapStoriaFirst").css('backgroundPosition').split(' ');
pos_x = position[0].replace("px", "");
pos_y = position[1].replace("px", "");
if (Browser.Version() < 8) {
$("#bgStoria img").css({
"margin-top" : pos_y - 46
});
} else {
$(".image-wrap").css("background-position",pos_x + "px " + ((pos_y) - 46) + "px");
}
var intvalue = 1953;
if ($('.page-inizia-il-viaggio').length) {
intvalue = parseInt(1953 + Math.round($(caneaseizampe_element).offset().top / $(window).height()));
console.log(intvalue);
}else if ($('.page-tempi-moderni').length) {
intvalue = parseInt(1986 + Math.round($(caneaseizampe_element).offset().top / $(window).height()));
}
console.log("scroll");
caneaseizampe_element_id = parseInt(intvalue);
$(".dates a").removeClass("selected");
$("#nav" + caneaseizampe_element_id).addClass("selected");
if (caneaseizampe_element_id == 1953 || caneaseizampe_element_id == 1986) {
$(".prev").unbind('click');
$(".prev").addClass("off");
} else {
$(".prev").removeClass("off");
$(".prev").unbind('click');
$(".prev").click(function() {
ajaxOneStepUpLoadElements(caneaseizampe_element_id-1);
});
}
if (caneaseizampe_element_id == 1985 || caneaseizampe_element_id == 2017) {
$(".next").unbind('click');
$(".next").addClass("off");
} else {
$(".next").removeClass("off");
$(".next").unbind('click');
$(".next").click(function() {
ajaxOneStepDownLoadElements(caneaseizampe_element_id+1);
});
}
moveTimeline("#nav" + caneaseizampe_element_id);
}
});
detectOrientation();
window.onorientationchange = detectOrientation;
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
if ($('.page-inizia-il-viaggio').length||$('.page-tempi-moderni').length) {
if ($('.page-inizia-il-viaggio').length) {
caneaseizampe_timeline_element = "#nav1953";
caneaseizampe_element = "#1953";
caneaseizampe_element_id = 1953;
}else if ($('.page-tempi-moderni').length) {
caneaseizampe_timeline_element = "#nav1986";
caneaseizampe_element = "#1986";
caneaseizampe_element_id = 1986;
}
$("#"+(caneaseizampe_element_id)).css({"background":"url('"+$("#"+(caneaseizampe_element_id)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(caneaseizampe_element_id)+" .elementBackground").remove();
$("#"+(caneaseizampe_element_id+1)).css({"background":"url('"+$("#"+(caneaseizampe_element_id+1)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(caneaseizampe_element_id+1)+" .elementBackground").remove();
}
}
});
function resetHovers(){
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$('.bullet-link').hover(function(){
$(this).find('span').stop().animate({opacity : 1}, 600);
}, function(){
$(this).find('span').stop().animate({opacity : 0}, 600);
});
$('.more').hover(function() {
$(this).find('span').css('backgroundPosition','-259px -54px');
},
function() {
$(this).find('span').css('backgroundPosition','-276px -2px');
});
$('.right .more').hover(function() {
$(this).find('span').css('backgroundPosition','-227px -54px');
},function() {
$(this).find('span').css('backgroundPosition','-246px -2px');
});
};
}
function ajaxLoadElements(id) {
console.log('1 mousewheel');
$('body').unbind('mousewheel');
if ($('.page-inizia-il-viaggio').length||$('.page-tempi-moderni').length) {
if ($('.page-inizia-il-viaggio').length){
// session = "storia";
session = "inizia-il-viaggio";
}else if ($('.page-tempi-moderni').length){
session = "tempi-moderni";
}
// commentare per la versione statica
console.log(window.location.pathname);
if((window.location.pathname).indexOf("/en/") != -1){
$("#" + id).load('/en/'+session+'/'+(id)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id)).css({"background":"url('"+$("#"+(id)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
$("#" + (id+1)).load('/en/'+session+'/'+(id+1)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id+1)).css({"background":"url('"+$("#"+(id+1)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id+1)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
}else if((window.location.pathname).indexOf("/it/") != -1){
$("#" + id).load('/it/'+session+'/'+(id)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id)).css({"background":"url('"+$("#"+(id)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
$("#" + (id+1)).load('/it/'+session+'/'+(id+1)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id+1)).css({"background":"url('"+$("#"+(id+1)+" .elementBackground").attr('src')+"') no-repeat fixed 0 0 transparent"});
$("#"+(id+1)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
}else{
console.log('asd1 /'+session+'/'+(id+1)+'_ajax.html');
$("#" + id).load('/'+session+'/'+(id)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id)).css({"background":"url('"+$("#"+(id)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
$("#" + (id+1)).load('/'+session+'/'+(id+1)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id+1)).css({"background":"url('"+$("#"+(id+1)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id+1)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
}
// commentare per la versione statica
// decommentare per la versione statica
// $("#" + id).load((id)+'_ajax.html', function() {
// if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
// $("#" + (id)).css({"background":"url('"+$("#"+(id)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
// $("#"+(id)+" .elementBackground").remove();
// resetHovers();
// }
// goToByScrollTimeline(id);
// });
// $("#" + (id+1)).load((id+1)+'_ajax.html', function() {
// if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
// $("#" + (id+1)).css({"background":"url('"+$("#"+(id+1)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
// $("#"+(id+1)+" .elementBackground").remove();
// resetHovers();
// }
// goToByScrollTimeline(id);
// });
// decommentare per la versione statica
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
$(".wrapStoria, .wrapStoriaFirst").not("#" + (id+1)+", #" + (id)).html('');
}
}
};
function ajaxOneStepUpLoadElements(id) {
if ($('.page-inizia-il-viaggio').length||$('.page-tempi-moderni').length) {
if ($('.page-inizia-il-viaggio').length){
// session = "storia";
session = "inizia-il-viaggio";
}else if ($('.page-tempi-moderni').length){
session = "tempi-moderni";
}
console.log('2 mousewheel');
$('body').unbind('mousewheel');
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
$("#" + (id+2)).html('');
}
// commentare per la versione statica
console.log(window.location.pathname);
if((window.location.pathname).indexOf("/en/") != -1){
$("#" + id).load('/en/'+session+'/'+(id)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id)).css({"background":"url('"+$("#"+(id)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
}else if((window.location.pathname).indexOf("/it/") != -1){
$("#" + id).load('/it/'+session+'/'+(id)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id)).css({"background":"url('"+$("#"+(id)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
}else{
console.log('asd2 /'+session+'/'+(id+1)+'_ajax.html');
$("#" + id).load('/'+session+'/'+(id)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id)).css({"background":"url('"+$("#"+(id)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
}
// commentare per la versione statica
// decommentare per la versione statica
// $("#" + id).load((id)+'_ajax.html', function() {
// if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
// $("#" + (id)).css({"background":"url('"+$("#"+(id)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
// $("#"+(id)+" .elementBackground").remove();
// resetHovers();
// }
// goToByScrollTimeline(id);
// });
// decommentare per la versione statica
}
};
function ajaxOneStepDownLoadElements(id) {
if ($('.page-inizia-il-viaggio').length||$('.page-tempi-moderni').length) {
if ($('.page-inizia-il-viaggio').length){
// session = "storia";
session = "inizia-il-viaggio";
}else if ($('.page-tempi-moderni').length){
session = "tempi-moderni";
}
console.log('3 mousewheel');
$('body').unbind('mousewheel');
if (id == 1985 || id == 2017) {
goToByScrollTimeline(id);
}else{
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
$("#" + (id+2)).html('');
}
// commentare per la versione statica
console.log(window.location.pathname);
if((window.location.pathname).indexOf("/en/") != -1){
$("#" + (id+1)).load('/en/'+session+'/'+(id+1)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id+1)).css({"background":"url('"+$("#"+(id+1)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id+1)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
}else if((window.location.pathname).indexOf("/it/") != -1){
$("#" + (id+1)).load('/it/'+session+'/'+(id+1)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id+1)).css({"background":"url('"+$("#"+(id+1)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id+1)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
}else{
console.log('/'+session+'/'+(id+1)+'_ajax.html');
$("#" + (id+1)).load('/'+session+'/'+(id+1)+'_ajax.html', function() {
if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
$("#" + (id+1)).css({"background":"url('"+$("#"+(id+1)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
$("#"+(id+1)+" .elementBackground").remove();
resetHovers();
}
goToByScrollTimeline(id);
});
};
// commentare per la versione statica
// decommentare per la versione statica
// $("#" + (id+1)).load((id+1)+'_ajax.html', function() {
// if (!((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)))) {
// $("#" + (id+1)).css({"background":"url('"+$("#"+(id+1)+" .elementBackground").attr('src').replace("/sites/default/files/ipad/","/sites/default/files/")+"') no-repeat fixed 0 0 transparent"});
// $("#"+(id+1)+" .elementBackground").remove();
// resetHovers();
// }
// goToByScrollTimeline(id);
// });
// decommentare per la versione statica
};
};
};
function goToByScrollTimeline(id) {
caneaseizampe_element_id = parseInt(id);
caneaseizampe_element = "#" + id;
$('.articleStoria').css({opacity : 0.8});
$("#" + (parseInt(caneaseizampe_element_id)) +' .articleStoria').css({opacity : 1});
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').css({opacity : 0.8});
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').css({opacity : 0.8});
$('html,body').stop().animate({scrollTop : $("#" + id).offset().top}, {duration : 700,complete : function() {
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').stop().animate({}, 200);
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').stop().animate({}, 200);
if ($('body .page-inizia-il-viaggio')||$('body .page-tempi-moderni')) {
$('body').bind('mousewheel', function(event, delta) {
if (delta < 0) {
$(".arrowTimline.next").click();
}
if (delta > 0) {
$(".arrowTimline.prev").click();
}
});
}
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
$("#" + (id)).height($(window).height()-110);
if (id != 1985 || id != 2017) {
$("#" + (id-1)).html('');
$("#" + (id+2)).html('');
};
};
$(".titleSite").css({'color':$("#colorTitleLeft" + (id)).html()});
$(".postTitle").css({'color':$("#colorTitleRight" + (id)).html()});
$(".btnMattei").css({'color':$("#colorMattei" + (id)).html()});
}
});
if (navigator.appVersion.indexOf("MSIE") != -1){
// position for current item and bullet
if (caneaseizampe_element_id != 1953 && caneaseizampe_element_id != 1986){
$(caneaseizampe_element+' .articleStoria').stop().animate({'top':((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))}, 700);
$(caneaseizampe_element+' .bullet-link').stop().animate({'top':((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2))}, 700);
//sistemare questo pezzo per alzare l'immagine
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
$("#" + parseInt(caneaseizampe_element_id) +' .elementBackground').css({'margin-top':-((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))-(((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2))-((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2)))+"px"});
}
}else{
$(caneaseizampe_element+' .articleStoria').stop().animate({'top':((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))}, 700);
$(caneaseizampe_element+' .bullet-link').stop().animate({'top':(($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight()/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2))}, 700);
//sistemare questo pezzo per alzare l'immagine
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
$("#" + parseInt(caneaseizampe_element_id) +' .elementBackground').css({'margin-top':-((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))+"px"});
}
}
// controllare bene questa cosa
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').css({'top':-($("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').outerHeight()/2)-110});
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').css({'top':-($("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').outerHeight()/2)-110});
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .bullet-link').css({'top':-146});
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .bullet-link').css({'top':-146});
}else{
// position for current item and bullet
if (caneaseizampe_element_id != 1953 && caneaseizampe_element_id != 1986){
$(caneaseizampe_element+' .articleStoria').stop().animate({'top':((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))}, 700);
$(caneaseizampe_element+' .bullet-link').stop().animate({'top':((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2))}, 700);
//sistemare questo pezzo per alzare l'immagine
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
$("#" + parseInt(caneaseizampe_element_id) +' .elementBackground').css({'margin-top':-((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))-(((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2))-((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2)))-20+"px"});
}
}else{
$(caneaseizampe_element+' .articleStoria').stop().animate({'top':((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))}, 700);
$(caneaseizampe_element+' .bullet-link').stop().animate({'top':(($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight()/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2))}, 700);
//sistemare questo pezzo per alzare l'immagine
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
$("#" + parseInt(caneaseizampe_element_id) +' .elementBackground').css({'margin-top':-((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))-((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight()/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2))-((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2)))+"px"});
}
}
// controllare bene questa cosa
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').stop().animate({'top':-($("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').outerHeight()/2)-110}, 700);
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').stop().animate({'top':-($("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').outerHeight()/2)-110}, 700);
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .bullet-link').stop().animate({'top':-146}, 700);
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .bullet-link').stop().animate({'top':-146}, 700);
}
}
function moveTimeline(id, setEl) {
caneaseizampe_timeline_element = id;
// if(setEl){
// position for current item and bullet
if (parseInt(caneaseizampe_element_id) != 1953 && parseInt(caneaseizampe_element_id) != 1986){
$(caneaseizampe_element+' .articleStoria').stop().animate({'top':((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))}, 300);
$(caneaseizampe_element+' .bullet-link').stop().animate({'top':((($(caneaseizampe_element+'.wrapStoria').outerHeight())/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2))}, 300);
}else{
$(caneaseizampe_element+' .articleStoria').stop().animate({'top':((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))}, 300);
$(caneaseizampe_element+' .bullet-link').stop().animate({'top':(($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight()/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2))}, 300);
}
if (navigator.appVersion.indexOf("MSIE") != -1){
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').css({'top':-($("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').outerHeight()/2)-110});
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').css({'top':-($("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').outerHeight()/2)-110});
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .bullet-link').css({'top':-146});
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .bullet-link').css({'top':-146});
}else{
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').stop().animate({'top':-($("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').outerHeight()/2)-110}, 300);
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').stop().animate({'top':-($("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').outerHeight()/2)-110}, 300);
$("#" + (parseInt(caneaseizampe_element_id)-1) +' .bullet-link').stop().animate({'top':-146}, 300);
$("#" + (parseInt(caneaseizampe_element_id)+1) +' .bullet-link').stop().animate({'top':-146}, 300);
}
// alert(-($("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').outerHeight()/2)-110);
// $("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').stop().animate({'top':-($("#" + (parseInt(caneaseizampe_element_id)-1) +' .articleStoria').outerHeight()/2)-110}, 300);
// $("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').stop().animate({'top':-($("#" + (parseInt(caneaseizampe_element_id)+1) +' .articleStoria').outerHeight()/2)-110}, 300);
// $("#" + (parseInt(caneaseizampe_element_id)-1) +' .bullet-link').stop().animate({'top':-146}, 300);
// $("#" + (parseInt(caneaseizampe_element_id)+1) +' .bullet-link').stop().animate({'top':-146}, 300);
// }
if ($('.page-inizia-il-viaggio').length || $('.page-tempi-moderni').length) {
if($(caneaseizampe_element).length){
timelineWidth = $('.dates li').length * $('.dates li').width();
$('.dates').width(timelineWidth);
diff = $(window).width() - 130 - timelineWidth;
oh = $(caneaseizampe_element).offset().top / $('#content').height();
if(diff>0){
$('.dates').stop().animate({left : 0}, {duration : 700,complete : function() {}});
}else{
if (oh > 0.85) {
$('.dates').stop().animate({left : diff}, {duration : 700,complete : function() {}});
} else if (oh > 0.27) {
$('.dates').stop().animate({left : 50*Math.round((diff*oh)/50)}, {duration : 700,complete : function() {}});
} else if (oh < 0.27) {
$('.dates').stop().animate({left : 0}, {duration : 700,complete : function() {}});
}
}
}
}
}
function shiftTimeline(direction) {
if ($('.page-inizia-il-viaggio').length || $('.page-tempi-moderni').length) {
timelineWidth = $('.dates li').length * $('.dates li').width();
$('.dates').width(timelineWidth);
diff = $(window).width() - 130 - timelineWidth;
$('.prev').removeClass('off');
$('.next').removeClass('off');
if(direction=="left"){
if(($('.dates').offset().left)<62){
if(($('.dates').offset().left + 50) < 62){
$('.dates').stop().animate({left : 0}, {duration : 700,complete : function() {}});
$('.next').addClass('off');
}else{
$('.dates').stop().animate({left : ($('.dates').offset().left + 50 - 62)}, {duration : 700,complete : function() {}});
}
}else{
$('.dates').stop().animate({left : 0}, {duration : 700,complete : function() {}});
$('.prev').addClass('off');
}
} else if(direction=="right"){
if(($('.dates').offset().left) - diff > 62){
if(($('.dates').offset().left - 50 - 62)0){
$('.dates').stop().animate({left : 0}, {duration : 700,complete : function() {}});
}else{
if (oh > 0.40) {
$('.dates').stop().animate({left : diff}, {duration : 700,complete : function() {}});
} else if (oh > 0.25) {
$('.dates').stop().animate({left : 50*Math.round((diff*oh)/50)}, {duration : 700,complete : function() {}});
} else if (oh < 0.25) {
$('.dates').stop().animate({left : 0}, {duration : 700,complete : function() {}});
}
}
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
if (navigator.userAgent.match(/OS 4_[0-9_]* like Mac OS X/i)) {
repositionBars();
}
}
}
}
function positionTimeline(id) {
timelineWidth = $('.dates li').length * $('.dates li').width();
$('.dates').width(timelineWidth);
diff = $(window).width() - 130 - timelineWidth;
var listItem = $(id).parent();
oh = ($('.dates li').index(listItem)*50) / timelineWidth;
if(diff>0){
$('.dates').stop().animate({left : 0}, {duration : 700,complete : function() {}});
}else{
if (oh > 0.40) {
$('.dates').stop().animate({left : diff}, {duration : 700,complete : function() {}});
} else if (oh > 0.25) {
$('.dates').stop().animate({left : 50*Math.round((diff*oh)/50)}, {duration : 700,complete : function() {}});
} else if (oh < 0.25) {
$('.dates').stop().animate({left : 0}, {duration : 700,complete : function() {}});
}
}
}
$(window).load(function() {
if ($('.page-inizia-il-viaggio').length || $('.page-tempi-moderni').length || $('.page-node-51').length || $('.page-node-107').length) {
$("#page-loading").stop().delay(1000).animate({ "top" : -$(window).height() + "px" }, { duration : 1000, specialEasing : { width : 'easeOutCubic' }, complete : function() {$("#page-loading").css("display", "none");}}, function() {});
}else{
$("#page-loading").stop().delay(0).animate({"top" : -$(window).height() + "px"}, {duration : 0,specialEasing : {width : 'easeOutCubic'},complete : function() {$("#page-loading").css("display", "none");}}, function() {});
}
$('html,body').scrollTop(1);
$('html,body').scrollTop(0);
if ($('.page-inizia-il-viaggio').length) {
caneaseizampe_timeline_element = "#nav1953";
caneaseizampe_element = "#1953";
caneaseizampe_element_id = 1953;
}else if ($('.page-tempi-moderni').length) {
caneaseizampe_timeline_element = "#nav1986";
caneaseizampe_element = "#1986";
caneaseizampe_element_id = 1986;
}
if ($('.wrapStoria').length) {
moveTimeline(caneaseizampe_timeline_element);
}
if ($('body .page-inizia-il-viaggio')||$('body .page-tempi-moderni')) {
$('body').bind('mousewheel', function(event, delta) {
if (delta < 0) {
$(".arrowTimline.next").click();
}
if (delta > 0) {
$(".arrowTimline.prev").click();
}
});
}
$("#" + parseInt(caneaseizampe_element_id) +' .elementBackground').css({'margin-top':-((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2))-((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight()/2) - ($(caneaseizampe_element+' .bullet-link').outerHeight() / 2))-((($(caneaseizampe_element+'.wrapStoriaFirst').outerHeight())/2) - ($(caneaseizampe_element+' .articleStoria').outerHeight() / 2)))+"px"});
// $("#content").stop().animate({"top":-$(window).height()},{duration:
// 10000, specialEasing: {width: 'easeInCubic'}}, function() {});
// $("#content").stop().animate({"top":-4*$(window).height()},{duration:
// 40000, specialEasing: {width: 'easeInCubic'}}, function() {});
// $('html,body').animate({scrollTop : 100}, 0);
// $('html,body').animate({scrollTop : 0}, 0);
// $(".videoWrapperFancy .video-js").height($(window).height());
// $(".videoWrapperFancy .video-js").width($(window).width());
$(".videoWrapperFancy .video-js").width(480);
$(".videoWrapperFancy .video-js").height(360);
// $(window).resize(function() {
// setTimeline(caneaseizampe_element_id);
// poster_left = ($(".video-js").width() - 340)/2;
// poster_top = ($(".video-js").height() - 256)/2;
// $(".vjs-poster").css({ "top": poster_top+"px", "left": poster_left+"px" });
// });
// $(".vjs-poster").offset({ top: poster_top+"px", left: poster_left+"px" });
// poster_left = ($(".video-js").width() - 340)/2;
// poster_top = ($(".video-js").height() - 256)/2;
// $(".vjs-poster").css({ "top": "123px", "left": "150px" });
$(".social li.share").bind('mouseenter', {div: '#shareBox'}, openShareBox);
$(".social li.share").bind('mouseleave', {div: '#shareBox'},closeShareBox);
});