var MAP_STARTED = false ; function startMap() { /*var latlng = new google.maps.LatLng( 45.499146909272824, 12.064930200576782 );*/ /* if (GBrowserIsCompatible()) { var mapcont = document.getElementById("gmap") ; if(mapcont) { var map = new GMap2(mapcont); var markPos = new GLatLng(45.499146909272824,12.064930200576782) ; map.setCenter( new GLatLng( 45.484687748392254 , 12.185897827148438 ), 11 ); //map.enableScrollWheelZoom(); map.addControl(new GLargeMapControl3D()); map.addControl(new GHierarchicalMapTypeControl ()); var marker = new GMarker(markPos, {draggable: false}); map.addOverlay(marker); /*GEvent.addListener(map,"click",function(overlay,point) { var myHtml = "Latitudine: " + map.getCenter().lat() + "\nLongitudine: " + map.getCenter().lng() + ""; trace(myHtml); });* / MAP_STARTED = true ; } }*/ } var LAST_CONTENT = false ; var PANEL_H = new Array() ; var TIMER_ROOMS = null ; var TIMER_WELCOME = null ; $(document).ready(function(){ // Startup slider first => unused /*$('#slider').nivoSlider({ directionNav:false, animSpeed:1000, // Slide transition speed pauseTime:4000 // How long each slide will show });*/ // Startup attractions slider => dropped //initSlider(); // Bind colorbox effects /*$("a.attractions_panel").colorbox({ iframe:true, href:"attrazioni_info.html?lang="+CURR_LANG, width:920, height:545 }) ;*/ $("a[rel='gallery1']").colorbox(); /*$("#top-slider").nivoSlider({ effect : 'fade', animSpeed : 500, pauseTime : 3500, startSlide : 0, directionNav : false, controlNav : false, controlNavThumbs : false, pauseOnHover : false, manualAdvance : false }); */ window.setTimeout( function(){initPage()} , 1000 ); }); /*bind effects*/ function initPage() { // TRACK AND RESET HEIGHTS !!! PANEL_H["content_welcome"] = $("#content_welcome").height() ; PANEL_H["content_camere"] = $("#content_camere").height() ; PANEL_H["content_posizione"] = $("#content_posizione").height() ; PANEL_H["content_attrazioni"] = $("#content_attrazioni").height() ; PANEL_H["content_prenotazioni"] = $("#content_prenotazioni").height() ; PANEL_H["content_photogallery"] = 560 ; //$("#content_photogallery").height() ; $(".menu_item").click(function(){ var elem = this ; var newSuffix = $(elem).attr("id").split("_") ; newSuffix = newSuffix[1] ; if(newSuffix=="prenotazioni") { avail('laloggia',$(elem).attr("lang")) ; } else { var oldSuffix = false ; if( LAST_CONTENT ) { oldSuffix = $(LAST_CONTENT).attr("id").split("_") ; oldSuffix = oldSuffix[1] ; } LAST_CONTENT = elem ; if( newSuffix==oldSuffix ) { return ; } var menuItem = ("#menu_"+newSuffix) ; var contentItem = ("#content_"+newSuffix) ; $(menuItem).animate( /*{backgroundPosition:"0px -58px"}, */ {opacity:0}, 400 , function(){ $(menuItem).addClass("sel") /*$(menuItem).css( {backgroundPosition:"0px -86px"} )*/ if( oldSuffix ) { $("#menu_"+oldSuffix).animate( /*{backgroundPosition:"0px 0px"} ,*/ {opacity:0}, 400, function(){ $(this).removeClass("sel") /*$(this).css({backgroundPosition:"0px 0px"});*/ $(this).animate({opacity:1}) } ); } $(menuItem).animate( /*{backgroundPosition:"0px -86px"} ,*/ {opacity:1}, 400, function(){ togglePanels( contentItem , oldSuffix? "#content_"+oldSuffix :false ) ; } ); } ); }// Fine if newSuffix=="prenotazioni" }); // TRIGGER THE WELCOME PANEL $("#menu_welcome").click(); }; function togglePanels(p1,p2) { if( $("#page_loader").css("display")=="block" ) { $("#page_loader").slideUp(); } var h = 0 ; var pc = $("#page_content") ; if(!p2) { h = PANEL_H[ p1.replace(/#/g,"") ]+50; pc.stop().animate( {height:h}, 500, function(){ $(p1).css({opacity:0,display:"block"}); $(p1).animate( { opacity:1 }, 400 , function(){ if(p1=="#content_camere" ) { TIMER_ROOMS = window.setTimeout( function(){ animate_inner_images(p1) } , 4000 ) ; } else if( p1=="#content_welcome" ) { TIMER_WELCOME = window.setTimeout( function(){ animate_inner_images(p1) } , 5000 ) ; } else if( p1=="#content_posizione" ) { if(!MAP_STARTED){startMap();} } } ); } ); } else { h = PANEL_H[ p2.replace(/#/g,"") ]; $(p2).stop().animate( {opacity:0}, 400, function(){ pc.css({height:h}); h = PANEL_H[ p1.replace(/#/g,"") ]+50; pc.stop().animate( {height:h}, 400, function(){ // CLEAR TIMEOUTS //trace("CLEAR TIMEOUTS"); clearTimeout(TIMER_ROOMS); clearTimeout(TIMER_WELCOME); $(p2).css({display:"none"}) ; $(p1).css({opacity:0,display:"block"}); $(p1).animate( { opacity:1 }, 400, function(){ if(p1=="#content_camere" ) { TIMER_ROOMS = window.setTimeout( function(){ animate_inner_images(p1) } , 4000 ) ; } else if( p1=="#content_welcome" ) { TIMER_WELCOME = window.setTimeout( function(){ animate_inner_images(p1) } , 5000 ) ; } else if( p1=="#content_posizione" ) { if(!MAP_STARTED){startMap();} } } ); } ); } ); } } function animate_inner_images(p1) { //trace("Animating "+p1) if( p1=="#content_camere" ) { var elem = $("#rooms_images") ; elem.stop().animate( {opacity:0}, 1000, function(){ var imgSrc = "./images/rooms_01.jpg" ; if( $(this).attr("src")==imgSrc ) { imgSrc = "./images/rooms_02.jpg" ; } $(this).attr("src" , imgSrc ) ; $(this).animate({opacity:1},1000); } ) TIMER_ROOMS = window.setTimeout( function(){ animate_inner_images(p1) } , 10000 ) ; } if( p1=="#content_welcome" ) { var elem = $("#welcome_images") ; elem.stop().animate( {opacity:0}, 1000, function(){ var imgSrc = "./images/welcome_01.jpg" ; if( $(this).attr("src")==imgSrc ) { imgSrc = "./images/welcome_02.jpg" ; } $(this).attr("src" , imgSrc ) ; $(this).animate({opacity:1},1000); } ) TIMER_WELCOME = window.setTimeout( function(){ animate_inner_images(p1) } , 10000 ) ; } } function trace(m) { if( window.console ) { window.console.log(m); } }